Commit b98293e4 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

webservices: Add support for decoding supplementary characters' references.

parent dd4c126e
......@@ -1190,6 +1190,7 @@ static int codepoint_to_utf8( int cp, unsigned char *dst )
dst[0] = 0xe0 | cp;
return 3;
}
if (cp >= 0x110000) return -1;
dst[3] = 0x80 | (cp & 0x3f);
cp >>= 6;
dst[2] = 0x80 | (cp & 0x3f);
......@@ -1259,7 +1260,7 @@ static HRESULT decode_text( const unsigned char *str, ULONG len, unsigned char *
if (!len) return WS_E_INVALID_FORMAT;
p -= nb_digits = start - len;
if (!nb_digits || nb_digits > 5 || p[nb_digits] != ';') return WS_E_INVALID_FORMAT;
if (!nb_digits || nb_digits > 6 || p[nb_digits] != ';') return WS_E_INVALID_FORMAT;
for (i = 0; i < nb_digits; i++)
{
cp *= 16;
......
......@@ -3614,11 +3614,16 @@ static void test_entities(void)
static const char str29[] = "<t>&#0;</t>";
static const char str30[] = "<t>&#65;</t>";
static const char str31[] = "<t>&#65393;</t>";
static const char str32[] = "<t>&#x10ffff;</t>";
static const char str33[] = "<t>&#x110000;</t>";
static const char str34[] = "<t>&#1114111;</t>";
static const char str35[] = "<t>&#1114112;</t>";
static const char res4[] = {0xea, 0xaa, 0xaa, 0x00};
static const char res5[] = {0xf2, 0xaa, 0xaa, 0xaa, 0x00};
static const char res21[] = {0xed, 0x9f, 0xbf, 0x00};
static const char res24[] = {0xee, 0x80, 0x80, 0x00};
static const char res31[] = {0xef, 0xbd, 0xb1, 0x00};
static const char res32[] = {0xf4, 0x8f, 0xbf, 0xbf, 0x00};
static const struct
{
const char *str;
......@@ -3658,6 +3663,10 @@ static void test_entities(void)
{ str29, WS_E_INVALID_FORMAT },
{ str30, S_OK, "A" },
{ str31, S_OK, res31 },
{ str32, S_OK, res32 },
{ str33, WS_E_INVALID_FORMAT },
{ str34, S_OK, res32 },
{ str35, WS_E_INVALID_FORMAT },
};
HRESULT hr;
WS_XML_READER *reader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment