Kaydet (Commit) 85b3c799 authored tarafından Julien Nabet's avatar Julien Nabet

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/48805Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst fe41d0ff
...@@ -267,9 +267,8 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat ...@@ -267,9 +267,8 @@ void TEParaPortion::CorrectValuesBehindLastFormattedLine( sal_uInt16 nLastFormat
TEParaPortions::~TEParaPortions() TEParaPortions::~TEParaPortions()
{ {
std::vector<TEParaPortion*>::iterator aIter( mvData.begin() ); for (auto const& elem : mvData)
while ( aIter != mvData.end() ) delete elem;
delete *aIter++;
} }
IdleFormatter::IdleFormatter() IdleFormatter::IdleFormatter()
......
...@@ -113,13 +113,13 @@ TextCharAttrib* TextCharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int3 ...@@ -113,13 +113,13 @@ TextCharAttrib* TextCharAttribList::FindEmptyAttrib( sal_uInt16 nWhich, sal_Int3
if ( !mbHasEmptyAttribs ) if ( !mbHasEmptyAttribs )
return nullptr; 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; return nullptr;
if ( ( (*it)->GetStart() == nPos ) && ( (*it)->GetEnd() == nPos ) && ( (*it)->Which() == nWhich ) ) if ( ( attrib->GetStart() == nPos ) && ( attrib->GetEnd() == nPos ) && ( attrib->Which() == nWhich ) )
return it->get(); return attrib.get();
} }
return nullptr; return nullptr;
} }
......
...@@ -317,11 +317,12 @@ OUString FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat ) ...@@ -317,11 +317,12 @@ OUString FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat )
sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName ) sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) for (auto const& elem : aImport)
{ {
if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) if ( elem.sUIName.equalsIgnoreAsciiCase( rFormatName ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
...@@ -329,37 +330,39 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName ...@@ -329,37 +330,39 @@ sal_uInt16 FilterConfigCache::GetImportFormatNumber( const OUString& rFormatName
/// get the index of the filter that matches this extension /// get the index of the filter that matches this extension
sal_uInt16 FilterConfigCache::GetImportFormatNumberForExtension( const OUString& rExt ) sal_uInt16 FilterConfigCache::GetImportFormatNumberForExtension( const OUString& rExt )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) 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 ) ) if ( elem.lExtensionList[i].equalsIgnoreAsciiCase( rExt ) )
return sal::static_int_cast< sal_uInt16 >( aIter - aImport.begin() ); return nPos;
} }
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& rShortName ) sal_uInt16 FilterConfigCache::GetImportFormatNumberForShortName( const OUString& rShortName )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aEnd; sal_uInt16 nPos = 0;
std::vector< FilterConfigCacheEntry >::iterator aIter; for (auto & elem : aImport)
for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter)
{ {
if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) if ( elem.GetShortName().equalsIgnoreAsciiCase( rShortName ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& rType ) sal_uInt16 FilterConfigCache::GetImportFormatNumberForTypeName( const OUString& rType )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aImport.begin(), aEnd = aImport.end(); aIter != aEnd; ++aIter) for (auto const& elem : aImport)
{ {
if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) if ( elem.sType.equalsIgnoreAsciiCase( rType ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aImport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
...@@ -443,45 +446,48 @@ OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat ) ...@@ -443,45 +446,48 @@ OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat )
sal_uInt16 FilterConfigCache::GetExportFormatNumber(const OUString& rFormatName) sal_uInt16 FilterConfigCache::GetExportFormatNumber(const OUString& rFormatName)
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) for (auto const& elem : aExport)
{ {
if ( aIter->sUIName.equalsIgnoreAsciiCase( rFormatName ) ) if ( elem.sUIName.equalsIgnoreAsciiCase( rFormatName ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& rMediaType ) sal_uInt16 FilterConfigCache::GetExportFormatNumberForMediaType( const OUString& rMediaType )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) for (auto const& elem : aExport)
{ {
if ( aIter->sMediaType.equalsIgnoreAsciiCase( rMediaType ) ) if ( elem.sMediaType.equalsIgnoreAsciiCase( rMediaType ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& rShortName ) sal_uInt16 FilterConfigCache::GetExportFormatNumberForShortName( const OUString& rShortName )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aEnd; sal_uInt16 nPos = 0;
std::vector< FilterConfigCacheEntry >::iterator aIter; for (auto & elem : aExport)
for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter)
{ {
if ( aIter->GetShortName().equalsIgnoreAsciiCase( rShortName ) ) if ( elem.GetShortName().equalsIgnoreAsciiCase( rShortName ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& rType ) sal_uInt16 FilterConfigCache::GetExportFormatNumberForTypeName( const OUString& rType )
{ {
std::vector< FilterConfigCacheEntry >::const_iterator aIter, aEnd; sal_uInt16 nPos = 0;
for (aIter = aExport.begin(), aEnd = aExport.end(); aIter != aEnd; ++aIter) for (auto const& elem : aExport)
{ {
if ( aIter->sType.equalsIgnoreAsciiCase( rType ) ) if ( elem.sType.equalsIgnoreAsciiCase( rType ) )
return sal::static_int_cast< sal_uInt16 >(aIter - aExport.begin()); return nPos;
++nPos;
} }
return GRFILTER_FORMAT_NOTFOUND; return GRFILTER_FORMAT_NOTFOUND;
} }
......
...@@ -90,10 +90,9 @@ void PhysicalFontCollection::Clear() ...@@ -90,10 +90,9 @@ void PhysicalFontCollection::Clear()
mnFallbackCount = -1; mnFallbackCount = -1;
// clear all entries in the device font list // clear all entries in the device font list
PhysicalFontFamilies::iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
PhysicalFontFamily* pEntry = (*it).second; PhysicalFontFamily* pEntry = family.second;
delete pEntry; delete pEntry;
} }
...@@ -352,10 +351,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( c ...@@ -352,10 +351,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( c
PhysicalFontFamily* pFoundData = nullptr; PhysicalFontFamily* pFoundData = nullptr;
// use the font substitutions suggested by the FontNameAttr to find the font // use the font substitutions suggested by the FontNameAttr to find the font
::std::vector< OUString >::const_iterator it = rFontAttr.Substitutions.begin(); for (auto const& substitution : rFontAttr.Substitutions)
for(; it != rFontAttr.Substitutions.end(); ++it )
{ {
pFoundData = FindFontFamily( *it ); pFoundData = FindFontFamily(substitution);
if( pFoundData ) if( pFoundData )
return pFoundData; return pFoundData;
} }
...@@ -392,11 +390,10 @@ void PhysicalFontCollection::ImplInitMatchData() const ...@@ -392,11 +390,10 @@ void PhysicalFontCollection::ImplInitMatchData() const
// calculate MatchData for all entries // calculate MatchData for all entries
const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get(); const utl::FontSubstConfiguration& rFontSubst = utl::FontSubstConfiguration::get();
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
const OUString& rSearchName = (*it).first; const OUString& rSearchName = family.first;
PhysicalFontFamily* pEntry = (*it).second; PhysicalFontFamily* pEntry = family.second;
pEntry->InitMatchData( rFontSubst, rSearchName ); pEntry->InitMatchData( rFontSubst, rSearchName );
} }
...@@ -423,10 +420,9 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont ...@@ -423,10 +420,9 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont
long nBestMatch = 40000; long nBestMatch = 40000;
ImplFontAttrs nBestType = ImplFontAttrs::None; ImplFontAttrs nBestType = ImplFontAttrs::None;
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
PhysicalFontFamily* pData = (*it).second; PhysicalFontFamily* pData = family.second;
// Get all information about the matching font // Get all information about the matching font
ImplFontAttrs nMatchType = pData->GetMatchType(); ImplFontAttrs nMatchType = pData->GetMatchType();
...@@ -489,7 +485,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont ...@@ -489,7 +485,7 @@ PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFont
// test SYMBOL attributes // test SYMBOL attributes
if ( nSearchType & ImplFontAttrs::Symbol ) if ( nSearchType & ImplFontAttrs::Symbol )
{ {
const OUString& rSearchName = it->first; const OUString& rSearchName = family.first;
// prefer some special known symbol fonts // prefer some special known symbol fonts
if ( rSearchName == "starsymbol" ) if ( rSearchName == "starsymbol" )
{ {
...@@ -859,10 +855,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co ...@@ -859,10 +855,9 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co
ImplInitMatchData(); ImplInitMatchData();
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
PhysicalFontFamily* pData = (*it).second; PhysicalFontFamily* pData = family.second;
if( pData->GetMatchType() & ImplFontAttrs::Symbol ) if( pData->GetMatchType() & ImplFontAttrs::Symbol )
continue; continue;
...@@ -874,7 +869,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co ...@@ -874,7 +869,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co
return pFoundData; return pFoundData;
// finding any font is better than finding no font at all // finding any font is better than finding no font at all
it = maPhysicalFontFamilies.begin(); auto it = maPhysicalFontFamilies.begin();
if( it != maPhysicalFontFamilies.end() ) if( it != maPhysicalFontFamilies.end() )
pFoundData = (*it).second; pFoundData = (*it).second;
...@@ -890,10 +885,9 @@ PhysicalFontCollection* PhysicalFontCollection::Clone() const ...@@ -890,10 +885,9 @@ PhysicalFontCollection* PhysicalFontCollection::Clone() const
// TODO: clone the config-font attributes too? // TODO: clone the config-font attributes too?
pClonedCollection->mbMatchData = false; pClonedCollection->mbMatchData = false;
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
const PhysicalFontFamily* pFontFace = (*it).second; const PhysicalFontFamily* pFontFace = family.second;
pFontFace->UpdateCloneFontList(*pClonedCollection); pFontFace->UpdateCloneFontList(*pClonedCollection);
} }
...@@ -904,10 +898,9 @@ ImplDeviceFontList* PhysicalFontCollection::GetDeviceFontList() const ...@@ -904,10 +898,9 @@ ImplDeviceFontList* PhysicalFontCollection::GetDeviceFontList() const
{ {
ImplDeviceFontList* pDeviceFontList = new ImplDeviceFontList; ImplDeviceFontList* pDeviceFontList = new ImplDeviceFontList;
PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.begin(); for (auto const& family : maPhysicalFontFamilies)
for(; it != maPhysicalFontFamilies.end(); ++it )
{ {
const PhysicalFontFamily* pFontFamily = (*it).second; const PhysicalFontFamily* pFontFamily = family.second;
pFontFamily->UpdateDevFontList( *pDeviceFontList ); pFontFamily->UpdateDevFontList( *pDeviceFontList );
} }
......
...@@ -99,12 +99,9 @@ PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName ) ...@@ -99,12 +99,9 @@ PhysicalFontFamily::PhysicalFontFamily( const OUString& rSearchName )
PhysicalFontFamily::~PhysicalFontFamily() PhysicalFontFamily::~PhysicalFontFamily()
{ {
// release all physical font faces // release all physical font faces
for( std::vector< PhysicalFontFace* >::iterator it=maFontFaces.begin(); it != maFontFaces.end(); ) for (auto const& font : maFontFaces)
{ delete font;
delete *it; maFontFaces.clear();
it = maFontFaces.erase( it );
}
} }
bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace ) bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
...@@ -225,9 +222,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern& ...@@ -225,9 +222,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern&
// TODO: linear search improve! // TODO: linear search improve!
PhysicalFontFace* pBestFontFace = maFontFaces[0]; PhysicalFontFace* pBestFontFace = maFontFaces[0];
FontMatchStatus aFontMatchStatus = {0,0,0, pTargetStyleName}; 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 ) ) if( pFoundFontFace->IsBetterMatch( rFSD, aFontMatchStatus ) )
pBestFontFace = pFoundFontFace; pBestFontFace = pFoundFontFace;
} }
...@@ -240,9 +237,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern& ...@@ -240,9 +237,9 @@ PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern&
void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) const void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) const
{ {
PhysicalFontFace* pPrevFace = nullptr; 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 ) ) if( !pPrevFace || pFoundFontFace->CompareIgnoreSize( *pPrevFace ) )
rDevFontList.Add( pFoundFontFace ); rDevFontList.Add( pFoundFontFace );
pPrevFace = pFoundFontFace; pPrevFace = pFoundFontFace;
...@@ -252,9 +249,9 @@ void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) c ...@@ -252,9 +249,9 @@ void PhysicalFontFamily::UpdateDevFontList( ImplDeviceFontList& rDevFontList ) c
void PhysicalFontFamily::GetFontHeights( std::set<int>& rHeights ) const void PhysicalFontFamily::GetFontHeights( std::set<int>& rHeights ) const
{ {
// add all available font heights // 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() ); rHeights.insert( pFoundFontFace->GetHeight() );
} }
} }
...@@ -264,9 +261,9 @@ void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollec ...@@ -264,9 +261,9 @@ void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollec
OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() ); OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
PhysicalFontFamily* pFamily(nullptr); 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) if (!pFamily)
{ // tdf#98989 lazy create as family without faces won't work { // tdf#98989 lazy create as family without faces won't work
......
...@@ -91,10 +91,9 @@ ImplFontCache::ImplFontCache() ...@@ -91,10 +91,9 @@ ImplFontCache::ImplFontCache()
ImplFontCache::~ImplFontCache() ImplFontCache::~ImplFontCache()
{ {
FontInstanceList::iterator it = maFontInstanceList.begin(); for (auto const& fontInstance : maFontInstanceList)
for(; it != maFontInstanceList.end(); ++it )
{ {
LogicalFontInstance* pFontInstance = (*it).second; LogicalFontInstance* pFontInstance = fontInstance.second;
delete pFontInstance; delete pFontInstance;
} }
} }
...@@ -268,12 +267,14 @@ void ImplFontCache::Release(LogicalFontInstance* pFontInstance) ...@@ -268,12 +267,14 @@ void ImplFontCache::Release(LogicalFontInstance* pFontInstance)
FontInstanceList::iterator it_next = maFontInstanceList.begin(); FontInstanceList::iterator it_next = maFontInstanceList.begin();
while( it_next != maFontInstanceList.end() ) while( it_next != maFontInstanceList.end() )
{ {
FontInstanceList::iterator it = it_next++; LogicalFontInstance* pFontEntry = (*it_next).second;
LogicalFontInstance* pFontEntry = (*it).second;
if( pFontEntry->mnRefCount > 0 ) if( pFontEntry->mnRefCount > 0 )
{
++it_next;
continue; continue;
}
maFontInstanceList.erase( it ); it_next = maFontInstanceList.erase(it_next);
delete pFontEntry; delete pFontEntry;
--mnRef0Count; --mnRef0Count;
assert(mnRef0Count>=0 && "ImplFontCache::Release() - refcount0 underflow"); assert(mnRef0Count>=0 && "ImplFontCache::Release() - refcount0 underflow");
...@@ -295,10 +296,9 @@ int ImplFontCache::CountUnreferencedEntries() const ...@@ -295,10 +296,9 @@ int ImplFontCache::CountUnreferencedEntries() const
{ {
size_t nCount = 0; size_t nCount = 0;
// count unreferenced entries // count unreferenced entries
for (FontInstanceList::const_iterator it = maFontInstanceList.begin(); for (auto const& fontInstance : maFontInstanceList)
it != maFontInstanceList.end(); ++it)
{ {
const LogicalFontInstance* pFontEntry = it->second; const LogicalFontInstance* pFontEntry = fontInstance.second;
if (pFontEntry->mnRefCount > 0) if (pFontEntry->mnRefCount > 0)
continue; continue;
++nCount; ++nCount;
...@@ -311,10 +311,9 @@ void ImplFontCache::Invalidate() ...@@ -311,10 +311,9 @@ void ImplFontCache::Invalidate()
assert(CountUnreferencedEntries() == mnRef0Count); assert(CountUnreferencedEntries() == mnRef0Count);
// delete unreferenced entries // delete unreferenced entries
FontInstanceList::iterator it = maFontInstanceList.begin(); for (auto const& fontInstance : maFontInstanceList)
for(; it != maFontInstanceList.end(); ++it )
{ {
LogicalFontInstance* pFontEntry = (*it).second; LogicalFontInstance* pFontEntry = fontInstance.second;
if( pFontEntry->mnRefCount > 0 ) if( pFontEntry->mnRefCount > 0 )
{ {
// These fonts will become orphans after clearing the list below; // These fonts will become orphans after clearing the list below;
......
...@@ -331,19 +331,18 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) ...@@ -331,19 +331,18 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
// convert the set of supported code points to ranges // convert the set of supported code points to ranges
std::vector<sal_UCS4> aSupportedRanges; std::vector<sal_UCS4> aSupportedRanges;
std::set<sal_UCS4>::const_iterator itChar = aSupportedCodePoints.begin(); for (auto const& supportedPoint : aSupportedCodePoints)
for(; itChar != aSupportedCodePoints.end(); ++itChar )
{ {
if( aSupportedRanges.empty() if( aSupportedRanges.empty()
|| (aSupportedRanges.back() != *itChar) ) || (aSupportedRanges.back() != supportedPoint) )
{ {
// add new range beginning with current unicode // add new range beginning with current unicode
aSupportedRanges.push_back( *itChar ); aSupportedRanges.push_back(supportedPoint);
aSupportedRanges.push_back( 0 ); aSupportedRanges.push_back( 0 );
} }
// extend existing range to include current unicode // extend existing range to include current unicode
aSupportedRanges.back() = *itChar + 1; aSupportedRanges.back() = supportedPoint + 1;
} }
// glyph mapping for non-unicode fonts not implemented // glyph mapping for non-unicode fonts not implemented
...@@ -357,9 +356,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) ...@@ -357,9 +356,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
if( nRangeCount <= 0 ) if( nRangeCount <= 0 )
return false; return false;
pCodePairs = new sal_UCS4[ nRangeCount * 2 ]; pCodePairs = new sal_UCS4[ nRangeCount * 2 ];
std::vector<sal_UCS4>::const_iterator itInt = aSupportedRanges.begin(); for (auto const& supportedRange : aSupportedRanges)
for( pCP = pCodePairs; itInt != aSupportedRanges.end(); ++itInt ) *(pCP++) = supportedRange;
*(pCP++) = *itInt;
} }
// prepare the glyphid-array if needed // prepare the glyphid-array if needed
...@@ -369,9 +367,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) ...@@ -369,9 +367,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
{ {
pGlyphIds = new sal_uInt16[ aGlyphIdArray.size() ]; pGlyphIds = new sal_uInt16[ aGlyphIdArray.size() ];
sal_uInt16* pOut = pGlyphIds; sal_uInt16* pOut = pGlyphIds;
std::vector<sal_uInt16>::const_iterator it = aGlyphIdArray.begin(); for (auto const& glyphId : aGlyphIdArray)
while( it != aGlyphIdArray.end() ) *(pOut++) = glyphId;
*(pOut++) = *(it++);
} }
// update the result struct // update the result struct
......
...@@ -59,19 +59,18 @@ void SettingsConfigItem::ImplCommit() ...@@ -59,19 +59,18 @@ void SettingsConfigItem::ImplCommit()
{ {
std::unordered_map< OUString, SmallOUStrMap >::const_iterator group; 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 ); /*bool bAdded =*/ AddNode( OUString(), aKeyName );
Sequence< PropertyValue > aValues( group->second.size() ); Sequence< PropertyValue > aValues( group->second.size() );
PropertyValue* pValues = aValues.getArray(); PropertyValue* pValues = aValues.getArray();
int nIndex = 0; int nIndex = 0;
SmallOUStrMap::const_iterator it; for (auto const& elem : group->second)
for( it = group->second.begin(); it != group->second.end(); ++it )
{ {
pValues[nIndex].Name = aKeyName + "/" + it->first; pValues[nIndex].Name = aKeyName + "/" + elem.first;
pValues[nIndex].Handle = 0; pValues[nIndex].Handle = 0;
pValues[nIndex].Value <<= it->second; pValues[nIndex].Value <<= elem.second;
pValues[nIndex].State = PropertyState_DIRECT_VALUE; pValues[nIndex].State = PropertyState_DIRECT_VALUE;
nIndex++; nIndex++;
} }
......
...@@ -365,14 +365,13 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup ) ...@@ -365,14 +365,13 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup )
rOStream.WriteBytes( &aOldJobData, nOldJobDataSize ); rOStream.WriteBytes( &aOldJobData, nOldJobDataSize );
rOStream.WriteBytes( rJobData.GetDriverData(), rJobData.GetDriverDataLen() ); rOStream.WriteBytes( rJobData.GetDriverData(), rJobData.GetDriverDataLen() );
std::unordered_map< OUString, OUString >::const_iterator it;
const std::unordered_map< OUString, OUString >& rValueMap( const std::unordered_map< OUString, OUString >& rValueMap(
rJobData.GetValueMap()); 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, value.first, RTL_TEXTENCODING_UTF8);
write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, it->second, RTL_TEXTENCODING_UTF8); write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStream, value.second, RTL_TEXTENCODING_UTF8);
} }
write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "COMPAT_DUPLEX_MODE"); write_uInt16_lenPrefixed_uInt8s_FromOString(rOStream, "COMPAT_DUPLEX_MODE");
switch( rJobData.GetDuplexMode() ) switch( rJobData.GetDuplexMode() )
......
...@@ -138,10 +138,9 @@ sal_Int32 GlobalSyncData::GetMappedStructId( sal_Int32 nStructId ) ...@@ -138,10 +138,9 @@ sal_Int32 GlobalSyncData::GetMappedStructId( sal_Int32 nStructId )
void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter ) void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter )
{ {
for (std::deque< PDFExtOutDevDataSync::Action >::const_iterator aIter( mActions.begin() ), aEnd( mActions.end() ) ; for (auto const& action : mActions)
aIter != aEnd ; ++aIter)
{ {
switch( *aIter ) switch (action)
{ {
case PDFExtOutDevDataSync::CreateNamedDest : //i56629 case PDFExtOutDevDataSync::CreateNamedDest : //i56629
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment