X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c904e251a8ba31afe28a39d7448fbab491604c9..d3211838bf578eb8ada5a608b66626a6bde6846a:/src/common/strconv.cpp diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index d809945203..8d27a4dd24 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -627,14 +627,18 @@ public: { size_t len = MultiByteToWideChar(CodePage, 0, psz, -1, buf, buf ? n : 0); - return len ? len : (size_t)-1; + //VS: returns # of written chars for buf!=NULL and *size* + // needed buffer for buf==NULL + return len ? (buf ? len : len-1) : (size_t)-1; } size_t WC2MB(char *buf, const wchar_t *psz, size_t n) { size_t len = WideCharToMultiByte(CodePage, 0, psz, -1, buf, buf ? n : 0, NULL, NULL); - return len ? len : (size_t)-1; + //VS: returns # of written chars for buf!=NULL and *size* + // needed buffer for buf==NULL + return len ? (buf ? len : len-1) : (size_t)-1; } bool usable()