]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
use macros to completely remove wxLogTrace, wxLogDebug etc. in release build
[wxWidgets.git] / src / common / strconv.cpp
index 8936454dfe22886d4e19cedaf0c443d4346436d7..52f1a41c1781537972505bd394caf7c93c76516c 100644 (file)
@@ -2229,11 +2229,11 @@ private:
             int verMaj, verMin;
             switch ( wxGetOsVersion(&verMaj, &verMin) )
             {
-                case wxWIN95:
+                case wxOS_WINDOWS_9X:
                     s_isWin98Or2k = verMaj >= 4 && verMin >= 10;
                     break;
 
-                case wxWINDOWS_NT:
+                case wxOS_WINDOWS_NT:
                     s_isWin98Or2k = verMaj >= 5;
                     break;
 
@@ -3339,20 +3339,26 @@ wxMBConv *wxCSConv::DoCreate() const
             }
 
             const wxChar** names = wxFontMapperBase::GetAllEncodingNames(encoding);
-
-            for ( ; *names; ++names )
+            // CS : in case this does not return valid names (eg for MacRoman) encoding
+            // got a 'failure' entry in the cache all the same, although it just has to 
+            // be created using a different method, so only store failed iconv creation
+            // attempts (or perhaps we shoulnd't do this at all ?)
+            if ( names[0] != NULL )
             {
-                wxMBConv_iconv *conv = new wxMBConv_iconv(*names);
-                if ( conv->IsOk() )
+                for ( ; *names; ++names )
                 {
-                    gs_nameCache[encoding] = *names;
-                    return conv;
+                    wxMBConv_iconv *conv = new wxMBConv_iconv(*names);
+                    if ( conv->IsOk() )
+                    {
+                        gs_nameCache[encoding] = *names;
+                        return conv;
+                    }
+
+                    delete conv;
                 }
 
-                delete conv;
+                gs_nameCache[encoding] = _T(""); // cache the failure
             }
-
-            gs_nameCache[encoding] = _T(""); // cache the failure
         }
 #endif // wxUSE_FONTMAP
     }
@@ -3493,14 +3499,17 @@ void wxCSConv::CreateConvIfNeeded() const
     {
         wxCSConv *self = (wxCSConv *)this; // const_cast
 
-#if wxUSE_INTL
         // if we don't have neither the name nor the encoding, use the default
         // encoding for this system
         if ( !m_name && m_encoding == wxFONTENCODING_SYSTEM )
         {
+#if wxUSE_INTL
             self->m_name = wxStrdup(wxLocale::GetSystemEncodingName());
-        }
+#else
+            // fallback to some reasonable default:
+            self->m_encoding = wxFONTENCODING_ISO8859_1;
 #endif // wxUSE_INTL
+        }
 
         self->m_convReal = DoCreate();
         self->m_deferred = false;