Commit 08005722 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

msvcrt: Add semi stub _mbcjmstojis implementation.

parent fefb5a94
......@@ -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)
......
......@@ -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)
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment