diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-01-28 22:46:46 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-01-29 07:02:23 +0100 |
commit | 85b3c799ede62a3d7ad0493fc80b629214956601 (patch) | |
tree | 28744ea275da6fce4bab05aaeed97d0ca21108e7 | |
parent | fe41d0ff8c426fe5934872de8b0dcb167cb636a2 (diff) |
Modernize a bit vcl (part2)
by using for-range loops
+ use returned iterator by erase method
+ avoid some iterators calculus by using plain loop
Change-Id: I196a52c3c7d0e2705d5ab0e3ea06bd4a4b83bb67
Reviewed-on: https://gerrit.libreoffice.org/48805
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r-- | vcl/source/edit/textdata.cxx | 5 | ||||
-rw-r--r-- | vcl/source/edit/textdoc.cxx | 8 | ||||
-rw-r--r-- | vcl/source/filter/FilterConfigCache.cxx | 76 | ||||
-rw-r--r-- | vcl/source/font/PhysicalFontCollection.cxx | 41 | ||||
-rw-r--r-- | vcl/source/font/PhysicalFontFamily.cxx | 25 | ||||
-rw-r--r-- | vcl/source/font/fontcache.cxx | 23 | ||||
-rw-r--r-- | vcl/source/font/fontcharmap.cxx | 19 | ||||
-rw-r--r-- | vcl/source/gdi/configsettings.cxx | 11 | ||||
-rw-r--r-- | vcl/source/gdi/jobset.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 5 |
10 files changed, 104 insertions, 116 deletions
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index 9f978e302e6b..72e8b3c309a8 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -267,9 +267,8 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat TEParaPortions::~TEParaPortions() { - std::vector<TEParaPortion*>::iterator aIter( mvData.begin() ); - while ( aIter != mvData.end() ) - delete *aIter++; + for (auto const& elem : mvData) + delete elem; } IdleFormatter::IdleFormatter() diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index 267d774818d3..82fa75e2aab3 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -113,13 +113,13 @@ TextCharAttrib* TextCharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int3 if ( !mbHasEmptyAttribs ) return nullptr; - for (std::vector<std::unique_ptr<TextCharAttrib> >::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it) + for (auto const& attrib : maAttribs) { - if ( (*it)->GetStart() > nPos ) + if ( attrib->GetStart() > nPos ) return nullptr; - if ( ( (*it)->GetStart() == nPos ) && ( (*it)->GetEnd() == nPos ) && ( (*it)->Which() == nWhich ) ) - return it->get(); + if ( ( attrib->GetStart() == nPos ) && ( attrib->GetEnd() == nPos ) && ( attrib->Which() == nWhich ) ) + return attrib.get(); } return nullptr; } diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 3f1914cd4a57..bfa48d5edee3 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -317,11 +317,12 @@ OUString FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat ) sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName ) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aImport) { - if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); + if ( elem.sUIName.equalsIgnoreAsciiCase( rFormatName ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } @@ -329,37 +330,39 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName /// get the index of the filter that matches this extension sal_uInt16 FilterConfigCache::GetImportFormatNumberForExtension( const OUString& rExt ) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aImport) { - for ( sal_Int32 i = 0; i < aIter->lExtensionList.getLength(); i++ ) + for ( sal_Int32 i = 0; i < elem.lExtensionList.getLength(); i++ ) { - if ( aIter->lExtensionList[i].equalsIgnoreAsciiCase( rExt ) ) - return sal::static_int_cast< sal_uInt16 >( aIter - aImport.begin() ); + if ( elem.lExtensionList[i].equalsIgnoreAsciiCase( rExt ) ) + return nPos; } + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& rShortName ) { - std::vector< FilterConfigCacheEntry >::const_iterator aEnd; - std::vector< FilterConfigCacheEntry >::iterator aIter; - for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto & elem : aImport) { - if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); + if ( elem.GetShortName().equalsIgnoreAsciiCase( rShortName ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& rType ) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aImport) { - if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); + if ( elem.sType.equalsIgnoreAsciiCase( rType ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } @@ -443,45 +446,48 @@ OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat ) sal_uInt16 FilterConfigCache::GetExportFormatNumber(const OUString& rFormatName) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aExport) { - if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); + if ( elem.sUIName.equalsIgnoreAsciiCase( rFormatName ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& rMediaType ) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aExport) { - if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); + if ( elem.sMediaType.equalsIgnoreAsciiCase( rMediaType ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& rShortName ) { - std::vector< FilterConfigCacheEntry >::const_iterator aEnd; - std::vector< FilterConfigCacheEntry >::iterator aIter; - for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto & elem : aExport) { - if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); + if ( elem.GetShortName().equalsIgnoreAsciiCase( rShortName ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& rType ) { - std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; - for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) + sal_uInt16 nPos = 0; + for (auto const& elem : aExport) { - if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) - return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); + if ( elem.sType.equalsIgnoreAsciiCase( rType ) ) + return nPos; + ++nPos; } return GRFILTER_FORMAT_NOTFOUND; } diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index bde66d9ab466..6f19f8c437b1 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -90,10 +90,9 @@ void PhysicalFontCollection::Clear() mnFallbackCount = -1; // clear all entries in the device font list - PhysicalFontFamilies::iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - PhysicalFontFamily* pEntry = (*it).second; + PhysicalFontFamily* pEntry = family.second; delete pEntry; } @@ -352,10 +351,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( c PhysicalFontFamily* pFoundData = nullptr; // use the font substitutions suggested by the FontNameAttr to find the font - ::std::vector< OUString >::const_iterator it = rFontAttr.Substitutions.begin(); - for(; it != rFontAttr.Substitutions.end(); ++it ) + for (auto const& substitution : rFontAttr.Substitutions) { - pFoundData = FindFontFamily( *it ); + pFoundData = FindFontFamily(substitution); if( pFoundData ) return pFoundData; } @@ -392,11 +390,10 @@ void PhysicalFontCollection::ImplInitMatchData() const // calculate MatchData for all entries const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get(); - PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - const OUString& rSearchName = (*it).first; - PhysicalFontFamily* pEntry = (*it).second; + const OUString& rSearchName = family.first; + PhysicalFontFamily* pEntry = family.second; pEntry->InitMatchData( rFontSubst, rSearchName ); } @@ -423,10 +420,9 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont long nBestMatch = 40000; ImplFontAttrs nBestType = ImplFontAttrs::None; - PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - PhysicalFontFamily* pData = (*it).second; + PhysicalFontFamily* pData = family.second; // Get all information about the matching font ImplFontAttrs nMatchType = pData->GetMatchType(); @@ -489,7 +485,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont // test SYMBOL attributes if ( nSearchType & ImplFontAttrs::Symbol ) { - const OUString& rSearchName = it->first; + const OUString& rSearchName = family.first; // prefer some special known symbol fonts if ( rSearchName == "starsymbol" ) { @@ -859,10 +855,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co ImplInitMatchData(); - PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - PhysicalFontFamily* pData = (*it).second; + PhysicalFontFamily* pData = family.second; if( pData->GetMatchType() & ImplFontAttrs::Symbol ) continue; @@ -874,7 +869,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co return pFoundData; // finding any font is better than finding no font at all - it = maPhysicalFontFamilies.begin(); + auto it = maPhysicalFontFamilies.begin(); if( it != maPhysicalFontFamilies.end() ) pFoundData = (*it).second; @@ -890,10 +885,9 @@ PhysicalFontCollection* PhysicalFontCollection::Clone() const // TODO: clone the config-font attributes too? pClonedCollection->mbMatchData = false; - PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - const PhysicalFontFamily* pFontFace = (*it).second; + const PhysicalFontFamily* pFontFace = family.second; pFontFace->UpdateCloneFontList(*pClonedCollection); } @@ -904,10 +898,9 @@ ImplDeviceFontList* PhysicalFontCollection::GetDeviceFontList() const { ImplDeviceFontList* pDeviceFontList = new ImplDeviceFontList; - PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); - for(; it != maPhysicalFontFamilies.end(); ++it ) + for (auto const& family : maPhysicalFontFamilies) { - const PhysicalFontFamily* pFontFamily = (*it).second; + const PhysicalFontFamily* pFontFamily = family.second; pFontFamily->UpdateDevFontList( *pDeviceFontList ); } diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx index 81fa20e8f17e..f52e31438f23 100644 --- a/vcl/source/font/PhysicalFontFamily.cxx +++ b/vcl/source/font/PhysicalFontFamily.cxx @@ -99,12 +99,9 @@ PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName ) PhysicalFontFamily::~PhysicalFontFamily() { // release all physical font faces - for( std::vector< PhysicalFontFace* >::iterator it=maFontFaces.begin(); it != maFontFaces.end(); ) - { - delete *it; - it = maFontFaces.erase( it ); - } - + for (auto const& font : maFontFaces) + delete font; + maFontFaces.clear(); } bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace ) @@ -225,9 +222,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern& // TODO: linear search improve! PhysicalFontFace* pBestFontFace = maFontFaces[0]; FontMatchStatus aFontMatchStatus = {0,0,0, pTargetStyleName}; - for( std::vector< PhysicalFontFace* >::const_iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it ) + for (auto const& font : maFontFaces) { - PhysicalFontFace* pFoundFontFace = *it; + PhysicalFontFace* pFoundFontFace = font; if( pFoundFontFace->IsBetterMatch( rFSD, aFontMatchStatus ) ) pBestFontFace = pFoundFontFace; } @@ -240,9 +237,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern& void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) const { PhysicalFontFace* pPrevFace = nullptr; - for(std::vector< PhysicalFontFace* >::const_iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it ) + for (auto const& font : maFontFaces) { - PhysicalFontFace* pFoundFontFace = *it; + PhysicalFontFace* pFoundFontFace = font; if( !pPrevFace || pFoundFontFace->CompareIgnoreSize( *pPrevFace ) ) rDevFontList.Add( pFoundFontFace ); pPrevFace = pFoundFontFace; @@ -252,9 +249,9 @@ void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) c void PhysicalFontFamily::GetFontHeights( std::set<int>& rHeights ) const { // add all available font heights - for( std::vector< PhysicalFontFace* >::const_iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it ) + for (auto const& font : maFontFaces) { - PhysicalFontFace *pFoundFontFace = *it; + PhysicalFontFace *pFoundFontFace = font; rHeights.insert( pFoundFontFace->GetHeight() ); } } @@ -264,9 +261,9 @@ void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollec OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() ); PhysicalFontFamily* pFamily(nullptr); - for( std::vector< PhysicalFontFace* >::const_iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it ) + for (auto const& font : maFontFaces) { - PhysicalFontFace *pFoundFontFace = *it; + PhysicalFontFace *pFoundFontFace = font; if (!pFamily) { // tdf#98989 lazy create as family without faces won't work diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index 874fd1e0cddc..011212fbdde3 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -91,10 +91,9 @@ ImplFontCache::ImplFontCache() ImplFontCache::~ImplFontCache() { - FontInstanceList::iterator it = maFontInstanceList.begin(); - for(; it != maFontInstanceList.end(); ++it ) + for (auto const& fontInstance : maFontInstanceList) { - LogicalFontInstance* pFontInstance = (*it).second; + LogicalFontInstance* pFontInstance = fontInstance.second; delete pFontInstance; } } @@ -268,12 +267,14 @@ void ImplFontCache::Release(LogicalFontInstance* pFontInstance) FontInstanceList::iterator it_next = maFontInstanceList.begin(); while( it_next != maFontInstanceList.end() ) { - FontInstanceList::iterator it = it_next++; - LogicalFontInstance* pFontEntry = (*it).second; + LogicalFontInstance* pFontEntry = (*it_next).second; if( pFontEntry->mnRefCount > 0 ) + { + ++it_next; continue; + } - maFontInstanceList.erase( it ); + it_next = maFontInstanceList.erase(it_next); delete pFontEntry; --mnRef0Count; assert(mnRef0Count>=0 && "ImplFontCache::Release() - refcount0 underflow"); @@ -295,10 +296,9 @@ int ImplFontCache::CountUnreferencedEntries() const { size_t nCount = 0; // count unreferenced entries - for (FontInstanceList::const_iterator it = maFontInstanceList.begin(); - it != maFontInstanceList.end(); ++it) + for (auto const& fontInstance : maFontInstanceList) { - const LogicalFontInstance* pFontEntry = it->second; + const LogicalFontInstance* pFontEntry = fontInstance.second; if (pFontEntry->mnRefCount > 0) continue; ++nCount; @@ -311,10 +311,9 @@ void ImplFontCache::Invalidate() assert(CountUnreferencedEntries() == mnRef0Count); // delete unreferenced entries - FontInstanceList::iterator it = maFontInstanceList.begin(); - for(; it != maFontInstanceList.end(); ++it ) + for (auto const& fontInstance : maFontInstanceList) { - LogicalFontInstance* pFontEntry = (*it).second; + LogicalFontInstance* pFontEntry = fontInstance.second; if( pFontEntry->mnRefCount > 0 ) { // These fonts will become orphans after clearing the list below; diff --git a/vcl/source/font/fontcharmap.cxx b/vcl/source/font/fontcharmap.cxx index faf3c906bca7..bafa613b764d 100644 --- a/vcl/source/font/fontcharmap.cxx +++ b/vcl/source/font/fontcharmap.cxx @@ -331,19 +331,18 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) // convert the set of supported code points to ranges std::vector<sal_UCS4> aSupportedRanges; - std::set<sal_UCS4>::const_iterator itChar = aSupportedCodePoints.begin(); - for(; itChar != aSupportedCodePoints.end(); ++itChar ) + for (auto const& supportedPoint : aSupportedCodePoints) { if( aSupportedRanges.empty() - || (aSupportedRanges.back() != *itChar) ) + || (aSupportedRanges.back() != supportedPoint) ) { // add new range beginning with current unicode - aSupportedRanges.push_back( *itChar ); + aSupportedRanges.push_back(supportedPoint); aSupportedRanges.push_back( 0 ); } // extend existing range to include current unicode - aSupportedRanges.back() = *itChar + 1; + aSupportedRanges.back() = supportedPoint + 1; } // glyph mapping for non-unicode fonts not implemented @@ -357,9 +356,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) if( nRangeCount <= 0 ) return false; pCodePairs = new sal_UCS4[ nRangeCount * 2 ]; - std::vector<sal_UCS4>::const_iterator itInt = aSupportedRanges.begin(); - for( pCP = pCodePairs; itInt != aSupportedRanges.end(); ++itInt ) - *(pCP++) = *itInt; + for (auto const& supportedRange : aSupportedRanges) + *(pCP++) = supportedRange; } // prepare the glyphid-array if needed @@ -369,9 +367,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) { pGlyphIds = new sal_uInt16[ aGlyphIdArray.size() ]; sal_uInt16* pOut = pGlyphIds; - std::vector<sal_uInt16>::const_iterator it = aGlyphIdArray.begin(); - while( it != aGlyphIdArray.end() ) - *(pOut++) = *(it++); + for (auto const& glyphId : aGlyphIdArray) + *(pOut++) = glyphId; } // update the result struct diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx index 25ec2cd50c74..8fe7e5b95ff1 100644 --- a/vcl/source/gdi/configsettings.cxx +++ b/vcl/source/gdi/configsettings.cxx @@ -59,19 +59,18 @@ void SettingsConfigItem::ImplCommit() { std::unordered_map< OUString, SmallOUStrMap >::const_iterator group; - for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) + for (auto const& setting : m_aSettings) { - OUString aKeyName( group->first ); + OUString aKeyName( setting.first ); /*bool bAdded =*/ AddNode( OUString(), aKeyName ); Sequence< PropertyValue > aValues( group->second.size() ); PropertyValue* pValues = aValues.getArray(); int nIndex = 0; - SmallOUStrMap::const_iterator it; - for( it = group->second.begin(); it != group->second.end(); ++it ) + for (auto const& elem : group->second) { - pValues[nIndex].Name = aKeyName + "/" + it->first; + pValues[nIndex].Name = aKeyName + "/" + elem.first; pValues[nIndex].Handle = 0; - pValues[nIndex].Value <<= it->second; + pValues[nIndex].Value <<= elem.second; pValues[nIndex].State = PropertyState_DIRECT_VALUE; nIndex++; } diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 844dcb60dce8..06b5ed6583d6 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -365,14 +365,13 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup ) rOStream.WriteBytes( &aOldJobData, nOldJobDataSize ); rOStream.WriteBytes( rJobData.GetDriverData(), rJobData.GetDriverDataLen() ); - std::unordered_map< OUString, OUString >::const_iterator it; const std::unordered_map< OUString, OUString >& rValueMap( rJobData.GetValueMap()); - for( it = rValueMap.begin(); it != rValueMap.end(); ++it ) + for (auto const& value : rValueMap) { - write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, it->first, RTL_TEXTENCODING_UTF8); - write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, it->second, RTL_TEXTENCODING_UTF8); + write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, value.first, RTL_TEXTENCODING_UTF8); + write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, value.second, RTL_TEXTENCODING_UTF8); } write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "COMPAT_DUPLEX_MODE"); switch( rJobData.GetDuplexMode() ) diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index d5197a04d41c..a21c0d98aee9 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -138,10 +138,9 @@ sal_Int32 GlobalSyncData::GetMappedStructId( sal_Int32 nStructId ) void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) { - for (std::deque< PDFExtOutDevDataSync::Action >::const_iterator aIter( mActions.begin() ), aEnd( mActions.end() ) ; - aIter != aEnd ; ++aIter) + for (auto const& action : mActions) { - switch( *aIter ) + switch (action) { case PDFExtOutDevDataSync::CreateNamedDest : //i56629 { |