]> git.saurik.com Git - wxWidgets.git/commitdiff
Compilation fix for wxUSE_UNICODE_WCHAR && !wxUSE_STL_BASED_WXSTRING.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Oct 2010 15:11:00 +0000 (15:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 26 Oct 2010 15:11:00 +0000 (15:11 +0000)
Construct wxScopedWCharBuffer using CreateNonOwned() in
wxString::ToStdWstring() in this case, creating it directly from wc_str()
doesn't work (intentionally, as this doesn't tell if the buffer owns the
string or not).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index cb8d6bccfe0c25df3988e4d3c30d8c6dd1e4e072..95d440a362a8cee9299a4a5c4b3b5412ad1eb585 100644 (file)
@@ -1383,7 +1383,13 @@ public:
     #define wxStringToStdWstringRetType wxStdWideString
     wxStdWideString ToStdWstring() const
     {
+#if wxUSE_UNICODE_WCHAR
+        wxScopedWCharBuffer buf =
+            wxScopedWCharBuffer::CreateNonOwned(m_impl.c_str(), m_impl.length());
+#else // !wxUSE_UNICODE_WCHAR
         wxScopedWCharBuffer buf(wc_str());
+#endif
+
         return wxStdWideString(buf.data(), buf.length());
     }
   #endif