From 8a07b43cf67138183c2a17becdc557efcbd64ddf Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 14 Jun 2004 22:44:57 +0000 Subject: [PATCH] Patch [ 971542 ] Tiny speedup for stc2wx in PlatWX.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/stc/PlatWX.cpp | 4 ++++ src/stc/PlatWX.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/contrib/src/stc/PlatWX.cpp b/contrib/src/stc/PlatWX.cpp index 43b6a2a443..d1e45d45fb 100644 --- a/contrib/src/stc/PlatWX.cpp +++ b/contrib/src/stc/PlatWX.cpp @@ -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; diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index 43b6a2a443..d1e45d45fb 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -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; -- 2.45.2