]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
don't use %08p format string, gcc complains about it
[wxWidgets.git] / src / common / intl.cpp
index d47dbea5b1f4954a7647c59087c9cec3939a062a..8805dbdcb1211bbf17e3ef10769305630caefb4f 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "intl.h"
-#endif
-
 #if defined(__BORLAND__) && !defined(__WXDEBUG__)
     // There's a bug in Borland's compiler that breaks wxLocale with -O2,
     // so make sure that flag is not used for this file:
@@ -506,7 +502,7 @@ private:
     wxPluralFormsNodePtr m_plural;
 };
 
-wxDEFINE_SCOPED_PTR_TYPE(wxPluralFormsCalculator);
+wxDEFINE_SCOPED_PTR_TYPE(wxPluralFormsCalculator)
 
 void wxPluralFormsCalculator::init(wxPluralFormsToken::Number nplurals,
                                    wxPluralFormsNode* plural)
@@ -1136,13 +1132,16 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName,
     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;
   }
@@ -1255,14 +1254,23 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
     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
@@ -1316,11 +1324,11 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
         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
 
@@ -1416,7 +1424,7 @@ const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const
 
 #include "wx/arrimpl.cpp"
 WX_DECLARE_EXPORTED_OBJARRAY(wxLanguageInfo, wxLanguageInfoArray);
-WX_DEFINE_OBJARRAY(wxLanguageInfoArray);
+WX_DEFINE_OBJARRAY(wxLanguageInfoArray)
 
 wxLanguageInfoArray *wxLocale::ms_languagesDB = NULL;
 
@@ -1592,7 +1600,9 @@ bool wxLocale::Init(int language, int flags)
     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
@@ -1763,8 +1773,6 @@ bool wxLocale::Init(int language, int flags)
         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
@@ -3540,10 +3548,9 @@ void wxLocale::InitLanguagesDB()
    LNG(wxLANGUAGE_ZHUANG,                     "za"   , 0              , 0                                 , "Zhuang")
    LNG(wxLANGUAGE_ZULU,                       "zu"   , 0              , 0                                 , "Zulu")
 
-};
+}
 #undef LNG
 
 // --- --- --- generated code ends here --- --- ---
 
 #endif // wxUSE_INTL
-