Akihiro Sagawa : msvcrt: Fix _ismbckata() for Halfwidth Katakana characters.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 16 10:34:24 CDT 2015


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Mon Mar 16 21:48:45 2015 +0900

msvcrt: Fix _ismbckata() for Halfwidth Katakana characters.

---

 dlls/msvcrt/mbcs.c         |  4 ----
 dlls/msvcrt/tests/string.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index d2c12d3..ba88ff2 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -1350,7 +1350,6 @@ int CDECL _ismbcpunct(unsigned int ch)
  */
 int CDECL _ismbchira(unsigned int c)
 {
-  /* FIXME: use lc_ctype when supported, not lc_all */
   if(get_mbcinfo()->mbcodepage == 932)
   {
     /* Japanese/Hiragana, CP 932 */
@@ -1364,11 +1363,8 @@ int CDECL _ismbchira(unsigned int c)
  */
 int CDECL _ismbckata(unsigned int c)
 {
-  /* FIXME: use lc_ctype when supported, not lc_all */
   if(get_mbcinfo()->mbcodepage == 932)
   {
-    if(c < 256)
-      return _ismbbkana(c);
     /* Japanese/Katakana, CP 932 */
     return (c >= 0x8340 && c <= 0x8396 && c != 0x837f);
   }
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index e2d53d4..4388085 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -1190,6 +1190,37 @@ static void test_mbctombb(void)
     _setmbcp(prev_cp);
 }
 
+static void test_ismbckata(void) {
+    struct katakana_pair {
+        UINT c;
+        BOOL exp;
+    };
+    static const struct katakana_pair tests[] = {
+        {0x8152, FALSE}, {0x8153, FALSE}, {0x8154, FALSE}, {0x8155, FALSE},
+        {0x82a0, FALSE}, {0x833f, FALSE}, {0x8340, TRUE }, {0x837e, TRUE },
+        {0x837f, FALSE}, {0x8380, TRUE }, {0x8396, TRUE }, {0x8397, FALSE},
+        {0xa5, FALSE}, {0xb0, FALSE}, {0xdd, FALSE}
+    };
+    unsigned int prev_cp = _getmbcp();
+    int ret;
+    unsigned int i;
+
+    _setmbcp(_MB_CP_SBCS);
+    for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
+        ret = _ismbckata(tests[i].c);
+        ok(!ret, "expected 0, got %d for %04x\n", ret, tests[i].c);
+    }
+
+    _setmbcp(932);
+    for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) {
+        ret = _ismbckata(tests[i].c);
+        ok(!!ret == tests[i].exp, "expected %d, got %d for %04x\n",
+           tests[i].exp, !!ret, tests[i].c);
+    }
+
+    _setmbcp(prev_cp);
+}
+
 static void test_ismbclegal(void) {
     unsigned int prev_cp = _getmbcp();
     int ret, exp, err;
@@ -2859,6 +2890,7 @@ START_TEST(string)
     test_mbcjmsjis();
     test_mbbtombc();
     test_mbctombb();
+    test_ismbckata();
     test_ismbclegal();
     test_strtok();
     test__mbstok();




More information about the wine-cvs mailing list