]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/strconv.cpp
1. use tar.bz2 as sources, not tar.gz
[wxWidgets.git] / src / common / strconv.cpp
index 462faa010a6367d1c5e2aa9775f7bee8ff9ee332..8d27a4dd24ca0f8cbb9a11329332dd00536f948e 100644 (file)
@@ -418,7 +418,7 @@ static long CharsetToCodepage(const wxChar *name)
         path += cn;
         wxRegKey key(wxRegKey::HKCR, path);
 
-        if (!key.Exists()) continue;
+        if (!key.Exists()) break;
 
         // two cases: either there's an AliasForCharset string,
         // or there are Codepage and InternetEncoding dwords.
@@ -627,14 +627,18 @@ public:
     {
         size_t len =
             MultiByteToWideChar(CodePage, 0, psz, -1, buf, buf ? n : 0);
-        return len ? len : (size_t)-1;
+        //VS: returns # of written chars for buf!=NULL and *size* 
+        //    needed buffer for buf==NULL
+        return len ? (buf ? len : len-1) : (size_t)-1;
     }
 
     size_t WC2MB(char *buf, const wchar_t *psz, size_t n)
     {
         size_t len = WideCharToMultiByte(CodePage, 0, psz, -1, buf,
                                          buf ? n : 0, NULL, NULL);
-        return len ? len : (size_t)-1;
+        //VS: returns # of written chars for buf!=NULL and *size* 
+        //    needed buffer for buf==NULL
+        return len ? (buf ? len : len-1) : (size_t)-1;
     }
 
     bool usable()