X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/563d535e46e7516fd4e2334203dbe910398bfd88..fbf456aa8952c6d2d3edeea1208b0e3159a3cb8d:/src/common/intl.cpp?ds=sidebyside diff --git a/src/common/intl.cpp b/src/common/intl.cpp index a45ef71754..20f1925725 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -420,7 +420,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons if ( !!charset ) csConv = new wxCSConv(charset); - wxMBConv& inputConv = csConv ? *csConv : *wxConvCurrent; + wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent; for (size_t i = 0; i < m_numStrings; i++) { @@ -443,6 +443,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons #if wxUSE_FONTMAP if ( convertEncoding ) { + wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM; wxFontEncoding enc = wxTheFontMapper->CharsetToEncoding(charset, FALSE); if ( enc == wxFONTENCODING_SYSTEM ) { @@ -450,7 +451,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons } else { - wxFontEncoding targetEnc = wxLocale::GetSystemEncoding(); + targetEnc = wxLocale::GetSystemEncoding(); if (targetEnc == wxFONTENCODING_SYSTEM) { wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc); @@ -479,7 +480,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons } if ( !convertEncoding ) - #else // !wxUSE_FONTMAP + #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP { for (size_t i = 0; i < m_numStrings; i++) { @@ -487,7 +488,6 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash, bool convertEncoding) cons hash[key] = StringAtOfs(m_pTransTable, i); } } - #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T } @@ -528,7 +528,7 @@ wxString wxMsgCatalogFile::GetCharset() const // ---------------------------------------------------------------------------- bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName, - bool bConvertEncoding = FALSE) + bool bConvertEncoding) { wxMsgCatalogFile file; @@ -539,8 +539,8 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName, file.FillHash(m_messages, bConvertEncoding); return TRUE; } - else - return FALSE; + + return FALSE; } const wxChar *wxMsgCatalog::GetString(const wxChar *sz) const @@ -1253,18 +1253,23 @@ wxString wxLocale::GetSystemEncodingName() char *alang = nl_langinfo(CODESET); setlocale(LC_CTYPE, oldLocale); free(oldLocale); - if (alang) + + if ( alang ) { -#ifdef __SOLARIS__ + // 7 bit ASCII encoding has several alternative names which we should + // recognize to avoid warnings about unrecognized encoding on each + // program startup + // 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 ) + // ISO-646, i.e. 7 bit ASCII + // + // and recent glibc call it ANSI_X3.4-1968... + if ( strcmp(alang, "646") == 0 || + strcmp(alang, "ANSI_X3.4-1968") == 0 ) { encname = _T("US-ASCII"); } else -#endif // __SOLARIS__ { encname = wxConvLibc.cMB2WX(alang); }