diff options
author | Eike Rathke <erack@redhat.com> | 2013-08-07 11:20:59 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-08-07 12:02:58 +0200 |
commit | 6b2aaa7d2393db7c5df9ed3e695013b1e44d868f (patch) | |
tree | 56e06f8cf7ccfffc6f86e1102d67cfb2cd0ef39d | |
parent | 18767fd249bce1c6ad9d42d02de32757fd93e053 (diff) |
resolved fdo#67444 don't push_back() with already reserved size
Change-Id: I5660bdf07ad0adae053508bed1805369850c1134
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 5 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index d35f82fe1407..e4380357f5bd 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -1336,10 +1336,11 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47, ::std::vector< OUString > aFallbacks( LanguageTag( rReference).getFallbackStrings()); aFallbacks.erase( aFallbacks.begin()); // first is full BCP47, we already checked that ::std::vector< ::std::vector< OUString > > aListFallbacks( rList.size()); - for (it = rList.begin(); it != rList.end(); ++it) + size_t i = 0; + for (it = rList.begin(); it != rList.end(); ++it, ++i) { ::std::vector< OUString > aTmp( LanguageTag( *it).getFallbackStrings()); - aListFallbacks.push_back( aTmp); + aListFallbacks[i] = aTmp; } for (::std::vector< OUString >::const_iterator rfb( aFallbacks.begin()); rfb != aFallbacks.end(); ++rfb) { diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 7a80699bcb3b..253d77bc1684 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -687,10 +687,11 @@ LocaleItem* StringResourceImpl::getClosestMatchItemForLocale( const Locale& loca LocaleItem* pRetItem = NULL; ::std::vector< Locale > aLocales( m_aLocaleItemVector.size()); - for( LocaleItemVectorConstIt it = m_aLocaleItemVector.begin(); it != m_aLocaleItemVector.end(); ++it ) + size_t i = 0; + for( LocaleItemVectorConstIt it = m_aLocaleItemVector.begin(); it != m_aLocaleItemVector.end(); ++it, ++i ) { LocaleItem* pLocaleItem = *it; - aLocales.push_back( pLocaleItem ? pLocaleItem->m_locale : Locale()); + aLocales[i] = (pLocaleItem ? pLocaleItem->m_locale : Locale()); } ::std::vector< Locale >::const_iterator iFound( LanguageTag::getMatchingFallback( aLocales, locale)); if (iFound != aLocales.end()) |