Commit 6bc984a6 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mshtml/tests: Use the available ARRAY_SIZE() macro.

parent 41623d62
...@@ -6456,7 +6456,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf) ...@@ -6456,7 +6456,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
static void test_OleCommandTarget(IHTMLDocument2 *doc) static void test_OleCommandTarget(IHTMLDocument2 *doc)
{ {
IOleCommandTarget *cmdtrg; IOleCommandTarget *cmdtrg;
OLECMD cmds[sizeof(expect_cmds)/sizeof(*expect_cmds)-1]; OLECMD cmds[ARRAY_SIZE(expect_cmds)-1];
int i; int i;
HRESULT hres; HRESULT hres;
...@@ -6465,19 +6465,19 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc) ...@@ -6465,19 +6465,19 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
if(FAILED(hres)) if(FAILED(hres))
return; return;
for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) { for(i=0; i < ARRAY_SIZE(cmds); i++) {
cmds[i].cmdID = i+1; cmds[i].cmdID = i+1;
cmds[i].cmdf = 0xf0f0; cmds[i].cmdf = 0xf0f0;
} }
SET_EXPECT(QueryStatus_OPEN); SET_EXPECT(QueryStatus_OPEN);
SET_EXPECT(QueryStatus_NEW); SET_EXPECT(QueryStatus_NEW);
hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL); hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, ARRAY_SIZE(cmds), cmds, NULL);
ok(hres == S_OK, "QueryStatus failed: %08x\n", hres); ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
CHECK_CALLED(QueryStatus_OPEN); CHECK_CALLED(QueryStatus_OPEN);
CHECK_CALLED(QueryStatus_NEW); CHECK_CALLED(QueryStatus_NEW);
for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) { for(i=0; i < ARRAY_SIZE(cmds); i++) {
ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID); ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
if(i+1 == OLECMDID_FIND) if(i+1 == OLECMDID_FIND)
continue; continue;
...@@ -7332,7 +7332,7 @@ static void test_enum_objects(IOleContainer *container) ...@@ -7332,7 +7332,7 @@ static void test_enum_objects(IOleContainer *container)
ok(enum_unknown != NULL, "enum_unknown == NULL\n"); ok(enum_unknown != NULL, "enum_unknown == NULL\n");
fetched = 0xdeadbeef; fetched = 0xdeadbeef;
hres = IEnumUnknown_Next(enum_unknown, sizeof(buf)/sizeof(*buf), buf, &fetched); hres = IEnumUnknown_Next(enum_unknown, ARRAY_SIZE(buf), buf, &fetched);
ok(hres == S_FALSE, "Next returned %08x\n", hres); ok(hres == S_FALSE, "Next returned %08x\n", hres);
ok(!fetched, "fetched = %d\n", fetched); ok(!fetched, "fetched = %d\n", fetched);
ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]); ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
...@@ -7764,7 +7764,7 @@ static void test_cookies(IHTMLDocument2 *doc) ...@@ -7764,7 +7764,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str); hres = IHTMLDocument2_get_cookie(doc, &str);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres); ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
if(str) { if(str) {
size = sizeof(buf)/sizeof(WCHAR); size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size); b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError()); ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf)); ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
...@@ -7779,7 +7779,7 @@ static void test_cookies(IHTMLDocument2 *doc) ...@@ -7779,7 +7779,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str2); hres = IHTMLDocument2_get_cookie(doc, &str2);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres); ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
ok(str2 != NULL, "cookie = NULL\n"); ok(str2 != NULL, "cookie = NULL\n");
size = sizeof(buf)/sizeof(WCHAR); size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size); b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError()); ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf)); ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
...@@ -7796,7 +7796,7 @@ static void test_cookies(IHTMLDocument2 *doc) ...@@ -7796,7 +7796,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str2); hres = IHTMLDocument2_get_cookie(doc, &str2);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres); ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
ok(str2 != NULL, "cookie = NULL\n"); ok(str2 != NULL, "cookie = NULL\n");
size = sizeof(buf)/sizeof(WCHAR); size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size); b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError()); ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf)); ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
......
...@@ -300,7 +300,7 @@ static void perform_test(const struct location_test* test) ...@@ -300,7 +300,7 @@ static void perform_test(const struct location_test* test)
if(FAILED(hres)) if(FAILED(hres))
return; return;
MultiByteToWideChar(CP_ACP, 0, test->url, -1, url, sizeof(url)/sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, test->url, -1, url, ARRAY_SIZE(url));
hres = CreateURLMoniker(NULL, url, &url_mon); hres = CreateURLMoniker(NULL, url, &url_mon);
ok(hres == S_OK, "%s: CreateURLMoniker failed: 0x%08x\n", test->name, hres); ok(hres == S_OK, "%s: CreateURLMoniker failed: 0x%08x\n", test->name, hres);
if(FAILED(hres)){ if(FAILED(hres)){
...@@ -381,7 +381,7 @@ START_TEST(htmllocation) ...@@ -381,7 +381,7 @@ START_TEST(htmllocation)
CoInitialize(NULL); CoInitialize(NULL);
for(i=0; i < sizeof(location_tests)/sizeof(*location_tests); i++) for(i=0; i < ARRAY_SIZE(location_tests); i++)
perform_test(location_tests+i); perform_test(location_tests+i);
CoUninitialize(); CoUninitialize();
......
...@@ -3378,9 +3378,9 @@ static void run_js_script(const char *test_name) ...@@ -3378,9 +3378,9 @@ static void run_js_script(const char *test_name)
trace("running %s...\n", test_name); trace("running %s...\n", test_name);
ptr = url + lstrlenW(url); ptr = url + lstrlenW(url);
ptr += GetModuleFileNameW(NULL, ptr, url + sizeof(url)/sizeof(WCHAR) - ptr); ptr += GetModuleFileNameW(NULL, ptr, url + ARRAY_SIZE(url) - ptr);
*ptr++ = '/'; *ptr++ = '/';
MultiByteToWideChar(CP_ACP, 0, test_name, -1, ptr, url + sizeof(url)/sizeof(WCHAR) - ptr); MultiByteToWideChar(CP_ACP, 0, test_name, -1, ptr, url + ARRAY_SIZE(url) - ptr);
hres = CreateURLMoniker(NULL, url, &mon); hres = CreateURLMoniker(NULL, url, &mon);
ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres); ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
......
...@@ -747,7 +747,7 @@ static void test_sync_xhr(IHTMLDocument2 *doc, const char *xml_url, const char * ...@@ -747,7 +747,7 @@ static void test_sync_xhr(IHTMLDocument2 *doc, const char *xml_url, const char *
SysFreeString(text); SysFreeString(text);
if(expect_text) if(expect_text)
test_header(expect_headers, sizeof(expect_headers)/sizeof(expect_headers[0])); test_header(expect_headers, ARRAY_SIZE(expect_headers));
val = 0xdeadbeef; val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_status(xhr, &val); hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
...@@ -905,7 +905,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url, const char ...@@ -905,7 +905,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url, const char
SysFreeString(text); SysFreeString(text);
if(expect_text) if(expect_text)
test_header(expect_headers, sizeof(expect_headers)/sizeof(expect_headers[0])); test_header(expect_headers, ARRAY_SIZE(expect_headers));
val = 0xdeadbeef; val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_status(xhr, &val); hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
......
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