Nikolay Sivov : kernel32: Added support for C3_HIGHSURROGATE/ C3_LOWSURROGATE in GetStringTypeW().

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 30 15:30:20 CDT 2014


Module: wine
Branch: master
Commit: 3a2db918d9b6de27ff96ccf7adafe2006157434f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3a2db918d9b6de27ff96ccf7adafe2006157434f

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jun 29 20:05:22 2014 +0400

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 26c00f5..b467886 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 f92311e..4992525 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 9ed4344..b332b72 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
 




More information about the wine-cvs mailing list