From: Václav Slavík Date: Fri, 24 Oct 2003 19:25:48 +0000 (+0000) Subject: fixed iso-8859-1 handling to report failures X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/246428310e0924dd9332187a51ad68f5932ac7a7 fixed iso-8859-1 handling to report failures git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index f13005cb37..840a24d54b 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -1483,7 +1483,19 @@ size_t wxCSConv::WC2MB(char *buf, const wchar_t *psz, size_t n) const if (buf) { for (size_t c = 0; c <= len; c++) - buf[c] = (psz[c] > 0xff) ? '?' : psz[c]; + { + if (psz[c] > 0xFF) + return (size_t)-1; + buf[c] = psz[c]; + } + } + else + { + for (size_t c = 0; c <= len; c++) + { + if (psz[c] > 0xFF) + return (size_t)-1; + } } return len;