]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
build fix. Need the full declaration for CLASSINFO().
[wxWidgets.git] / src / common / intl.cpp
index 9c7a2e30b7d6311cca59dd7767033da046ba00dd..d84627fc7a3240bc1fe9e1665df34a8dddfaeb15 100644 (file)
@@ -88,20 +88,9 @@ typedef unsigned char size_t8;
         typedef unsigned long size_t32;
     #else
         // assume sizeof(int) == 4 - what else can we do
-        typedef unsigned int size_t32;
+        wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
 
-        // ... but at least check it during run time
-        static class IntSizeChecker
-        {
-        public:
-            IntSizeChecker()
-            {
-                // Asserting a sizeof directly causes some compilers to
-                // issue a "using constant in a conditional expression" warning
-                wxASSERT_MSG( wxAssertIsEqual(sizeof(int), 4),
-                              "size_t32 is incorrectly defined!" );
-            }
-        } intsizechecker;
+        typedef unsigned int size_t32;
     #endif
 #endif // Win/!Win
 
@@ -1260,7 +1249,19 @@ wxString wxLocale::GetSystemEncodingName()
     free(oldLocale);
     if (alang)
     {
-        encname = wxConvLibc.cMB2WX(alang);
+#ifdef __SOLARIS__
+        // nl_langinfo() under Solaris returns 646 by default which stands for
+        // ISO-646, i.e. 7 bit ASCII and we should recognize it to avoid
+        // warnings about unrecognized encoding on each program startup
+        if ( strcmp(alang, "646") == 0 )
+        {
+            encname = _T("US-ASCII");
+        }
+        else
+#endif // __SOLARIS__
+        {
+            encname = wxConvLibc.cMB2WX(alang);
+        }
     }
     else
 #endif // HAVE_LANGINFO_H
@@ -1328,8 +1329,20 @@ wxFontEncoding wxLocale::GetSystemEncoding()
     wxString encname = GetSystemEncodingName();
     if ( !encname.empty() )
     {
-        return wxTheFontMapper->
+        wxFontEncoding enc = wxTheFontMapper->
             CharsetToEncoding(encname, FALSE /* not interactive */);
+
+        // this should probably be considered as a bug in CharsetToEncoding():
+        // it shouldn't return wxFONTENCODING_DEFAULT at all - but it does it
+        // for US-ASCII charset
+        //
+        // we, OTOH, definitely shouldn't return it as it doesn't make sense at
+        // all (which encoding is it?)
+        if ( enc != wxFONTENCODING_DEFAULT )
+        {
+            return enc;
+        }
+        //else: return wxFONTENCODING_SYSTEM below
     }
 #endif // Win32/Unix
 
@@ -1464,6 +1477,62 @@ bool wxLocale::AddCatalog(const wxChar *szDomain)
   }
 }
 
+// ----------------------------------------------------------------------------
+// accessors for locale-dependent data
+// ----------------------------------------------------------------------------
+
+#if 0
+
+#ifdef __WXMSW__
+
+/* static */
+wxString wxLocale::GetInfo(wxLocaleInfo index)
+{
+    wxString str;
+    wxChar buffer[256];
+    size_t count;
+    buffer[0] = wxT('\0');
+    switch (index)
+    {
+        case wxSYS_DECIMAL_SEPARATOR:
+            count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256);
+            if (!count)
+                str << ".";
+            else
+                str << buffer;
+            break;
+        case wxSYS_LIST_SEPARATOR:
+            count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256);
+            if (!count)
+                str << ",";
+            else
+                str << buffer;
+            break;
+        case wxSYS_LEADING_ZERO: // 0 means no leading zero, 1 means leading zero
+            count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILZERO, buffer, 256);
+            if (!count)
+                str << "0";
+            else
+                str << buffer;
+            break;
+        default:
+            wxFAIL_MSG("Unknown System String !");
+    }
+    return str;
+}
+
+#else // !__WXMSW__
+
+/* static */
+wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory)
+{
+    return wxEmptyString;
+}
+
+#endif // __WXMSW__/!__WXMSW__
+
+#endif // 0
+
 // ----------------------------------------------------------------------------
 // global functions and variables
 // ----------------------------------------------------------------------------