X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cee59b5218956f1cbfda13c10024d3322decd5d..78e37b46a4c1581822bab8d99486bc35c0f360ea:/src/common/intl.cpp diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 62967e53c7..f91de783c4 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -72,14 +72,10 @@ #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 "wx/osx/core/cfref.h" #include - #include "wx/mac/corefoundation/cfstring.h" + #include "wx/osx/core/cfstring.h" #endif // ---------------------------------------------------------------------------- @@ -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; } @@ -1267,6 +1263,8 @@ bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName, // read the whole file in memory if ( fileMsg.Read(m_data.GetWriteBuf(nSize), nSize) != lenFile ) return false; + + m_data.UngetWriteBuf(nSize); #endif // wxUSE_FILESYSTEM/!wxUSE_FILESYSTEM @@ -1842,11 +1840,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 +2235,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 +2675,24 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) wxCFRef 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(cfstr))); + wxCFStringRef str(wxCFRetain(cfstr)); return str.AsString(); } @@ -2956,6 +2955,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxLocaleModule, wxModule) #ifndef LANG_RUSSIAN #define LANG_RUSSIAN (0) #endif +#ifndef LANG_SAMI +#define LANG_SAMI (0) +#endif #ifndef LANG_SANSKRIT #define LANG_SANSKRIT (0) #endif @@ -3004,9 +3006,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 @@ -3450,6 +3449,7 @@ void wxLocale::InitLanguagesDB() LNG(wxLANGUAGE_ROMANIAN, "ro_RO", LANG_ROMANIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Romanian") LNG(wxLANGUAGE_RUSSIAN, "ru_RU", LANG_RUSSIAN , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Russian") LNG(wxLANGUAGE_RUSSIAN_UKRAINE, "ru_UA", 0 , 0 , wxLayout_LeftToRight, "Russian (Ukraine)") + LNG(wxLANGUAGE_SAMI, "se_NO", LANG_SAMI , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Northern Sami") LNG(wxLANGUAGE_SAMOAN, "sm" , 0 , 0 , wxLayout_LeftToRight, "Samoan") LNG(wxLANGUAGE_SANGHO, "sg" , 0 , 0 , wxLayout_LeftToRight, "Sangho") LNG(wxLANGUAGE_SANSKRIT, "sa" , LANG_SANSKRIT , SUBLANG_DEFAULT , wxLayout_LeftToRight, "Sanskrit") @@ -3515,7 +3515,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 (Souternhern Catalan)") 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")