Commit 05b07dbe authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/tests: Build without WINE_NO_LONG_TYPES.

parent 6d7aeede
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = xmllite.dll TESTDLL = xmllite.dll
IMPORTS = xmllite ole32 IMPORTS = xmllite ole32
......
...@@ -50,7 +50,7 @@ static IStream *create_stream_on_data(const void *data, unsigned int size) ...@@ -50,7 +50,7 @@ static IStream *create_stream_on_data(const void *data, unsigned int size)
memcpy(ptr, data, size); memcpy(ptr, data, size);
hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream); hr = CreateStreamOnHGlobal(hglobal, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(stream != NULL, "Expected non-NULL stream\n"); ok(stream != NULL, "Expected non-NULL stream\n");
GlobalUnlock(hglobal); GlobalUnlock(hglobal);
...@@ -209,7 +209,7 @@ static void _set_input_string(unsigned line, IXmlReader *reader, const char *xml ...@@ -209,7 +209,7 @@ static void _set_input_string(unsigned line, IXmlReader *reader, const char *xml
stream = create_stream_on_data(xml, strlen(xml)); stream = create_stream_on_data(xml, strlen(xml));
hr = IXmlReader_SetInput(reader, (IUnknown *)stream); hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
ok_(__FILE__,line)(hr == S_OK, "got %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
} }
...@@ -222,9 +222,9 @@ static void _read_node(unsigned line, IXmlReader *reader, XmlNodeType expected_t ...@@ -222,9 +222,9 @@ static void _read_node(unsigned line, IXmlReader *reader, XmlNodeType expected_t
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
if (expected_type == XmlNodeType_None) if (expected_type == XmlNodeType_None)
ok_(__FILE__,line)(hr == S_FALSE, "Read returned %08x, expected S_FALSE\n", hr); ok_(__FILE__,line)(hr == S_FALSE, "Read returned %#lx, expected S_FALSE.\n", hr);
else else
ok_(__FILE__,line)(hr == S_OK, "Read returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Read returned %#lx.\n", hr);
ok_(__FILE__,line)(type == expected_type, "read type %d, expected %d\n", type, expected_type); ok_(__FILE__,line)(type == expected_type, "read type %d, expected %d\n", type, expected_type);
} }
...@@ -233,7 +233,7 @@ static void _next_attribute(unsigned line, IXmlReader *reader) ...@@ -233,7 +233,7 @@ static void _next_attribute(unsigned line, IXmlReader *reader)
{ {
HRESULT hr; HRESULT hr;
hr = IXmlReader_MoveToNextAttribute(reader); hr = IXmlReader_MoveToNextAttribute(reader);
ok_(__FILE__,line)(hr == S_OK, "MoveToNextAttribute returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
#define move_to_element(a) _move_to_element(__LINE__,a) #define move_to_element(a) _move_to_element(__LINE__,a)
...@@ -241,7 +241,7 @@ static void _move_to_element(unsigned line, IXmlReader *reader) ...@@ -241,7 +241,7 @@ static void _move_to_element(unsigned line, IXmlReader *reader)
{ {
HRESULT hr; HRESULT hr;
hr = IXmlReader_MoveToElement(reader); hr = IXmlReader_MoveToElement(reader);
ok_(__FILE__,line)(hr == S_OK, "MoveToElement failed: %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
static void test_read_state(IXmlReader *reader, XmlReadState expected, static void test_read_state(IXmlReader *reader, XmlReadState expected,
...@@ -269,11 +269,11 @@ static void test_read_state(IXmlReader *reader, XmlReadState expected, ...@@ -269,11 +269,11 @@ static void test_read_state(IXmlReader *reader, XmlReadState expected,
static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR *expect) static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR *expect)
{ {
const WCHAR *str = (void*)0xdeadbeef; const WCHAR *str = (void*)0xdeadbeef;
ULONG len = 0xdeadbeef; UINT len = 0xdeadbeef;
HRESULT hr; HRESULT hr;
hr = IXmlReader_GetValue(reader, &str, &len); hr = IXmlReader_GetValue(reader, &str, &len);
ok_(__FILE__,line)(hr == S_OK, "GetValue returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len); ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len);
ok_(__FILE__,line)(!lstrcmpW(str, expect), "value = %s\n", wine_dbgstr_w(str)); ok_(__FILE__,line)(!lstrcmpW(str, expect), "value = %s\n", wine_dbgstr_w(str));
return str; return str;
...@@ -283,12 +283,12 @@ static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR ...@@ -283,12 +283,12 @@ static const WCHAR *_reader_value(unsigned line, IXmlReader *reader, const WCHAR
static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR *expect) static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR *expect)
{ {
const WCHAR *str = (void*)0xdeadbeef; const WCHAR *str = (void*)0xdeadbeef;
ULONG len = 0xdeadbeef; UINT len = 0xdeadbeef;
HRESULT hr; HRESULT hr;
hr = IXmlReader_GetLocalName(reader, &str, &len); hr = IXmlReader_GetLocalName(reader, &str, &len);
ok_(__FILE__,line)(hr == S_OK, "GetLocalName returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len); ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str)); ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str));
return str; return str;
} }
...@@ -297,12 +297,12 @@ static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR ...@@ -297,12 +297,12 @@ static const WCHAR *_reader_name(unsigned line, IXmlReader *reader, const WCHAR
static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHAR *expect) static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHAR *expect)
{ {
const WCHAR *str = (void*)0xdeadbeef; const WCHAR *str = (void*)0xdeadbeef;
ULONG len = 0xdeadbeef; UINT len = 0xdeadbeef;
HRESULT hr; HRESULT hr;
hr = IXmlReader_GetPrefix(reader, &str, &len); hr = IXmlReader_GetPrefix(reader, &str, &len);
ok_(__FILE__,line)(hr == S_OK, "GetPrefix returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len); ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
ok_(__FILE__,line)(!lstrcmpW(str, expect), "prefix = %s\n", wine_dbgstr_w(str)); ok_(__FILE__,line)(!lstrcmpW(str, expect), "prefix = %s\n", wine_dbgstr_w(str));
return str; return str;
} }
...@@ -311,12 +311,12 @@ static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHA ...@@ -311,12 +311,12 @@ static const WCHAR *_reader_prefix(unsigned line, IXmlReader *reader, const WCHA
static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const WCHAR *expect) static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const WCHAR *expect)
{ {
const WCHAR *str = (void*)0xdeadbeef; const WCHAR *str = (void*)0xdeadbeef;
ULONG len = 0xdeadbeef; UINT len = 0xdeadbeef;
HRESULT hr; HRESULT hr;
hr = IXmlReader_GetNamespaceUri(reader, &str, &len); hr = IXmlReader_GetNamespaceUri(reader, &str, &len);
ok_(__FILE__,line)(hr == S_OK, "GetNamespaceUri returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len); ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
ok_(__FILE__,line)(!lstrcmpW(str, expect), "namespace = %s\n", wine_dbgstr_w(str)); ok_(__FILE__,line)(!lstrcmpW(str, expect), "namespace = %s\n", wine_dbgstr_w(str));
return str; return str;
} }
...@@ -325,12 +325,12 @@ static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const W ...@@ -325,12 +325,12 @@ static const WCHAR *_reader_namespace(unsigned line, IXmlReader *reader, const W
static const WCHAR *_reader_qname(IXmlReader *reader, const WCHAR *expect, unsigned line) static const WCHAR *_reader_qname(IXmlReader *reader, const WCHAR *expect, unsigned line)
{ {
const WCHAR *str = (void*)0xdeadbeef; const WCHAR *str = (void*)0xdeadbeef;
ULONG len = 0xdeadbeef; UINT len = 0xdeadbeef;
HRESULT hr; HRESULT hr;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok_(__FILE__,line)(hr == S_OK, "GetQualifiedName returned %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(len == lstrlenW(str), "len = %u\n", len); ok_(__FILE__,line)(len == lstrlenW(str), "len = %u.\n", len);
ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str)); ok_(__FILE__,line)(!lstrcmpW(str, expect), "name = %s\n", wine_dbgstr_w(str));
return str; return str;
} }
...@@ -343,7 +343,7 @@ static void _read_value_char(IXmlReader *reader, WCHAR expected_char, unsigned l ...@@ -343,7 +343,7 @@ static void _read_value_char(IXmlReader *reader, WCHAR expected_char, unsigned l
HRESULT hr; HRESULT hr;
hr = IXmlReader_ReadValueChunk(reader, &c, 1, &count); hr = IXmlReader_ReadValueChunk(reader, &c, 1, &count);
ok_(__FILE__,line)(hr == S_OK, "got %08x\n", hr); ok_(__FILE__,line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_(__FILE__,line)(count == 1, "got %u\n", c); ok_(__FILE__,line)(count == 1, "got %u\n", c);
ok_(__FILE__,line)(c == expected_char, "got %x\n", c); ok_(__FILE__,line)(c == expected_char, "got %x\n", c);
} }
...@@ -528,84 +528,84 @@ static void test_reader_create(void) ...@@ -528,84 +528,84 @@ static void test_reader_create(void)
} }
hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL); hr = CreateXmlReader(&IID_IStream, (void **)&unk, NULL);
ok(hr == E_NOINTERFACE, "got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL); hr = CreateXmlReader(&IID_IUnknown, (void **)&unk, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader); hr = IUnknown_QueryInterface(unk, &IID_IXmlReader, (void **)&reader);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk == (IUnknown *)reader, "unexpected interface\n"); ok(unk == (IUnknown *)reader, "unexpected interface\n");
IXmlReader_Release(reader); IXmlReader_Release(reader);
IUnknown_Release(unk); IUnknown_Release(unk);
hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IUnknown, (void **)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IXmlReader_Release(reader); IXmlReader_Release(reader);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE(reader, XmlReadState_Closed); TEST_READER_STATE(reader, XmlReadState_Closed);
nodetype = XmlNodeType_Element; nodetype = XmlNodeType_Element;
hr = IXmlReader_GetNodeType(reader, &nodetype); hr = IXmlReader_GetNodeType(reader, &nodetype);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "got %d\n", nodetype); ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
/* crashes on XP, 2k3, works on newer versions */ /* crashes on XP, 2k3, works on newer versions */
if (0) if (0)
{ {
hr = IXmlReader_GetNodeType(reader, NULL); hr = IXmlReader_GetNodeType(reader, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
} }
resolver = (void*)0xdeadbeef; resolver = (void*)0xdeadbeef;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(resolver == NULL, "got %p\n", resolver); ok(resolver == NULL, "got %p\n", resolver);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR)&testresolver); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR)&testresolver);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
resolver = NULL; resolver = NULL;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_XmlResolver, (LONG_PTR*)&resolver);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(resolver == &testresolver, "got %p\n", resolver); ok(resolver == &testresolver, "got %p\n", resolver);
IXmlResolver_Release(resolver); IXmlResolver_Release(resolver);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_XmlResolver, 0);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
dtd = 2; dtd = 2;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_DtdProcessing, (LONG_PTR*)&dtd);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(dtd == DtdProcessing_Prohibit, "got %d\n", dtd); ok(dtd == DtdProcessing_Prohibit, "got %d\n", dtd);
dtd = 2; dtd = 2;
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, dtd); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, dtd);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, -1); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, -1);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Null input pointer, releases previous input */ /* Null input pointer, releases previous input */
hr = IXmlReader_SetInput(reader, NULL); hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed); TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed);
/* test input interface selection sequence */ /* test input interface selection sequence */
hr = testinput_createinstance((void**)&input); hr = testinput_createinstance((void**)&input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (hr == S_OK) if (hr == S_OK)
{ {
input_iids.count = 0; input_iids.count = 0;
hr = IXmlReader_SetInput(reader, input); hr = IXmlReader_SetInput(reader, input);
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE); ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE);
IUnknown_Release(input); IUnknown_Release(input);
} }
...@@ -623,71 +623,71 @@ static void test_readerinput(void) ...@@ -623,71 +623,71 @@ static void test_readerinput(void)
LONG ref; LONG ref;
hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, NULL); hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, &reader_input); hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ref = IStream_AddRef(stream); ref = IStream_AddRef(stream);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 2, "Expected 2, got %ld.\n", ref);
IStream_Release(stream); IStream_Release(stream);
hr = CreateXmlReaderInputWithEncodingName((IUnknown*)stream, NULL, NULL, FALSE, NULL, &reader_input); hr = CreateXmlReaderInputWithEncodingName((IUnknown*)stream, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IUnknown_QueryInterface(reader_input, &IID_IStream, (void**)&stream2); hr = IUnknown_QueryInterface(reader_input, &IID_IStream, (void**)&stream2);
ok(hr == E_NOINTERFACE, "Expected S_OK, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
hr = IUnknown_QueryInterface(reader_input, &IID_ISequentialStream, (void**)&stream2); hr = IUnknown_QueryInterface(reader_input, &IID_ISequentialStream, (void**)&stream2);
ok(hr == E_NOINTERFACE, "Expected S_OK, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
/* IXmlReaderInput grabs a stream reference */ /* IXmlReaderInput grabs a stream reference */
ref = IStream_AddRef(stream); ref = IStream_AddRef(stream);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IStream_Release(stream); IStream_Release(stream);
/* try ::SetInput() with valid IXmlReaderInput */ /* try ::SetInput() with valid IXmlReaderInput */
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 2, "Expected 2, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
hr = IXmlReader_SetInput(reader, reader_input); hr = IXmlReader_SetInput(reader, reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE(reader, XmlReadState_Initial); TEST_READER_STATE(reader, XmlReadState_Initial);
nodetype = XmlNodeType_Element; nodetype = XmlNodeType_Element;
hr = IXmlReader_GetNodeType(reader, &nodetype); hr = IXmlReader_GetNodeType(reader, &nodetype);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "got %d\n", nodetype); ok(nodetype == XmlNodeType_None, "got %d\n", nodetype);
/* IXmlReader grabs a IXmlReaderInput reference */ /* IXmlReader grabs a IXmlReaderInput reference */
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
ref = IStream_AddRef(stream); ref = IStream_AddRef(stream);
ok(ref == 4, "Expected 4, got %d\n", ref); ok(ref == 4, "Expected 4, got %ld.\n", ref);
IStream_Release(stream); IStream_Release(stream);
/* reset input and check state */ /* reset input and check state */
hr = IXmlReader_SetInput(reader, NULL); hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed); TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed);
IXmlReader_Release(reader); IXmlReader_Release(reader);
ref = IStream_AddRef(stream); ref = IStream_AddRef(stream);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IStream_Release(stream); IStream_Release(stream);
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 2, "Expected 2, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
/* IID_IXmlReaderInput */ /* IID_IXmlReaderInput */
...@@ -696,9 +696,9 @@ static void test_readerinput(void) ...@@ -696,9 +696,9 @@ static void test_readerinput(void)
Such query will be used only to check if input is really IXmlReaderInput */ Such query will be used only to check if input is really IXmlReaderInput */
obj = (IUnknown*)0xdeadbeef; obj = (IUnknown*)0xdeadbeef;
hr = IUnknown_QueryInterface(reader_input, &IID_IXmlReaderInput, (void**)&obj); hr = IUnknown_QueryInterface(reader_input, &IID_IXmlReaderInput, (void**)&obj);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
...@@ -708,59 +708,59 @@ static void test_readerinput(void) ...@@ -708,59 +708,59 @@ static void test_readerinput(void)
/* test input interface selection sequence */ /* test input interface selection sequence */
input = NULL; input = NULL;
hr = testinput_createinstance((void**)&input); hr = testinput_createinstance((void**)&input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
input_iids.count = 0; input_iids.count = 0;
ref = IUnknown_AddRef(input); ref = IUnknown_AddRef(input);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 2, "Expected 2, got %ld.\n", ref);
IUnknown_Release(input); IUnknown_Release(input);
hr = CreateXmlReaderInputWithEncodingName(input, NULL, NULL, FALSE, NULL, &reader_input); hr = CreateXmlReaderInputWithEncodingName(input, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok_iids(&input_iids, empty_seq, NULL, FALSE); ok_iids(&input_iids, empty_seq, NULL, FALSE);
/* IXmlReaderInput stores stream interface as IUnknown */ /* IXmlReaderInput stores stream interface as IUnknown */
ref = IUnknown_AddRef(input); ref = IUnknown_AddRef(input);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IUnknown_Release(input); IUnknown_Release(input);
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
input_iids.count = 0; input_iids.count = 0;
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 2, "Expected 2, got %d\n", ref); ok(ref == 2, "Expected 2, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
ref = IUnknown_AddRef(input); ref = IUnknown_AddRef(input);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IUnknown_Release(input); IUnknown_Release(input);
hr = IXmlReader_SetInput(reader, reader_input); hr = IXmlReader_SetInput(reader, reader_input);
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
ok_iids(&input_iids, setinput_readerinput, NULL, FALSE); ok_iids(&input_iids, setinput_readerinput, NULL, FALSE);
TEST_READER_STATE(reader, XmlReadState_Closed); TEST_READER_STATE(reader, XmlReadState_Closed);
ref = IUnknown_AddRef(input); ref = IUnknown_AddRef(input);
ok(ref == 3, "Expected 3, got %d\n", ref); ok(ref == 3, "Expected 3, got %ld.\n", ref);
IUnknown_Release(input); IUnknown_Release(input);
ref = IUnknown_AddRef(reader_input); ref = IUnknown_AddRef(reader_input);
ok(ref == 3 || broken(ref == 2) /* versions 1.0.x and 1.1.x - XP, Vista */, ok(ref == 3 || broken(ref == 2) /* versions 1.0.x and 1.1.x - XP, Vista */,
"Expected 3, got %d\n", ref); "Expected 3, got %ld.\n", ref);
IUnknown_Release(reader_input); IUnknown_Release(reader_input);
/* repeat another time, no check or caching here */ /* repeat another time, no check or caching here */
input_iids.count = 0; input_iids.count = 0;
hr = IXmlReader_SetInput(reader, reader_input); hr = IXmlReader_SetInput(reader, reader_input);
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
ok_iids(&input_iids, setinput_readerinput, NULL, FALSE); ok_iids(&input_iids, setinput_readerinput, NULL, FALSE);
/* another reader */ /* another reader */
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL); hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* resolving from IXmlReaderInput to IStream/ISequentialStream is done at /* resolving from IXmlReaderInput to IStream/ISequentialStream is done at
::SetInput() level, each time it's called */ ::SetInput() level, each time it's called */
input_iids.count = 0; input_iids.count = 0;
hr = IXmlReader_SetInput(reader2, reader_input); hr = IXmlReader_SetInput(reader2, reader_input);
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
ok_iids(&input_iids, setinput_readerinput, NULL, FALSE); ok_iids(&input_iids, setinput_readerinput, NULL, FALSE);
IXmlReader_Release(reader2); IXmlReader_Release(reader2);
...@@ -777,11 +777,11 @@ static void test_reader_state(void) ...@@ -777,11 +777,11 @@ static void test_reader_state(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* invalid arguments */ /* invalid arguments */
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, NULL); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* attempt to read on closed reader */ /* attempt to read on closed reader */
TEST_READER_STATE(reader, XmlReadState_Closed); TEST_READER_STATE(reader, XmlReadState_Closed);
...@@ -790,7 +790,7 @@ if (0) ...@@ -790,7 +790,7 @@ if (0)
{ {
/* newer versions crash here, probably because no input was set */ /* newer versions crash here, probably because no input was set */
hr = IXmlReader_Read(reader, &nodetype); hr = IXmlReader_Read(reader, &nodetype);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
} }
set_input_string(reader, "xml"); set_input_string(reader, "xml");
TEST_READER_STATE(reader, XmlReadState_Initial); TEST_READER_STATE(reader, XmlReadState_Initial);
...@@ -798,7 +798,7 @@ if (0) ...@@ -798,7 +798,7 @@ if (0)
nodetype = XmlNodeType_Element; nodetype = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &nodetype); hr = IXmlReader_Read(reader, &nodetype);
todo_wine todo_wine
ok(FAILED(hr), "got %08x\n", hr); ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype); ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
todo_wine todo_wine
...@@ -807,7 +807,7 @@ if (0) ...@@ -807,7 +807,7 @@ if (0)
nodetype = XmlNodeType_Element; nodetype = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &nodetype); hr = IXmlReader_Read(reader, &nodetype);
todo_wine todo_wine
ok(FAILED(hr), "got %08x\n", hr); ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype); ok(nodetype == XmlNodeType_None, "Unexpected node type %d\n", nodetype);
IXmlReader_Release(reader); IXmlReader_Release(reader);
...@@ -850,26 +850,26 @@ static void test_read_xmldeclaration(void) ...@@ -850,26 +850,26 @@ static void test_read_xmldeclaration(void)
const WCHAR *val; const WCHAR *val;
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = create_stream_on_data(xmldecl_full, sizeof(xmldecl_full)); stream = create_stream_on_data(xmldecl_full, sizeof(xmldecl_full));
hr = IXmlReader_SetInput(reader, (IUnknown*)stream); hr = IXmlReader_SetInput(reader, (IUnknown*)stream);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 0, "got %d\n", count); ok(count == 0, "got %d\n", count);
/* try to move without attributes */ /* try to move without attributes */
hr = IXmlReader_MoveToElement(reader); hr = IXmlReader_MoveToElement(reader);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToNextAttribute(reader); hr = IXmlReader_MoveToNextAttribute(reader);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
TEST_READER_POSITION(reader, 0, 0); TEST_READER_POSITION(reader, 0, 0);
...@@ -890,7 +890,7 @@ static void test_read_xmldeclaration(void) ...@@ -890,7 +890,7 @@ static void test_read_xmldeclaration(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
TEST_READER_POSITION2(reader, 1, 7, ~0u, 55); TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
...@@ -899,40 +899,40 @@ static void test_read_xmldeclaration(void) ...@@ -899,40 +899,40 @@ static void test_read_xmldeclaration(void)
next_attribute(reader); next_attribute(reader);
next_attribute(reader); next_attribute(reader);
hr = IXmlReader_MoveToNextAttribute(reader); hr = IXmlReader_MoveToNextAttribute(reader);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_POSITION2(reader, 1, 7, ~0u, 55); TEST_READER_POSITION2(reader, 1, 7, ~0u, 55);
hr = IXmlReader_GetAttributeCount(reader, NULL); hr = IXmlReader_GetAttributeCount(reader, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 3, "Expected 3, got %d\n", count); ok(count == 3, "Expected 3, got %d\n", count);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
len = 0; len = 0;
hr = IXmlReader_GetLocalName(reader, &val, &len); hr = IXmlReader_GetLocalName(reader, &val, &len);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len); ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len);
ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val)); ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val));
len = 0; len = 0;
hr = IXmlReader_GetValue(reader, &val, &len); hr = IXmlReader_GetValue(reader, &val, &len);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len); ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len);
ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val)); ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
hr = IXmlReader_MoveToNextAttribute(reader); hr = IXmlReader_MoveToNextAttribute(reader);
ok(hr == ((i < count - 1) ? S_OK : S_FALSE), "got %08x\n", hr); ok(hr == ((i < count - 1) ? S_OK : S_FALSE), "Unexpected hr %#lx.\n", hr);
} }
TEST_DEPTH(reader, 1); TEST_DEPTH(reader, 1);
...@@ -942,7 +942,7 @@ static void test_read_xmldeclaration(void) ...@@ -942,7 +942,7 @@ static void test_read_xmldeclaration(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type); ok(type == XmlNodeType_XmlDeclaration, "got %d\n", type);
type = XmlNodeType_XmlDeclaration; type = XmlNodeType_XmlDeclaration;
...@@ -950,7 +950,7 @@ static void test_read_xmldeclaration(void) ...@@ -950,7 +950,7 @@ static void test_read_xmldeclaration(void)
/* newer versions return syntax error here cause document is incomplete, /* newer versions return syntax error here cause document is incomplete,
it makes more sense than invalid char error */ it makes more sense than invalid char error */
todo_wine { todo_wine {
ok(hr == WC_E_SYNTAX || broken(hr == WC_E_XMLCHARACTER), "got 0x%08x\n", hr); ok(hr == WC_E_SYNTAX || broken(hr == WC_E_XMLCHARACTER), "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "got %d\n", type); ok(type == XmlNodeType_None, "got %d\n", type);
} }
IStream_Release(stream); IStream_Release(stream);
...@@ -959,14 +959,14 @@ todo_wine { ...@@ -959,14 +959,14 @@ todo_wine {
stream = create_stream_on_data(xmldecl_short, sizeof(xmldecl_short)); stream = create_stream_on_data(xmldecl_short, sizeof(xmldecl_short));
hr = IXmlReader_SetInput(reader, (IUnknown *)stream); hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
ok(hr == S_OK, "expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
read_node(reader, XmlNodeType_XmlDeclaration); read_node(reader, XmlNodeType_XmlDeclaration);
TEST_READER_POSITION2(reader, 1, 3, ~0u, 21); TEST_READER_POSITION2(reader, 1, 3, ~0u, 21);
TEST_READER_STATE(reader, XmlReadState_Interactive); TEST_READER_STATE(reader, XmlReadState_Interactive);
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 1, "expected 1, got %d\n", count); ok(count == 1, "expected 1, got %d\n", count);
ret = IXmlReader_IsEmptyElement(reader); ret = IXmlReader_IsEmptyElement(reader);
...@@ -982,20 +982,20 @@ todo_wine { ...@@ -982,20 +982,20 @@ todo_wine {
type = -1; type = -1;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
TEST_READER_POSITION2(reader, 1, 7, ~0u, 21); TEST_READER_POSITION2(reader, 1, 7, ~0u, 21);
/* try to move from last attribute */ /* try to move from last attribute */
hr = IXmlReader_MoveToNextAttribute(reader); hr = IXmlReader_MoveToNextAttribute(reader);
ok(hr == S_FALSE, "expected S_FALSE, got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
read_node(reader, XmlNodeType_Element); read_node(reader, XmlNodeType_Element);
TEST_READER_POSITION2(reader, 1, 23, ~0u, 40); TEST_READER_POSITION2(reader, 1, 23, ~0u, 40);
TEST_READER_STATE(reader, XmlReadState_Interactive); TEST_READER_STATE(reader, XmlReadState_Interactive);
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 0, "expected 0, got %d\n", count); ok(count == 0, "expected 0, got %d\n", count);
ret = IXmlReader_IsEmptyElement(reader); ret = IXmlReader_IsEmptyElement(reader);
...@@ -1007,7 +1007,7 @@ todo_wine { ...@@ -1007,7 +1007,7 @@ todo_wine {
type = -1; type = -1;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
todo_wine todo_wine
ok(hr == WC_E_SYNTAX || hr == WC_E_XMLCHARACTER /* XP */, "expected WC_E_SYNTAX, got %08x\n", hr); ok(hr == WC_E_SYNTAX || hr == WC_E_XMLCHARACTER /* XP */, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "expected XmlNodeType_None, got %s\n", type_to_str(type)); ok(type == XmlNodeType_None, "expected XmlNodeType_None, got %s\n", type_to_str(type));
TEST_READER_POSITION(reader, 1, 41); TEST_READER_POSITION(reader, 1, 41);
todo_wine todo_wine
...@@ -1053,7 +1053,7 @@ static void test_read_comment(void) ...@@ -1053,7 +1053,7 @@ static void test_read_comment(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, teststr); set_input_string(reader, teststr);
...@@ -1066,7 +1066,7 @@ static void test_read_comment(void) ...@@ -1066,7 +1066,7 @@ static void test_read_comment(void)
if (type == XmlNodeType_Text || type == XmlNodeType_Comment) if (type == XmlNodeType_Text || type == XmlNodeType_Comment)
{ {
hr = IXmlReader_GetValue(reader, &value, NULL); hr = IXmlReader_GetValue(reader, &value, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*value != 0, "Expected node value\n"); ok(*value != 0, "Expected node value\n");
} }
i++; i++;
...@@ -1079,9 +1079,9 @@ static void test_read_comment(void) ...@@ -1079,9 +1079,9 @@ static void test_read_comment(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
if (test->hr_broken) if (test->hr_broken)
ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml); ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
else else
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1092,14 +1092,14 @@ static void test_read_comment(void) ...@@ -1092,14 +1092,14 @@ static void test_read_comment(void)
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, NULL); hr = IXmlReader_GetLocalName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
reader_qname(reader, L""); reader_qname(reader, L"");
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, NULL); hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
/* value */ /* value */
...@@ -1134,7 +1134,7 @@ static void test_read_pi(void) ...@@ -1134,7 +1134,7 @@ static void test_read_pi(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1145,9 +1145,9 @@ static void test_read_pi(void) ...@@ -1145,9 +1145,9 @@ static void test_read_pi(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
if (test->hr_broken) if (test->hr_broken)
ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml); ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
else else
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1160,7 +1160,7 @@ static void test_read_pi(void) ...@@ -1160,7 +1160,7 @@ static void test_read_pi(void)
len = 0; len = 0;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == lstrlenW(test->name), "got %u\n", len); ok(len == lstrlenW(test->name), "got %u\n", len);
ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
...@@ -1230,7 +1230,7 @@ static void test_read_full(void) ...@@ -1230,7 +1230,7 @@ static void test_read_full(void)
int i; int i;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, test->xml); set_input_string(reader, test->xml);
...@@ -1257,10 +1257,10 @@ static void test_read_public_dtd(void) ...@@ -1257,10 +1257,10 @@ static void test_read_public_dtd(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse);
ok(hr == S_OK, "got 0x%8x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, test_public_dtd); set_input_string(reader, test_public_dtd);
...@@ -1268,15 +1268,15 @@ static void test_read_public_dtd(void) ...@@ -1268,15 +1268,15 @@ static void test_read_public_dtd(void)
count = 0; count = 0;
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 2, "got %d\n", count); ok(count == 2, "got %d\n", count);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
reader_name(reader, L"PUBLIC"); reader_name(reader, L"PUBLIC");
...@@ -1286,7 +1286,7 @@ static void test_read_public_dtd(void) ...@@ -1286,7 +1286,7 @@ static void test_read_public_dtd(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
reader_name(reader, L"SYSTEM"); reader_name(reader, L"SYSTEM");
...@@ -1298,7 +1298,7 @@ static void test_read_public_dtd(void) ...@@ -1298,7 +1298,7 @@ static void test_read_public_dtd(void)
len = 0; len = 0;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine { todo_wine {
ok(len == lstrlenW(dtdnameW), "got %u\n", len); ok(len == lstrlenW(dtdnameW), "got %u\n", len);
ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
...@@ -1320,10 +1320,10 @@ static void test_read_system_dtd(void) ...@@ -1320,10 +1320,10 @@ static void test_read_system_dtd(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse);
ok(hr == S_OK, "got 0x%8x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, test_system_dtd); set_input_string(reader, test_system_dtd);
...@@ -1331,15 +1331,15 @@ static void test_read_system_dtd(void) ...@@ -1331,15 +1331,15 @@ static void test_read_system_dtd(void)
count = 0; count = 0;
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 1, "got %d\n", count); ok(count == 1, "got %d\n", count);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "got %d\n", type); ok(type == XmlNodeType_Attribute, "got %d\n", type);
reader_name(reader, L"SYSTEM"); reader_name(reader, L"SYSTEM");
...@@ -1351,7 +1351,7 @@ static void test_read_system_dtd(void) ...@@ -1351,7 +1351,7 @@ static void test_read_system_dtd(void)
len = 0; len = 0;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine { todo_wine {
ok(len == lstrlenW(dtdnameW), "got %u\n", len); ok(len == lstrlenW(dtdnameW), "got %u\n", len);
ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, dtdnameW), "got %s\n", wine_dbgstr_w(str));
...@@ -1397,7 +1397,7 @@ static void test_read_element(void) ...@@ -1397,7 +1397,7 @@ static void test_read_element(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1406,10 +1406,10 @@ static void test_read_element(void) ...@@ -1406,10 +1406,10 @@ static void test_read_element(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
if (test->hr_broken) if (test->hr_broken)
ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml); ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
else else
todo_wine_if(test->hr == NC_E_UNDECLAREDPREFIX) todo_wine_if(test->hr == NC_E_UNDECLAREDPREFIX)
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1420,7 +1420,7 @@ static void test_read_element(void) ...@@ -1420,7 +1420,7 @@ static void test_read_element(void)
len = 0; len = 0;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == lstrlenW(test->name), "got %u\n", len); ok(len == lstrlenW(test->name), "got %u\n", len);
ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
...@@ -1444,7 +1444,7 @@ static void test_read_element(void) ...@@ -1444,7 +1444,7 @@ static void test_read_element(void)
depth = 123; depth = 123;
hr = IXmlReader_GetDepth(reader, &depth); hr = IXmlReader_GetDepth(reader, &depth);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]); ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
if (type == XmlNodeType_Element || type == XmlNodeType_EndElement) if (type == XmlNodeType_Element || type == XmlNodeType_EndElement)
...@@ -1453,7 +1453,7 @@ static void test_read_element(void) ...@@ -1453,7 +1453,7 @@ static void test_read_element(void)
prefix = NULL; prefix = NULL;
hr = IXmlReader_GetPrefix(reader, &prefix, NULL); hr = IXmlReader_GetPrefix(reader, &prefix, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(prefix != NULL, "got %p\n", prefix); ok(prefix != NULL, "got %p\n", prefix);
if (!*prefix) if (!*prefix)
...@@ -1462,12 +1462,12 @@ static void test_read_element(void) ...@@ -1462,12 +1462,12 @@ static void test_read_element(void)
local = NULL; local = NULL;
hr = IXmlReader_GetLocalName(reader, &local, NULL); hr = IXmlReader_GetLocalName(reader, &local, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(local != NULL, "got %p\n", local); ok(local != NULL, "got %p\n", local);
qname = NULL; qname = NULL;
hr = IXmlReader_GetQualifiedName(reader, &qname, NULL); hr = IXmlReader_GetQualifiedName(reader, &qname, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(qname != NULL, "got %p\n", qname); ok(qname != NULL, "got %p\n", qname);
ok(local == qname, "expected same pointer\n"); ok(local == qname, "expected same pointer\n");
...@@ -1478,7 +1478,7 @@ static void test_read_element(void) ...@@ -1478,7 +1478,7 @@ static void test_read_element(void)
{ {
count = 1; count = 1;
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(count == 0, "got %u\n", count); ok(count == 0, "got %u\n", count);
} }
...@@ -1486,7 +1486,7 @@ static void test_read_element(void) ...@@ -1486,7 +1486,7 @@ static void test_read_element(void)
{ {
count = 0; count = 0;
hr = IXmlReader_GetAttributeCount(reader, &count); hr = IXmlReader_GetAttributeCount(reader, &count);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* moving to attributes increases depth */ /* moving to attributes increases depth */
if (count) if (count)
...@@ -1496,14 +1496,14 @@ static void test_read_element(void) ...@@ -1496,14 +1496,14 @@ static void test_read_element(void)
reader_value(reader, L""); reader_value(reader, L"");
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_GetValue(reader, &value, NULL); hr = IXmlReader_GetValue(reader, &value, NULL);
ok(*value != 0, "Unexpected value %s\n", wine_dbgstr_w(value)); ok(*value != 0, "Unexpected value %s\n", wine_dbgstr_w(value));
depth = 123; depth = 123;
hr = IXmlReader_GetDepth(reader, &depth); hr = IXmlReader_GetDepth(reader, &depth);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(depth == depths[i] + 1, "%u: got depth %u, expected %u\n", i, depth, depths[i] + 1); ok(depth == depths[i] + 1, "%u: got depth %u, expected %u\n", i, depth, depths[i] + 1);
move_to_element(reader); move_to_element(reader);
...@@ -1511,7 +1511,7 @@ static void test_read_element(void) ...@@ -1511,7 +1511,7 @@ static void test_read_element(void)
depth = 123; depth = 123;
hr = IXmlReader_GetDepth(reader, &depth); hr = IXmlReader_GetDepth(reader, &depth);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]); ok(depth == depths[i], "%u: got depth %u, expected %u\n", i, depth, depths[i]);
} }
} }
...@@ -1526,7 +1526,7 @@ static void test_read_element(void) ...@@ -1526,7 +1526,7 @@ static void test_read_element(void)
type = XmlNodeType_Element; type = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == WC_E_ELEMENTMATCH, "got %08x\n", hr); ok(hr == WC_E_ELEMENTMATCH, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "got %d\n", type); ok(type == XmlNodeType_None, "got %d\n", type);
TEST_READER_STATE(reader, XmlReadState_Error); TEST_READER_STATE(reader, XmlReadState_Error);
...@@ -1544,16 +1544,16 @@ static void test_read_pending(void) ...@@ -1544,16 +1544,16 @@ static void test_read_pending(void)
int c; int c;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream); hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* first read call returns incomplete node, second attempt fails with E_PENDING */ /* first read call returns incomplete node, second attempt fails with E_PENDING */
stream_readcall = 0; stream_readcall = 0;
type = XmlNodeType_Element; type = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK || broken(hr == E_PENDING), "got 0x%08x\n", hr); ok(hr == S_OK || broken(hr == E_PENDING), "Unexpected hr %#lx.\n", hr);
/* newer versions are happy when it's enough data to detect node type, /* newer versions are happy when it's enough data to detect node type,
older versions keep reading until it fails to read more */ older versions keep reading until it fails to read more */
todo_wine todo_wine
...@@ -1564,7 +1564,7 @@ static void test_read_pending(void) ...@@ -1564,7 +1564,7 @@ static void test_read_pending(void)
c = stream_readcall; c = stream_readcall;
value = (void*)0xdeadbeef; value = (void*)0xdeadbeef;
hr = IXmlReader_GetValue(reader, &value, NULL); hr = IXmlReader_GetValue(reader, &value, NULL);
ok(hr == E_PENDING, "got 0x%08x\n", hr); ok(hr == E_PENDING, "Unexpected hr %#lx.\n", hr);
ok(value == NULL || broken(value == (void*)0xdeadbeef) /* Win8 sets it to NULL */, "got %p\n", value); ok(value == NULL || broken(value == (void*)0xdeadbeef) /* Win8 sets it to NULL */, "got %p\n", value);
ok(c < stream_readcall || broken(c == stream_readcall), "got %d, expected %d\n", stream_readcall, c+1); ok(c < stream_readcall || broken(c == stream_readcall), "got %d, expected %d\n", stream_readcall, c+1);
...@@ -1581,12 +1581,12 @@ static void test_readvaluechunk(void) ...@@ -1581,12 +1581,12 @@ static void test_readvaluechunk(void)
UINT c; UINT c;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, "<!-- comment1 --><!-- comment2 -->"); set_input_string(reader, "<!-- comment1 --><!-- comment2 -->");
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Comment, "type = %u\n", type); ok(type == XmlNodeType_Comment, "type = %u\n", type);
read_value_char(reader, ' '); read_value_char(reader, ' ');
...@@ -1599,13 +1599,13 @@ static void test_readvaluechunk(void) ...@@ -1599,13 +1599,13 @@ static void test_readvaluechunk(void)
c = 0; c = 0;
b = 0; b = 0;
hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c); hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(c == 0, "got %u\n", c); ok(c == 0, "got %u\n", c);
ok(b == 0, "got %x\n", b); ok(b == 0, "got %x\n", b);
c = 0xdeadbeef; c = 0xdeadbeef;
hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c); hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!c, "c = %u\n", c); ok(!c, "c = %u\n", c);
reader_value(reader, L"omment1 "); reader_value(reader, L"omment1 ");
...@@ -1615,13 +1615,13 @@ static void test_readvaluechunk(void) ...@@ -1615,13 +1615,13 @@ static void test_readvaluechunk(void)
c = 0xdeadbeef; c = 0xdeadbeef;
hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c); hr = IXmlReader_ReadValueChunk(reader, buf, 0, &c);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!c, "c = %u\n", c); ok(!c, "c = %u\n", c);
c = 0xdeadbeef; c = 0xdeadbeef;
memset(buf, 0xcc, sizeof(buf)); memset(buf, 0xcc, sizeof(buf));
hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c); hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(c == 10, "got %u\n", c); ok(c == 10, "got %u\n", c);
ok(buf[c] == 0xcccc, "buffer overflow\n"); ok(buf[c] == 0xcccc, "buffer overflow\n");
buf[c] = 0; buf[c] = 0;
...@@ -1630,7 +1630,7 @@ static void test_readvaluechunk(void) ...@@ -1630,7 +1630,7 @@ static void test_readvaluechunk(void)
c = 0xdeadbeef; c = 0xdeadbeef;
memset(buf, 0xcc, sizeof(buf)); memset(buf, 0xcc, sizeof(buf));
hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c); hr = IXmlReader_ReadValueChunk(reader, buf, ARRAY_SIZE(buf), &c);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(!c, "got %u\n", c); ok(!c, "got %u\n", c);
/* portion read as chunk is skipped from resulting node value */ /* portion read as chunk is skipped from resulting node value */
...@@ -1640,7 +1640,7 @@ static void test_readvaluechunk(void) ...@@ -1640,7 +1640,7 @@ static void test_readvaluechunk(void)
c = 0xdeadbeef; c = 0xdeadbeef;
b = 0xffff; b = 0xffff;
hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c); hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(c == 0, "got %u\n", c); ok(c == 0, "got %u\n", c);
ok(b == 0xffff, "got %x\n", b); ok(b == 0xffff, "got %x\n", b);
...@@ -1666,7 +1666,7 @@ static void test_read_cdata(void) ...@@ -1666,7 +1666,7 @@ static void test_read_cdata(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1685,9 +1685,9 @@ static void test_read_cdata(void) ...@@ -1685,9 +1685,9 @@ static void test_read_cdata(void)
} }
if (test->hr_broken) if (test->hr_broken)
ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml); ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
else else
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1699,19 +1699,19 @@ static void test_read_cdata(void) ...@@ -1699,19 +1699,19 @@ static void test_read_cdata(void)
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, NULL); hr = IXmlReader_GetLocalName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
len = 1; len = 1;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "got %u\n", len); ok(len == 0, "got %u\n", len);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, NULL); hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
/* value */ /* value */
...@@ -1740,7 +1740,7 @@ static void test_read_text(void) ...@@ -1740,7 +1740,7 @@ static void test_read_text(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1757,7 +1757,7 @@ static void test_read_text(void) ...@@ -1757,7 +1757,7 @@ static void test_read_text(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
} }
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1769,19 +1769,19 @@ static void test_read_text(void) ...@@ -1769,19 +1769,19 @@ static void test_read_text(void)
str = NULL; str = NULL;
hr = IXmlReader_GetLocalName(reader, &str, NULL); hr = IXmlReader_GetLocalName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
len = 1; len = 1;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == 0, "got %u\n", len); ok(len == 0, "got %u\n", len);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, NULL); hr = IXmlReader_GetQualifiedName(reader, &str, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(*str == 0, "got %s\n", wine_dbgstr_w(str)); ok(*str == 0, "got %s\n", wine_dbgstr_w(str));
/* value */ /* value */
...@@ -1812,7 +1812,7 @@ static void test_isemptyelement(void) ...@@ -1812,7 +1812,7 @@ static void test_isemptyelement(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1823,7 +1823,7 @@ static void test_isemptyelement(void) ...@@ -1823,7 +1823,7 @@ static void test_isemptyelement(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "got %d\n", type); ok(type == XmlNodeType_Element, "got %d\n", type);
ret = IXmlReader_IsEmptyElement(reader); ret = IXmlReader_IsEmptyElement(reader);
...@@ -1867,7 +1867,7 @@ static void test_read_attribute(void) ...@@ -1867,7 +1867,7 @@ static void test_read_attribute(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
while (test->xml) while (test->xml)
{ {
...@@ -1878,9 +1878,9 @@ static void test_read_attribute(void) ...@@ -1878,9 +1878,9 @@ static void test_read_attribute(void)
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
if (test->hr_broken) if (test->hr_broken)
ok(hr == test->hr || broken(hr == test->hr_broken), "got %08x for %s\n", hr, test->xml); ok(hr == test->hr || broken(hr == test->hr_broken), "Unexpected hr %#lx, for %s.\n", hr, test->xml);
else else
ok(hr == test->hr, "got %08x for %s\n", hr, test->xml); ok(hr == test->hr, "Unexpected hr %#lx, for %s.\n", hr, test->xml);
if (hr == S_OK) if (hr == S_OK)
{ {
const WCHAR *str; const WCHAR *str;
...@@ -1888,19 +1888,19 @@ static void test_read_attribute(void) ...@@ -1888,19 +1888,19 @@ static void test_read_attribute(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "Failed to get node type, %#x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml); ok(type == XmlNodeType_Element, "got %d for %s\n", type, test->xml);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_name(reader, test->name); reader_name(reader, test->name);
len = 1; len = 1;
str = NULL; str = NULL;
hr = IXmlReader_GetQualifiedName(reader, &str, &len); hr = IXmlReader_GetQualifiedName(reader, &str, &len);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(len == lstrlenW(test->name), "got %u\n", len); ok(len == lstrlenW(test->name), "got %u\n", len);
ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str)); ok(!lstrcmpW(str, test->name), "got %s\n", wine_dbgstr_w(str));
...@@ -1921,23 +1921,23 @@ static void test_reader_properties(void) ...@@ -1921,23 +1921,23 @@ static void test_reader_properties(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
value = 0; value = 0;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
ok(hr == S_OK, "GetProperty failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == 256, "Unexpected default max depth value %ld\n", value); ok(value == 256, "Unexpected default max depth value %Id.\n", value);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MultiLanguage, 0); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MultiLanguage, 0);
ok(hr == S_OK, "SetProperty failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
ok(hr == S_OK, "SetProperty failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
value = 256; value = 256;
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_MaxElementDepth, &value);
ok(hr == S_OK, "GetProperty failed: %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == 0, "Unexpected max depth value %ld\n", value); ok(value == 0, "Unexpected max depth value %Id.\n", value);
IXmlReader_Release(reader); IXmlReader_Release(reader);
} }
...@@ -1960,7 +1960,7 @@ static void test_prefix(void) ...@@ -1960,7 +1960,7 @@ static void test_prefix(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(prefix_tests); i++) { for (i = 0; i < ARRAY_SIZE(prefix_tests); i++) {
XmlNodeType type; XmlNodeType type;
...@@ -1968,16 +1968,16 @@ static void test_prefix(void) ...@@ -1968,16 +1968,16 @@ static void test_prefix(void)
set_input_string(reader, prefix_tests[i].xml); set_input_string(reader, prefix_tests[i].xml);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "Read() failed, %#x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type); ok(type == XmlNodeType_Element, "Unexpected node type %d.\n", type);
reader_prefix(reader, prefix_tests[i].prefix1); reader_prefix(reader, prefix_tests[i].prefix1);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "MoveToFirstAttribute() failed, %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type); ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
reader_prefix(reader, prefix_tests[i].prefix2); reader_prefix(reader, prefix_tests[i].prefix2);
...@@ -1985,7 +1985,7 @@ static void test_prefix(void) ...@@ -1985,7 +1985,7 @@ static void test_prefix(void)
next_attribute(reader); next_attribute(reader);
hr = IXmlReader_GetNodeType(reader, &type); hr = IXmlReader_GetNodeType(reader, &type);
ok(hr == S_OK, "GetNodeType() failed, %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type); ok(type == XmlNodeType_Attribute, "Unexpected node type %d.\n", type);
reader_prefix(reader, prefix_tests[i].prefix3); reader_prefix(reader, prefix_tests[i].prefix3);
...@@ -2035,7 +2035,7 @@ static void test_namespaceuri(void) ...@@ -2035,7 +2035,7 @@ static void test_namespaceuri(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(uri_tests); i++) { for (i = 0; i < ARRAY_SIZE(uri_tests); i++) {
unsigned int j = 0; unsigned int j = 0;
...@@ -2059,13 +2059,13 @@ static void test_namespaceuri(void) ...@@ -2059,13 +2059,13 @@ static void test_namespaceuri(void)
local = NULL; local = NULL;
length = 0; length = 0;
hr = IXmlReader_GetLocalName(reader, &local, &length); hr = IXmlReader_GetLocalName(reader, &local, &length);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(local != NULL, "Unexpected NULL local name pointer\n"); ok(local != NULL, "Unexpected NULL local name pointer\n");
qname = NULL; qname = NULL;
length2 = 0; length2 = 0;
hr = IXmlReader_GetQualifiedName(reader, &qname, &length2); hr = IXmlReader_GetQualifiedName(reader, &qname, &length2);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(qname != NULL, "Unexpected NULL qualified name pointer\n"); ok(qname != NULL, "Unexpected NULL qualified name pointer\n");
if (type == XmlNodeType_Element || if (type == XmlNodeType_Element ||
...@@ -2100,28 +2100,28 @@ static void test_read_charref(void) ...@@ -2100,28 +2100,28 @@ static void test_read_charref(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, testA); set_input_string(reader, testA);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "Unexpected node type %d\n", type); ok(type == XmlNodeType_Element, "Unexpected node type %d\n", type);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Text, "Unexpected node type %d\n", type); ok(type == XmlNodeType_Text, "Unexpected node type %d\n", type);
hr = IXmlReader_GetValue(reader, &value, NULL); hr = IXmlReader_GetValue(reader, &value, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!lstrcmpW(value, chardataW), "Text value : %s\n", wine_dbgstr_w(value)); ok(!lstrcmpW(value, chardataW), "Text value : %s\n", wine_dbgstr_w(value));
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_EndElement, "Unexpected node type %d\n", type); ok(type == XmlNodeType_EndElement, "Unexpected node type %d\n", type);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_FALSE, "got %08x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "Unexpected node type %d\n", type); ok(type == XmlNodeType_None, "Unexpected node type %d\n", type);
IXmlReader_Release(reader); IXmlReader_Release(reader);
...@@ -2154,7 +2154,7 @@ static void test_encoding_detection(void) ...@@ -2154,7 +2154,7 @@ static void test_encoding_detection(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* there's no way to query detected encoding back, so just verify that document is browsable */ /* there's no way to query detected encoding back, so just verify that document is browsable */
...@@ -2164,7 +2164,7 @@ static void test_encoding_detection(void) ...@@ -2164,7 +2164,7 @@ static void test_encoding_detection(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type != XmlNodeType_None, "Unexpected node type %d\n", type); ok(type != XmlNodeType_None, "Unexpected node type %d\n", type);
} }
...@@ -2173,11 +2173,11 @@ static void test_encoding_detection(void) ...@@ -2173,11 +2173,11 @@ static void test_encoding_detection(void)
stream = create_stream_on_data(encoding_testsW[i].text, lstrlenW(encoding_testsW[i].text) * sizeof(WCHAR)); stream = create_stream_on_data(encoding_testsW[i].text, lstrlenW(encoding_testsW[i].text) * sizeof(WCHAR));
hr = IXmlReader_SetInput(reader, (IUnknown *)stream); hr = IXmlReader_SetInput(reader, (IUnknown *)stream);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "%u: got %08x\n", i, hr); ok(hr == S_OK, "%u: unexpected hr %#lx.\n", i, hr);
ok(type != XmlNodeType_None, "%u: unexpected node type %d\n", i, type); ok(type != XmlNodeType_None, "%u: unexpected node type %d\n", i, type);
IStream_Release(stream); IStream_Release(stream);
...@@ -2193,8 +2193,8 @@ static void test_eof_state(IXmlReader *reader, BOOL eof) ...@@ -2193,8 +2193,8 @@ static void test_eof_state(IXmlReader *reader, BOOL eof)
ok(IXmlReader_IsEOF(reader) == eof, "Unexpected IsEOF() result\n"); ok(IXmlReader_IsEOF(reader) == eof, "Unexpected IsEOF() result\n");
hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state); hr = IXmlReader_GetProperty(reader, XmlReaderProperty_ReadState, &state);
ok(hr == S_OK, "GetProperty() failed, %#x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok((state == XmlReadState_EndOfFile) == eof, "Unexpected EndOfFile state %ld\n", state); ok((state == XmlReadState_EndOfFile) == eof, "Unexpected EndOfFile state %Id.\n", state);
} }
static void test_endoffile(void) static void test_endoffile(void)
...@@ -2204,7 +2204,7 @@ static void test_endoffile(void) ...@@ -2204,7 +2204,7 @@ static void test_endoffile(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_eof_state(reader, FALSE); test_eof_state(reader, FALSE);
...@@ -2214,46 +2214,46 @@ static void test_endoffile(void) ...@@ -2214,46 +2214,46 @@ static void test_endoffile(void)
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %#x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "Unexpected type %d\n", type); ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
test_eof_state(reader, FALSE); test_eof_state(reader, FALSE);
type = XmlNodeType_Element; type = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_FALSE, "got %#x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "Unexpected type %d\n", type); ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
test_eof_state(reader, TRUE); test_eof_state(reader, TRUE);
hr = IXmlReader_SetInput(reader, NULL); hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_eof_state(reader, FALSE); test_eof_state(reader, FALSE);
IXmlReader_Release(reader); IXmlReader_Release(reader);
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, "<a/>text"); set_input_string(reader, "<a/>text");
type = XmlNodeType_None; type = XmlNodeType_None;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %#x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "Unexpected type %d\n", type); ok(type == XmlNodeType_Element, "Unexpected type %d\n", type);
test_eof_state(reader, FALSE); test_eof_state(reader, FALSE);
type = XmlNodeType_Element; type = XmlNodeType_Element;
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == WC_E_SYNTAX, "got %#x\n", hr); ok(hr == WC_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_None, "Unexpected type %d\n", type); ok(type == XmlNodeType_None, "Unexpected type %d\n", type);
test_eof_state(reader, FALSE); test_eof_state(reader, FALSE);
hr = IXmlReader_SetInput(reader, NULL); hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IXmlReader_Release(reader); IXmlReader_Release(reader);
} }
...@@ -2274,37 +2274,37 @@ static void test_max_element_depth(void) ...@@ -2274,37 +2274,37 @@ static void test_max_element_depth(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, xml); set_input_string(reader, xml);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 0); TEST_DEPTH(reader, 0);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 0); TEST_DEPTH(reader, 0);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 1); TEST_DEPTH(reader, 1);
TEST_READER_STATE(reader, XmlReadState_Interactive); TEST_READER_STATE(reader, XmlReadState_Interactive);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr); ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH2(reader, 0, 2); TEST_DEPTH2(reader, 0, 2);
TEST_READER_STATE(reader, XmlReadState_Error); TEST_READER_STATE(reader, XmlReadState_Error);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 10); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 10);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr); ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH2(reader, 0, 2); TEST_DEPTH2(reader, 0, 2);
TEST_READER_STATE(reader, XmlReadState_Error); TEST_READER_STATE(reader, XmlReadState_Error);
...@@ -2313,34 +2313,34 @@ static void test_max_element_depth(void) ...@@ -2313,34 +2313,34 @@ static void test_max_element_depth(void)
set_input_string(reader, xml); set_input_string(reader, xml);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 2);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 0); TEST_DEPTH(reader, 0);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 0); TEST_DEPTH(reader, 0);
hr = IXmlReader_Read(reader, NULL); hr = IXmlReader_Read(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 1); TEST_DEPTH(reader, 1);
hr = IXmlReader_MoveToFirstAttribute(reader); hr = IXmlReader_MoveToFirstAttribute(reader);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_DEPTH(reader, 2); TEST_DEPTH(reader, 2);
TEST_READER_STATE(reader, XmlReadState_Interactive); TEST_READER_STATE(reader, XmlReadState_Interactive);
nodetype = 123; nodetype = 123;
hr = IXmlReader_Read(reader, &nodetype); hr = IXmlReader_Read(reader, &nodetype);
ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr); ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype); ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
nodetype = 123; nodetype = 123;
hr = IXmlReader_Read(reader, &nodetype); hr = IXmlReader_Read(reader, &nodetype);
ok(hr == SC_E_MAXELEMENTDEPTH, "got %08x\n", hr); ok(hr == SC_E_MAXELEMENTDEPTH, "Unexpected hr %#lx.\n", hr);
ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype); ok(nodetype == XmlNodeType_None, "got node type %d\n", nodetype);
TEST_DEPTH2(reader, 0, 2); TEST_DEPTH2(reader, 0, 2);
...@@ -2350,7 +2350,7 @@ static void test_max_element_depth(void) ...@@ -2350,7 +2350,7 @@ static void test_max_element_depth(void)
set_input_string(reader, xml); set_input_string(reader, xml);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0); hr = IXmlReader_SetProperty(reader, XmlReaderProperty_MaxElementDepth, 0);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
count = 0; count = 0;
while (IXmlReader_Read(reader, NULL) == S_OK) while (IXmlReader_Read(reader, NULL) == S_OK)
...@@ -2370,25 +2370,25 @@ static void test_reader_position(void) ...@@ -2370,25 +2370,25 @@ static void test_reader_position(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE(reader, XmlReadState_Closed); TEST_READER_STATE(reader, XmlReadState_Closed);
/* position methods with Null args */ /* position methods with Null args */
hr = IXmlReader_GetLineNumber(reader, NULL); hr = IXmlReader_GetLineNumber(reader, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_GetLinePosition(reader, NULL); hr = IXmlReader_GetLinePosition(reader, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
position = 123; position = 123;
hr = IXmlReader_GetLinePosition(reader, &position); hr = IXmlReader_GetLinePosition(reader, &position);
ok(hr == S_FALSE, "got %#x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(position == 0, "got %u\n", position); ok(position == 0, "got %u\n", position);
position = 123; position = 123;
hr = IXmlReader_GetLineNumber(reader, &position); hr = IXmlReader_GetLineNumber(reader, &position);
ok(hr == S_FALSE, "got %#x\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
ok(position == 0, "got %u\n", position); ok(position == 0, "got %u\n", position);
set_input_string(reader, xml); set_input_string(reader, xml);
...@@ -2396,7 +2396,7 @@ static void test_reader_position(void) ...@@ -2396,7 +2396,7 @@ static void test_reader_position(void)
TEST_READER_STATE(reader, XmlReadState_Initial); TEST_READER_STATE(reader, XmlReadState_Initial);
TEST_READER_POSITION(reader, 0, 0); TEST_READER_POSITION(reader, 0, 0);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Element, "got type %d\n", type); ok(type == XmlNodeType_Element, "got type %d\n", type);
TEST_READER_POSITION2(reader, 1, 2, ~0u, 34); TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
...@@ -2410,17 +2410,17 @@ static void test_reader_position(void) ...@@ -2410,17 +2410,17 @@ static void test_reader_position(void)
TEST_READER_POSITION2(reader, 1, 2, ~0u, 34); TEST_READER_POSITION2(reader, 1, 2, ~0u, 34);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_Whitespace, "got type %d\n", type); ok(type == XmlNodeType_Whitespace, "got type %d\n", type);
TEST_READER_POSITION2(reader, 1, 35, 2, 6); TEST_READER_POSITION2(reader, 1, 35, 2, 6);
hr = IXmlReader_Read(reader, &type); hr = IXmlReader_Read(reader, &type);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(type == XmlNodeType_EndElement, "got type %d\n", type); ok(type == XmlNodeType_EndElement, "got type %d\n", type);
TEST_READER_POSITION2(reader, 2, 3, 2, 6); TEST_READER_POSITION2(reader, 2, 3, 2, 6);
hr = IXmlReader_SetInput(reader, NULL); hr = IXmlReader_SetInput(reader, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed); TEST_READER_STATE2(reader, XmlReadState_Initial, XmlReadState_Closed);
TEST_READER_POSITION(reader, 0, 0); TEST_READER_POSITION(reader, 0, 0);
...@@ -2434,7 +2434,7 @@ static void test_string_pointers(void) ...@@ -2434,7 +2434,7 @@ static void test_string_pointers(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, "<elem xmlns=\"myns\">myns<elem2 /></elem>"); set_input_string(reader, "<elem xmlns=\"myns\">myns<elem2 /></elem>");
...@@ -2565,67 +2565,67 @@ static void test_attribute_by_name(void) ...@@ -2565,67 +2565,67 @@ static void test_attribute_by_name(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL); hr = CreateXmlReader(&IID_IXmlReader, (void **)&reader, NULL);
ok(hr == S_OK, "Failed to create reader, hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
set_input_string(reader, xml); set_input_string(reader, xml);
hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL); hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* WinXP */, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG || broken(hr == S_FALSE) /* WinXP */, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
read_node(reader, XmlNodeType_Element); read_node(reader, XmlNodeType_Element);
hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, emptyW, NULL);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
read_node(reader, XmlNodeType_Element); read_node(reader, XmlNodeType_Element);
hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL); hr = IXmlReader_MoveToAttributeByName(reader, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, NULL, xmlns_uriW); hr = IXmlReader_MoveToAttributeByName(reader, NULL, xmlns_uriW);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, emptyW, xmlns_uriW); hr = IXmlReader_MoveToAttributeByName(reader, emptyW, xmlns_uriW);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, NULL);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, xmlns_uriW); hr = IXmlReader_MoveToAttributeByName(reader, xmlnsW, xmlns_uriW);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"myns"); reader_value(reader, L"myns");
hr = IXmlReader_MoveToAttributeByName(reader, aW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, aW, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"value a"); reader_value(reader, L"value a");
hr = IXmlReader_MoveToAttributeByName(reader, bW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, bW, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"value b"); reader_value(reader, L"value b");
hr = IXmlReader_MoveToAttributeByName(reader, aW, mynsW); hr = IXmlReader_MoveToAttributeByName(reader, aW, mynsW);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, nsW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, nsW, NULL);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
hr = IXmlReader_MoveToAttributeByName(reader, nsW, xmlns_uriW); hr = IXmlReader_MoveToAttributeByName(reader, nsW, xmlns_uriW);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"ns uri"); reader_value(reader, L"ns uri");
hr = IXmlReader_MoveToAttributeByName(reader, bW, emptyW); hr = IXmlReader_MoveToAttributeByName(reader, bW, emptyW);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"value b"); reader_value(reader, L"value b");
hr = IXmlReader_MoveToAttributeByName(reader, cW, NULL); hr = IXmlReader_MoveToAttributeByName(reader, cW, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"value c2"); reader_value(reader, L"value c2");
hr = IXmlReader_MoveToAttributeByName(reader, cW, nsuriW); hr = IXmlReader_MoveToAttributeByName(reader, cW, nsuriW);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
reader_value(reader, L"value c"); reader_value(reader, L"value c");
IXmlReader_Release(reader); IXmlReader_Release(reader);
......
...@@ -41,7 +41,7 @@ static void _expect_ref(IUnknown *obj, ULONG ref, int line) ...@@ -41,7 +41,7 @@ static void _expect_ref(IUnknown *obj, ULONG ref, int line)
ULONG refcount; ULONG refcount;
IUnknown_AddRef(obj); IUnknown_AddRef(obj);
refcount = IUnknown_Release(obj); refcount = IUnknown_Release(obj);
ok_(__FILE__, line)(refcount == ref, "expected refcount %d, got %d\n", ref, refcount); ok_(__FILE__, line)(refcount == ref, "expected refcount %lu, got %lu.\n", ref, refcount);
} }
static void check_output_raw(IStream *stream, const void *expected, SIZE_T size, int line) static void check_output_raw(IStream *stream, const void *expected, SIZE_T size, int line)
...@@ -52,10 +52,10 @@ static void check_output_raw(IStream *stream, const void *expected, SIZE_T size, ...@@ -52,10 +52,10 @@ static void check_output_raw(IStream *stream, const void *expected, SIZE_T size,
WCHAR *ptr; WCHAR *ptr;
hr = GetHGlobalFromStream(stream, &hglobal); hr = GetHGlobalFromStream(stream, &hglobal);
ok_(__FILE__, line)(hr == S_OK, "Failed to get the stream handle, hr %#x.\n", hr); ok_(__FILE__, line)(hr == S_OK, "Failed to get the stream handle, hr %#lx.\n", hr);
content_size = GlobalSize(hglobal); content_size = GlobalSize(hglobal);
ok_(__FILE__, line)(size == content_size, "Unexpected test output size %ld.\n", content_size); ok_(__FILE__, line)(size == content_size, "Unexpected test output size %Id.\n", content_size);
ptr = GlobalLock(hglobal); ptr = GlobalLock(hglobal);
if (size <= content_size) if (size <= content_size)
ok_(__FILE__, line)(!memcmp(expected, ptr, size), "Unexpected output content.\n"); ok_(__FILE__, line)(!memcmp(expected, ptr, size), "Unexpected output content.\n");
...@@ -73,7 +73,7 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l ...@@ -73,7 +73,7 @@ static void check_output(IStream *stream, const char *expected, BOOL todo, int l
char *ptr; char *ptr;
hr = GetHGlobalFromStream(stream, &hglobal); hr = GetHGlobalFromStream(stream, &hglobal);
ok_(__FILE__, line)(hr == S_OK, "got 0x%08x\n", hr); ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
size = GlobalSize(hglobal); size = GlobalSize(hglobal);
ptr = GlobalLock(hglobal); ptr = GlobalLock(hglobal);
...@@ -111,7 +111,7 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property) ...@@ -111,7 +111,7 @@ static void writer_set_property(IXmlWriter *writer, XmlWriterProperty property)
HRESULT hr; HRESULT hr;
hr = IXmlWriter_SetProperty(writer, property, TRUE); hr = IXmlWriter_SetProperty(writer, property, TRUE);
ok(hr == S_OK, "Failed to set writer property, hr %#x.\n", hr); ok(hr == S_OK, "Failed to set writer property, hr %#lx.\n", hr);
} }
/* used to test all Write* methods for consistent error state */ /* used to test all Write* methods for consistent error state */
...@@ -123,67 +123,67 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr) ...@@ -123,67 +123,67 @@ static void check_writer_state(IXmlWriter *writer, HRESULT exp_hr)
/* FIXME: add WriteAttributes */ /* FIXME: add WriteAttributes */
hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteCData(writer, aW); hr = IXmlWriter_WriteCData(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteCharEntity(writer, aW[0]); hr = IXmlWriter_WriteCharEntity(writer, aW[0]);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteChars(writer, aW, 1); hr = IXmlWriter_WriteChars(writer, aW, 1);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteComment(writer, aW); hr = IXmlWriter_WriteComment(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); 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, aW, NULL, NULL, NULL);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); 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, aW, NULL, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteEntityRef(writer, aW); hr = IXmlWriter_WriteEntityRef(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteName(writer, aW); hr = IXmlWriter_WriteName(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteNmToken(writer, aW); hr = IXmlWriter_WriteNmToken(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx, expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteNode */ /* FIXME: add WriteNode */
/* FIXME: add WriteNodeShallow */ /* FIXME: add WriteNodeShallow */
hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL); hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteRaw(writer, aW); hr = IXmlWriter_WriteRaw(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteRawChars(writer, aW, 1); hr = IXmlWriter_WriteRawChars(writer, aW, 1);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); 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, aW, NULL);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
hr = IXmlWriter_WriteString(writer, aW); hr = IXmlWriter_WriteString(writer, aW);
ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr); ok(hr == exp_hr, "Unexpected hr %#lx., expected %#lx.\n", hr, exp_hr);
/* FIXME: add WriteSurrogateCharEntity */ /* FIXME: add WriteSurrogateCharEntity */
/* FIXME: add WriteWhitespace */ /* FIXME: add WriteWhitespace */
...@@ -195,10 +195,10 @@ static IStream *writer_set_output(IXmlWriter *writer) ...@@ -195,10 +195,10 @@ static IStream *writer_set_output(IXmlWriter *writer)
HRESULT hr; HRESULT hr;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
return stream; return stream;
} }
...@@ -295,39 +295,39 @@ static void test_writer_create(void) ...@@ -295,39 +295,39 @@ static void test_writer_create(void)
} }
hr = CreateXmlWriter(&IID_IStream, (void **)&unk, NULL); hr = CreateXmlWriter(&IID_IStream, (void **)&unk, NULL);
ok(hr == E_NOINTERFACE, "got %08x\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IUnknown, (void **)&unk, NULL); hr = CreateXmlWriter(&IID_IUnknown, (void **)&unk, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IUnknown_QueryInterface(unk, &IID_IXmlWriter, (void **)&writer); hr = IUnknown_QueryInterface(unk, &IID_IXmlWriter, (void **)&writer);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk == (IUnknown *)writer, "unexpected interface pointer\n"); ok(unk == (IUnknown *)writer, "unexpected interface pointer\n");
IUnknown_Release(unk); IUnknown_Release(unk);
IXmlWriter_Release(writer); IXmlWriter_Release(writer);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* check default properties values */ /* check default properties values */
value = 0; value = 0;
hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ByteOrderMark, &value); hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ByteOrderMark, &value);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == TRUE, "got %ld\n", value); ok(value == TRUE, "got %Id.\n", value);
value = TRUE; value = TRUE;
hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_Indent, &value); hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_Indent, &value);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == FALSE, "got %ld\n", value); ok(value == FALSE, "got %Id.\n", value);
value = TRUE; value = TRUE;
hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, &value); hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, &value);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == FALSE, "got %ld\n", value); ok(value == FALSE, "got %Id.\n", value);
value = XmlConformanceLevel_Auto; value = XmlConformanceLevel_Auto;
hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ConformanceLevel, &value); hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ConformanceLevel, &value);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value == XmlConformanceLevel_Document, "got %ld\n", value); ok(value == XmlConformanceLevel_Document, "got %Id.\n", value);
IXmlWriter_Release(writer); IXmlWriter_Release(writer);
} }
...@@ -337,78 +337,78 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output) ...@@ -337,78 +337,78 @@ static void test_invalid_output_encoding(IXmlWriter *writer, IUnknown *output)
HRESULT hr; HRESULT hr;
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Failed to set output, hr %#x.\n", hr); ok(hr == S_OK, "Failed to set output, hr %#lx.\n", hr);
/* TODO: WriteAttributes */ /* TODO: WriteAttributes */
hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, aW); hr = IXmlWriter_WriteCData(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100); hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteChars(writer, aW, 1); hr = IXmlWriter_WriteChars(writer, aW, 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, aW); hr = IXmlWriter_WriteComment(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL); hr = IXmlWriter_WriteDocType(writer, aW, NULL, NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL); hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEntityRef(writer, aW); hr = IXmlWriter_WriteEntityRef(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteName(writer, aW); hr = IXmlWriter_WriteName(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteNmToken(writer, aW); hr = IXmlWriter_WriteNmToken(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteNode */ /* TODO: WriteNode */
/* TODO: WriteNodeShallow */ /* TODO: WriteNodeShallow */
hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL); hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, aW); hr = IXmlWriter_WriteRaw(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRawChars(writer, aW, 1); hr = IXmlWriter_WriteRawChars(writer, aW, 1);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteString(writer, aW); hr = IXmlWriter_WriteString(writer, aW);
ok(hr == MX_E_ENCODING, "Unexpected hr %#x.\n", hr); ok(hr == MX_E_ENCODING, "Unexpected hr %#lx.\n", hr);
/* TODO: WriteSurrogateCharEntity */ /* TODO: WriteSurrogateCharEntity */
/* ًُُTODO: WriteWhitespace */ /* TODO: WriteWhitespace */
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
} }
static void test_writeroutput(void) static void test_writeroutput(void)
...@@ -425,15 +425,15 @@ static void test_writeroutput(void) ...@@ -425,15 +425,15 @@ static void test_writeroutput(void)
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, NULL, &output); hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, NULL, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
EXPECT_REF(output, 1); EXPECT_REF(output, 1);
IUnknown_Release(output); IUnknown_Release(output);
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output); hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
unk = NULL; unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk); hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine todo_wine
ok(unk != NULL && unk != output, "got %p, output %p\n", unk, output); ok(unk != NULL && unk != output, "got %p, output %p\n", unk, output);
EXPECT_REF(output, 2); EXPECT_REF(output, 2);
...@@ -444,14 +444,14 @@ static void test_writeroutput(void) ...@@ -444,14 +444,14 @@ static void test_writeroutput(void)
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, ~0u, &output); hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, ~0u, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IUnknown_Release(output); IUnknown_Release(output);
hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, CP_UTF8, &output); hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, CP_UTF8, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
unk = NULL; unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk); hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(unk != NULL, "got %p\n", unk); ok(unk != NULL, "got %p\n", unk);
/* releasing 'unk' crashes on native */ /* releasing 'unk' crashes on native */
IUnknown_Release(output); IUnknown_Release(output);
...@@ -460,27 +460,27 @@ static void test_writeroutput(void) ...@@ -460,27 +460,27 @@ static void test_writeroutput(void)
/* create with us-ascii */ /* create with us-ascii */
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output); hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, usasciiW, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IUnknown_Release(output); IUnknown_Release(output);
/* Output with codepage 1200. */ /* Output with codepage 1200. */
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
ok(hr == S_OK, "Failed to create writer, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create writer, hr %#lx.\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Failed to create stream, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create stream, hr %#lx.\n", hr);
hr = CreateXmlWriterOutputWithEncodingCodePage((IUnknown *)stream, NULL, 1200, &output); hr = CreateXmlWriterOutputWithEncodingCodePage((IUnknown *)stream, NULL, 1200, &output);
ok(hr == S_OK, "Failed to create writer output, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create writer output, hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "Failed to set writer output, hr %#x.\n", hr); 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, aW, NULL);
ok(hr == S_OK, "Write failed, hr %#x.\n", hr); ok(hr == S_OK, "Write failed, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT_RAW(stream, utf16_outputW, sizeof(utf16_outputW)); CHECK_OUTPUT_RAW(stream, utf16_outputW, sizeof(utf16_outputW));
...@@ -489,11 +489,11 @@ static void test_writeroutput(void) ...@@ -489,11 +489,11 @@ static void test_writeroutput(void)
/* Create output with meaningless code page value. */ /* Create output with meaningless code page value. */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "Failed to create stream, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create stream, hr %#lx.\n", hr);
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingCodePage((IUnknown *)stream, NULL, ~0u, &output); hr = CreateXmlWriterOutputWithEncodingCodePage((IUnknown *)stream, NULL, ~0u, &output);
ok(hr == S_OK, "Failed to create writer output, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create writer output, hr %#lx.\n", hr);
test_invalid_output_encoding(writer, output); test_invalid_output_encoding(writer, output);
CHECK_OUTPUT(stream, ""); CHECK_OUTPUT(stream, "");
...@@ -503,11 +503,11 @@ static void test_writeroutput(void) ...@@ -503,11 +503,11 @@ static void test_writeroutput(void)
/* Same, with invalid encoding name. */ /* Same, with invalid encoding name. */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, dummyW, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, dummyW, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
test_invalid_output_encoding(writer, output); test_invalid_output_encoding(writer, output);
CHECK_OUTPUT(stream, ""); CHECK_OUTPUT(stream, "");
...@@ -532,55 +532,55 @@ static void test_writestartdocument(void) ...@@ -532,55 +532,55 @@ static void test_writestartdocument(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* output not set */ /* output not set */
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
/* nothing written yet */ /* nothing written yet */
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, fullprolog); CHECK_OUTPUT(stream, fullprolog);
/* one more time */ /* one more time */
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
/* now add PI manually, and try to start a document */ /* now add PI manually, and try to start a document */
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
/* another attempt to add 'xml' PI */ /* another attempt to add 'xml' PI */
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, prologversion); CHECK_OUTPUT(stream, prologversion);
...@@ -589,23 +589,23 @@ static void test_writestartdocument(void) ...@@ -589,23 +589,23 @@ static void test_writestartdocument(void)
/* create with us-ascii */ /* create with us-ascii */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
output = NULL; output = NULL;
hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, usasciiW, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown *)stream, NULL, usasciiW, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, prologversion2); CHECK_OUTPUT(stream, prologversion2);
...@@ -620,28 +620,28 @@ static void test_flush(void) ...@@ -620,28 +620,28 @@ static void test_flush(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)&teststream); hr = IXmlWriter_SetOutput(writer, (IUnknown*)&teststream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
g_write_len = 0; g_write_len = 0;
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(g_write_len > 0, "got %d\n", g_write_len); ok(g_write_len > 0, "Unexpected length %lu.\n", g_write_len);
g_write_len = 1; g_write_len = 1;
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(g_write_len == 0, "got %d\n", g_write_len); ok(g_write_len == 0, "Unexpected length %lu.\n", g_write_len);
/* Release() flushes too */ /* Release() flushes too */
g_write_len = 1; g_write_len = 1;
IXmlWriter_Release(writer); IXmlWriter_Release(writer);
ok(g_write_len == 0, "got %d\n", g_write_len); ok(g_write_len == 0, "Unexpected length %lu.\n", g_write_len);
} }
static void test_omitxmldeclaration(void) static void test_omitxmldeclaration(void)
...@@ -656,20 +656,20 @@ static void test_omitxmldeclaration(void) ...@@ -656,20 +656,20 @@ static void test_omitxmldeclaration(void)
char *ptr; char *ptr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal); hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ptr = GlobalLock(hglobal); ptr = GlobalLock(hglobal);
ok(!ptr, "got %p\n", ptr); ok(!ptr, "got %p\n", ptr);
...@@ -677,7 +677,7 @@ static void test_omitxmldeclaration(void) ...@@ -677,7 +677,7 @@ static void test_omitxmldeclaration(void)
/* one more time */ /* one more time */
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
...@@ -685,35 +685,35 @@ static void test_omitxmldeclaration(void) ...@@ -685,35 +685,35 @@ static void test_omitxmldeclaration(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, prologversion); CHECK_OUTPUT(stream, prologversion);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, prologversion); CHECK_OUTPUT(stream, prologversion);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, prologversion); CHECK_OUTPUT(stream, prologversion);
/* another attempt to add 'xml' PI */ /* another attempt to add 'xml' PI */
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
IXmlWriter_Release(writer); IXmlWriter_Release(writer);
...@@ -735,25 +735,25 @@ static void test_bom(void) ...@@ -735,25 +735,25 @@ static void test_bom(void)
HRESULT hr; HRESULT hr;
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* BOM is on by default */ /* BOM is on by default */
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT_RAW(stream, bomW, sizeof(bomW)); CHECK_OUTPUT_RAW(stream, bomW, sizeof(bomW));
...@@ -762,19 +762,19 @@ static void test_bom(void) ...@@ -762,19 +762,19 @@ static void test_bom(void)
/* start with PI */ /* start with PI */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT_RAW(stream, piW, sizeof(piW)); CHECK_OUTPUT_RAW(stream, piW, sizeof(piW));
...@@ -783,19 +783,19 @@ static void test_bom(void) ...@@ -783,19 +783,19 @@ static void test_bom(void)
/* start with element */ /* start with element */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT_RAW(stream, aopenW, sizeof(aopenW)); CHECK_OUTPUT_RAW(stream, aopenW, sizeof(aopenW));
...@@ -804,24 +804,24 @@ static void test_bom(void) ...@@ -804,24 +804,24 @@ static void test_bom(void)
/* WriteElementString */ /* WriteElementString */
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, output); hr = IXmlWriter_SetOutput(writer, output);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_Indent); writer_set_property(writer, XmlWriterProperty_Indent);
hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL); hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal); hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT_RAW(stream, afullW, sizeof(afullW)); CHECK_OUTPUT_RAW(stream, afullW, sizeof(afullW));
...@@ -922,65 +922,65 @@ static void test_WriteStartElement(void) ...@@ -922,65 +922,65 @@ static void test_WriteStartElement(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<a"); CHECK_OUTPUT(stream, "<a");
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
IXmlWriter_Release(writer); IXmlWriter_Release(writer);
/* WriteElementString */ /* WriteElementString */
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "b", NULL, "value"); hr = write_element_string(writer, NULL, "b", NULL, "value");
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, "prefix", "a", "uri"); hr = write_start_element(writer, "prefix", "a", "uri");
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "b", NULL, "value"); hr = write_element_string(writer, NULL, "b", NULL, "value");
ok(hr == S_OK, "Failed to write element string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "c", NULL, NULL); hr = write_element_string(writer, NULL, "c", NULL, NULL);
ok(hr == S_OK, "Failed to write element string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element string, hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "d", "uri"); hr = write_start_element(writer, NULL, "d", "uri");
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_start_element(writer, "", "e", "uri"); hr = write_start_element(writer, "", "e", "uri");
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_start_element(writer, "prefix2", "f", "uri"); hr = write_start_element(writer, "prefix2", "f", "uri");
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<prefix:a xmlns:prefix=\"uri\">" "<prefix:a xmlns:prefix=\"uri\">"
...@@ -1000,24 +1000,24 @@ static void test_WriteStartElement(void) ...@@ -1000,24 +1000,24 @@ static void test_WriteStartElement(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
hr = write_start_element(writer, start_element_tests[i].prefix, start_element_tests[i].local, hr = write_start_element(writer, start_element_tests[i].prefix, start_element_tests[i].local,
start_element_tests[i].uri); start_element_tests[i].uri);
ok(hr == start_element_tests[i].hr, "%u: unexpected hr %#x.\n", i, hr); ok(hr == start_element_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
if (SUCCEEDED(start_element_tests[i].hr)) if (SUCCEEDED(start_element_tests[i].hr))
{ {
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, start_element_tests[i].output_partial, start_element_tests[i].todo_partial, __LINE__); check_output(stream, start_element_tests[i].output_partial, start_element_tests[i].todo_partial, __LINE__);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "Failed to end document, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end document, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, start_element_tests[i].output, start_element_tests[i].todo, __LINE__); check_output(stream, start_element_tests[i].output, start_element_tests[i].todo, __LINE__);
} }
...@@ -1072,54 +1072,54 @@ static void test_WriteElementString(void) ...@@ -1072,54 +1072,54 @@ static void test_WriteElementString(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "b", NULL, "value"); hr = write_element_string(writer, NULL, "b", NULL, "value");
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "b", NULL, "value"); hr = write_element_string(writer, NULL, "b", NULL, "value");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "b", NULL, NULL); hr = write_element_string(writer, NULL, "b", NULL, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix", "b", "uri", NULL); hr = write_element_string(writer, "prefix", "b", "uri", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, "prefix", "c", "uri"); hr = write_start_element(writer, "prefix", "c", "uri");
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix", "d", NULL, NULL); hr = write_element_string(writer, "prefix", "d", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix2", "d", "uri", NULL); hr = write_element_string(writer, "prefix2", "d", "uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "e", "uri", NULL); hr = write_element_string(writer, NULL, "e", "uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix", "f", "uri2", NULL); hr = write_element_string(writer, "prefix", "f", "uri2", NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, NULL, "g", "uri3", NULL); hr = write_element_string(writer, NULL, "g", "uri3", NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix", "h", NULL, NULL); hr = write_element_string(writer, "prefix", "h", NULL, NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, "prefix_i", "i", NULL, NULL); hr = write_element_string(writer, "prefix_i", "i", NULL, NULL);
ok(hr == WR_E_NSPREFIXWITHEMPTYNSURI, "Failed to write element, hr %#x.\n", hr); ok(hr == WR_E_NSPREFIXWITHEMPTYNSURI, "Failed to write element, hr %#lx.\n", hr);
hr = write_element_string(writer, "", "j", "uri", NULL); hr = write_element_string(writer, "", "j", "uri", NULL);
ok(hr == S_OK, "Failed to write element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a><b>value</b><b />" "<a><b>value</b><b />"
...@@ -1142,24 +1142,24 @@ static void test_WriteElementString(void) ...@@ -1142,24 +1142,24 @@ static void test_WriteElementString(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#x.\n", hr); 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 = write_element_string(writer, element_string_tests[i].prefix, element_string_tests[i].local,
element_string_tests[i].uri, element_string_tests[i].value); element_string_tests[i].uri, element_string_tests[i].value);
ok(hr == element_string_tests[i].hr, "%u: unexpected hr %#x.\n", i, hr); ok(hr == element_string_tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
if (SUCCEEDED(element_string_tests[i].hr)) if (SUCCEEDED(element_string_tests[i].hr))
{ {
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, element_string_tests[i].output, element_string_tests[i].todo, __LINE__); check_output(stream, element_string_tests[i].output, element_string_tests[i].todo, __LINE__);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "Failed to end document, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end document, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, element_string_tests[i].output, element_string_tests[i].todo, __LINE__); check_output(stream, element_string_tests[i].output, element_string_tests[i].todo, __LINE__);
} }
...@@ -1177,24 +1177,24 @@ static void test_WriteEndElement(void) ...@@ -1177,24 +1177,24 @@ static void test_WriteEndElement(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<a><b /></a>"); CHECK_OUTPUT(stream, "<a><b /></a>");
...@@ -1213,47 +1213,47 @@ static void test_writeenddocument(void) ...@@ -1213,47 +1213,47 @@ static void test_writeenddocument(void)
char *ptr; char *ptr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
/* WriteEndDocument resets it to initial state */ /* WriteEndDocument resets it to initial state */
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = GetHGlobalFromStream(stream, &hglobal); hr = GetHGlobalFromStream(stream, &hglobal);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ptr = GlobalLock(hglobal); ptr = GlobalLock(hglobal);
ok(ptr == NULL, "got %p\n", ptr); ok(ptr == NULL, "got %p\n", ptr);
/* we still need to flush manually, WriteEndDocument doesn't do that */ /* we still need to flush manually, WriteEndDocument doesn't do that */
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<a><b /></a>"); CHECK_OUTPUT(stream, "<a><b /></a>");
...@@ -1271,35 +1271,35 @@ static void test_WriteComment(void) ...@@ -1271,35 +1271,35 @@ static void test_WriteComment(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteComment(writer, aW); hr = IXmlWriter_WriteComment(writer, aW);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, aW); hr = IXmlWriter_WriteComment(writer, aW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, aW); hr = IXmlWriter_WriteComment(writer, aW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, NULL); hr = IXmlWriter_WriteComment(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, closeW); hr = IXmlWriter_WriteComment(writer, closeW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<!--a--><b><!--a--><!----><!--- ->-->"); CHECK_OUTPUT(stream, "<!--a--><b><!--a--><!----><!--- ->-->");
...@@ -1318,32 +1318,32 @@ static void test_WriteCData(void) ...@@ -1318,32 +1318,32 @@ static void test_WriteCData(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteCData(writer, aW); hr = IXmlWriter_WriteCData(writer, aW);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, aW); hr = IXmlWriter_WriteCData(writer, aW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, NULL); hr = IXmlWriter_WriteCData(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, closeW); hr = IXmlWriter_WriteCData(writer, closeW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCData(writer, close2W); hr = IXmlWriter_WriteCData(writer, close2W);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<b>" "<b>"
...@@ -1367,48 +1367,48 @@ static void test_WriteRaw(void) ...@@ -1367,48 +1367,48 @@ static void test_WriteRaw(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, NULL); hr = IXmlWriter_WriteRaw(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, rawW); hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteRaw(writer, NULL); hr = IXmlWriter_WriteRaw(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, rawW); hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, rawW); hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, rawW); hr = IXmlWriter_WriteComment(writer, rawW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, rawW); hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW); hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, aW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, rawW); hr = IXmlWriter_WriteComment(writer, rawW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteRaw(writer, rawW); hr = IXmlWriter_WriteRaw(writer, rawW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>a<:a<:<!--a<:-->a<:<a>a</a>"); CHECK_OUTPUT(stream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>a<:a<:<!--a<:-->a<:<a>a</a>");
...@@ -1424,7 +1424,7 @@ static void test_writer_state(void) ...@@ -1424,7 +1424,7 @@ static void test_writer_state(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* initial state */ /* initial state */
check_writer_state(writer, E_UNEXPECTED); check_writer_state(writer, E_UNEXPECTED);
...@@ -1433,7 +1433,7 @@ static void test_writer_state(void) ...@@ -1433,7 +1433,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1442,7 +1442,7 @@ static void test_writer_state(void) ...@@ -1442,7 +1442,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW); hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1451,7 +1451,7 @@ static void test_writer_state(void) ...@@ -1451,7 +1451,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1460,7 +1460,7 @@ static void test_writer_state(void) ...@@ -1460,7 +1460,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1469,7 +1469,7 @@ static void test_writer_state(void) ...@@ -1469,7 +1469,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteCData(writer, aW); hr = IXmlWriter_WriteCData(writer, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1478,7 +1478,7 @@ static void test_writer_state(void) ...@@ -1478,7 +1478,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteName(writer, aW); hr = IXmlWriter_WriteName(writer, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1487,7 +1487,7 @@ static void test_writer_state(void) ...@@ -1487,7 +1487,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteNmToken(writer, aW); hr = IXmlWriter_WriteNmToken(writer, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1496,7 +1496,7 @@ static void test_writer_state(void) ...@@ -1496,7 +1496,7 @@ static void test_writer_state(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteString(writer, aW); hr = IXmlWriter_WriteString(writer, aW);
ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
check_writer_state(writer, WR_E_INVALIDACTION); check_writer_state(writer, WR_E_INVALIDACTION);
IStream_Release(stream); IStream_Release(stream);
...@@ -1514,7 +1514,7 @@ static void test_indentation(void) ...@@ -1514,7 +1514,7 @@ static void test_indentation(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
...@@ -1522,22 +1522,22 @@ static void test_indentation(void) ...@@ -1522,22 +1522,22 @@ static void test_indentation(void)
writer_set_property(writer, XmlWriterProperty_Indent); writer_set_property(writer, XmlWriterProperty_Indent);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteComment(writer, commentW); hr = IXmlWriter_WriteComment(writer, commentW);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -1551,19 +1551,19 @@ static void test_indentation(void) ...@@ -1551,19 +1551,19 @@ static void test_indentation(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL); hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL); hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, NULL);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -1678,7 +1678,7 @@ static void test_WriteAttributeString(void) ...@@ -1678,7 +1678,7 @@ static void test_WriteAttributeString(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
...@@ -1687,26 +1687,26 @@ static void test_WriteAttributeString(void) ...@@ -1687,26 +1687,26 @@ static void test_WriteAttributeString(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "Failed to start document, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start document, hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "e", NULL); hr = write_start_element(writer, NULL, "e", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_attribute_string(writer, attribute_tests[i].prefix, attribute_tests[i].local, hr = write_attribute_string(writer, attribute_tests[i].prefix, attribute_tests[i].local,
attribute_tests[i].uri, attribute_tests[i].value); attribute_tests[i].uri, attribute_tests[i].value);
todo_wine_if(attribute_tests[i].todo_hr) todo_wine_if(attribute_tests[i].todo_hr)
ok(hr == attribute_tests[i].hr, "%u: unexpected hr %#x, expected %#x.\n", i, hr, attribute_tests[i].hr); ok(hr == attribute_tests[i].hr, "%u: unexpected hr %#lx, expected %#lx.\n", i, hr, attribute_tests[i].hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, attribute_tests[i].output_partial, attribute_tests[i].todo_partial, __LINE__); check_output(stream, attribute_tests[i].output_partial, attribute_tests[i].todo_partial, __LINE__);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "Failed to end document, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end document, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
check_output(stream, attribute_tests[i].output, attribute_tests[i].todo, __LINE__); check_output(stream, attribute_tests[i].output, attribute_tests[i].todo, __LINE__);
IStream_Release(stream); IStream_Release(stream);
...@@ -1716,41 +1716,41 @@ static void test_WriteAttributeString(void) ...@@ -1716,41 +1716,41 @@ static void test_WriteAttributeString(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, "p", "a", "outeruri"); hr = write_start_element(writer, "p", "a", "outeruri");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, "prefix", "local", "uri", "b"); hr = write_attribute_string(writer, "prefix", "local", "uri", "b");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, NULL, "a", NULL, "b"); hr = write_attribute_string(writer, NULL, "a", NULL, "b");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri"); hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, "p", "attr", NULL, "value"); hr = write_attribute_string(writer, "p", "attr", NULL, "value");
ok(hr == S_OK, "Failed to write attribute string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = write_attribute_string(writer, "prefix", "local", NULL, "b"); hr = write_attribute_string(writer, "prefix", "local", NULL, "b");
todo_wine todo_wine
ok(hr == WR_E_DUPLICATEATTRIBUTE, "got 0x%08x\n", hr); ok(hr == WR_E_DUPLICATEATTRIBUTE, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, NULL, "attr2", "outeruri", "value"); hr = write_attribute_string(writer, NULL, "attr2", "outeruri", "value");
ok(hr == S_OK, "Failed to write attribute string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = write_attribute_string(writer, "pr", "attr3", "outeruri", "value"); hr = write_attribute_string(writer, "pr", "attr3", "outeruri", "value");
ok(hr == S_OK, "Failed to write attribute string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT_TODO(stream, CHECK_OUTPUT_TODO(stream,
"<p:a prefix:local=\"b\" a=\"b\" xmlns:prefix=\"uri\" p:attr=\"value\" xmlns:p=\"outeruri\">" "<p:a prefix:local=\"b\" a=\"b\" xmlns:prefix=\"uri\" p:attr=\"value\" xmlns:p=\"outeruri\">"
...@@ -1763,22 +1763,22 @@ static void test_WriteAttributeString(void) ...@@ -1763,22 +1763,22 @@ static void test_WriteAttributeString(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "e", NULL); hr = write_start_element(writer, NULL, "e", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri"); hr = write_attribute_string(writer, "xmlns", "prefix", NULL, "uri");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_attribute_string(writer, "prefix", "attr", NULL, "value"); hr = write_attribute_string(writer, "prefix", "attr", NULL, "value");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<e xmlns:prefix=\"uri\" prefix:attr=\"value\" />"); "<e xmlns:prefix=\"uri\" prefix:attr=\"value\" />");
...@@ -1796,7 +1796,7 @@ static void test_WriteFullEndElement(void) ...@@ -1796,7 +1796,7 @@ static void test_WriteFullEndElement(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* standalone element */ /* standalone element */
stream = writer_set_output(writer); stream = writer_set_output(writer);
...@@ -1805,19 +1805,19 @@ static void test_WriteFullEndElement(void) ...@@ -1805,19 +1805,19 @@ static void test_WriteFullEndElement(void)
writer_set_property(writer, XmlWriterProperty_Indent); writer_set_property(writer, XmlWriterProperty_Indent);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a></a>"); "<a></a>");
...@@ -1830,22 +1830,22 @@ static void test_WriteFullEndElement(void) ...@@ -1830,22 +1830,22 @@ static void test_WriteFullEndElement(void)
writer_set_property(writer, XmlWriterProperty_Indent); writer_set_property(writer, XmlWriterProperty_Indent);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -1864,7 +1864,7 @@ static void test_WriteCharEntity(void) ...@@ -1864,7 +1864,7 @@ static void test_WriteCharEntity(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* without indentation */ /* without indentation */
stream = writer_set_output(writer); stream = writer_set_output(writer);
...@@ -1872,22 +1872,22 @@ static void test_WriteCharEntity(void) ...@@ -1872,22 +1872,22 @@ static void test_WriteCharEntity(void)
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit); hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteCharEntity(writer, 0x100); hr = IXmlWriter_WriteCharEntity(writer, 0x100);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndDocument(writer); hr = IXmlWriter_WriteEndDocument(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>&#x100;<a /></a>"); "<a>&#x100;<a /></a>");
...@@ -1903,39 +1903,39 @@ static void test_WriteString(void) ...@@ -1903,39 +1903,39 @@ static void test_WriteString(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration); writer_set_property(writer, XmlWriterProperty_OmitXmlDeclaration);
hr = write_string(writer, "a"); hr = write_string(writer, "a");
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, NULL); hr = write_string(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, ""); hr = write_string(writer, "");
ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, NULL); hr = write_string(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, ""); hr = write_string(writer, "");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, "a"); hr = write_string(writer, "a");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* WriteString automatically escapes markup characters */ /* WriteString automatically escapes markup characters */
hr = write_string(writer, "<&\">="); hr = write_string(writer, "<&\">=");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<b>a&lt;&amp;\"&gt;="); "<b>a&lt;&amp;\"&gt;=");
...@@ -1944,22 +1944,22 @@ static void test_WriteString(void) ...@@ -1944,22 +1944,22 @@ static void test_WriteString(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = write_string(writer, NULL); hr = write_string(writer, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<b"); "<b");
hr = write_string(writer, ""); hr = write_string(writer, "");
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<b>"); "<b>");
...@@ -1969,43 +1969,43 @@ static void test_WriteString(void) ...@@ -1969,43 +1969,43 @@ static void test_WriteString(void)
/* With indentation */ /* With indentation */
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
ok(hr == S_OK, "Failed to create a writer, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create a writer, hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
writer_set_property(writer, XmlWriterProperty_Indent); writer_set_property(writer, XmlWriterProperty_Indent);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_string(writer, "text"); hr = write_string(writer, "text");
ok(hr == S_OK, "Failed to write a string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
" <b>text"); " <b>text");
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
" <b>text</b>"); " <b>text</b>");
hr = IXmlWriter_WriteFullEndElement(writer); hr = IXmlWriter_WriteFullEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2017,29 +2017,29 @@ static void test_WriteString(void) ...@@ -2017,29 +2017,29 @@ static void test_WriteString(void)
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = write_start_element(writer, NULL, "a", NULL); hr = write_start_element(writer, NULL, "a", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_start_element(writer, NULL, "b", NULL); hr = write_start_element(writer, NULL, "b", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
" <b />"); " <b />");
hr = write_start_element(writer, NULL, "c", NULL); hr = write_start_element(writer, NULL, "c", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_attribute_string(writer, NULL, "attr", NULL, "value"); hr = write_attribute_string(writer, NULL, "attr", NULL, "value");
ok(hr == S_OK, "Failed to write attribute string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write attribute string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2047,10 +2047,10 @@ static void test_WriteString(void) ...@@ -2047,10 +2047,10 @@ static void test_WriteString(void)
" <c attr=\"value\""); " <c attr=\"value\"");
hr = write_string(writer, "text"); hr = write_string(writer, "text");
ok(hr == S_OK, "Failed to write a string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2058,10 +2058,10 @@ static void test_WriteString(void) ...@@ -2058,10 +2058,10 @@ static void test_WriteString(void)
" <c attr=\"value\">text"); " <c attr=\"value\">text");
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2069,16 +2069,16 @@ static void test_WriteString(void) ...@@ -2069,16 +2069,16 @@ static void test_WriteString(void)
" <c attr=\"value\">text</c>"); " <c attr=\"value\">text</c>");
hr = write_start_element(writer, NULL, "d", NULL); hr = write_start_element(writer, NULL, "d", NULL);
ok(hr == S_OK, "Failed to start element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to start element, hr %#lx.\n", hr);
hr = write_string(writer, ""); hr = write_string(writer, "");
ok(hr == S_OK, "Failed to write a string, hr %#x.\n", hr); ok(hr == S_OK, "Failed to write a string, hr %#lx.\n", hr);
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2087,10 +2087,10 @@ static void test_WriteString(void) ...@@ -2087,10 +2087,10 @@ static void test_WriteString(void)
" <d></d>"); " <d></d>");
hr = IXmlWriter_WriteEndElement(writer); hr = IXmlWriter_WriteEndElement(writer);
ok(hr == S_OK, "Failed to end element, hr %#x.\n", hr); ok(hr == S_OK, "Failed to end element, hr %#lx.\n", hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, CHECK_OUTPUT(stream,
"<a>\r\n" "<a>\r\n"
...@@ -2163,23 +2163,23 @@ static void test_WriteDocType(void) ...@@ -2163,23 +2163,23 @@ static void test_WriteDocType(void)
HRESULT hr; HRESULT hr;
hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL); hr = CreateXmlWriter(&IID_IXmlWriter, (void **)&writer, NULL);
ok(hr == S_OK, "Failed to create writer instance, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create writer instance, hr %#lx.\n", hr);
stream = writer_set_output(writer); stream = writer_set_output(writer);
hr = IXmlWriter_WriteDocType(writer, NULL, NULL, NULL, NULL); hr = IXmlWriter_WriteDocType(writer, NULL, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IXmlWriter_WriteDocType(writer, emptyW, NULL, NULL, NULL); hr = IXmlWriter_WriteDocType(writer, emptyW, NULL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
/* Name validation. */ /* Name validation. */
hr = IXmlWriter_WriteDocType(writer, nameW, NULL, NULL, NULL); hr = IXmlWriter_WriteDocType(writer, nameW, NULL, NULL, NULL);
ok(hr == WC_E_NAMECHARACTER, "Unexpected hr %#x.\n", hr); ok(hr == WC_E_NAMECHARACTER, "Unexpected hr %#lx.\n", hr);
/* Pubid validation. */ /* Pubid validation. */
hr = IXmlWriter_WriteDocType(writer, aW, pubidW, NULL, NULL); hr = IXmlWriter_WriteDocType(writer, aW, pubidW, NULL, NULL);
ok(hr == WC_E_PUBLICID, "Unexpected hr %#x.\n", hr); ok(hr == WC_E_PUBLICID, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
...@@ -2189,16 +2189,16 @@ static void test_WriteDocType(void) ...@@ -2189,16 +2189,16 @@ static void test_WriteDocType(void)
hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset); doctype_tests[i].subset);
ok(hr == S_OK, "%u: failed to write doctype, hr %#x.\n", i, hr); ok(hr == S_OK, "%u: failed to write doctype, hr %#lx.\n", i, hr);
hr = IXmlWriter_Flush(writer); hr = IXmlWriter_Flush(writer);
ok(hr == S_OK, "Failed to flush, hr %#x.\n", hr); ok(hr == S_OK, "Failed to flush, hr %#lx.\n", hr);
CHECK_OUTPUT(stream, doctype_tests[i].output); CHECK_OUTPUT(stream, doctype_tests[i].output);
hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid, hr = write_doctype(writer, doctype_tests[i].name, doctype_tests[i].pubid, doctype_tests[i].sysid,
doctype_tests[i].subset); doctype_tests[i].subset);
ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#x.\n", hr); ok(hr == WR_E_INVALIDACTION, "Unexpected hr %#lx.\n", hr);
IStream_Release(stream); IStream_Release(stream);
} }
......
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