diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 09:35:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-14 14:17:14 +0200 |
commit | b70fa47aec65fe95da94fc17640dda27650e9677 (patch) | |
tree | 7e54f37342fd57c324f43d54659335554a9c8e72 /unotools | |
parent | 6db84250d1c4e7ec5a54ff75e124ea9a84ff89d9 (diff) |
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 'unotools')
-rw-r--r-- | unotools/source/config/defaultoptions.cxx | 2 | ||||
-rw-r--r-- | unotools/source/config/pathoptions.cxx | 13 | ||||
-rw-r--r-- | unotools/source/config/saveopt.cxx | 2 |
3 files changed, 7 insertions, 10 deletions
diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index 47f1ce54e291..c338a741e24c 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -174,7 +174,7 @@ Sequence< OUString > GetDefaultPropertyNames() "Classification" // PATH_CLASSIFICATION }; - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + const int nCount = SAL_N_ELEMENTS( aPropNames ); Sequence< OUString > aNames( nCount ); OUString* pNames = aNames.getArray(); for ( int i = 0; i < nCount; i++ ) diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 7b42f63b98fe..d6675cd31333 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -416,26 +416,23 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() : } // Create mapping between internal enum (SvtPathOptions::Paths) and property handle - sal_Int32 nCount = sizeof( aPropNames ) / sizeof( PropertyStruct ); - sal_Int32 i; - for ( i = 0; i < nCount; i++ ) + for ( auto const & p : aPropNames ) { NameToHandleMap::const_iterator pIter = - aTempHashMap.find( OUString::createFromAscii( aPropNames[i].pPropName )); + aTempHashMap.find( OUString::createFromAscii( p.pPropName )); if ( pIter != aTempHashMap.end() ) { sal_Int32 nHandle = pIter->second; - sal_Int32 nEnum = aPropNames[i].ePath; + sal_Int32 nEnum = p.ePath; m_aMapEnumToPropHandle.insert( EnumToHandleMap::value_type( nEnum, nHandle )); } } // Create hash map for path variables that need a system path as a return value! - nCount = sizeof( aVarNameAttribute ) / sizeof( VarNameAttribute ); - for ( i = 0; i < nCount; i++ ) + for ( auto const & i : aVarNameAttribute ) { - m_aSystemPathVarNames.insert( OUString::createFromAscii( aVarNameAttribute[i].pVarName ) ); + m_aSystemPathVarNames.insert( OUString::createFromAscii( i.pVarName ) ); } } diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 1dff44cee452..7fa55766aa5b 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -375,7 +375,7 @@ Sequence< OUString > GetPropertyNames() "ODF/UseBlowfishInODF12" }; - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); + const int nCount = SAL_N_ELEMENTS( aPropNames ); Sequence< OUString > aNames( nCount ); OUString* pNames = aNames.getArray(); for ( int i = 0; i < nCount; i++ ) |