summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-28 15:13:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-29 07:17:37 +0100
commit21de55596c0fdc2be736c6d0369bd9d3783020be (patch)
tree07d0f0cd54690e54405fe574c572cb2be74a3336 /oox
parentda9fb5d6d9ebf9363981c370ce937d8848989fcb (diff)
remove unnecessary "if (!empty()" checks before loops
found with git grep -n -A4 'if.*!.*empty' | grep -B3 -P '(\bfor)|(\bwhile)|(\bdo)' Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334 Reviewed-on: https://gerrit.libreoffice.org/64169 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/helper/propertymap.cxx17
-rw-r--r--oox/source/ole/axbinaryreader.cxx4
-rw-r--r--oox/source/ole/axbinarywriter.cxx24
3 files changed, 18 insertions, 27 deletions
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 6b5635d8023e..8e7d3c505f98 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -239,17 +239,14 @@ void PropertyMap::assignAll( const PropertyMap& rPropMap )
Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const
{
Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( maProperties.size() ) );
- if( !maProperties.empty() )
+ PropertyValue* pValues = aSeq.getArray();
+ for (auto const& prop : maProperties)
{
- PropertyValue* pValues = aSeq.getArray();
- for (auto const& prop : maProperties)
- {
- OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" );
- pValues->Name = (*mpPropNames)[ prop.first ];
- pValues->Value = prop.second;
- pValues->State = PropertyState_DIRECT_VALUE;
- ++pValues;
- }
+ OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" );
+ pValues->Name = (*mpPropNames)[ prop.first ];
+ pValues->Value = prop.second;
+ pValues->State = PropertyState_DIRECT_VALUE;
+ ++pValues;
}
return aSeq;
}
diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx
index e478677f9aeb..cbd7051637a5 100644
--- a/oox/source/ole/axbinaryreader.cxx
+++ b/oox/source/ole/axbinaryreader.cxx
@@ -247,7 +247,7 @@ bool AxBinaryPropertyReader::finalizeImport()
{
// read large properties
maInStrm.align( 4 );
- if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
+ if( ensureValid( mnPropFlags == 0 ) )
{
for (auto const& largeProp : maLargeProps)
{
@@ -260,7 +260,7 @@ bool AxBinaryPropertyReader::finalizeImport()
maInStrm.seek( mnPropsEnd );
// read stream properties (no stream alignment between properties!)
- if( ensureValid() && !maStreamProps.empty() )
+ if( ensureValid() )
{
for (auto const& streamProp : maStreamProps)
{
diff --git a/oox/source/ole/axbinarywriter.cxx b/oox/source/ole/axbinarywriter.cxx
index d0e0c556e975..89d2dc25351a 100644
--- a/oox/source/ole/axbinarywriter.cxx
+++ b/oox/source/ole/axbinarywriter.cxx
@@ -155,28 +155,22 @@ void AxBinaryPropertyWriter::finalizeExport()
{
// write large properties
maOutStrm.align( 4 );
- if( !maLargeProps.empty() )
+ for (auto const& largeProp : maLargeProps)
{
- for (auto const& largeProp : maLargeProps)
- {
- if (!ensureValid())
- break;
- largeProp->writeProperty( maOutStrm );
- maOutStrm.align( 4 );
- }
+ if (!ensureValid())
+ break;
+ largeProp->writeProperty( maOutStrm );
+ maOutStrm.align( 4 );
}
mnBlockSize = maOutStrm.tell() - mnPropFlagsStart;
// write stream properties (no stream alignment between properties!)
- if( !maStreamProps.empty() )
+ for (auto const& streamProp : maStreamProps)
{
- for (auto const& streamProp : maStreamProps)
- {
- if (!ensureValid())
- break;
- streamProp->writeProperty( maOutStrm );
- }
+ if (!ensureValid())
+ break;
+ streamProp->writeProperty( maOutStrm );
}
sal_Int64 nPos = maOutStrm.tell();