]> git.saurik.com Git - wxWidgets.git/commitdiff
Patch [ 971542 ] Tiny speedup for stc2wx in PlatWX.cpp
authorRobin Dunn <robin@alldunn.com>
Mon, 14 Jun 2004 22:44:57 +0000 (22:44 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 14 Jun 2004 22:44:57 +0000 (22:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/stc/PlatWX.cpp
src/stc/PlatWX.cpp

index 43b6a2a44335c02ad2a0fe6cdde33a0fba72162f..d1e45d45fb7d9395298550ca5be0129e8b90e2df 100644 (file)
@@ -1251,6 +1251,10 @@ double ElapsedTime::Duration(bool reset) {
 #if wxUSE_UNICODE
 wxString stc2wx(const char* str, size_t len)
 {
+    if (str[len] == 0)
+        // It's already terminated correctly.
+        return wxString(str, wxConvUTF8, len);
+
     char *buffer=new char[len+1];
     strncpy(buffer, str, len);
     buffer[len]=0;
index 43b6a2a44335c02ad2a0fe6cdde33a0fba72162f..d1e45d45fb7d9395298550ca5be0129e8b90e2df 100644 (file)
@@ -1251,6 +1251,10 @@ double ElapsedTime::Duration(bool reset) {
 #if wxUSE_UNICODE
 wxString stc2wx(const char* str, size_t len)
 {
+    if (str[len] == 0)
+        // It's already terminated correctly.
+        return wxString(str, wxConvUTF8, len);
+
     char *buffer=new char[len+1];
     strncpy(buffer, str, len);
     buffer[len]=0;