diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c index 2f6edb26d16..3e1c362664e 100644 --- a/dlls/xmllite/tests/writer.c +++ b/dlls/xmllite/tests/writer.c @@ -32,8 +32,6 @@ #include "initguid.h" DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); -static const WCHAR aW[] = {'a',0}; - #define EXPECT_REF(obj, ref) _expect_ref((IUnknown *)obj, ref, __LINE__) static void _expect_ref(IUnknown *obj, ULONG ref, int line) { @@ -92,19 +90,6 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l #define CHECK_OUTPUT_TODO(stream, expected) check_output(stream, expected, TRUE, __LINE__) #define CHECK_OUTPUT_RAW(stream, expected, size) check_output_raw(stream, expected, size, __LINE__) -static WCHAR *strdupAtoW(const char *str) -{ - WCHAR *ret = NULL; - DWORD len; - - if (!str) return ret; - len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = malloc(len * sizeof(WCHAR)); - if (ret) - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); - return ret; -} - static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property) { HRESULT hr; @@ -116,30 +101,29 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property) /* used to test all Write* methods for consistent error state */ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr) { - static const WCHAR aW[] = {'a',0}; HRESULT hr; /* FIXME: add WriteAttributes */ - hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); + hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteCData(writer, aW); + hr = IXmlWriter_WriteCData(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteCharEntity(writer, aW[0]); + hr = IXmlWriter_WriteCharEntity(writer, 'a'); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteChars(writer, aW, 1); + hr = IXmlWriter_WriteChars(writer, L"a", 1); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteComment(writer, aW); + hr = IXmlWriter_WriteComment(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL); + hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW); + hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); hr = IXmlWriter_WriteEndDocument(writer); @@ -148,40 +132,40 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr) hr = IXmlWriter_WriteEndElement(writer); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteEntityRef(writer, aW); + hr = IXmlWriter_WriteEntityRef(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); hr = IXmlWriter_WriteFullEndElement(writer); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteName(writer, aW); + hr = IXmlWriter_WriteName(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteNmToken(writer, aW); + hr = IXmlWriter_WriteNmToken(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr); /* FIXME: add WriteNode */ /* FIXME: add WriteNodeShallow */ - hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a"); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL); + hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteRaw(writer, aW); + hr = IXmlWriter_WriteRaw(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteRawChars(writer, aW, 1); + hr = IXmlWriter_WriteRawChars(writer, L"a", 1); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); - hr = IXmlWriter_WriteString(writer, aW); + hr = IXmlWriter_WriteString(writer, L"a"); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr); /* FIXME: add WriteSurrogateCharEntity */ @@ -340,25 +324,25 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output) /* TODO: WriteAttributes */ - hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); + hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteCData(writer, aW); + hr = IXmlWriter_WriteCData(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteCharEntity(writer, 0x100); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteChars(writer, aW, 1); + hr = IXmlWriter_WriteChars(writer, L"a", 1); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteComment(writer, aW); + hr = IXmlWriter_WriteComment(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL); + hr = IXmlWriter_WriteDocType(writer, L"a", NULL, NULL, NULL); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteEndDocument(writer); @@ -367,40 +351,40 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output) hr = IXmlWriter_WriteEndElement(writer); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteEntityRef(writer, aW); + hr = IXmlWriter_WriteEntityRef(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteFullEndElement(writer); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteName(writer, aW); + hr = IXmlWriter_WriteName(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteNmToken(writer, aW); + hr = IXmlWriter_WriteNmToken(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); /* TODO: WriteNode */ /* TODO: WriteNodeShallow */ - hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"a", L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL); + hr = IXmlWriter_WriteQualifiedName(writer, L"a", NULL); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteRaw(writer, aW); + hr = IXmlWriter_WriteRaw(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteRawChars(writer, aW, 1); + hr = IXmlWriter_WriteRawChars(writer, L"a", 1); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteString(writer, aW); + hr = IXmlWriter_WriteString(writer, L"a"); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr); /* TODO: WriteSurrogateCharEntity */ @@ -412,9 +396,6 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output) 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}; - static const WCHAR dummyW[] = {'d','u','m','m','y',0}; static const WCHAR utf16_outputW[] = {0xfeff,'<','a'}; IXmlWriterOutput *output; IXmlWriter *writer; @@ -428,7 +409,7 @@ static void test_writeroutput(void) EXPECT_REF(output, 1); IUnknown_Release(output); - hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output); + hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"utf-16", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); unk = NULL; hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk); @@ -458,7 +439,7 @@ static void test_writeroutput(void) /* create with us-ascii */ output = NULL; - hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output); + hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, L"us-ascii", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IUnknown_Release(output); @@ -475,7 +456,7 @@ static void test_writeroutput(void) hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "Failed to set writer output, hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Write failed, hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -505,7 +486,7 @@ static void test_writeroutput(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); output = NULL; - hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, dummyW, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"dummy", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); test_invalid_output_encoding(writer, output); @@ -522,9 +503,6 @@ static void test_writestartdocument(void) static const char fullprolog[] = ""; static const char *prologversion2 = ""; static const char prologversion[] = ""; - static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; - static const WCHAR usasciiW[] = {'u','S','-','a','s','C','i','i',0}; - static const WCHAR xmlW[] = {'x','m','l',0}; IXmlWriterOutput *output; IXmlWriter *writer; IStream *stream; @@ -537,7 +515,7 @@ static void test_writestartdocument(void) hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -565,7 +543,7 @@ static void test_writestartdocument(void) /* now add PI manually, and try to start a document */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); @@ -575,7 +553,7 @@ static void test_writestartdocument(void) ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); /* another attempt to add 'xml' PI */ - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -591,7 +569,7 @@ static void test_writestartdocument(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); output = NULL; - hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, usasciiW, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, L"uS-asCii", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL); @@ -646,8 +624,6 @@ static void test_flush(void) static void test_omitxmldeclaration(void) { static const char prologversion[] = ""; - static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; - static const WCHAR xmlW[] = {'x','m','l',0}; IXmlWriter *writer; HGLOBAL hglobal; IStream *stream; @@ -683,7 +659,7 @@ static void test_omitxmldeclaration(void) /* now add PI manually, and try to start a document */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -708,7 +684,7 @@ static void test_omitxmldeclaration(void) CHECK_OUTPUT(stream, prologversion); /* another attempt to add 'xml' PI */ - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -723,9 +699,6 @@ static void test_bom(void) static const WCHAR piW[] = {0xfeff,'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"','?','>'}; static const WCHAR aopenW[] = {0xfeff,'<','a'}; static const WCHAR afullW[] = {0xfeff,'<','a',' ','/','>'}; - static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; - static const WCHAR utf16W[] = {'u','t','f','-','1','6',0}; - static const WCHAR xmlW[] = {'x','m','l',0}; static const WCHAR bomW[] = {0xfeff}; IXmlWriterOutput *output; IXmlWriter *writer; @@ -736,7 +709,7 @@ static void test_bom(void) hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); @@ -763,13 +736,13 @@ static void test_bom(void) hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + hr = IXmlWriter_WriteProcessingInstruction(writer, L"xml", L"version=\"1.0\""); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -784,13 +757,13 @@ static void test_bom(void) hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_SetOutput(writer, output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -805,7 +778,7 @@ static void test_bom(void) hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, L"utf-16", &output); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_SetOutput(writer, output); @@ -813,7 +786,7 @@ static void test_bom(void) writer_set_property(writer, XmlWriterProperty_Indent); - hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -830,67 +803,13 @@ static void test_bom(void) IXmlWriter_Release(writer); } -static HRESULT write_start_element(IXmlWriter *writer, const char *prefix, const char *local, - const char *uri) -{ - WCHAR *prefixW, *localW, *uriW; - HRESULT hr; - - prefixW = strdupAtoW(prefix); - localW = strdupAtoW(local); - uriW = strdupAtoW(uri); - - hr = IXmlWriter_WriteStartElement(writer, prefixW, localW, uriW); - - free(prefixW); - free(localW); - free(uriW); - - return hr; -} - -static HRESULT write_element_string(IXmlWriter *writer, const char *prefix, const char *local, - const char *uri, const char *value) -{ - WCHAR *prefixW, *localW, *uriW, *valueW; - HRESULT hr; - - prefixW = strdupAtoW(prefix); - localW = strdupAtoW(local); - uriW = strdupAtoW(uri); - valueW = strdupAtoW(value); - - hr = IXmlWriter_WriteElementString(writer, prefixW, localW, uriW, valueW); - - free(prefixW); - free(localW); - free(uriW); - free(valueW); - - return hr; -} - -static HRESULT write_string(IXmlWriter *writer, const char *str) -{ - WCHAR *strW; - HRESULT hr; - - strW = strdupAtoW(str); - - hr = IXmlWriter_WriteString(writer, strW); - - free(strW); - - return hr; -} - static void test_WriteStartElement(void) { static const struct { - const char *prefix; - const char *local; - const char *uri; + const WCHAR *prefix; + const WCHAR *local; + const WCHAR *uri; const char *output; const char *output_partial; HRESULT hr; @@ -899,22 +818,21 @@ static void test_WriteStartElement(void) } start_element_tests[] = { - { "prefix", "local", "uri", "", "", "", "", "", "", "", "", "value" }, - { NULL, "local", "uri", "value", "value" }, - { "", "local", "uri", "value", "value" }, - { "prefix", "local", "uri", NULL, "" }, - { NULL, "local", "uri", NULL, "" }, - { "", "local", "uri", NULL, "" }, - { NULL, "local", NULL, NULL, "" }, - { "prefix", "local", "uri", "", "" }, - { NULL, "local", "uri", "", "" }, - { "", "local", "uri", "", "" }, - { NULL, "local", NULL, "", "" }, - { "", "local", "http://www.w3.org/2000/xmlns/", NULL, "" }, + { L"prefix", L"local", L"uri", L"value", "value" }, + { NULL, L"local", L"uri", L"value", "value" }, + { L"", L"local", L"uri", L"value", "value" }, + { L"prefix", L"local", L"uri", NULL, "" }, + { NULL, L"local", L"uri", NULL, "" }, + { L"", L"local", L"uri", NULL, "" }, + { NULL, L"local", NULL, NULL, "" }, + { L"prefix", L"local", L"uri", L"", "" }, + { NULL, L"local", L"uri", L"", "" }, + { L"", L"local", L"uri", L"", "" }, + { NULL, L"local", NULL, L"", "" }, + { L"", L"local", L"http://www.w3.org/2000/xmlns/", NULL, "" }, - { "prefix", NULL, NULL, "value", NULL, E_INVALIDARG }, - { NULL, NULL, "uri", "value", NULL, E_INVALIDARG }, - { NULL, NULL, NULL, "value", NULL, E_INVALIDARG }, - { NULL, "prefix:local", "uri", "value", NULL, WC_E_NAMECHARACTER }, - { NULL, ":local", "uri", "value", NULL, WC_E_NAMECHARACTER }, - { ":", "local", "uri", "value", NULL, WC_E_NAMECHARACTER }, - { "prefix", "local", NULL, "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI }, - { "prefix", "local", "", "value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI }, - { NULL, "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSPREFIXDECLARATION }, - { "prefix", "local", "http://www.w3.org/2000/xmlns/", "value", NULL, WR_E_XMLNSURIDECLARATION }, + { L"prefix", NULL, NULL, L"value", NULL, E_INVALIDARG }, + { NULL, NULL, L"uri", L"value", NULL, E_INVALIDARG }, + { NULL, NULL, NULL, L"value", NULL, E_INVALIDARG }, + { NULL, L"prefix:local", L"uri", L"value", NULL, WC_E_NAMECHARACTER }, + { NULL, L":local", L"uri", L"value", NULL, WC_E_NAMECHARACTER }, + { L":", L"local", L"uri", L"value", NULL, WC_E_NAMECHARACTER }, + { L"prefix", L"local", NULL, L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI }, + { L"prefix", L"local", L"", L"value", NULL, WR_E_NSPREFIXWITHEMPTYNSURI }, + { NULL, L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSPREFIXDECLARATION }, + { L"prefix", L"local", L"http://www.w3.org/2000/xmlns/", L"value", NULL, WR_E_XMLNSURIDECLARATION }, }; IXmlWriter *writer; IStream *stream; @@ -1073,48 +991,48 @@ static void test_WriteElementString(void) hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_element_string(writer, NULL, "b", NULL, "value"); + hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value"); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr); stream = writer_set_output(writer); - hr = write_start_element(writer, NULL, "a", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_element_string(writer, NULL, "b", NULL, "value"); + hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, L"value"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_element_string(writer, NULL, "b", NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix", "b", "uri", NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix", L"b", L"uri", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_start_element(writer, "prefix", "c", "uri"); + hr = IXmlWriter_WriteStartElement(writer, L"prefix", L"c", L"uri"); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix", "d", NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix", L"d", NULL, NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix2", "d", "uri", NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix2", L"d", L"uri", NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, NULL, "e", "uri", NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"e", L"uri", NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix", "f", "uri2", NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix", L"f", L"uri2", NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, NULL, "g", "uri3", NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"g", L"uri3", NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix", "h", NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix", L"h", NULL, NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, "prefix_i", "i", NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, L"prefix_i", L"i", NULL, NULL); ok(hr == WR_E_NSPREFIXWITHEMPTYNSURI, "Failed to write element, hr %#lx.\n", hr); - hr = write_element_string(writer, "", "j", "uri", NULL); + hr = IXmlWriter_WriteElementString(writer, L"", L"j", L"uri", NULL); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -1143,7 +1061,7 @@ static void test_WriteElementString(void) hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr); - hr = write_element_string(writer, element_string_tests[i].prefix, element_string_tests[i].local, + hr = IXmlWriter_WriteElementString(writer, element_string_tests[i].prefix, element_string_tests[i].local, element_string_tests[i].uri, element_string_tests[i].value); ok(hr == element_string_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr); @@ -1180,10 +1098,10 @@ static void test_WriteEndElement(void) stream = writer_set_output(writer); - hr = write_start_element(writer, NULL, "a", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_start_element(writer, NULL, "b", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteEndElement(writer); @@ -1203,8 +1121,6 @@ static void test_WriteEndElement(void) static void test_writeenddocument(void) { - static const WCHAR aW[] = {'a',0}; - static const WCHAR bW[] = {'b',0}; IXmlWriter *writer; IStream *stream; HGLOBAL hglobal; @@ -1229,16 +1145,16 @@ static void test_writeenddocument(void) hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteEndDocument(writer); @@ -1262,9 +1178,6 @@ static void test_writeenddocument(void) static void test_WriteComment(void) { - static const WCHAR closeW[] = {'-','-','>',0}; - static const WCHAR aW[] = {'a',0}; - static const WCHAR bW[] = {'b',0}; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -1274,7 +1187,7 @@ static void test_WriteComment(void) writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); - hr = IXmlWriter_WriteComment(writer, aW); + hr = IXmlWriter_WriteComment(writer, L"a"); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr); stream = writer_set_output(writer); @@ -1282,19 +1195,19 @@ static void test_WriteComment(void) hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteComment(writer, aW); + hr = IXmlWriter_WriteComment(writer, L"a"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteComment(writer, aW); + hr = IXmlWriter_WriteComment(writer, L"a"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteComment(writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteComment(writer, closeW); + hr = IXmlWriter_WriteComment(writer, L"-->"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -1308,10 +1221,6 @@ static void test_WriteComment(void) static void test_WriteCData(void) { - static const WCHAR closeW[] = {']',']','>',0}; - static const WCHAR close2W[] = {'a',']',']','>','b',0}; - static const WCHAR aW[] = {'a',0}; - static const WCHAR bW[] = {'b',0}; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -1321,24 +1230,24 @@ static void test_WriteCData(void) writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); - hr = IXmlWriter_WriteCData(writer, aW); + hr = IXmlWriter_WriteCData(writer, L"a"); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr); stream = writer_set_output(writer); - hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteCData(writer, aW); + hr = IXmlWriter_WriteCData(writer, L"a"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteCData(writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteCData(writer, closeW); + hr = IXmlWriter_WriteCData(writer, L"]]>"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteCData(writer, close2W); + hr = IXmlWriter_WriteCData(writer, L"a]]>b"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -1359,8 +1268,7 @@ static void test_WriteCData(void) static void test_WriteRaw(void) { - static const WCHAR rawW[] = {'a','<',':',0}; - static const WCHAR aW[] = {'a',0}; + static const WCHAR rawW[] = L"a<:"; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -1391,7 +1299,7 @@ static void test_WriteRaw(void) hr = IXmlWriter_WriteRaw(writer, rawW); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW); + hr = IXmlWriter_WriteElementString(writer, NULL, L"a", NULL, L"a"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); @@ -1417,7 +1325,6 @@ static void test_WriteRaw(void) static void test_writer_state(void) { - static const WCHAR aW[] = {'a',0}; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -1440,7 +1347,7 @@ static void test_writer_state(void) /* WriteAttributeString */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); + hr = IXmlWriter_WriteAttributeString(writer, NULL, L"a", NULL, L"a"); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); check_writer_state(writer, WR_E_INVALIDACTION); @@ -1467,7 +1374,7 @@ static void test_writer_state(void) /* WriteCData */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteCData(writer, aW); + hr = IXmlWriter_WriteCData(writer, L"a"); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); check_writer_state(writer, WR_E_INVALIDACTION); @@ -1476,7 +1383,7 @@ static void test_writer_state(void) /* WriteName */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteName(writer, aW); + hr = IXmlWriter_WriteName(writer, L"a"); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); check_writer_state(writer, WR_E_INVALIDACTION); @@ -1485,7 +1392,7 @@ static void test_writer_state(void) /* WriteNmToken */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteNmToken(writer, aW); + hr = IXmlWriter_WriteNmToken(writer, L"a"); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); check_writer_state(writer, WR_E_INVALIDACTION); @@ -1494,7 +1401,7 @@ static void test_writer_state(void) /* WriteString */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteString(writer, aW); + hr = IXmlWriter_WriteString(writer, L"a"); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr); check_writer_state(writer, WR_E_INVALIDACTION); @@ -1505,9 +1412,6 @@ static void test_writer_state(void) static void test_indentation(void) { - static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0}; - static const WCHAR aW[] = {'a',0}; - static const WCHAR bW[] = {'b',0}; IXmlWriter *writer; IStream *stream; HRESULT hr; @@ -1523,13 +1427,13 @@ static void test_indentation(void) hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteComment(writer, commentW); + hr = IXmlWriter_WriteComment(writer, L"comment"); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteEndDocument(writer); @@ -1549,13 +1453,13 @@ static void test_indentation(void) /* WriteElementString */ stream = writer_set_output(writer); - hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"a", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL); + hr = IXmlWriter_WriteElementString(writer, NULL, L"b", NULL, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_WriteEndElement(writer); @@ -1575,35 +1479,14 @@ static void test_indentation(void) IXmlWriter_Release(writer); } -static HRESULT write_attribute_string(IXmlWriter *writer, const char *prefix, const char *local, - const char *uri, const char *value) -{ - WCHAR *prefixW, *localW, *uriW, *valueW; - HRESULT hr; - - prefixW = strdupAtoW(prefix); - localW = strdupAtoW(local); - uriW = strdupAtoW(uri); - valueW = strdupAtoW(value); - - hr = IXmlWriter_WriteAttributeString(writer, prefixW, localW, uriW, valueW); - - free(prefixW); - free(localW); - free(uriW); - free(valueW); - - return hr; -} - static void test_WriteAttributeString(void) { static const struct { - const char *prefix; - const char *local; - const char *uri; - const char *value; + const WCHAR *prefix; + const WCHAR *local; + const WCHAR *uri; + const WCHAR *value; const char *output; const char *output_partial; HRESULT hr; @@ -1613,62 +1496,62 @@ static void test_WriteAttributeString(void) } attribute_tests[] = { - { NULL, "a", NULL, "b", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "="); + hr = IXmlWriter_WriteString(writer, L"<&\">="); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -1942,10 +1823,10 @@ static void test_WriteString(void) stream = writer_set_output(writer); - hr = write_start_element(writer, NULL, "b", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = write_string(writer, NULL); + hr = IXmlWriter_WriteString(writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -1954,7 +1835,7 @@ static void test_WriteString(void) CHECK_OUTPUT(stream, "\r\n" " "); - hr = write_start_element(writer, NULL, "c", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"c", NULL); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr); - hr = write_attribute_string(writer, NULL, "attr", NULL, "value"); + hr = IXmlWriter_WriteAttributeString(writer, NULL, L"attr", NULL, L"value"); ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr); hr = IXmlWriter_Flush(writer); @@ -2045,7 +1926,7 @@ static void test_WriteString(void) " \r\n" " \r\n" " text"); - hr = write_start_element(writer, NULL, "d", NULL); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"d", NULL); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr); - hr = write_string(writer, ""); + hr = IXmlWriter_WriteString(writer, L""); ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr); hr = IXmlWriter_WriteEndElement(writer); @@ -2102,60 +1983,37 @@ static void test_WriteString(void) IStream_Release(stream); } -static HRESULT write_doctype(IXmlWriter *writer, const char *name, const char *pubid, const char *sysid, - const char *subset) -{ - WCHAR *nameW, *pubidW, *sysidW, *subsetW; - HRESULT hr; - - nameW = strdupAtoW(name); - pubidW = strdupAtoW(pubid); - sysidW = strdupAtoW(sysid); - subsetW = strdupAtoW(subset); - - hr = IXmlWriter_WriteDocType(writer, nameW, pubidW, sysidW, subsetW); - - free(nameW); - free(pubidW); - free(sysidW); - free(subsetW); - - return hr; -} - static void test_WriteDocType(void) { static const struct { - const char *name; - const char *pubid; - const char *sysid; - const char *subset; + const WCHAR *name; + const WCHAR *pubid; + const WCHAR *sysid; + const WCHAR *subset; const char *output; } doctype_tests[] = { - { "a", "", NULL, NULL, "" }, - { "a", NULL, NULL, NULL, "" }, - { "a", NULL, "", NULL, "" }, - { "a", "", "", NULL, "" }, - { "a", "pubid", "", NULL, "" }, - { "a", "pubid", NULL, NULL, "" }, - { "a", "", "sysid", NULL, "" }, - { "a", NULL, NULL, "", "" }, - { "a", NULL, NULL, "subset", "" }, - { "a", "", NULL, "subset", "" }, - { "a", NULL, "", "subset", "" }, - { "a", "", "", "subset", "" }, - { "a", "pubid", NULL, "subset", "" }, - { "a", "pubid", "", "subset", "" }, - { "a", NULL, "sysid", "subset", "" }, - { "a", "", "sysid", "subset", "" }, - { "a", "pubid", "sysid", "subset", "" }, + { L"a", L"", NULL, NULL, "" }, + { L"a", NULL, NULL, NULL, "" }, + { L"a", NULL, L"", NULL, "" }, + { L"a", L"", L"", NULL, "" }, + { L"a", L"pubid", L"", NULL, "" }, + { L"a", L"pubid", NULL, NULL, "" }, + { L"a", L"", L"sysid", NULL, "" }, + { L"a", NULL, NULL, L"", "" }, + { L"a", NULL, NULL, L"subset", "" }, + { L"a", L"", NULL, L"subset", "" }, + { L"a", NULL, L"", L"subset", "" }, + { L"a", L"", L"", L"subset", "" }, + { L"a", L"pubid", NULL, L"subset", "" }, + { L"a", L"pubid", L"", L"subset", "" }, + { L"a", NULL, L"sysid", L"subset", "" }, + { L"a", L"", L"sysid", L"subset", "" }, + { L"a", L"pubid", L"sysid", L"subset", "" }, }; static const WCHAR pubidW[] = {'p',0x100,'i','d',0}; - static const WCHAR nameW[] = {'-','a',0}; - static const WCHAR emptyW[] = { 0 }; IXmlWriter *writer; IStream *stream; unsigned int i; @@ -2169,15 +2027,15 @@ static void test_WriteDocType(void) hr = IXmlWriter_WriteDocType(writer, NULL, NULL, NULL, NULL); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); - hr = IXmlWriter_WriteDocType(writer, emptyW, NULL, NULL, NULL); + hr = IXmlWriter_WriteDocType(writer, L"", NULL, NULL, NULL); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); /* Name validation. */ - hr = IXmlWriter_WriteDocType(writer, nameW, NULL, NULL, NULL); + hr = IXmlWriter_WriteDocType(writer, L"-a", NULL, NULL, NULL); ok(hr == WC_E_NAMECHARACTER, "Unexpected hr %#lx.\n", hr); /* Pubid validation. */ - hr = IXmlWriter_WriteDocType(writer, aW, pubidW, NULL, NULL); + hr = IXmlWriter_WriteDocType(writer, L"a", pubidW, NULL, NULL); ok(hr == WC_E_PUBLICID, "Unexpected hr %#lx.\n", hr); IStream_Release(stream); @@ -2186,7 +2044,7 @@ static void test_WriteDocType(void) { stream = writer_set_output(writer); - hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, + hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, doctype_tests[i].subset); ok(hr == S_OK, "%u: failed to write doctype, hr %#lx.\n", i, hr); @@ -2195,7 +2053,7 @@ static void test_WriteDocType(void) CHECK_OUTPUT(stream, doctype_tests[i].output); - hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, + hr = IXmlWriter_WriteDocType(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, doctype_tests[i].subset); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);