return false;
// get the file size (assume it is less than 4Gb...)
- wxFileOffset nSize = fileMsg.Length();
- if ( nSize == wxInvalidOffset )
+ wxFileOffset lenFile = fileMsg.Length();
+ if ( lenFile == wxInvalidOffset )
return false;
+ size_t nSize = wx_truncate_cast(size_t, lenFile);
+ wxASSERT_MSG( nSize == lenFile, _T("message catalog bigger than 4GB?") );
+
// read the whole file in memory
m_pData = new size_t8[nSize];
- if ( fileMsg.Read(m_pData, (size_t)nSize) != nSize ) {
+ if ( fileMsg.Read(m_pData, nSize) != lenFile ) {
wxDELETEA(m_pData);
return false;
}
if ( convertEncoding )
{
if ( m_charset.empty() )
+ {
inputConv = wxConvCurrent;
+ }
else
+ {
inputConv =
csConv = new wxCSConv(m_charset);
+ }
}
- else // no conversion needed
+ else // no need to convert the encoding
{
+ // we still need the conversion for Unicode build
+#if wxUSE_UNICODE
+ inputConv = wxConvCurrent;
+#else // !wxUSE_UNICODE
inputConv = NULL;
+#endif // wxUSE_UNICODE/!wxUSE_UNICODE
}
// conversion to apply to msgid strings before looking them up: we only
wxString msgid(data, *inputConv);
#else // ASCII
wxString msgid;
-#if wxUSE_WCHAR_T
- if ( inputConv && sourceConv )
- msgid = wxString(inputConv->cMB2WC(data), *sourceConv);
- else
-#endif
+ #if wxUSE_WCHAR_T
+ if ( inputConv && sourceConv )
+ msgid = wxString(inputConv->cMB2WC(data), *sourceConv);
+ else
+ #endif
msgid = data;
#endif // wxUSE_UNICODE
wxString locale;
// Set the locale:
-#if defined(__UNIX__) && !defined(__WXMAC__)
+#if defined(__OS2__)
+ wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
+#elif defined(__UNIX__) && !defined(__WXMAC__)
if (language == wxLANGUAGE_DEFAULT)
locale = wxEmptyString;
else
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
return false;
}
-#elif defined(__WXPM__)
- wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#else
return false;
#define WX_NO_LOCALE_SUPPORT
// --- --- --- generated code ends here --- --- ---
#endif // wxUSE_INTL
-