diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-10-21 20:30:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-22 12:21:20 +0200 |
commit | 3bf3cae9b7b4d38e0427d71a2b34629fd5988af7 (patch) | |
tree | 1c582289baf6aabb814ea6263ab27d7afa3384f9 /vcl/unx/generic | |
parent | 61bddaff3380f7700f58a41adedf8befd34d4d91 (diff) |
Replace some lists by vectors (vcl)
Change-Id: Id6f61cbbcd91e1a81e5ac23cdf19a6cda07f8659
Reviewed-on: https://gerrit.libreoffice.org/43675
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 22 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/cairotextrender.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 12 |
3 files changed, 19 insertions, 22 deletions
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index 8336c1738b26..2c298340e3c9 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -497,7 +497,7 @@ namespace } } -void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUString >& rNames ) +void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::vector< OUString >& rNames ) { OUString aFamily; @@ -556,10 +556,10 @@ void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::list< OUStri DisposeNameRecords( pNameRecords, nNameRecords ); if( !aFamily.isEmpty() ) { - rNames.push_front( aFamily ); - for( ::std::set< OUString >::const_iterator it = aSet.begin(); it != aSet.end(); ++it ) - if( *it != aFamily ) - rNames.push_back( *it ); + rNames.emplace_back( aFamily ); + for (auto const& elem : aSet) + if( elem != aFamily ) + rNames.emplace_back(elem); } } @@ -575,7 +575,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const TTGlobalFontInfo aInfo; GetTTGlobalFontInfo( pTTFont, & aInfo ); - ::std::list< OUString > aNames; + ::std::vector< OUString > aNames; analyzeSfntFamilyName( pTTFont, aNames ); // set family name from XLFD if possible @@ -584,7 +584,7 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const if( !aNames.empty() ) { pFont->m_aFamilyName = aNames.front(); - aNames.pop_front(); + aNames.erase(aNames.begin()); } else { @@ -777,13 +777,13 @@ void PrintFontManager::initialize() #endif } -void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs ) +void PrintFontManager::getFontList( ::std::vector< fontID >& rFontIDs ) { rFontIDs.clear(); std::unordered_map< fontID, PrintFont* >::const_iterator it; - for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it ) - rFontIDs.push_back( it->first ); + for (auto const& font : m_aFonts) + rFontIDs.emplace_back(font.first); } void PrintFontManager::fillPrintFontInfo(PrintFont* pFont, FastPrintFontInfo& rInfo) @@ -1185,7 +1185,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont, extern "C" { SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void) { - std::list< fontID > aFontIDs; + std::vector< fontID > aFontIDs; PrintFontManager &rMgr = PrintFontManager::get(); rMgr.getFontList(aFontIDs); OStringBuffer aBuf; diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index bb3ffa456377..c3d0ecc42e75 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -370,13 +370,12 @@ void CairoTextRender::GetDevFontList( PhysicalFontCollection* pFontCollection ) GlyphCache& rGC = getPlatformGlyphCache(); psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); - ::std::list< psp::fontID > aList; - ::std::list< psp::fontID >::iterator it; + ::std::vector< psp::fontID > aList; psp::FastPrintFontInfo aInfo; rMgr.getFontList( aList ); - for( it = aList.begin(); it != aList.end(); ++it ) + for (auto const& elem : aList) { - if( !rMgr.getFontFastInfo( *it, aInfo ) ) + if( !rMgr.getFontFastInfo( elem, aInfo ) ) continue; // normalize face number to the GlyphCache diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index 8cae10af2997..6f458df680eb 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -722,14 +722,13 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti void GenPspGraphics::GetDevFontList( PhysicalFontCollection *pFontCollection ) { - ::std::list< psp::fontID > aList; + ::std::vector< psp::fontID > aList; psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); rMgr.getFontList( aList ); - ::std::list< psp::fontID >::iterator it; psp::FastPrintFontInfo aInfo; - for (it = aList.begin(); it != aList.end(); ++it) - if (rMgr.getFontFastInfo (*it, aInfo)) + for (auto const& elem : aList) + if (rMgr.getFontFastInfo (elem, aInfo)) AnnounceFonts( pFontCollection, aInfo ); // register platform specific font substitutions if available @@ -851,9 +850,8 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo aDFA.SetQuality(512); // add font family name aliases - ::std::list< OUString >::const_iterator it = rInfo.m_aAliases.begin(); - for(; it != rInfo.m_aAliases.end(); ++it ) - aDFA.AddMapName( *it ); + for (auto const& alias : rInfo.m_aAliases) + aDFA.AddMapName(alias); #if OSL_DEBUG_LEVEL > 2 if( aDFA.HasMapNames() ) |