summaryrefslogtreecommitdiffstats
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-14 09:35:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-14 14:17:14 +0200
commitb70fa47aec65fe95da94fc17640dda27650e9677 (patch)
tree7e54f37342fd57c324f43d54659335554a9c8e72 /xmloff
parentuitest: Add test for insertPageHeader and tdf#107427 (diff)
downloadcore-b70fa47aec65fe95da94fc17640dda27650e9677.tar.gz
core-b70fa47aec65fe95da94fc17640dda27650e9677.zip
use more SAL_N_ELEMENTS part 1
- teach comphelper::containerToSequence to handle sized arrays - also use range based for-loop where appropriate. Change-Id: I73ba9b6295e7b29c872ee53de7a9340969e07f99 Reviewed-on: https://gerrit.libreoffice.org/38769 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/EnhancedCustomShapeToken.cxx8
-rw-r--r--xmloff/source/style/weighhdl.cxx9
2 files changed, 7 insertions, 10 deletions
diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
index 076ae2728fbd..cf644e34e7f6 100644
--- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx
+++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx
@@ -141,7 +141,7 @@ static const TokenTable pTokenTableArray[] =
{ "Origin", EAS_Origin },
{ "Color", EAS_Color },
{ "Switched", EAS_Switched },
- { "Polar", EAS_Polar },
+ { "Polar", EAS_Polar },
{ "RangeXMinimum", EAS_RangeXMinimum },
{ "RangeXMaximum", EAS_RangeXMaximum },
{ "RangeYMinimum", EAS_RangeYMinimum },
@@ -175,10 +175,8 @@ EnhancedCustomShapeTokenEnum EASGet( const OUString& rShapeType )
if ( !pHashMap )
{
TypeNameHashMap* pH = new TypeNameHashMap;
- const TokenTable* pPtr = pTokenTableArray;
- const TokenTable* pEnd = pPtr + ( sizeof( pTokenTableArray ) / sizeof( TokenTable ) );
- for ( ; pPtr < pEnd; pPtr++ )
- (*pH)[ pPtr->pS ] = pPtr->pE;
+ for (auto const & pair : pTokenTableArray)
+ (*pH)[pair.pS] = pair.pE;
pHashMap = pH;
}
}
diff --git a/xmloff/source/style/weighhdl.cxx b/xmloff/source/style/weighhdl.cxx
index 7181dbcd13a6..52aa20f7f370 100644
--- a/xmloff/source/style/weighhdl.cxx
+++ b/xmloff/source/style/weighhdl.cxx
@@ -89,7 +89,7 @@ bool XMLFontWeightPropHdl::importXML( const OUString& rStrImpValue, Any& rValue,
if( bRet )
{
bRet = false;
- static int nCount = sizeof(aFontWeightMap)/sizeof(FontWeightMapper);
+ int const nCount = SAL_N_ELEMENTS(aFontWeightMap);
for (int i = 0; i < (nCount-1); ++i)
{
if( (nWeight >= aFontWeightMap[i].nValue) && (nWeight <= aFontWeightMap[i+1].nValue) )
@@ -131,12 +131,11 @@ bool XMLFontWeightPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue,
if( bRet )
{
sal_uInt16 nWeight = 0;
- static int nCount = sizeof(aFontWeightMap)/sizeof(FontWeightMapper);
- for( int i=0; i<nCount; i++ )
+ for( auto const & pair : aFontWeightMap )
{
- if( fValue <= aFontWeightMap[i].fWeight )
+ if( fValue <= pair.fWeight )
{
- nWeight = aFontWeightMap[i].nValue;
+ nWeight = pair.nValue;
break;
}
}