xmllite: Recognize us-ascii encoding.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-03-30 21:35:16 +03:00 committed by Alexandre Julliard
parent 64e4a03a92
commit ef023c3fd6
3 changed files with 12 additions and 2 deletions

View file

@ -84,6 +84,7 @@ typedef enum
StringValue_Last
} XmlReaderStringValue;
static const WCHAR usasciiW[] = {'U','S','-','A','S','C','I','I',0};
static const WCHAR utf16W[] = {'U','T','F','-','1','6',0};
static const WCHAR utf8W[] = {'U','T','F','-','8',0};
@ -154,8 +155,9 @@ struct xml_encoding_data
};
static const struct xml_encoding_data xml_encoding_map[] = {
{ usasciiW, XmlEncoding_USASCII, 20127 },
{ utf16W, XmlEncoding_UTF16, ~0 },
{ utf8W, XmlEncoding_UTF8, CP_UTF8 }
{ utf8W, XmlEncoding_UTF8, CP_UTF8 },
};
const WCHAR *get_encoding_name(xml_encoding encoding)
@ -734,7 +736,7 @@ xml_encoding parse_encoding_name(const WCHAR *name, int len)
if (!name) return XmlEncoding_Unknown;
min = 0;
max = sizeof(xml_encoding_map)/sizeof(struct xml_encoding_data) - 1;
max = sizeof(xml_encoding_map)/sizeof(xml_encoding_map[0]) - 1;
while (min <= max)
{

View file

@ -275,6 +275,7 @@ static void test_writer_create(void)
static void test_writeroutput(void)
{
static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
static const WCHAR usasciiW[] = {'u','s','-','a','s','c','i','i',0};
IXmlWriterOutput *output;
IUnknown *unk;
HRESULT hr;
@ -312,6 +313,12 @@ todo_wine
/* releasing 'unk' crashes on native */
IUnknown_Release(output);
IUnknown_Release(output);
/* create with us-ascii */
output = NULL;
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output);
ok(hr == S_OK, "got %08x\n", hr);
IUnknown_Release(output);
}
static void test_writestartdocument(void)

View file

@ -64,6 +64,7 @@ static inline void m_free(IMalloc *imalloc, void *mem)
typedef enum
{
XmlEncoding_USASCII,
XmlEncoding_UTF16,
XmlEncoding_UTF8,
XmlEncoding_Unknown