]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
do nothing in ShowHidden() if the flag doesn't change (patch 1678963)
[wxWidgets.git] / src / common / strconv.cpp
index f442e54dcd595e15998e5e0a67473c55e0e07b04..e5150240356d7ca440498f931aec47934430399e 100644 (file)
@@ -3518,6 +3518,19 @@ void wxCSConv::CreateConvIfNeeded() const
     }
 }
 
+bool wxCSConv::IsOk() const
+{
+    CreateConvIfNeeded();
+
+    // special case: no convReal created for wxFONTENCODING_ISO8859_1
+    if ( m_encoding == wxFONTENCODING_ISO8859_1 )
+        return true; // always ok as we do it ourselves
+
+    // m_convReal->IsOk() is called at its own creation, so we know it must
+    // be ok if m_convReal is non-NULL
+    return m_convReal != NULL;
+}
+
 size_t wxCSConv::ToWChar(wchar_t *dst, size_t dstLen,
                          const char *src, size_t srcLen) const
 {
@@ -3637,9 +3650,39 @@ WXDLLIMPEXP_DATA_BASE(wxMBConv *) wxConvFileName = &
 #else
                                     wxConvUTF8Obj;
 #endif
-#else
+#else // !__WXOSX__
                                     wxConvLibcObj;
-#endif
+#endif // __WXOSX__/!__WXOSX__
+
+#if wxUSE_UNICODE
+
+wxWCharBuffer wxSafeConvertMB2WX(const char *s)
+{
+    if ( !s )
+        return wxWCharBuffer();
+
+    wxWCharBuffer wbuf(wxConvLibc.cMB2WX(s));
+    if ( !wbuf )
+        wbuf = wxConvUTF8.cMB2WX(s);
+    if ( !wbuf )
+        wbuf = wxConvISO8859_1.cMB2WX(s);
+
+    return wbuf;
+}
+
+wxCharBuffer wxSafeConvertWX2MB(const wchar_t *ws)
+{
+    if ( !ws )
+        return wxCharBuffer();
+
+    wxCharBuffer buf(wxConvLibc.cWX2MB(ws));
+    if ( !buf )
+        buf = wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL).cWX2MB(ws);
+
+    return buf;
+}
+
+#endif // wxUSE_UNICODE
 
 #else // !wxUSE_WCHAR_T