diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index a7df4b5df88..7ca7f8c18ec 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1082,7 +1082,7 @@ @ stub _mbcjmstojis_l @ cdecl _mbclen(ptr) @ stub _mbclen_l -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctohira_l @ stub _mbctokata(long) @ stub _mbctokata_l diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index f696aaf9819..d4459a61c0c 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1440,7 +1440,7 @@ @ stub _mbcjmstojis_l @ cdecl _mbclen(ptr) @ stub _mbclen_l -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctohira_l @ stub _mbctokata(long) @ stub _mbctokata_l diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 58e708dac0a..03fff1a1436 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1448,7 +1448,7 @@ @ stub _mbcjmstojis_l @ cdecl _mbclen(ptr) @ stub _mbclen_l -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctohira_l @ stub _mbctokata(long) @ stub _mbctokata_l diff --git a/dlls/msvcr70/msvcr70.spec b/dlls/msvcr70/msvcr70.spec index fb47e7827e9..9881ecacc12 100644 --- a/dlls/msvcr70/msvcr70.spec +++ b/dlls/msvcr70/msvcr70.spec @@ -423,7 +423,7 @@ @ cdecl _mbcjistojms(long) @ cdecl _mbcjmstojis(long) @ cdecl _mbclen(ptr) -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctokata(long) @ cdecl _mbctolower(long) @ cdecl _mbctombb(long) diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index 8b868db8ce5..6e1d30961b6 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -418,7 +418,7 @@ @ cdecl _mbcjistojms(long) @ cdecl _mbcjmstojis(long) @ cdecl _mbclen(ptr) -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctokata(long) @ cdecl _mbctolower(long) @ cdecl _mbctombb(long) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 68e709738e6..5709319f59c 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -755,7 +755,7 @@ @ stub _mbcjmstojis_l @ cdecl _mbclen(ptr) @ stub _mbclen_l -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctohira_l @ stub _mbctokata(long) @ stub _mbctokata_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 2d88683ee23..167e0f90957 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -732,7 +732,7 @@ @ stub _mbcjmstojis_l @ cdecl _mbclen(ptr) @ stub _mbclen_l -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) @ stub _mbctohira_l @ stub _mbctokata(long) @ stub _mbctokata_l diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index ba88ff2fcba..b76157f6be9 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -2276,3 +2276,15 @@ MSVCRT_size_t CDECL MSVCRT_mbsrtowcs(MSVCRT_wchar_t *wcstr, return ret; } + +/********************************************************************* + * _mbctohira (MSVCRT.@) + * + * Converts a sjis katakana character to hiragana. + */ +unsigned int CDECL _mbctohira(unsigned int c) +{ + if(_ismbckata(c) && c <= 0x8393) + return (c - 0x8340 - (c >= 0x837f ? 1 : 0)) + 0x829f; + return c; +} diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 6d9b4c3f759..ea7dd906cc4 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -698,7 +698,7 @@ # stub _mbcjmstojis_l(long ptr) @ cdecl _mbclen(ptr) # stub _mbclen_l(ptr ptr) -@ stub _mbctohira(long) +@ cdecl _mbctohira(long) # stub _mbctohira_l(long ptr) @ stub _mbctokata(long) # stub _mbctokata_l(long ptr) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 438808548b4..4e48cd2dc4a 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -1142,6 +1142,36 @@ static void test_mbcjmsjis(void) _setmbcp(prev_cp); } +static void test_mbctohira(void) +{ + static const unsigned int mbchira_932[][2] = { + {0x8152, 0x8152}, {0x8153, 0x8153}, {0x8154, 0x8154}, {0x8155, 0x8155}, + {0x82a0, 0x82a0}, {0x833f, 0x833f}, {0x8340, 0x829f}, {0x837e, 0x82dd}, + {0x837f, 0x837f}, {0x8380, 0x82de}, {0x8393, 0x82f1}, {0x8394, 0x8394}, + {0x8396, 0x8396}, {0x8397, 0x8397}, + {0xa5, 0xa5}, {0xb0, 0xb0}, {0xdd, 0xdd} }; + unsigned int i; + unsigned int prev_cp = _getmbcp(); + + _setmbcp(_MB_CP_SBCS); + for (i = 0; i < sizeof(mbchira_932)/sizeof(mbchira_932[0]); i++) + { + int ret, exp = mbchira_932[i][0]; + ret = _mbctohira(mbchira_932[i][0]); + ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret); + } + + _setmbcp(932); + for (i = 0; i < sizeof(mbchira_932)/sizeof(mbchira_932[0]); i++) + { + unsigned int ret, exp; + ret = _mbctohira(mbchira_932[i][0]); + exp = mbchira_932[i][1]; + ok(ret == exp, "Expected 0x%x, got 0x%x\n", exp, ret); + } + _setmbcp(prev_cp); +} + static void test_mbbtombc(void) { static const unsigned int mbbmbc[][2] = { @@ -2888,6 +2918,7 @@ START_TEST(string) test__mbscpy_s(); test_mbcjisjms(); test_mbcjmsjis(); + test_mbctohira(); test_mbbtombc(); test_mbctombb(); test_ismbckata();