]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/string.cpp
removed no longer needed wxOKlibc() helper
[wxWidgets.git] / src / common / string.cpp
index a287759822baabf199d1bc79f2845cba128072b3..e68c7f03c0de6d5be491592661e754f45c317c86 100644 (file)
@@ -369,6 +369,9 @@ wxString::SubstrBufFromMB wxString::ConvertStr(const char *psz, size_t nLength,
         // UTF-8 sequence and psz may be invalid:
         if ( wxStringOperations::IsValidUtf8String(psz, nLength) )
         {
+            // we must pass the real string length to SubstrBufFromMB ctor
+            if ( nLength == npos )
+                nLength = psz ? strlen(psz) : 0;
             return SubstrBufFromMB(wxCharBuffer::CreateNonOwned(psz), nLength);
         }
         // else: do the roundtrip through wchar_t*