X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fe1f685b4d05fefd042ebb4a88bb8789ed237c2..9b69526274b023fa1460b29a92bea8bf82e4703f:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index d0297f3c97..134cd452c6 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -340,10 +340,17 @@ wxString::wxString(const char *psz, wxMBConv& conv, size_t nLength) #if wxUSE_WCHAR_T // from wide string -wxString::wxString(const wchar_t *pwz, wxMBConv& conv) +wxString::wxString(const wchar_t *pwz, wxMBConv& conv, size_t nLength) { // first get necessary size - size_t nLen = pwz ? conv.WC2MB((char *) NULL, pwz, 0) : 0; + size_t nLen = 0; + if (pwz) + { + if (nLength == wxSTRING_MAXLEN) + nLen = conv.WC2MB((char *) NULL, pwz, 0); + else + nLen = nLength; + } // empty? if ( (nLen != 0) && (nLen != (size_t)-1) ) {