]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed iso-8859-1 handling to report failures
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 24 Oct 2003 19:25:48 +0000 (19:25 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 24 Oct 2003 19:25:48 +0000 (19:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/strconv.cpp

index f13005cb373963954ffb3d47d16244583246b2fd..840a24d54bb0b2d0b4428d5451b107b04cb4806e 100644 (file)
@@ -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;