]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
Added constructor to wxGCDC from wxPrinterDC
[wxWidgets.git] / src / common / intl.cpp
index 62967e53c77fd4848acde9968e4135328a003f29..53e36b28921ef0668d545717beacee81114e88ed 100644 (file)
 #include "wx/hashset.h"
 #include "wx/filesys.h"
 
-#if defined(__WXMAC__)
-    #include "wx/mac/private.h"  // includes mac headers
-#endif
-
 #if defined(__DARWIN__)
     #include "wx/mac/corefoundation/cfref.h"
     #include <CoreFoundation/CFLocale.h>
@@ -240,7 +236,7 @@ wxPluralFormsScanner::wxPluralFormsScanner(const char* s) : m_s(s)
 bool wxPluralFormsScanner::nextToken()
 {
     wxPluralFormsToken::Type type = wxPluralFormsToken::T_ERROR;
-    while (isspace(*m_s))
+    while (isspace((unsigned char) *m_s))
     {
         ++m_s;
     }
@@ -248,20 +244,20 @@ bool wxPluralFormsScanner::nextToken()
     {
         type = wxPluralFormsToken::T_EOF;
     }
-    else if (isdigit(*m_s))
+    else if (isdigit((unsigned char) *m_s))
     {
         wxPluralFormsToken::Number number = *m_s++ - '0';
-        while (isdigit(*m_s))
+        while (isdigit((unsigned char) *m_s))
         {
             number = number * 10 + (*m_s++ - '0');
         }
         m_token.setNumber(number);
         type = wxPluralFormsToken::T_NUMBER;
     }
-    else if (isalpha(*m_s))
+    else if (isalpha((unsigned char) *m_s))
     {
         const char* begin = m_s++;
-        while (isalnum(*m_s))
+        while (isalnum((unsigned char) *m_s))
         {
             ++m_s;
         }
@@ -1842,11 +1838,11 @@ bool wxLocale::Init(int language, int flags)
         }
         else // language supported by Windows
         {
-            const wxUint32 lcid = info->GetLCID();
-
             // Windows CE doesn't have SetThreadLocale() and there doesn't seem
             // to be any equivalent
 #ifndef __WXWINCE__
+            const wxUint32 lcid = info->GetLCID();
+
             // change locale used by Windows functions
             ::SetThreadLocale(lcid);
 #endif
@@ -2237,7 +2233,7 @@ wxFontEncoding wxLocale::GetSystemEncoding()
         return wxFONTENCODING_CP950;
     }
 #elif defined(__WXMAC__)
-    TextEncoding encoding = 0 ;
+    CFStringEncoding encoding = 0 ;
     encoding = CFStringGetSystemEncoding() ;
     return wxMacGetFontEncFromSystemEnc( encoding ) ;
 #elif defined(__UNIX_LIKE__) && wxUSE_FONTMAP
@@ -2677,23 +2673,24 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
 
     wxCFRef<CFLocaleRef> userLocaleRef(userLocaleRefRaw);
 
-    CFTypeRef cfstr;
+    CFStringRef cfstr = 0;
     switch ( index )
     {
         case wxLOCALE_THOUSANDS_SEP:
-            cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator);
+            cfstr = (CFStringRef) CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator);
             break;
 
         case wxLOCALE_DECIMAL_POINT:
-            cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator);
+            cfstr = (CFStringRef) CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator);
             break;
 
         default:
             wxFAIL_MSG( "Unknown locale info" );
+            cfstr = CFSTR("");
+            break;
     }
 
-    wxCFStringRef
-        str(CFStringCreateCopy(NULL, static_cast<CFStringRef>(cfstr)));
+    wxCFStringRef str(wxCFRetain(cfstr));
     return str.AsString();
 }
 
@@ -3004,9 +3001,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule)
 #ifndef LANG_UZBEK
 #define LANG_UZBEK (0)
 #endif
-#ifndef LANG_VALENCIAN
-#define LANG_VALENCIAN (0)
-#endif
 #ifndef LANG_VIETNAMESE
 #define LANG_VIETNAMESE (0)
 #endif
@@ -3515,7 +3509,7 @@ void wxLocale::InitLanguagesDB()
    LNG(wxLANGUAGE_UZBEK,                      "uz"   , LANG_UZBEK     , SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Uzbek")
    LNG(wxLANGUAGE_UZBEK_CYRILLIC,             "uz"   , LANG_UZBEK     , SUBLANG_UZBEK_CYRILLIC            , wxLayout_LeftToRight, "Uzbek (Cyrillic)")
    LNG(wxLANGUAGE_UZBEK_LATIN,                "uz"   , LANG_UZBEK     , SUBLANG_UZBEK_LATIN               , wxLayout_LeftToRight, "Uzbek (Latin)")
-   LNG(wxLANGUAGE_VALENCIAN,                  "ca_ES@valencia", LANG_VALENCIAN , SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Valencian")
+   LNG(wxLANGUAGE_VALENCIAN,                  "ca_ES@valencia", 0     , 0                                 , wxLayout_LeftToRight, "Valencian")
    LNG(wxLANGUAGE_VIETNAMESE,                 "vi_VN", LANG_VIETNAMESE, SUBLANG_DEFAULT                   , wxLayout_LeftToRight, "Vietnamese")
    LNG(wxLANGUAGE_VOLAPUK,                    "vo"   , 0              , 0                                 , wxLayout_LeftToRight, "Volapuk")
    LNG(wxLANGUAGE_WELSH,                      "cy"   , 0              , 0                                 , wxLayout_LeftToRight, "Welsh")