diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-21 19:54:05 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-21 19:54:45 +0200 |
commit | 3acc0cc1e527d3389c329d36744da76b10c83be6 (patch) | |
tree | 91926eb4ea8ddae81071bb301544fc12630aa64c /i18nlangtag | |
parent | Enable Drop Caps for Firefox HTML compatibility mode (diff) | |
download | core-3acc0cc1e527d3389c329d36744da76b10c83be6.tar.gz core-3acc0cc1e527d3389c329d36744da76b10c83be6.zip |
moved LANGUAGE_DONTKNOW impl detection up
Change-Id: Iba2c7f03420a709c5ee6338c1504b1133a8cb643
Diffstat (limited to 'i18nlangtag')
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index a194f4f452b9..03c4e0506d04 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -698,17 +698,37 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const if (mbInitializedLangID) { - // A great share are calls for a system equal locale. - pImpl = theSystemLocale::get(); - if (pImpl && pImpl->mnLangID == mnLangID) + if (mnLangID == LANGUAGE_DONTKNOW) { + // Heavy usage of LANGUAGE_DONTKNOW, make it an own Impl for all the + // conversion attempts. At the same time provide a central breakpoint + // to inspect such places. + LanguageTag::ImplPtr& rDontKnow = theDontKnow::get(); + if (!rDontKnow) + rDontKnow.reset( new LanguageTagImpl( *this)); + pImpl = rDontKnow; #if OSL_DEBUG_LEVEL > 0 - static size_t nCallsSystemEqual = 0; - ++nCallsSystemEqual; - SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsSystemEqual << " system equal LangID calls"); + static size_t nCallsDontKnow = 0; + ++nCallsDontKnow; + SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsDontKnow << " DontKnow calls"); #endif return pImpl; } + else + { + // A great share are calls for a system equal locale. + pImpl = theSystemLocale::get(); + if (pImpl && pImpl->mnLangID == mnLangID) + { +#if OSL_DEBUG_LEVEL > 0 + static size_t nCallsSystemEqual = 0; + ++nCallsSystemEqual; + SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsSystemEqual + << " system equal LangID calls"); +#endif + return pImpl; + } + } } // Force Bcp47 if not LangID. @@ -752,8 +772,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const #endif // Prefer LangID map as find+insert needs less comparison work. - // Never insert LANGUAGE_DONTKNOW - if (mbInitializedLangID && mnLangID != LANGUAGE_DONTKNOW) + if (mbInitializedLangID) { MapLangID& rMap = theMapLangID::get(); MapLangID::const_iterator it( rMap.find( mnLangID)); @@ -863,21 +882,6 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const } } } - else if (mbInitializedLangID && mnLangID == LANGUAGE_DONTKNOW) - { - // Heavy usage of LANGUAGE_DONTKNOW, make it an own Impl for all the - // conversion attempts. At the same time provide a central breakpoint - // to inspect such places. - LanguageTag::ImplPtr& rDontKnow = theDontKnow::get(); - if (!rDontKnow) - rDontKnow.reset( new LanguageTagImpl( *this)); - pImpl = rDontKnow; -#if OSL_DEBUG_LEVEL > 0 - static size_t nCallsDontKnow = 0; - ++nCallsDontKnow; - SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << nCallsDontKnow << " DontKnow calls"); -#endif - } else { SAL_WARN( "i18nlangtag", "LanguageTag::registerImpl: can't register for 0x" << ::std::hex << mnLangID ); |