]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
ClearMemberVar() did not correctly handle columns defined as SQL_C_LONG
[wxWidgets.git] / src / common / strconv.cpp
index 6623da650c9adcbf6d73474e03360a0ddc48efa1..7b39e4bb3f0ecc3dfb171f5885751c51e96eaee1 100644 (file)
@@ -1148,10 +1148,15 @@ public:
 
     size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const
     {
+        // note that we have to use MB_ERR_INVALID_CHARS flag as it without it
+        // the behaviour is not compatible with the Unix version (using iconv)
+        // and break the library itself, e.g. wxTextInputStream::NextChar()
+        // wouldn't work if reading an incomplete MB char didn't result in an
+        // error
         const size_t len = ::MultiByteToWideChar
                              (
                                 m_CodePage,     // code page
-                                0,              // flags (none)
+                                MB_ERR_INVALID_CHARS, // flags: fall on error
                                 psz,            // input string
                                 -1,             // its length (NUL-terminated)
                                 buf,            // output string