Module: wine Branch: master Commit: 0800572257a1da4cb8a18c0017c3057e262903aa URL: http://source.winehq.org/git/wine.git/?a=commit;h=0800572257a1da4cb8a18c0017...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Thu Mar 15 23:41:30 2012 +0900
msvcrt: Add semi stub _mbcjmstojis implementation.
---
dlls/msvcrt/mbcs.c | 17 +++++++++++++++++ dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/tests/string.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index a8cd237..cde1e06 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -464,6 +464,23 @@ unsigned int CDECL _mbcjistojms(unsigned int c) }
/********************************************************************* + * _mbcjmstojis(MSVCRT.@) + * + * Converts a sjis character to jis. + */ +unsigned int CDECL _mbcjmstojis(unsigned int c) +{ + /* Conversion takes place only when codepage is 932. + In all other cases, c is returned unchanged */ + if(get_mbcinfo()->mbcodepage == 932) + { + FIXME("(%x): stub\n", c); + } + + return c; +} + +/********************************************************************* * _mbsdec(MSVCRT.@) */ unsigned char* CDECL _mbsdec(const unsigned char* start, const unsigned char* cur) diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 393939e..04ef9ad 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -664,7 +664,7 @@ # stub _mbccpy_s_l(ptr long ptr str ptr) @ cdecl _mbcjistojms (long) # stub _mbcjistojms_l(long ptr) -@ stub _mbcjmstojis(long) +@ cdecl _mbcjmstojis(long) # stub _mbcjmstojis_l(long ptr) @ cdecl _mbclen(ptr) # stub _mbclen_l(ptr ptr) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 8aa7a81..659afc2 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -880,6 +880,38 @@ static void test_mbcjisjms(void) } while(jisjms[i++][0] != 0); }
+static void test_mbcjmsjis(void) +{ + /* List of value-pairs to test. The test assumes the last pair to be {0, ..} */ + unsigned int jmsjis[][2] = { {0x80fc, 0}, {0x813f, 0}, {0x8140, 0x2121}, + {0x817e, 0x215f}, {0x817f, 0}, {0x8180, 0x2160}, + {0x819e, 0x217e}, {0x819f, 0x2221}, {0x81fc, 0x227e}, + {0x81fd, 0}, {0x9ffc, 0x5e7e}, {0x9ffd, 0}, + {0xa040, 0}, {0xdffc, 0}, {0xe040, 0x5f21}, + {0xeffc, 0x7e7e}, {0xf040, 0}, {0x21, 0}, {0, 0}}; + int cp[] = { 932, 936, 939, 950, 1361, _MB_CP_SBCS }; + unsigned int i, j; + int prev_cp = _getmbcp(); + + for (i = 0; i < sizeof(cp)/sizeof(cp[0]); i++) + { + _setmbcp(cp[i]); + for (j = 0; jmsjis[j][0] != 0; j++) + { + unsigned int ret, exp; + ret = _mbcjmstojis(jmsjis[j][0]); + exp = (cp[i] == 932) ? jmsjis[j][1] : jmsjis[j][0]; + if (cp[i] == 932) + todo_wine ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage=%d)\n", + exp, ret, jmsjis[j][0], cp[i]); + else + ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage=%d)\n", + exp, ret, jmsjis[j][0], cp[i]); + } + } + _setmbcp(prev_cp); +} + static void test_mbctombb(void) { static const unsigned int mbcmbb_932[][2] = { @@ -2105,6 +2137,7 @@ START_TEST(string) test_strcat_s(); test__mbsnbcpy_s(); test_mbcjisjms(); + test_mbcjmsjis(); test_mbctombb(); test_ismbclegal(); test_strtok();