X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b568d04ffa191f9e3b643ca33526094eca0ba304..20d9661c04e34d64dbec300c002d5d1c1f70ad1e:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 280e105f25..ed777353a7 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -203,7 +203,10 @@ extern int WXDLLEXPORT wxVsnprintf(wxChar *buf, size_t len, // vsnprintf() will not terminate the string with '\0' if there is not // enough place, but we want the string to always be NUL terminated int rc = wxVsnprintfA(buf, len - 1, format, argptr); - buf[len] = 0; + if ( rc == -1 ) + { + buf[len] = 0; + } return rc; #endif // Unicode/ANSI @@ -1640,17 +1643,6 @@ size_t wxString::find_last_not_of(wxChar ch, size_t nStart) const return npos; } -wxString wxString::substr(size_t nStart, size_t nLen) const -{ - // npos means 'take all' - if ( nLen == npos ) - nLen = 0; - - wxASSERT( nStart + nLen <= Len() ); - - return wxString(c_str() + nStart, nLen == npos ? 0 : nLen); -} - wxString& wxString::erase(size_t nStart, size_t nLen) { wxString strTmp(c_str(), nStart);