From 564da6ff0b0492f87e84693faf0e6afc0120fa6b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Sep 2007 13:16:37 +0000 Subject: [PATCH] fix round trip check in wxMBConv_win32::WC2MB() when the buffer size is 0 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index f4731ceabe..3e354f466b 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -2457,8 +2457,10 @@ public: return wxCONV_FAILED; } + if ( !n ) + n = wcslen(pwz); wxWCharBuffer wcBuf(n); - if ( MB2WC(wcBuf.data(), buf, n) == wxCONV_FAILED || + if ( MB2WC(wcBuf.data(), buf, n + 1) == wxCONV_FAILED || wcscmp(wcBuf, pwz) != 0 ) { // we didn't obtain the same thing we started from, hence -- 2.45.2