diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-08-31 12:40:19 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-08-31 14:11:29 +0000 |
commit | e8b19c216be98aa0dd7f837152fc5bc93cd0f367 (patch) | |
tree | 558fe6c6862a8f40f842d02229b19dbe02ef9ffe /rsc | |
parent | cea58d4c27621725b068d26f3587491322769f45 (diff) |
use range based loops
clear of standard containers is superfluous in dtors
Change-Id: I3dd482573100a67a931122670abdcc60b8521790
Reviewed-on: https://gerrit.libreoffice.org/28544
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 60 |
1 files changed, 26 insertions, 34 deletions
diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index c96b7f172cd9..53855fc0f9ab 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -88,9 +88,9 @@ OString RscTypCont::ChangeLanguage(const OString& rNewLang) aLangFallbacks.clear(); - for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it) + for (OUString& rItem : aFallbacks) { - OString aLang( OUStringToOString( *it, RTL_TEXTENCODING_ASCII_US)); + OString aLang(OUStringToOString(rItem, RTL_TEXTENCODING_ASCII_US)); sal_uInt32 nID = GetLangId( aLang ); bool bAdd = (nID == 0); if ( bAdd ) @@ -174,8 +174,8 @@ RscTypCont::~RscTypCont() // all classes are still valid, destroy each instance // of base types - for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) - aBaseLst[ i ]->Pre_dtor(); + for (RscTop* pItem : aBaseLst) + pItem->Pre_dtor(); aBool.Pre_dtor(); aShort.Pre_dtor(); @@ -194,21 +194,17 @@ RscTypCont::~RscTypCont() delete aVersion.pClass; DestroyTree( pRoot ); - for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) - delete aBaseLst[ i ]; + for (RscTop* pItem : aBaseLst) + delete pItem; - aBaseLst.clear(); - - for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) - delete aSysLst[ i ]; - - aSysLst.clear(); + for (RscSysEntry* pItem: aSysLst) + delete pItem; } void RscTypCont::ClearSysNames() { - for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) - delete aSysLst[ i ]; + for (RscSysEntry* pItem: aSysLst) + delete pItem; aSysLst.clear(); } @@ -244,33 +240,30 @@ RscTop * RscTypCont::SearchType( Atom nId ) // al least to not pollute #undef ELSE_IF - for ( size_t i = 0, n = aBaseLst.size(); i < n; ++i ) + for (RscTop* pItem : aBaseLst) { - RscTop* pEle = aBaseLst[ i ]; - if( pEle->GetId() == nId ) - return pEle; + if (pItem->GetId() == nId) + return pItem; } return nullptr; } sal_uInt32 RscTypCont::PutSysName( sal_uInt32 nRscTyp, char * pFileName ) { - RscSysEntry *pSysEntry; RscSysEntry *pFoundEntry = nullptr; - for ( size_t i = 0, n = aSysLst.size(); i < n; ++i ) + for (RscSysEntry* pItem: aSysLst) { - pSysEntry = aSysLst[ i ]; - if( !strcmp( pSysEntry->aFileName.getStr(), pFileName ) ) - if( pSysEntry->nRscTyp == nRscTyp && - pSysEntry->nTyp == 0 && - pSysEntry->nRefId == 0) - { - pFoundEntry = pSysEntry; - break; - } + if( !strcmp( pItem->aFileName.getStr(), pFileName ) && + pItem->nRscTyp == nRscTyp && + pItem->nTyp == 0 && + pItem->nRefId == 0) + { + pFoundEntry = pItem; + break; + } } - pSysEntry = pFoundEntry; + RscSysEntry *pSysEntry = pFoundEntry; if ( !pSysEntry ) { @@ -366,13 +359,12 @@ void RscEnumerateObj::WriteRcFile( RscWriteRc & rMem, FILE * fOut ) sal_uInt32 nSize = (nCount * (sizeof(sal_uInt64)+sizeof(sal_Int32))) + sizeof(sal_Int32); rMem.Put( nCount ); // save the count - for( std::map< sal_uInt64, sal_uLong >::const_iterator it = - pTypCont->aIdTranslator.begin(); it != pTypCont->aIdTranslator.end(); ++it ) + for (auto& rItem : pTypCont->aIdTranslator) { // save the key - rMem.Put( it->first ); + rMem.Put( rItem.first ); // save the object id or position - rMem.Put( (sal_Int32)it->second ); + rMem.Put( static_cast<sal_Int32>(rItem.second) ); } rMem.Put( nSize ); // save the size next } |