From: Vadim Zeitlin Date: Sat, 31 May 2008 01:39:32 +0000 (+0000) Subject: fix wxMBConv_iconv to respect the base class conventions: when the input is NUL-termi... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d50c083157f7280e9244595a7c0de72bbead2e7d fix wxMBConv_iconv to respect the base class conventions: when the input is NUL-terminated, the output should be NUL-terminated and the return value should account for the terminating NUL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index ba9af8782c..5c239e2728 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -2082,6 +2082,11 @@ wxMBConv_iconv::ToWChar(wchar_t *dst, size_t dstLen, srcLen = p - src; break; } + + // when we're determining the length of the string ourselves we count + // the terminating NUL(s) as part of it and always NUL-terminate the + // output + srcLen += nulLen; } // we express length in the number of (wide) characters but iconv always