kernel32: Implement LCMAP_KATAKANA.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2016-09-23 00:06:19 +09:00 committed by Alexandre Julliard
parent c4af608845
commit 12c547919f
2 changed files with 17 additions and 2 deletions

View File

@ -3194,7 +3194,7 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
}
if (((flags & (NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS)) &&
(flags & ~(NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS))) ||
((flags & LCMAP_HIRAGANA) &&
((flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) &&
(flags & (LCMAP_SIMPLIFIED_CHINESE | LCMAP_TRADITIONAL_CHINESE))))
{
SetLastError(ERROR_INVALID_FLAGS);
@ -3281,6 +3281,17 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
*dst_ptr -= 0x60;
}
}
else if (flags & LCMAP_KATAKANA)
{
/* map hiragana to katakana, e.g. U+3041 -> U+30A1.
we can't use C3_HIRAGANA as some characters can't map to katakana */
for (len = dst_ptr - dst, dst_ptr = dst; len; len--, dst_ptr++)
{
if ((*dst_ptr >= 0x3041 && *dst_ptr <= 0x3096) ||
*dst_ptr == 0x309D || *dst_ptr == 0x309E)
*dst_ptr += 0x60;
}
}
done:
if (srclen)

View File

@ -2210,6 +2210,10 @@ static const DWORD lcmap_invalid_flags[] = {
LCMAP_HIRAGANA | NORM_IGNORESYMBOLS,
LCMAP_HIRAGANA | LCMAP_SIMPLIFIED_CHINESE,
LCMAP_HIRAGANA | LCMAP_TRADITIONAL_CHINESE,
LCMAP_KATAKANA | NORM_IGNORENONSPACE,
LCMAP_KATAKANA | NORM_IGNORESYMBOLS,
LCMAP_KATAKANA | LCMAP_SIMPLIFIED_CHINESE,
LCMAP_KATAKANA | LCMAP_TRADITIONAL_CHINESE,
};
static void test_LCMapStringA(void)
@ -2452,7 +2456,7 @@ static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *f
japanese_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
ok(ret == lstrlenW(katakana_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
ret, GetLastError(), lstrlenW(katakana_text) + 1);
todo_wine ok(!lstrcmpW(buf, katakana_text), "%s string compare mismatch\n", func_name);
ok(!lstrcmpW(buf, katakana_text), "%s string compare mismatch\n", func_name);
/* test LCMAP_FULLWIDTH */
ret = func_ptr(LCMAP_FULLWIDTH,