]> git.saurik.com Git - wxWidgets.git/commitdiff
minor cleanup of Unix GetInfo(): assert if invalid parameters are passed; don't use...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Mar 2009 15:13:40 +0000 (15:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Mar 2009 15:13:40 +0000 (15:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59912 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp

index 023d7cf2ac15553da3d627a9124fd88920cc0a4f..e3a3c0de75968f70731f1a7e9c186a21f25d14e9 100644 (file)
@@ -2689,36 +2689,42 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
 /* static */
 wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
 {
-    struct lconv *locale_info = localeconv();
-    switch (cat)
+    lconv * const lc = localeconv();
+    if ( !lc )
+        return wxString();
+
+    switch ( cat )
     {
         case wxLOCALE_CAT_NUMBER:
-            switch (index)
+            switch ( index )
             {
                 case wxLOCALE_THOUSANDS_SEP:
-                    return wxString(locale_info->thousands_sep,
-                                    *wxConvCurrent);
+                    return lc->thousands_sep;
+
                 case wxLOCALE_DECIMAL_POINT:
-                    return wxString(locale_info->decimal_point,
-                                    *wxConvCurrent);
-                default:
-                    return wxEmptyString;
+                    return lc->decimal_point;
             }
+            break;
+
         case wxLOCALE_CAT_MONEY:
-            switch (index)
+            switch ( index )
             {
                 case wxLOCALE_THOUSANDS_SEP:
-                    return wxString(locale_info->mon_thousands_sep,
-                                    *wxConvCurrent);
+                    return lc->mon_thousands_sep;
+
                 case wxLOCALE_DECIMAL_POINT:
-                    return wxString(locale_info->mon_decimal_point,
-                                    *wxConvCurrent);
-                default:
-                    return wxEmptyString;
+                    return lc->mon_decimal_point;
             }
+            break;
+
         default:
-            return wxEmptyString;
+            wxFAIL_MSG( "unknown wxLocaleCategory" );
+            return wxString(); // skip second assert below
     }
+
+    wxFAIL_MSG( "unknown wxLocaleInfo value for this category" );
+
+    return wxString();
 }
 
 #endif // platform