From 8b700053cf1b91fbc728cb0b69b6efe21ab61248 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Wed, 31 Jan 2018 11:49:59 +0100 Subject: Modernize a bit vcl (part5) by using for range loops Change-Id: I52d6e6c9e1c2c321dc81d8258943a1a9a611441c Reviewed-on: https://gerrit.libreoffice.org/48987 Tested-by: Jenkins Reviewed-by: Julien Nabet --- vcl/unx/generic/fontmanager/fontconfig.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'vcl/unx/generic/fontmanager/fontconfig.cxx') diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 59acfa5841b0..639dc37591ae 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -269,16 +269,15 @@ namespace sFullMatch += OString('-'); sFullMatch += OUStringToOString(rLangTag.getCountry().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8); - std::vector::const_iterator aEnd = elements.end(); bool alreadyclosematch = false; bool found_fallback_englishname = false; - for( std::vector::const_iterator aIter = elements.begin(); aIter != aEnd; ++aIter ) + for (auto const& element : elements) { - const char *pLang = reinterpret_cast(aIter->first); + const char *pLang = reinterpret_cast(element.first); if( sFullMatch == pLang) { // both language and country match - candidate = aIter->second; + candidate = element.second; break; } else if( alreadyclosematch ) @@ -290,7 +289,7 @@ namespace else if( sLangMatch == pLang) { // just the language matches - candidate = aIter->second; + candidate = element.second; alreadyclosematch = true; } else if( found_fallback_englishname ) @@ -303,7 +302,7 @@ namespace { // select a fallback candidate of the first english element // name - candidate = aIter->second; + candidate = element.second; found_fallback_englishname = true; } } @@ -315,10 +314,9 @@ namespace void FontCfgWrapper::cacheLocalizedFontNames(const FcChar8 *origfontname, const FcChar8 *bestfontname, const std::vector< lang_and_element > &lang_and_elements) { - std::vector::const_iterator aEnd = lang_and_elements.end(); - for (std::vector::const_iterator aIter = lang_and_elements.begin(); aIter != aEnd; ++aIter) + for (auto const& element : lang_and_elements) { - const char *candidate = reinterpret_cast(aIter->second); + const char *candidate = reinterpret_cast(element.second); if (rtl_str_compare(candidate, reinterpret_cast(bestfontname)) != 0) m_aFontNameToLocalized[OString(candidate)] = OString(reinterpret_cast(bestfontname)); } @@ -585,11 +583,11 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map& o // a collection entry, get the correct index if( eIndexRes == FcResultMatch && nCollectionEntry != -1 ) { - for (auto it = aFonts.begin(); it != aFonts.end(); ++it) + for (auto & font : aFonts) { - if( (*it)->m_nCollectionEntry == nCollectionEntry ) + if( font->m_nCollectionEntry == nCollectionEntry ) { - xUpdate = std::move(*it); + xUpdate = std::move(font); break; } } -- cgit