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

msvcrt: Implement _mbcjmstojis.

parent 08005722
...@@ -474,7 +474,23 @@ unsigned int CDECL _mbcjmstojis(unsigned int c) ...@@ -474,7 +474,23 @@ unsigned int CDECL _mbcjmstojis(unsigned int c)
In all other cases, c is returned unchanged */ In all other cases, c is returned unchanged */
if(get_mbcinfo()->mbcodepage == 932) if(get_mbcinfo()->mbcodepage == 932)
{ {
FIXME("(%x): stub\n", c); if(_ismbclegal(c) && HIBYTE(c) < 0xf0)
{
if(HIBYTE(c) >= 0xe0)
c -= 0x4000;
c = (((HIBYTE(c) - 0x81)*2 + 0x21) << 8) | LOBYTE(c);
if(LOBYTE(c) > 0x7f)
c -= 0x1;
if(LOBYTE(c) > 0x9d)
c += 0x83;
else
c -= 0x1f;
}
else
return 0; /* Codepage is 932, but c can't be converted */
} }
return c; return c;
......
...@@ -913,6 +913,7 @@ int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN; ...@@ -913,6 +913,7 @@ int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
int __cdecl MSVCRT__write(int,const void*,unsigned int); int __cdecl MSVCRT__write(int,const void*,unsigned int);
int __cdecl _getch(void); int __cdecl _getch(void);
int __cdecl _ismbblead(unsigned int); int __cdecl _ismbblead(unsigned int);
int __cdecl _ismbclegal(unsigned int c);
int __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str); int __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
MSVCRT_size_t __cdecl MSVCRT_mbstowcs(MSVCRT_wchar_t*,const char*,MSVCRT_size_t); MSVCRT_size_t __cdecl MSVCRT_mbstowcs(MSVCRT_wchar_t*,const char*,MSVCRT_size_t);
MSVCRT_intptr_t __cdecl MSVCRT__spawnve(int,const char*,const char* const *,const char* const *); MSVCRT_intptr_t __cdecl MSVCRT__spawnve(int,const char*,const char* const *,const char* const *);
......
...@@ -901,12 +901,8 @@ static void test_mbcjmsjis(void) ...@@ -901,12 +901,8 @@ static void test_mbcjmsjis(void)
unsigned int ret, exp; unsigned int ret, exp;
ret = _mbcjmstojis(jmsjis[j][0]); ret = _mbcjmstojis(jmsjis[j][0]);
exp = (cp[i] == 932) ? jmsjis[j][1] : jmsjis[j][0]; exp = (cp[i] == 932) ? jmsjis[j][1] : jmsjis[j][0];
if (cp[i] == 932) ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage=%d)\n",
todo_wine ok(ret == exp, "Expected 0x%x, got 0x%x (0x%x, codepage=%d)\n", exp, ret, jmsjis[j][0], cp[i]);
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); _setmbcp(prev_cp);
......
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