msvcrt: Add semi stub _mbcjmstojis implementation.

This commit is contained in:
Akihiro Sagawa 2012-03-15 23:41:30 +09:00 committed by Alexandre Julliard
parent fefb5a943d
commit 0800572257
3 changed files with 51 additions and 1 deletions

View File

@ -463,6 +463,23 @@ unsigned int CDECL _mbcjistojms(unsigned int c)
return 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.@)
*/

View File

@ -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)

View File

@ -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();