From 53c174fcd5b6943308e0a53f0c5b5e54baf525f8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Fri, 31 Mar 2006 17:40:17 +0000 Subject: [PATCH] really pass the proper output buffer size in wxMBConv_win32 round trip check, at least for the encodings without NULs such as UTF7 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index cc851b8ff3..ccffb2594b 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -1694,7 +1694,8 @@ public: // check if we succeeded, by doing a double trip: if ( !flags && buf ) { - wxCharBuffer mbBuf(n); + const size_t mbLen = strlen(psz); + wxCharBuffer mbBuf(mbLen); if ( ::WideCharToMultiByte ( m_CodePage, @@ -1702,7 +1703,7 @@ public: buf, -1, mbBuf.data(), - n + 1, // size in bytes, not length + mbLen + 1, // size in bytes, not length NULL, NULL ) == 0 || -- 2.47.2