Commit ef023c3f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite: Recognize us-ascii encoding.

parent 64e4a03a
......@@ -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)
{
......
......@@ -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)
......
......@@ -64,6 +64,7 @@ static inline void m_free(IMalloc *imalloc, void *mem)
typedef enum
{
XmlEncoding_USASCII,
XmlEncoding_UTF16,
XmlEncoding_UTF8,
XmlEncoding_Unknown
......
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