diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-05-09 21:14:18 +0200 |
---|---|---|
committer | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-05-10 09:39:38 +0000 |
commit | 9727c0e736dd880fff84848f153ca066da226237 (patch) | |
tree | d60d041bc2ce9c73502c8ee103e8cd7a4d2f065e | |
parent | 12df0a2ac89cc8da216d2244aa52ca3c291ba93f (diff) |
remove usages of STATIC_ARRAY_END in sc
if used in loops, rewrite to range based loop,
else replace STATIC_ARRAY_END( ) with std::end( )
Change-Id: Ib05063eb78f82c8af967bc82e9759af2a58258c8
Reviewed-on: https://gerrit.libreoffice.org/24808
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
-rw-r--r-- | sc/source/filter/excel/xeformula.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xlchart.cxx | 26 | ||||
-rw-r--r-- | sc/source/filter/excel/xlformula.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/excel/xlpage.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/excel/xlstyle.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/excel/xltools.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabase.cxx | 22 | ||||
-rw-r--r-- | sc/source/filter/oox/numberformatsbuffer.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/pagesettings.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/xml/XMLConverter.cxx | 7 |
11 files changed, 62 insertions, 66 deletions
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 975acbf3b8ef..031ff4732e73 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -478,8 +478,8 @@ XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) : mnMaxRowMask( static_cast< sal_uInt32 >( rRoot.GetXclMaxPos().Row() ) ) { // build the configuration map - for( const XclExpCompConfig* pEntry = spConfigTable; pEntry != STATIC_ARRAY_END( spConfigTable ); ++pEntry ) - maCfgMap[ pEntry->meType ] = *pEntry; + for(auto const &rEntry : spConfigTable) + maCfgMap[ rEntry.meType ] = rEntry; } XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType, diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index bf395ac20425..ee8d4aa56cd5 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -448,9 +448,8 @@ static const XclChFormatInfo spFmtInfos[] = XclChFormatInfoProvider::XclChFormatInfoProvider() { - const XclChFormatInfo* pEnd = STATIC_ARRAY_END( spFmtInfos ); - for( const XclChFormatInfo* pIt = spFmtInfos; pIt != pEnd; ++pIt ) - maInfoMap[ pIt->meObjType ] = pIt; + for(auto const &rIt : spFmtInfos) + maInfoMap[ rIt.meObjType ] = &rIt; } const XclChFormatInfo& XclChFormatInfoProvider::GetFormatInfo( XclChObjectType eObjType ) const @@ -515,9 +514,8 @@ void XclChExtTypeInfo::Set( const XclChTypeInfo& rTypeInfo, bool b3dChart, bool XclChTypeInfoProvider::XclChTypeInfoProvider() { - const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); - for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) - maInfoMap[ pIt->meTypeId ] = pIt; + for(const auto &rIt : spTypeInfos) + maInfoMap[ rIt.meTypeId ] = &rIt; } const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfo( XclChTypeId eTypeId ) const @@ -529,20 +527,20 @@ const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfo( XclChTypeId eTypeId ) c const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromRecId( sal_uInt16 nRecId ) const { - const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); - for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) - if( pIt->mnRecId == nRecId ) - return *pIt; + for(const auto &rIt : spTypeInfos) + { + if(rIt.mnRecId == nRecId) + return rIt; + } OSL_FAIL( "XclChTypeInfoProvider::GetTypeInfoFromRecId - unknown record id" ); return GetTypeInfo( EXC_CHTYPEID_UNKNOWN ); } const XclChTypeInfo& XclChTypeInfoProvider::GetTypeInfoFromService( const OUString& rServiceName ) const { - const XclChTypeInfo* pEnd = STATIC_ARRAY_END( spTypeInfos ); - for( const XclChTypeInfo* pIt = spTypeInfos; pIt != pEnd; ++pIt ) - if( rServiceName.equalsAscii( pIt->mpcServiceName ) ) - return *pIt; + for(auto const &rIt : spTypeInfos) + if( rServiceName.equalsAscii( rIt.mpcServiceName ) ) + return rIt; OSL_FAIL( "XclChTypeInfoProvider::GetTypeInfoFromService - unknown service name" ); return GetTypeInfo( EXC_CHTYPEID_UNKNOWN ); } diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index c79a432c0601..76ff512c7de7 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -629,21 +629,21 @@ XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot ) from earlier tables. */ XclBiff eBiff = rRoot.GetBiff(); if( eBiff >= EXC_BIFF2 ) - (this->*pFillFunc)( saFuncTable_2, STATIC_ARRAY_END( saFuncTable_2 ) ); + (this->*pFillFunc)( saFuncTable_2, std::end( saFuncTable_2 ) ); if( eBiff >= EXC_BIFF3 ) - (this->*pFillFunc)( saFuncTable_3, STATIC_ARRAY_END( saFuncTable_3 ) ); + (this->*pFillFunc)( saFuncTable_3, std::end( saFuncTable_3 ) ); if( eBiff >= EXC_BIFF4 ) - (this->*pFillFunc)( saFuncTable_4, STATIC_ARRAY_END( saFuncTable_4 ) ); + (this->*pFillFunc)( saFuncTable_4, std::end( saFuncTable_4 ) ); if( eBiff >= EXC_BIFF5 ) - (this->*pFillFunc)( saFuncTable_5, STATIC_ARRAY_END( saFuncTable_5 ) ); + (this->*pFillFunc)( saFuncTable_5, std::end( saFuncTable_5 ) ); if( eBiff >= EXC_BIFF8 ) - (this->*pFillFunc)( saFuncTable_8, STATIC_ARRAY_END( saFuncTable_8 ) ); - (this->*pFillFunc)( saFuncTable_Oox, STATIC_ARRAY_END( saFuncTable_Oox ) ); - (this->*pFillFunc)( saFuncTable_2010, STATIC_ARRAY_END( saFuncTable_2010 ) ); - (this->*pFillFunc)( saFuncTable_2013, STATIC_ARRAY_END( saFuncTable_2013 ) ); - (this->*pFillFunc)( saFuncTable_2016, STATIC_ARRAY_END( saFuncTable_2016 ) ); - (this->*pFillFunc)( saFuncTable_Odf, STATIC_ARRAY_END( saFuncTable_Odf ) ); - (this->*pFillFunc)( saFuncTable_OOoLO, STATIC_ARRAY_END( saFuncTable_OOoLO ) ); + (this->*pFillFunc)( saFuncTable_8, std::end( saFuncTable_8 ) ); + (this->*pFillFunc)( saFuncTable_Oox, std::end( saFuncTable_Oox ) ); + (this->*pFillFunc)( saFuncTable_2010, std::end( saFuncTable_2010 ) ); + (this->*pFillFunc)( saFuncTable_2013, std::end( saFuncTable_2013 ) ); + (this->*pFillFunc)( saFuncTable_2016, std::end( saFuncTable_2016 ) ); + (this->*pFillFunc)( saFuncTable_Odf, std::end( saFuncTable_Odf ) ); + (this->*pFillFunc)( saFuncTable_OOoLO, std::end( saFuncTable_OOoLO ) ); } const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx index c18c8073b361..b45a0fc6719a 100644 --- a/sc/source/filter/excel/xlpage.cxx +++ b/sc/source/filter/excel/xlpage.cxx @@ -244,21 +244,20 @@ void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait, bool bStric } else { - mnPaperSize = 0; + mnPaperSize = EXC_PAPERSIZE_DEFAULT; } - for( const XclPaperSize* pEntry = pPaperSizeTable; pEntry != STATIC_ARRAY_END( pPaperSizeTable ); ++pEntry ) + for( const auto &rEntry : pPaperSizeTable) { - long nWDiff = std::abs( pEntry->mnWidth - nWidth ); - long nHDiff = std::abs( pEntry->mnHeight - nHeight ); + long nWDiff = std::abs( rEntry.mnWidth - nWidth ); + long nHDiff = std::abs( rEntry.mnHeight - nHeight ); if( ((nWDiff <= nMaxWDiff) && (nHDiff < nMaxHDiff)) || ((nWDiff < nMaxWDiff) && (nHDiff <= nMaxHDiff)) ) { - sal_uInt16 nIndex = static_cast< sal_uInt16 >( pEntry - pPaperSizeTable ); - if( !bStrictSize ) - mnPaperSize = nIndex; - else - mnStrictPaperSize = mnPaperSize = nIndex; + sal_uInt16 nIndex = static_cast< sal_uInt16 >( &rEntry - pPaperSizeTable ); + mnPaperSize = nIndex; + if( bStrictSize ) + mnStrictPaperSize = nIndex; nMaxWDiff = nWDiff; nMaxHDiff = nHDiff; diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx index 505c50808500..31d78d66d5df 100644 --- a/sc/source/filter/excel/xlstyle.cxx +++ b/sc/source/filter/excel/xlstyle.cxx @@ -1476,9 +1476,8 @@ void XclNumFmtBuffer::InsertBuiltinFormats() // build a map containing tables for all languages typedef ::std::map< LanguageType, const XclBuiltInFormatTable* > XclBuiltInMap; XclBuiltInMap aBuiltInMap; - for( const XclBuiltInFormatTable* pTable = spBuiltInFormatTables; - pTable != STATIC_ARRAY_END( spBuiltInFormatTables ); ++pTable ) - aBuiltInMap[ pTable->meLanguage ] = pTable; + for(const auto &rTable : spBuiltInFormatTables) + aBuiltInMap[ rTable.meLanguage ] = &rTable; // build a list of table pointers for the current language, with all parent tables typedef ::std::vector< const XclBuiltInFormatTable* > XclBuiltInVec; diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index d6e0b443b326..0780908b38d1 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -40,8 +40,8 @@ // GUID import/export XclGuid::XclGuid() + : mpnData{} { - ::std::fill( mpnData, STATIC_ARRAY_END( mpnData ), 0 ); } XclGuid::XclGuid( @@ -65,7 +65,7 @@ XclGuid::XclGuid( bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 ) { - return ::std::equal( rCmp1.mpnData, STATIC_ARRAY_END( rCmp1.mpnData ), rCmp2.mpnData ); + return ::std::equal( rCmp1.mpnData, std::end( rCmp1.mpnData ), rCmp2.mpnData ); } XclImpStream& operator>>( XclImpStream& rStrm, XclGuid& rGuid ) @@ -389,7 +389,7 @@ pCodePageTable[] = { 32768, RTL_TEXTENCODING_APPLE_ROMAN }, // Apple Roman { 32769, RTL_TEXTENCODING_MS_1252 } // MS Windows Latin I (BIFF2-BIFF3) }; -const XclCodePageEntry* const pCodePageTableEnd = STATIC_ARRAY_END( pCodePageTable ); +const XclCodePageEntry* const pCodePageTableEnd = std::end(pCodePageTable); struct XclCodePageEntry_CPPred { diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx index 3778f2c1a582..a0b1350ee3c4 100644 --- a/sc/source/filter/oox/formulabase.cxx +++ b/sc/source/filter/oox/formulabase.cxx @@ -1060,21 +1060,21 @@ FunctionProviderImpl::FunctionProviderImpl( FilterType eFilter, BiffType eBiff, tables from later BIFF versions may overwrite single functions from earlier tables. */ if( eBiff >= BIFF2 ) - initFuncs( saFuncTableBiff2, STATIC_ARRAY_END( saFuncTableBiff2 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableBiff2, ::std::end( saFuncTableBiff2 ), nMaxParam, bImportFilter, eFilter ); if( eBiff >= BIFF3 ) - initFuncs( saFuncTableBiff3, STATIC_ARRAY_END( saFuncTableBiff3 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableBiff3, ::std::end( saFuncTableBiff3 ), nMaxParam, bImportFilter, eFilter ); if( eBiff >= BIFF4 ) - initFuncs( saFuncTableBiff4, STATIC_ARRAY_END( saFuncTableBiff4 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableBiff4, ::std::end( saFuncTableBiff4 ), nMaxParam, bImportFilter, eFilter ); if( eBiff >= BIFF5 ) - initFuncs( saFuncTableBiff5, STATIC_ARRAY_END( saFuncTableBiff5 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableBiff5, ::std::end( saFuncTableBiff5 ), nMaxParam, bImportFilter, eFilter ); if( eBiff >= BIFF8 ) - initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTable2010, STATIC_ARRAY_END( saFuncTable2010 ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTable2013, STATIC_ARRAY_END( saFuncTable2013 ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTable2016, STATIC_ARRAY_END( saFuncTable2016 ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTableOdf, STATIC_ARRAY_END( saFuncTableOdf ), nMaxParam, bImportFilter, eFilter ); - initFuncs( saFuncTableOOoLO, STATIC_ARRAY_END( saFuncTableOOoLO ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableBiff8, ::std::end( saFuncTableBiff8 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableOox, ::std::end( saFuncTableOox ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTable2010, ::std::end( saFuncTable2010 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTable2013, ::std::end( saFuncTable2013 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTable2016, ::std::end( saFuncTable2016 ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableOdf, ::std::end( saFuncTableOdf ), nMaxParam, bImportFilter, eFilter ); + initFuncs( saFuncTableOOoLO, ::std::end( saFuncTableOOoLO ), nMaxParam, bImportFilter, eFilter ); } void FunctionProviderImpl::initFunc( const FunctionData& rFuncData, sal_uInt8 nMaxParam ) diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index c92bd2959b87..f3825c214e84 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -2001,9 +2001,8 @@ void NumberFormatsBuffer::insertBuiltinFormats() // build a map containing pointers to all tables typedef ::std::map< OUString, const BuiltinFormatTable* > BuiltinMap; BuiltinMap aBuiltinMap; - for( const BuiltinFormatTable* pTable = spBuiltinFormatTables; - pTable != STATIC_ARRAY_END( spBuiltinFormatTables ); ++pTable ) - aBuiltinMap[ OUString::createFromAscii( pTable->mpcLocale ) ] = pTable; + for(auto const &rTable : spBuiltinFormatTables) + aBuiltinMap[ OUString::createFromAscii(rTable.mpcLocale) ] = &rTable; // convert locale string to locale struct Locale aSysLocale( LanguageTag::convertToLocale( maLocaleStr)); diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index c45abf7a2b45..693722f0bd68 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -471,8 +471,8 @@ HeaderFooterParser::HeaderFooterParser( const WorkbookHelper& rHelper ) : maSheetNameService( "com.sun.star.text.TextField.SheetName" ), maFileNameService( "com.sun.star.text.TextField.FileName" ), maDateTimeService( "com.sun.star.text.TextField.DateTime" ), - maBoldNames( sppcBoldNames, STATIC_ARRAY_END( sppcBoldNames ) ), - maItalicNames( sppcItalicNames, STATIC_ARRAY_END( sppcItalicNames ) ), + maBoldNames( sppcBoldNames, ::std::end(sppcBoldNames) ), + maItalicNames( sppcItalicNames, ::std::end(sppcItalicNames) ), maPortions( static_cast< size_t >( HF_COUNT ) ), meCurrPortion( HF_CENTER ) { diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 10cc7c5be1ad..553b44eadc75 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -399,17 +399,17 @@ ColorPalette::ColorPalette( const WorkbookHelper& rHelper ) switch( getFilterType() ) { case FILTER_OOXML: - maColors.insert( maColors.begin(), spnDefColors8, STATIC_ARRAY_END( spnDefColors8 ) ); + maColors.insert( maColors.begin(), spnDefColors8, ::std::end(spnDefColors8) ); mnAppendIndex = OOX_COLOR_USEROFFSET; break; case FILTER_BIFF: switch( getBiff() ) { - case BIFF2: maColors.insert( maColors.begin(), spnDefColors2, STATIC_ARRAY_END( spnDefColors2 ) ); break; + case BIFF2: maColors.insert( maColors.begin(), spnDefColors2, ::std::end(spnDefColors2) ); break; case BIFF3: - case BIFF4: maColors.insert( maColors.begin(), spnDefColors3, STATIC_ARRAY_END( spnDefColors3 ) ); break; - case BIFF5: maColors.insert( maColors.begin(), spnDefColors5, STATIC_ARRAY_END( spnDefColors5 ) ); break; - case BIFF8: maColors.insert( maColors.begin(), spnDefColors8, STATIC_ARRAY_END( spnDefColors8 ) ); break; + case BIFF4: maColors.insert( maColors.begin(), spnDefColors3, ::std::end(spnDefColors3) ); break; + case BIFF5: maColors.insert( maColors.begin(), spnDefColors5, ::std::end(spnDefColors5) ); break; + case BIFF8: maColors.insert( maColors.begin(), spnDefColors8, ::std::end(spnDefColors8) ); break; case BIFF_UNKNOWN: break; } mnAppendIndex = BIFF_COLOR_USEROFFSET; diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index 4b88f3737c3c..5a5c529289d4 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -358,9 +358,10 @@ const ScXMLConditionInfo* lclGetConditionInfo( const sal_Unicode*& rpcString, co // search the table for an entry if( nLength > 0 ) - for( const ScXMLConditionInfo* pInfo = spConditionInfos; pInfo < STATIC_ARRAY_END( spConditionInfos ); ++pInfo ) - if( (nLength == pInfo->mnIdentLength) && (::rtl_ustr_ascii_shortenedCompare_WithLength( pcIdStart, nLength, pInfo->mpcIdentifier, nLength ) == 0) ) - return pInfo; + for(auto const &rInfo : spConditionInfos) + if((nLength == rInfo.mnIdentLength) + && (::rtl_ustr_ascii_shortenedCompare_WithLength(pcIdStart, nLength, rInfo.mpcIdentifier, nLength) == 0) ) + return &rInfo; return nullptr; } |