]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/PlatWX.cpp
fix for opening files with VC++ 8 (closes bug 994337)
[wxWidgets.git] / src / stc / PlatWX.cpp
index 43b6a2a44335c02ad2a0fe6cdde33a0fba72162f..b20f68fa34ca18f7c1315d2b886a0b18d5ae91f6 100644 (file)
@@ -1251,6 +1251,14 @@ double ElapsedTime::Duration(bool reset) {
 #if wxUSE_UNICODE
 wxString stc2wx(const char* str, size_t len)
 {
+    // note: we assume that str is of length len not including the terminating null.
+
+    if (!len)
+        return wxEmptyString;
+    else if (str[len-1] == 0)
+        // It's already terminated correctly.
+        return wxString(str, wxConvUTF8, len);
+
     char *buffer=new char[len+1];
     strncpy(buffer, str, len);
     buffer[len]=0;