]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed wxString::utf8_str() in UTF8 build to return buffer with length
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 12 Apr 2009 10:12:44 +0000 (10:12 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 12 Apr 2009 10:12:44 +0000 (10:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index 5b29a2546dd91bcf2c97d4de04cde10b97a5aaa7..99a90164e4bfa1dfa4e06d982ac16bbfa8c6a77c 100644 (file)
@@ -1711,9 +1711,7 @@ public:
     }
 
     const wxScopedCharBuffer utf8_str() const
-        { return wxCharBuffer::CreateNonOwned(wx_str()); }
-    const wxScopedCharBuffer ToUTF8() const
-        { return wxCharBuffer::CreateNonOwned(wx_str()); }
+        { return wxCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length()); }
 
     // this function exists in UTF-8 build only and returns the length of the
     // internal UTF-8 representation
@@ -1729,7 +1727,6 @@ public:
         return s;
     }
     const wxScopedCharBuffer utf8_str() const { return mb_str(wxMBConvUTF8()); }
-    const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
 #else // ANSI
     static wxString FromUTF8(const char *utf8)
       { return wxString(wxMBConvUTF8().cMB2WC(utf8)); }
@@ -1758,9 +1755,10 @@ public:
     }
     const wxScopedCharBuffer utf8_str() const
       { return wxMBConvUTF8().cWC2MB(wc_str()); }
-    const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
 #endif
 
+    const wxScopedCharBuffer ToUTF8() const { return utf8_str(); }
+
     // functions for storing binary data in wxString:
 #if wxUSE_UNICODE
     static wxString From8BitData(const char *data, size_t len)