[Libreoffice-commits] core.git: i18nlangtag/source

Eike Rathke erack at redhat.com
Sat Sep 21 10:55:06 PDT 2013


 i18nlangtag/source/languagetag/languagetag.cxx |   50 +++++++++++++------------
 1 file changed, 27 insertions(+), 23 deletions(-)

New commits:
commit 3acc0cc1e527d3389c329d36744da76b10c83be6
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Sep 21 19:54:05 2013 +0200

    moved LANGUAGE_DONTKNOW impl detection up
    
    Change-Id: Iba2c7f03420a709c5ee6338c1504b1133a8cb643

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index a194f4f..03c4e05 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 );


More information about the Libreoffice-commits mailing list