[haiku-commits] r35214 - haiku/trunk/src/kits/locale

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 21 Jan 2010 12:38:16 +0100 (CET)

Author: stippi
Date: 2010-01-21 12:38:16 +0100 (Thu, 21 Jan 2010)
New Revision: 35214
Changeset: http://dev.haiku-os.org/changeset/35214/haiku

Modified:
   haiku/trunk/src/kits/locale/Catalog.cpp
   haiku/trunk/src/kits/locale/Language.cpp
   haiku/trunk/src/kits/locale/Locale.cpp
   haiku/trunk/src/kits/locale/LocaleRoster.cpp
Log:
Stumbled across some problems while using the Locale Kit and added TODOs
accordingly.


Modified: haiku/trunk/src/kits/locale/Catalog.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Catalog.cpp     2010-01-21 10:07:25 UTC (rev 
35213)
+++ haiku/trunk/src/kits/locale/Catalog.cpp     2010-01-21 11:38:16 UTC (rev 
35214)
@@ -121,6 +121,10 @@
        appNode.ReadAttr(BLocaleRoster::kCatFingerprintAttr, B_UINT32_TYPE, 0,
                &fingerprint, sizeof(uint32));
        // try to load catalog (with given fingerprint):
+       // TODO: Not so nice C++ design here, leading to such bugs: The previous
+       // fCatalog is leaked here. (The whole chain, it looks like.) There 
should
+       // be a SetCatalog() method (it can be private), and that should take 
care
+       // that internal members are always properly maintained.
        catalog->fCatalog
                = be_locale_roster->LoadCatalog(sig.String(), NULL,     
fingerprint);
 

Modified: haiku/trunk/src/kits/locale/Language.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Language.cpp    2010-01-21 10:07:25 UTC (rev 
35213)
+++ haiku/trunk/src/kits/locale/Language.cpp    2010-01-21 11:38:16 UTC (rev 
35214)
@@ -132,6 +132,8 @@
 status_t
 BLanguage::GetName(BString* name)
 {
+       // TODO: This will return the language not in the current 
be_app_catalog,
+       // but in the current system wide language! Don't know the exact reason.
        UnicodeString s;
        fICULocale->getDisplayLanguage(s);
        BStringByteSink converter(name);

Modified: haiku/trunk/src/kits/locale/Locale.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Locale.cpp      2010-01-21 10:07:25 UTC (rev 
35213)
+++ haiku/trunk/src/kits/locale/Locale.cpp      2010-01-21 11:38:16 UTC (rev 
35214)
@@ -45,9 +45,12 @@
 }
 
 status_t 
-BLocale::GetAppCatalog(BCatalog *catalog) {
+BLocale::GetAppCatalog(BCatalog *catalog)
+{
        if (!catalog)
                return B_BAD_VALUE;
+       // TODO: This is not so nice, and I don't know why it is here, but how
+       // is it envisioned to switch languages on the fly?
        if (be_catalog)
                debugger( "GetAppCatalog() has been called while be_catalog != 
NULL");
        return BCatalog::GetAppCatalog(catalog);

Modified: haiku/trunk/src/kits/locale/LocaleRoster.cpp
===================================================================
--- haiku/trunk/src/kits/locale/LocaleRoster.cpp        2010-01-21 10:07:25 UTC 
(rev 35213)
+++ haiku/trunk/src/kits/locale/LocaleRoster.cpp        2010-01-21 11:38:16 UTC 
(rev 35214)
@@ -513,6 +513,8 @@
 
 #undef REALLY_ALL_LANGUAGES
 #ifdef REALLY_ALL_LANGUAGES
+       // TODO: Using static variables here looks really weird, and is probably
+       // the reason why calling this method a second time will crash.
        static const char* const* icuLocaleList = Locale::getISOLanguages();
 
        // Loop over the strings and add them to an std::set to remove 
duplicates


Other related posts:

  • » [haiku-commits] r35214 - haiku/trunk/src/kits/locale - superstippi