diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-04-05 19:37:11 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-04-12 22:36:18 +0200 |
commit | 4de0d33deff40ce7bd2755a7d17caca72d2fd25f (patch) | |
tree | aa9be7a3c5acbebf60dbe1c39242f4fb3fa32f47 /sw | |
parent | 969c1d5e44ed11e08f64334ed65ce01d2fa54acb (diff) |
Reduce scope and make code more readable
Change-Id: Ic3525571be577c555e45d40b3a6a7de0c7665678
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/docnode/ndsect.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 7eee0d6cc2ba..2b2db1aa0558 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1394,15 +1394,16 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const const OUString aName( ResId( STR_REGION_DEFNAME, *pSwResMgr ) ); sal_uInt16 nNum = 0; - sal_uInt16 nTmp, nFlagSize = ( mpSectionFmtTbl->size() / 8 ) +2; + sal_uInt16 nFlagSize = ( mpSectionFmtTbl->size() / 8 ) +2; sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ]; memset( pSetFlags, 0, nFlagSize ); - const SwSectionNode* pSectNd; sal_uInt16 n; for( n = 0; n < mpSectionFmtTbl->size(); ++n ) - if( 0 != ( pSectNd = (*mpSectionFmtTbl)[ n ]->GetSectionNode( false ) )) + { + const SwSectionNode *const pSectNd = (*mpSectionFmtTbl)[ n ]->GetSectionNode( false ); + if( pSectNd != nullptr ) { const OUString rNm = pSectNd->GetSection().GetSectionName(); if (rNm.startsWith( aName )) @@ -1415,21 +1416,27 @@ OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const if( pChkStr && *pChkStr==rNm ) pChkStr = 0; } + } if( !pChkStr ) { // Flagged all Numbers accordingly, so get the right Number nNum = mpSectionFmtTbl->size(); for( n = 0; n < nFlagSize; ++n ) - if( 0xff != ( nTmp = pSetFlags[ n ] )) + { + auto nTmp = pSetFlags[ n ]; + if( nTmp != 0xFF ) { // Calculate the Number nNum = n * 8; while( nTmp & 1 ) - ++nNum, nTmp >>= 1; + { + ++nNum; + nTmp >>= 1; + } break; } - + } } delete [] pSetFlags; if( pChkStr ) |