From 3a2db918d9b6de27ff96ccf7adafe2006157434f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 29 Jun 2014 20:05:22 +0400 Subject: [PATCH] kernel32: Added support for C3_HIGHSURROGATE/C3_LOWSURROGATE in GetStringTypeW(). --- dlls/kernel32/locale.c | 3 +++ dlls/kernel32/tests/locale.c | 16 ++++++++++++++++ include/winnls.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 26c00f55f66..b4678861a8b 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -2504,6 +2504,9 @@ BOOL WINAPI GetStringTypeW( DWORD type, LPCWSTR src, INT count, LPWORD chartype if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA; if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL; + if ((c>=0xD800)&&(c<=0xDBFF)) type3 |= C3_HIGHSURROGATE; + if ((c>=0xDC00)&&(c<=0xDFFF)) type3 |= C3_LOWSURROGATE; + if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH; if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL; if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL; diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index f92311e9e73..49925252e1d 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -3271,6 +3271,7 @@ static void test_GetStringTypeW(void) static const WCHAR space_special[] = {0x09, 0x0d, 0x85}; WORD types[20]; + WCHAR ch; int i; memset(types,0,sizeof(types)); @@ -3327,6 +3328,21 @@ static void test_GetStringTypeW(void) GetStringTypeW(CT_CTYPE1, space_special, 3, types); for (i = 0; i < 3; i++) ok(types[i] & C1_SPACE || broken(types[i] == C1_CNTRL) || broken(types[i] == 0), "incorrect types returned for %x -> (%x does not have %x)\n",space_special[i], types[i], C1_SPACE ); + + /* surrogate pairs */ + ch = 0xd800; + memset(types, 0, sizeof(types)); + GetStringTypeW(CT_CTYPE3, &ch, 1, types); + if (types[0] == C3_NOTAPPLICABLE) + win_skip("C3_HIGHSURROGATE/C3_LOWSURROGATE are not supported.\n"); + else { + ok(types[0] == C3_HIGHSURROGATE, "got %x\n", types[0]); + + ch = 0xdc00; + memset(types, 0, sizeof(types)); + GetStringTypeW(CT_CTYPE3, &ch, 1, types); + ok(types[0] == C3_LOWSURROGATE, "got %x\n", types[0]); + } } static void test_IdnToNameprepUnicode(void) diff --git a/include/winnls.h b/include/winnls.h index 9ed43448b76..b332b72b256 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -460,6 +460,8 @@ static const WCHAR LOCALE_NAME_SYSTEM_DEFAULT[] = {'!','s','y','s','-','d','e',' #define C3_IDEOGRAPH 0x0100 #define C3_KASHIDA 0x0200 #define C3_LEXICAL 0x0400 +#define C3_HIGHSURROGATE 0x0800 +#define C3_LOWSURROGATE 0x1000 #define C3_ALPHA 0x8000 #define C3_NOTAPPLICABLE 0x0000 -- 2.11.4.GIT