https://git.reactos.org/?p=reactos.git;a=commitdiff;h=98fa9b2cfcc8368aedc96…
commit 98fa9b2cfcc8368aedc961b756ba179ee51269a8
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Tue Jan 29 13:12:12 2019 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Tue Jan 29 13:12:12 2019 +0100
[MSXML3_WINETEST] Sync with Wine Staging 4.0. CORE-15682
---
modules/rostests/winetests/msxml3/domdoc.c | 232 ++++++++++++++++++++++++--
modules/rostests/winetests/msxml3/httpreq.c | 85 +++++++++-
modules/rostests/winetests/msxml3/saxreader.c | 32 ++--
modules/rostests/winetests/msxml3/schema.c | 2 +-
modules/rostests/winetests/msxml3/xmlview.c | 2 +-
5 files changed, 320 insertions(+), 33 deletions(-)
diff --git a/modules/rostests/winetests/msxml3/domdoc.c
b/modules/rostests/winetests/msxml3/domdoc.c
index 57bc88df48..9fd83dda7d 100644
--- a/modules/rostests/winetests/msxml3/domdoc.c
+++ b/modules/rostests/winetests/msxml3/domdoc.c
@@ -102,7 +102,7 @@ static void get_class_support_data(struct msxmlsupported_data_t
*table)
HRESULT hr;
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0])
&& table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] !=
NULL; i++)
{
hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER,
table->ifaces[i], (void**)&unk);
if (hr == S_OK) IUnknown_Release(unk);
@@ -124,7 +124,7 @@ static BOOL is_clsid_supported(const GUID *clsid, REFIID riid)
{
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0])
&& table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) &&
table->ifaces[i] != NULL; i++)
if (table->ifaces[i] == riid) return table->supported[i];
}
@@ -1243,7 +1243,7 @@ static int alloced_bstrs_count;
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
@@ -10869,13 +10869,13 @@ static void test_mxnamespacemanager_override(void)
&IID_IMXNamespaceManager, (void**)&nsmgr);
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n",
wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, E_FAIL);
@@ -10894,7 +10894,7 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10903,19 +10903,19 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns0"),
_bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n",
wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0")), "got prefix %s\n",
wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 2, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10925,7 +10925,7 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns1"),
_bstr_("ns1 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10946,13 +10946,13 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri
override"));
EXPECT_HR(hr, S_FALSE);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0 uri override")), "got uri %s\n",
wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 3, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -12827,6 +12827,212 @@ static void test_transformNodeToObject(void)
free_bstrs();
}
+static void test_normalize_attribute_values(void)
+{
+ IXMLDOMDocument2 *doc;
+ VARIANT var;
+ HRESULT hr;
+
+ if (!is_clsid_supported(&CLSID_DOMDocument60, &IID_IXMLDOMDocument2))
+ {
+ win_skip("NormalizeAttributeValues is not supported.\n");
+ return;
+ }
+
+ doc = create_document_version(60, &IID_IXMLDOMDocument2);
+
+ V_VT(&var) = VT_I2;
+ V_I2(&var) = 10;
+ hr = IXMLDOMDocument2_getProperty(doc, _bstr_("NormalizeAttributeValues"),
&var);
+todo_wine {
+ ok(hr == S_OK, "Failed to get property value, hr %#x.\n", hr);
+ ok(V_VT(&var) == VT_BOOL, "Unexpected property value type, vt %d.\n",
V_VT(&var));
+ ok(V_BOOL(&var) == VARIANT_FALSE, "Unexpected property value.\n");
+}
+ V_VT(&var) = VT_BOOL;
+ V_BOOL(&var) = VARIANT_TRUE;
+ hr = IXMLDOMDocument2_setProperty(doc, _bstr_("NormalizeAttributeValues"),
var);
+ ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
+
+ V_VT(&var) = VT_I2;
+ V_I2(&var) = 10;
+ hr = IXMLDOMDocument2_getProperty(doc, _bstr_("NormalizeAttributeValues"),
&var);
+todo_wine {
+ ok(hr == S_OK, "Failed to get property value, hr %#x.\n", hr);
+ ok(V_VT(&var) == VT_BOOL, "Unexpected property value type, vt %d.\n",
V_VT(&var));
+ ok(V_BOOL(&var) == VARIANT_TRUE, "Unexpected property value.\n");
+}
+ IXMLDOMDocument2_Release(doc);
+}
+
+typedef struct _namespace_as_attribute_t {
+ const GUID *guid;
+ const char *clsid;
+ const char *xmlns_uri;
+} namespace_as_attribute_t;
+
+static const namespace_as_attribute_t namespace_as_attribute_test_data[] = {
+ { &CLSID_DOMDocument, "CLSID_DOMDocument", "" },
+ { &CLSID_DOMDocument2, "CLSID_DOMDocument2", "" },
+ { &CLSID_DOMDocument26, "CLSID_DOMDocument26", "" },
+ { &CLSID_DOMDocument30, "CLSID_DOMDocument30", "" },
+ { &CLSID_DOMDocument40, "CLSID_DOMDocument40", "" },
+ { &CLSID_DOMDocument60, "CLSID_DOMDocument60",
"http://www.w3.org/2000/xmlns/" },
+ { 0 }
+};
+
+static void test_namespaces_as_attributes(void)
+{
+ const namespace_as_attribute_t *entry = namespace_as_attribute_test_data;
+ struct test {
+ const char *xml;
+ int explen;
+ const char *names[3];
+ const char *prefixes[3];
+ const char *basenames[3];
+ const char *uris[3];
+ const char *texts[3];
+ };
+ static const struct test tests[] = {
+ {
+ "<a ns:b=\"b attr\" d=\"d attr\"
xmlns:ns=\"nshref\" />", 3,
+ { "ns:b", "d", "xmlns:ns" }, /* nodeName
*/
+ { "ns", NULL, "xmlns" }, /* prefix */
+ { "b", "d", "ns" }, /* baseName
*/
+ { "nshref", NULL, "" }, /* namespaceURI */
+ { "b attr", "d attr", "nshref" }, /* text */
+ },
+ /* property only */
+ {
+ "<a d=\"d attr\" />", 1,
+ { "d" }, /* nodeName */
+ { NULL }, /* prefix */
+ { "d" }, /* baseName */
+ { NULL }, /* namespaceURI */
+ { "d attr" }, /* text */
+ },
+ /* namespace only */
+ {
+ "<a xmlns:ns=\"nshref\" />", 1,
+ { "xmlns:ns" }, /* nodeName */
+ { "xmlns" }, /* prefix */
+ { "ns" }, /* baseName */
+ { "" }, /* namespaceURI */
+ { "nshref" }, /* text */
+ },
+ /* no properties or namespaces */
+ {
+ "<a />", 0,
+ },
+
+ { NULL }
+ };
+ const struct test *test;
+ IXMLDOMNamedNodeMap *map;
+ IXMLDOMNode *node, *item;
+ IXMLDOMDocument *doc;
+ VARIANT_BOOL b;
+ LONG len, i;
+ HRESULT hr;
+ BSTR str;
+
+ while (entry->guid)
+ {
+ if (!is_clsid_supported(entry->guid, &IID_IXMLDOMDocument2))
+ {
+ entry++;
+ continue;
+ }
+
+ test = tests;
+ while (test->xml) {
+ hr = CoCreateInstance(entry->guid, NULL, CLSCTX_INPROC_SERVER,
&IID_IXMLDOMDocument2, (void **)&doc);
+ ok(SUCCEEDED(hr), "Failed to create document %s, hr %#x.\n",
wine_dbgstr_guid(entry->guid), hr);
+
+ hr = IXMLDOMDocument_loadXML(doc, _bstr_(test->xml), &b);
+ ok(hr == S_OK, "Failed to load xml, hr %#x.\n", hr);
+
+ node = NULL;
+ hr = IXMLDOMDocument_selectSingleNode(doc, _bstr_("a"),
&node);
+ ok(SUCCEEDED(hr), "Failed to select a node, hr %#x.\n", hr);
+
+ hr = IXMLDOMNode_get_attributes(node, &map);
+ ok(SUCCEEDED(hr), "Failed to get attributes, hr %#x.\n", hr);
+
+ len = -1;
+ hr = IXMLDOMNamedNodeMap_get_length(map, &len);
+ ok(SUCCEEDED(hr), "Failed to get map length, hr %#x.\n", hr);
+ ok(len == test->explen, "got %d\n", len);
+
+ item = NULL;
+ hr = IXMLDOMNamedNodeMap_get_item(map, test->explen+1, &item);
+ ok(hr == S_FALSE, "Failed to get item, hr %#x.\n", hr);
+ ok(!item, "Item should be NULL\n");
+
+ for (i = 0; i < len; i++)
+ {
+ item = NULL;
+ hr = IXMLDOMNamedNodeMap_get_item(map, i, &item);
+ ok(SUCCEEDED(hr), "Failed to get item, hr %#x.\n", hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_nodeName(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get node name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->names[i])), "got %s\n",
wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_prefix(item, &str);
+ if (test->prefixes[i])
+ {
+ ok(hr == S_OK, "Failed to get node name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->prefixes[i])), "got
%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+ else
+ ok(hr == S_FALSE, "Failed to get node name, hr %#x.\n",
hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_baseName(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get base name, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->basenames[i])), "got %s\n",
wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_namespaceURI(item, &str);
+ if (test->uris[i])
+ {
+ ok(hr == S_OK, "Failed to get node name, hr %#x.\n", hr);
+ if (test->prefixes[i] && !strcmp(test->prefixes[i],
"xmlns"))
+ ok(!lstrcmpW(str, _bstr_(entry->xmlns_uri)), "got
%s\n", wine_dbgstr_w(str));
+ else
+ ok(!lstrcmpW(str, _bstr_(test->uris[i])), "got
%s\n", wine_dbgstr_w(str));
+ SysFreeString(str);
+ }
+ else
+ ok(hr == S_FALSE, "Failed to get node name, hr %#x.\n",
hr);
+
+ str = NULL;
+ hr = IXMLDOMNode_get_text(item, &str);
+ ok(SUCCEEDED(hr), "Failed to get node text, hr %#x.\n", hr);
+ ok(!lstrcmpW(str, _bstr_(test->texts[i])), "got %s\n",
wine_dbgstr_w(str));
+ SysFreeString(str);
+
+ IXMLDOMNode_Release(item);
+ }
+
+ IXMLDOMNamedNodeMap_Release(map);
+ IXMLDOMNode_Release(node);
+ IXMLDOMDocument_Release(doc);
+
+ test++;
+ }
+
+ entry++;
+ }
+ free_bstrs();
+}
+
START_TEST(domdoc)
{
HRESULT hr;
@@ -12910,6 +13116,8 @@ START_TEST(domdoc)
test_url();
test_merging_text();
test_transformNodeToObject();
+ test_normalize_attribute_values();
+ test_namespaces_as_attributes();
test_xsltemplate();
test_xsltext();
diff --git a/modules/rostests/winetests/msxml3/httpreq.c
b/modules/rostests/winetests/msxml3/httpreq.c
index 4f51ef9faf..ae0a95a2f1 100644
--- a/modules/rostests/winetests/msxml3/httpreq.c
+++ b/modules/rostests/winetests/msxml3/httpreq.c
@@ -50,6 +50,9 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line)
ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
}
+static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml";
+static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\"
encoding=\"utf-8\"?>\n<a>TEST</a>\n";
+
DEFINE_GUID(SID_SContainerDispatch, 0xb722be00, 0x4e68, 0x101b, 0xa2, 0xbc, 0x00, 0xaa,
0x00, 0x40, 0x47, 0x70);
DEFINE_GUID(SID_UnknownSID, 0x75dd09cb, 0x6c40, 0x11d5, 0x85, 0x43, 0x00, 0xc0, 0x4f,
0xa0, 0xfb, 0xa3);
@@ -91,6 +94,13 @@ DEFINE_EXPECT(collection_get_length);
static int g_unexpectedcall, g_expectedcall;
+static int strcmp_wa(const WCHAR *strw, const char *stra)
+{
+ WCHAR buf[512];
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf));
+ return lstrcmpW(strw, buf);
+}
+
static BSTR alloc_str_from_narrow(const char *str)
{
int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
@@ -107,7 +117,7 @@ static BSTR _bstr_(const char *str)
if(!str)
return NULL;
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
@@ -1431,14 +1441,26 @@ static void _test_open(unsigned line, IXMLHttpRequest *xhr, const
char *method,
ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected
%08x\n", method, url, hr, exhres);
}
+#define test_server_open(a,b,c,d) _test_server_open(__LINE__,a,b,c,d)
+static void _test_server_open(unsigned line, IServerXMLHTTPRequest *xhr, const char
*method, const char *url, HRESULT exhres)
+{
+ VARIANT empty, vfalse;
+ HRESULT hr;
+
+ V_VT(&empty) = VT_EMPTY;
+ V_VT(&vfalse) = VT_BOOL;
+ V_BOOL(&vfalse) = VARIANT_FALSE;
+
+ hr = IServerXMLHTTPRequest_open(xhr, _bstr_(method), _bstr_(url), vfalse, empty,
empty);
+ ok_(__FILE__,line)(hr == exhres, "open(%s %s) failed: %08x, expected
%08x\n", method, url, hr, exhres);
+}
+
static void test_XMLHTTP(void)
{
static const char bodyA[] = "mode=Test";
static const char urlA[] = "http://test.winehq.org/tests/post.php";
- static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml";
static const char referertesturl[] =
"http://test.winehq.org/tests/referer.php";
static const WCHAR wszExpectedResponse[] =
{'F','A','I','L','E','D',0};
- static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\"
encoding=\"utf-8\"?>\n<a>TEST</a>\n";
static const WCHAR norefererW[] = {'n','o','
','r','e','f','e','r','e','r','
','s','e','t',0};
IXMLHttpRequest *xhr;
@@ -1765,6 +1787,62 @@ static void test_XMLHTTP(void)
SysFreeString(str);
IXMLHttpRequest_Release(xhr);
+
+ /* invalid host */
+ xhr = create_xhr();
+
+ test_open(xhr, "GET",
"http://invalid.host.test.winehq.org/test/path", S_OK);
+
+ V_VT(&varbody) = VT_EMPTY;
+ hr = IXMLHttpRequest_send(xhr, varbody);
+ todo_wine
+ ok(hr == INET_E_RESOURCE_NOT_FOUND, "send to invalid host returned %#x.\n",
hr);
+
+ IXMLHttpRequest_Release(xhr);
+ free_bstrs();
+}
+
+static void test_server_xhr(void)
+{
+ IServerXMLHTTPRequest *xhr;
+ BSTR response;
+ VARIANT body;
+ HRESULT hr;
+
+ /* GET request */
+ xhr = create_server_xhr();
+
+ test_server_open(xhr, "GET", xmltestA, S_OK);
+
+ V_VT(&body) = VT_EMPTY;
+
+ hr = IServerXMLHTTPRequest_send(xhr, body);
+ if (hr == INET_E_RESOURCE_NOT_FOUND)
+ {
+ skip("No connection could be made with test.winehq.org\n");
+ IServerXMLHTTPRequest_Release(xhr);
+ return;
+ }
+ ok(hr == S_OK, "send failed: %08x\n", hr);
+
+ hr = IServerXMLHTTPRequest_get_responseText(xhr, &response);
+ ok(hr == S_OK, "get_responseText failed: %08x\n", hr);
+ ok(!strcmp_wa(response, xmltestbodyA), "got %s\n",
wine_dbgstr_w(response));
+ SysFreeString(response);
+
+ IServerXMLHTTPRequest_Release(xhr);
+
+ /* invalid host */
+ xhr = create_server_xhr();
+
+ test_server_open(xhr, "GET",
"http://invalid.host.test.winehq.org/test/path", S_OK);
+
+ V_VT(&body) = VT_EMPTY;
+ hr = IServerXMLHTTPRequest_send(xhr, body);
+ todo_wine
+ ok(hr == WININET_E_NAME_NOT_RESOLVED, "send to invalid host returned
%#x.\n", hr);
+
+ IServerXMLHTTPRequest_Release(xhr);
free_bstrs();
}
@@ -1847,6 +1925,7 @@ START_TEST(httpreq)
IXMLHttpRequest_Release(xhr);
test_XMLHTTP();
+ test_server_xhr();
test_safe_httpreq();
test_supporterrorinfo();
diff --git a/modules/rostests/winetests/msxml3/saxreader.c
b/modules/rostests/winetests/msxml3/saxreader.c
index 3ed332edb6..eeef5b64c1 100644
--- a/modules/rostests/winetests/msxml3/saxreader.c
+++ b/modules/rostests/winetests/msxml3/saxreader.c
@@ -90,7 +90,7 @@ static int alloced_bstrs_count;
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
@@ -144,7 +144,7 @@ static void test_saxstr(const char *file, unsigned line, BSTR str,
const char *e
/* exit earlier on length mismatch */
if (lenexp != len) return;
- MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, ARRAY_SIZE(buf));
cmp = memcmp(str, buf, lenexp*sizeof(WCHAR));
if (cmp && todo)
@@ -2952,7 +2952,7 @@ static void test_mxwriter_handlers(void)
EXPECT_REF(writer, 1);
- for (i = 0; i < sizeof(riids)/sizeof(REFIID); i++)
+ for (i = 0; i < ARRAY_SIZE(riids); i++)
{
IUnknown *handler;
IMXWriter *writer2;
@@ -3976,7 +3976,7 @@ static void test_mxwriter_characters(void)
hr = ISAXContentHandler_characters(content, chardataW, 0);
EXPECT_HR(hr, S_OK);
- hr = ISAXContentHandler_characters(content, chardataW,
sizeof(chardataW)/sizeof(WCHAR) - 1);
+ hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4166,7 +4166,7 @@ static void test_mxwriter_stream(void)
IStream *stream;
LARGE_INTEGER pos;
ULARGE_INTEGER pos2;
- DWORD test_count = sizeof(mxwriter_stream_tests)/sizeof(mxwriter_stream_tests[0]);
+ DWORD test_count = ARRAY_SIZE(mxwriter_stream_tests);
for(current_stream_test_index = 0; current_stream_test_index < test_count;
++current_stream_test_index) {
const mxwriter_stream_test *test =
mxwriter_stream_tests+current_stream_test_index;
@@ -4640,7 +4640,7 @@ static void test_mxwriter_comment(void)
ok(!lstrcmpW(_bstr_("<!---->\r\n"), V_BSTR(&dest)), "got
wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
- hr = ISAXLexicalHandler_comment(lexical, commentW,
sizeof(commentW)/sizeof(WCHAR)-1);
+ hr = ISAXLexicalHandler_comment(lexical, commentW, ARRAY_SIZE(commentW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4865,16 +4865,16 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR),
NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW,
sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR),
sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), sysW,
ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), NULL,
0, NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), NULL, 0, NULL,
0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4885,11 +4885,11 @@ static void test_mxwriter_dtd(void)
VariantClear(&dest);
/* system id is required if public is present */
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), pubW,
sizeof(pubW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), pubW,
ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR),
- pubW, sizeof(pubW)/sizeof(WCHAR), sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW),
+ pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4926,10 +4926,10 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXDeclHandler_elementDecl(vbdecl, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW,
sizeof(contentW)/sizeof(WCHAR));
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW,
ARRAY_SIZE(contentW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4944,7 +4944,7 @@ static void test_mxwriter_dtd(void)
hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW,
0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, 0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
diff --git a/modules/rostests/winetests/msxml3/schema.c
b/modules/rostests/winetests/msxml3/schema.c
index 799365b5c6..a62314dd26 100644
--- a/modules/rostests/winetests/msxml3/schema.c
+++ b/modules/rostests/winetests/msxml3/schema.c
@@ -461,7 +461,7 @@ static BSTR alloc_str_from_narrow(const char *str)
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
diff --git a/modules/rostests/winetests/msxml3/xmlview.c
b/modules/rostests/winetests/msxml3/xmlview.c
index dc8ab7d200..53eefcb7e0 100644
--- a/modules/rostests/winetests/msxml3/xmlview.c
+++ b/modules/rostests/winetests/msxml3/xmlview.c
@@ -206,7 +206,7 @@ static void test_Load(void)
BSTR source;
lstrcpyW(buf, res);
- GetModuleFileNameW(NULL, buf+lstrlenW(buf),
(sizeof(buf)-sizeof(res))/sizeof(WCHAR));
+ GetModuleFileNameW(NULL, buf+lstrlenW(buf), ARRAY_SIZE(buf)-ARRAY_SIZE(res));
lstrcatW(buf, xmlview_xmlW);
if(!pCreateURLMoniker) {