kernel32: Implement LCMAP_HIRAGANA.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
659e161d7e
commit
c4af608845
|
@ -3192,8 +3192,10 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
|
|||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
}
|
||||
if ((flags & (NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS)) &&
|
||||
(flags & ~(NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS)))
|
||||
if (((flags & (NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS)) &&
|
||||
(flags & ~(NORM_IGNORENONSPACE | NORM_IGNORESYMBOLS))) ||
|
||||
((flags & LCMAP_HIRAGANA) &&
|
||||
(flags & (LCMAP_SIMPLIFIED_CHINESE | LCMAP_TRADITIONAL_CHINESE))))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return 0;
|
||||
|
@ -3268,6 +3270,18 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
|
|||
srclen -= len;
|
||||
}
|
||||
|
||||
if (flags & LCMAP_HIRAGANA)
|
||||
{
|
||||
/* map katakana to hiragana, e.g. U+30A1 -> U+3041.
|
||||
we can't use C3_KATAKANA as some characters can't map to hiragana */
|
||||
for (len = dst_ptr - dst, dst_ptr = dst; len; len--, dst_ptr++)
|
||||
{
|
||||
if ((*dst_ptr >= 0x30A1 && *dst_ptr <= 0x30F6) ||
|
||||
*dst_ptr == 0x30FD || *dst_ptr == 0x30FE)
|
||||
*dst_ptr -= 0x60;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (srclen)
|
||||
{
|
||||
|
|
|
@ -2206,6 +2206,10 @@ static const DWORD lcmap_invalid_flags[] = {
|
|||
LCMAP_LOWERCASE | NORM_IGNORESYMBOLS,
|
||||
LCMAP_UPPERCASE | NORM_IGNORENONSPACE,
|
||||
LCMAP_LOWERCASE | NORM_IGNORENONSPACE,
|
||||
LCMAP_HIRAGANA | NORM_IGNORENONSPACE,
|
||||
LCMAP_HIRAGANA | NORM_IGNORESYMBOLS,
|
||||
LCMAP_HIRAGANA | LCMAP_SIMPLIFIED_CHINESE,
|
||||
LCMAP_HIRAGANA | LCMAP_TRADITIONAL_CHINESE,
|
||||
};
|
||||
|
||||
static void test_LCMapStringA(void)
|
||||
|
@ -2433,14 +2437,14 @@ static void test_lcmapstring_unicode(lcmapstring_wrapper func_ptr, const char *f
|
|||
japanese_text, -1, buf, sizeof(buf)/sizeof(WCHAR));
|
||||
ok(ret == lstrlenW(hiragana_text) + 1, "%s ret %d, error %d, expected value %d\n", func_name,
|
||||
ret, GetLastError(), lstrlenW(hiragana_text) + 1);
|
||||
todo_wine ok(!lstrcmpW(buf, hiragana_text), "%s string compare mismatch\n", func_name);
|
||||
ok(!lstrcmpW(buf, hiragana_text), "%s string compare mismatch\n", func_name);
|
||||
|
||||
buf[0] = 0x30f5; /* KATAKANA LETTER SMALL KA */
|
||||
ret = func_ptr(LCMAP_HIRAGANA, buf, 1, buf2, 1);
|
||||
ok(ret == 1, "%s ret %d, error %d, expected value 1\n", func_name,
|
||||
ret, GetLastError());
|
||||
/* U+3095: HIRAGANA LETTER SMALL KA was added in Unicode 3.2 */
|
||||
todo_wine ok(buf2[0] == 0x3095 || broken(buf2[0] == 0x30f5 /* Vista and earlier versions */),
|
||||
ok(buf2[0] == 0x3095 || broken(buf2[0] == 0x30f5 /* Vista and earlier versions */),
|
||||
"%s expected %04x, got %04x\n", func_name, 0x3095, buf2[0]);
|
||||
|
||||
/* test LCMAP_KATAKANA | LCMAP_LOWERCASE */
|
||||
|
|
Loading…
Reference in New Issue