[Libreoffice-commits] .: i18npool/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 08:53:09 PST 2012


 i18npool/source/languagetag/languagetag.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit a4471c3321105d062f7e3f894065eace5574ff9a
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Nov 22 17:51:11 2012 +0100

    exclude language(-Script) only tags from pRegionT==NULL check
    
    Change-Id: Ie5423578e34a295aad3a03d2b29f3a6b1a6572ce

diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index cc9fc55..7f3c15e 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -584,7 +584,14 @@ rtl::OUString LanguageTag::getRegionFromLangtag() const
     if (maBcp47.isEmpty())
         return aRegion;
     const lt_region_t* pRegionT = lt_tag_get_region( MPLANGTAG);
-    SAL_WARN_IF( !pRegionT, "i18npool.langtag", "LanguageTag::getRegionFromLangtag: pRegionT==NULL");
+    // pRegionT==NULL is valid for language only tags, rough check here that
+    // does not take sophisticated tags into account that actually should have
+    // a region, check for ll, lll, ll-Ssss and lll-Ssss so that ll-CC and
+    // lll-CC actually fail.
+    SAL_WARN_IF( !pRegionT &&
+            maBcp47.getLength() != 2 && maBcp47.getLength() != 3 &&
+            maBcp47.getLength() != 7 && maBcp47.getLength() != 8,
+            "i18npool.langtag", "LanguageTag::getRegionFromLangtag: pRegionT==NULL");
     if (!pRegionT)
         return aRegion;
     const char* pRegion = lt_region_get_tag( pRegionT);


More information about the Libreoffice-commits mailing list