[KERNEL32] LCMapString: Hiragana/Katakana conversion (#5200)

Implement LCMAP_KATAKANA and LCMAP_HIRAGANA flags. CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2023-03-28 08:37:17 +09:00 committed by GitHub
parent 3526ffc094
commit 5d1ae45b83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2008,6 +2008,39 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
}
}
#ifdef __REACTOS__
if (flags & LCMAP_KATAKANA)
{
INT convlen = dst_ptr - dst;
for (dst_ptr = dst; convlen; --convlen, ++dst_ptr)
{
/*
* U+3041 ... U+3093: Hiragana
* U+3095: Hiragana Letter Small KA
* U+309D: Hiragana Iteration Mark
*/
WCHAR wch = *dst_ptr;
if ((0x3041 <= wch && wch <= 0x3093) || wch == 0x3095 || wch == 0x309D)
*dst_ptr = wch + 0x60; /* Hiragana to Katanaka */
}
}
else if (flags & LCMAP_HIRAGANA)
{
INT convlen = dst_ptr - dst;
for (dst_ptr = dst; convlen; --convlen, ++dst_ptr)
{
/*
* U+30A1 ... U+30F3: Katakana
* U+30F5: Katakana Letter Small KA
* U+30FD: Katakana Iteration Mark
*/
WCHAR wch = *dst_ptr;
if ((0x30A1 <= wch && wch <= 0x30F3) || wch == 0x30F5 || wch == 0x30FD)
*dst_ptr = wch - 0x60; /* Katanaka to Hiragana */
}
}
#endif
if (srclen)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);