]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
added wxTextEntry::AutoComplete() and implemented it for wxGTK
[wxWidgets.git] / src / common / strconv.cpp
index 65f6cb7eeea5faeda51bb515ee5a2d1f0d50789f..3e354f466b668ab41e01c581f0bea6af1df5ac2a 100644 (file)
@@ -395,6 +395,7 @@ wxMBConv::cMB2WC(const char *inBuff, size_t inLen, size_t *outLen) const
         // because we want the buffer to always be NUL-terminated, even if the
         // input isn't (as otherwise the caller has no way to know its length)
         wxWCharBuffer wbuf(dstLen);
+        wbuf.data()[dstLen - 1] = L'\0';
         if ( ToWChar(wbuf.data(), dstLen, inBuff, inLen) != wxCONV_FAILED )
         {
             if ( outLen )
@@ -2456,8 +2457,10 @@ public:
                     return wxCONV_FAILED;
             }
 
+            if ( !n )
+                n = wcslen(pwz);
             wxWCharBuffer wcBuf(n);
-            if ( MB2WC(wcBuf.data(), buf, n) == wxCONV_FAILED ||
+            if ( MB2WC(wcBuf.data(), buf, n + 1) == wxCONV_FAILED ||
                     wcscmp(wcBuf, pwz) != 0 )
             {
                 // we didn't obtain the same thing we started from, hence