From 330ab29f70cea8095b3c5a79526d9e8ca99cef2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 24 Oct 2003 19:25:48 +0000 Subject: [PATCH] fixed iso-8859-1 handling to report failures git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@24284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 92c62856ff..c6403944ae 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -1071,7 +1071,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;