X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d775fa82354a1f8d5db87ad1d71ab00ef7d9123c..57c26f8210c40317d70d616a05198e042ee9175b:/src/common/string.cpp diff --git a/src/common/string.cpp b/src/common/string.cpp index 8d3c198b8d..07a532d180 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1223,6 +1223,12 @@ wxString operator+(const wxChar *psz, const wxString& str) #if wxUSE_UNICODE +#ifdef __MWERKS__ +#ifndef __SCHAR_MAX__ +#define __SCHAR_MAX__ 127 +#endif +#endif + wxString wxString::FromAscii(const char *ascii) { if (!ascii) @@ -1721,7 +1727,12 @@ int wxString::PrintfV(const wxChar* pszFormat, va_list argptr) return -1; } - len = wxVsnprintf(buf, size, pszFormat, argptr); + // wxVsnprintf() may modify the original arg pointer, so pass it + // only a copy + va_list argptrcopy; + wxVaCopy(argptrcopy, argptr); + len = wxVsnprintf(buf, size, pszFormat, argptrcopy); + va_end(argptrcopy); // some implementations of vsnprintf() don't NUL terminate // the string if there is not enough space for it so