Piotr Caban : msvcrt: Fix C locale handling in mbstowcs.

Alexandre Julliard julliard at winehq.org
Tue Jun 14 12:04:34 CDT 2016


Module: wine
Branch: master
Commit: f091d9edf652eb2b45d8042c598addd7d0ef4d2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f091d9edf652eb2b45d8042c598addd7d0ef4d2c

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Jun 14 11:57:16 2016 +0200

msvcrt: Fix C locale handling in mbstowcs.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/mbcs.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 5d389bf..fe88cc7 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -2253,6 +2253,17 @@ MSVCRT_size_t CDECL MSVCRT__mbstowcs_l(MSVCRT_wchar_t *wcstr, const char *mbstr,
     else
         locinfo = locale->locinfo;
 
+    if(!locinfo->lc_codepage) {
+        if(!wcstr)
+            return strlen(mbstr);
+
+        for(i=0; i<count; i++) {
+            wcstr[i] = (unsigned char)mbstr[i];
+            if(!wcstr[i]) break;
+        }
+        return i;
+    }
+
     /* Ignore count parameter */
     if(!wcstr)
         return MultiByteToWideChar(locinfo->lc_codepage, 0, mbstr, -1, NULL, 0)-1;




More information about the wine-cvs mailing list