]> git.saurik.com Git - wxWidgets.git/commitdiff
don't do char*->wchar_t*>char* roundtrip in wxArgNormalizerUtf8<const char*> if curre...
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 3 May 2007 14:34:29 +0000 (14:34 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 3 May 2007 14:34:29 +0000 (14:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45787 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/strvararg.h

index 16273f47a66b3a8aa858d77d7bbeac2b0b004717..82f0039b08a181f86e03ecaba30289ac8b5fd542 100644 (file)
@@ -238,14 +238,19 @@ struct wxArgNormalizerUtf8<const char*>
 {
     wxArgNormalizerUtf8(const char* s)
     {
-        // FIXME-UTF8: optimize this if current locale is UTF-8 one
-
-        // convert to widechar string first:
-        wxWCharBuffer buf(wxConvLibc.cMB2WC(s));
-
-        // then to UTF-8:
-        if ( buf )
-            m_value = wxConvUTF8.cWC2MB(buf);
+        if ( wxLocaleIsUtf8 )
+        {
+            m_value = wxCharBuffer::CreateNonOwned(s);
+        }
+        else
+        {
+            // convert to widechar string first:
+            wxWCharBuffer buf(wxConvLibc.cMB2WC(s));
+
+            // then to UTF-8:
+            if ( buf )
+                m_value = wxConvUTF8.cWC2MB(buf);
+        }
     }
 };