]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/intl.cpp
Implement wxMask given a wxBitmap and a mask wxColour.
[wxWidgets.git] / src / common / intl.cpp
index a383076d0f6342f623c89744add3efcf7e8a8415..fb90e08538e949bec4e3b35bc5e9e88ada40e149 100644 (file)
@@ -672,12 +672,11 @@ wxPluralFormsNode*wxPluralFormsParser::logicalOrExpression()
             rn->setNode(0, un.release());
             return rn.release();
         }
-        else
-        {
-            un->setNode(0, ln.release());
-            un->setNode(1, rn.release());
-            return un.release();
-        }
+
+
+        un->setNode(0, ln.release());
+        un->setNode(1, rn.release());
+        return un.release();
     }
     return ln.release();
 }
@@ -712,12 +711,10 @@ wxPluralFormsNode* wxPluralFormsParser::logicalAndExpression()
             rn->setNode(0, un.release());
             return rn.release();
         }
-        else
-        {
-            un->setNode(0, ln.release());
-            un->setNode(1, rn.release());
-            return un.release();
-        }
+
+        un->setNode(0, ln.release());
+        un->setNode(1, rn.release());
+        return un.release();
     }
     return ln.release();
 }
@@ -1372,6 +1369,7 @@ wxLocale::wxLocale()
   m_pszOldLocale = NULL;
   m_pMsgCat = NULL;
   m_language = wxLANGUAGE_UNKNOWN;
+  m_initialized = false;
 }
 
 // NB: this function has (desired) side effect of changing current locale
@@ -1381,6 +1379,10 @@ bool wxLocale::Init(const wxChar *szName,
                     bool        bLoadDefault,
                     bool        bConvertEncoding)
 {
+  wxASSERT_MSG( !m_initialized,
+                _T("you can't call wxLocale::Init more than once") );
+  
+  m_initialized = true;
   m_strLocale = szName;
   m_strShort = szShort;
   m_bConvertEncoding = bConvertEncoding;
@@ -1423,7 +1425,7 @@ bool wxLocale::Init(const wxChar *szName,
   if ( m_strShort.IsEmpty() ) {
     // FIXME I don't know how these 2 letter abbreviations are formed,
     //       this wild guess is surely wrong
-    if ( szLocale[0] )
+    if ( szLocale && szLocale[0] )
     {
         m_strShort += (wxChar)wxTolower(szLocale[0]);
         if ( szLocale[1] )
@@ -1569,7 +1571,11 @@ bool wxLocale::Init(int language, int flags)
         }
         else
         {
-            int codepage = -1;
+            int codepage 
+                         #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
+                         = -1
+                         #endif
+                         ;
             wxUint32 lcid = MAKELCID(MAKELANGID(info->WinLang, info->WinSublang),
                                      SORT_DEFAULT);
             // FIXME
@@ -1653,7 +1659,7 @@ bool wxLocale::Init(int language, int flags)
                     (flags & wxLOCALE_CONV_ENCODING) != 0);
     free(szLocale);
 
-    if ( ret )
+    if (IsOk()) // setlocale() succeeded
         m_language = lang;
 
     return ret;