Handle terminating NULL correctly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28312 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1251,7 +1251,11 @@ 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)
|
// 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.
|
// It's already terminated correctly.
|
||||||
return wxString(str, wxConvUTF8, len);
|
return wxString(str, wxConvUTF8, len);
|
||||||
|
|
||||||
|
@@ -1251,7 +1251,11 @@ 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)
|
// 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.
|
// It's already terminated correctly.
|
||||||
return wxString(str, wxConvUTF8, len);
|
return wxString(str, wxConvUTF8, len);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user