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

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 17 06:30:49 CDT 2007


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

Author: Mikolaj Zalewski <mikolajz at google.com>
Date:   Thu Aug 16 11:14:48 2007 -0700

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);
 }




More information about the wine-cvs mailing list