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
This commit is contained in:
Robin Dunn 2004-06-14 22:44:57 +00:00
parent 6923d0a947
commit 8a07b43cf6
2 changed files with 8 additions and 0 deletions

View File

@ -1251,6 +1251,10 @@ double ElapsedTime::Duration(bool reset) {
#if wxUSE_UNICODE #if wxUSE_UNICODE
wxString stc2wx(const char* str, size_t len) 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]; char *buffer=new char[len+1];
strncpy(buffer, str, len); strncpy(buffer, str, len);
buffer[len]=0; buffer[len]=0;

View File

@ -1251,6 +1251,10 @@ double ElapsedTime::Duration(bool reset) {
#if wxUSE_UNICODE #if wxUSE_UNICODE
wxString stc2wx(const char* str, size_t len) 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]; char *buffer=new char[len+1];
strncpy(buffer, str, len); strncpy(buffer, str, len);
buffer[len]=0; buffer[len]=0;