msvcrt: __mb_cur_max is not updated in _setmbcp (with testcase) and should not be used in _ismbblead

Mikolaj Zalewski mikolajz at google.com
Thu Aug 16 15:25:37 CDT 2007


Skipped content of type multipart/alternative-------------- next part --------------
From e815bdd0c6e3178fac9c98819bc9fa57c2908e50 Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz at mikolajz.smo.corp.google.com>
Date: Thu, 16 Aug 2007 11:14:48 -0700
Subject: [PATCH] msvcrt: __mb_cur_max is not updated in _setmbcp (with testcase) and should not be used in _ismbblead
---
 dlls/msvcrt/mbcs.c         |    2 +-
 dlls/msvcrt/tests/string.c |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 07e38ec..0dc0120 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -911,7 +911,7 @@ int CDECL _ismbckata(unsigned int c)
 int CDECL _ismbblead(unsigned int c)
 {
   /* FIXME: should reference MSVCRT_mbctype */
-  return MSVCRT___mb_cur_max > 1 && MSVCRT_isleadbyte(c);
+  return MSVCRT_isleadbyte(c);
 }
 
 
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index 7b434f7..d7148da 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -78,8 +78,10 @@ static void test_swab( void ) {
 static void test_ismbblead(void)
 {
     unsigned int s = '\354';
+    int mb_orig_max = __mb_cur_max;
 
     _setmbcp(936);
+    ok(__mb_cur_max == mb_orig_max, "__mb_cur_max shouldn't be updated (is %d != %d)\n", __mb_cur_max, mb_orig_max);
     todo_wine ok(_ismbblead(s), "got result %d\n", _ismbblead(s));
     _setmbcp(1252);
 }
-- 
1.4.1


More information about the wine-patches mailing list