mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-07 15:27:49 +00:00
mshtml/tests: Use the available ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
41623d6216
commit
6bc984a600
|
@ -2704,7 +2704,7 @@ static void _test_elem_collection(unsigned line, IUnknown *unk,
|
|||
|
||||
memset(vs, 0, sizeof(vs));
|
||||
fetched = 0;
|
||||
hres = IEnumVARIANT_Next(enum_var, sizeof(vs)/sizeof(*vs), vs, &fetched);
|
||||
hres = IEnumVARIANT_Next(enum_var, ARRAY_SIZE(vs), vs, &fetched);
|
||||
ok_(__FILE__,line)(hres == S_FALSE, "Next failed: %08x\n", hres);
|
||||
ok_(__FILE__,line)(fetched == (len > 2 ? 2 : len), "fetched = %d\n", fetched);
|
||||
if(len) {
|
||||
|
@ -6188,7 +6188,7 @@ static void _test_language_string(unsigned line, const WCHAR *lang, LCID lcid)
|
|||
int res;
|
||||
|
||||
if(pLCIDToLocaleName) {
|
||||
res = pLCIDToLocaleName(lcid, buf, sizeof(buf)/sizeof(WCHAR), 0);
|
||||
res = pLCIDToLocaleName(lcid, buf, ARRAY_SIZE(buf), 0);
|
||||
ok_(__FILE__,line)(res, "LCIDToLocaleName failed: %u\n", GetLastError());
|
||||
ok_(__FILE__,line)(!lstrcmpW(lang, buf), "lang = %s, expected %s\n", wine_dbgstr_w(lang), wine_dbgstr_w(buf));
|
||||
}else {
|
||||
|
@ -6486,17 +6486,17 @@ static void test_unique_id(IHTMLDocument2 *doc, IHTMLElement *elem)
|
|||
|
||||
hres = IHTMLDocument3_get_uniqueID(doc3, &id);
|
||||
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
|
||||
ok(SysStringLen(id) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id));
|
||||
ok(SysStringLen(id) >= ARRAY_SIZE(prefixW), "id %s too short\n", wine_dbgstr_w(id));
|
||||
|
||||
hres = IHTMLDocument3_get_uniqueID(doc3, &id2);
|
||||
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
|
||||
ok(SysStringLen(id2) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id2));
|
||||
ok(SysStringLen(id2) >= ARRAY_SIZE(prefixW), "id %s too short\n", wine_dbgstr_w(id2));
|
||||
|
||||
ok(lstrcmpW(id, id2), "same unique ids %s\n", wine_dbgstr_w(id));
|
||||
|
||||
id[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
|
||||
id[ARRAY_SIZE(prefixW)-1] = 0;
|
||||
ok(!lstrcmpW(id, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id));
|
||||
id2[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
|
||||
id2[ARRAY_SIZE(prefixW)-1] = 0;
|
||||
ok(!lstrcmpW(id2, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id2));
|
||||
|
||||
SysFreeString(id);
|
||||
|
@ -7267,7 +7267,7 @@ static void test_tr_elem(IHTMLElement *elem)
|
|||
ok(hres == S_OK, "get_cells failed: %08x\n", hres);
|
||||
ok(col != NULL, "get_cells returned NULL\n");
|
||||
|
||||
test_elem_collection((IUnknown*)col, cell_types, sizeof(cell_types)/sizeof(*cell_types));
|
||||
test_elem_collection((IUnknown*)col, cell_types, ARRAY_SIZE(cell_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
bstr = a2bstr("left");
|
||||
|
@ -7591,14 +7591,14 @@ static void test_table_elem(IHTMLElement *elem)
|
|||
ok(hres == S_OK, "get_rows failed: %08x\n", hres);
|
||||
ok(col != NULL, "get_rows returned NULL\n");
|
||||
|
||||
test_elem_collection((IUnknown*)col, row_types, sizeof(row_types)/sizeof(*row_types));
|
||||
test_elem_collection((IUnknown*)col, row_types, ARRAY_SIZE(row_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
test_elem_all((IUnknown*)table, all_types, sizeof(all_types)/sizeof(*all_types));
|
||||
test_elem_all((IUnknown*)table, all_types, ARRAY_SIZE(all_types));
|
||||
|
||||
node = clone_node((IUnknown*)table, VARIANT_TRUE);
|
||||
test_elem_tag((IUnknown*)node, "TABLE");
|
||||
test_elem_all((IUnknown*)node, all_types, sizeof(all_types)/sizeof(*all_types));
|
||||
test_elem_all((IUnknown*)node, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLDOMNode_Release(node);
|
||||
|
||||
node = clone_node((IUnknown*)table, VARIANT_FALSE);
|
||||
|
@ -7611,7 +7611,7 @@ static void test_table_elem(IHTMLElement *elem)
|
|||
ok(hres == S_OK, "get_tBodies failed: %08x\n", hres);
|
||||
ok(col != NULL, "get_tBodies returned NULL\n");
|
||||
|
||||
test_elem_collection((IUnknown*)col, tbodies_types, sizeof(tbodies_types)/sizeof(*tbodies_types));
|
||||
test_elem_collection((IUnknown*)col, tbodies_types, ARRAY_SIZE(tbodies_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
test_table_cell_spacing(table, NULL);
|
||||
|
@ -7994,7 +7994,7 @@ static void test_iframe_elem(IHTMLElement *elem)
|
|||
|
||||
hres = IHTMLDocument2_get_all(content_doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
body = doc_get_body(content_doc);
|
||||
|
@ -8302,7 +8302,7 @@ static void test_elemsbyclass(IHTMLElement *div)
|
|||
hres = IHTMLElement6_getElementsByClassName(elem, str, &collection);
|
||||
ok(hres == S_OK, "getElementsByClassName failed: %08x\n", hres);
|
||||
ok(collection != NULL, "collection == NULL\n");
|
||||
test_elem_collection((IUnknown*)collection, types, sizeof(types)/sizeof(*types));
|
||||
test_elem_collection((IUnknown*)collection, types, ARRAY_SIZE(types));
|
||||
IHTMLElementCollection_Release(collection);
|
||||
SysFreeString(str);
|
||||
|
||||
|
@ -8364,8 +8364,8 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_col_item(col, "x", item_types, sizeof(item_types)/sizeof(item_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
test_elem_col_item(col, "x", item_types, ARRAY_SIZE(item_types));
|
||||
|
||||
elem = get_elem_col_item_idx(col, 0);
|
||||
test_elem_source_index(elem, 0);
|
||||
|
@ -8419,7 +8419,7 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
|
||||
elem = get_doc_elem(doc);
|
||||
test_elem_istextedit(elem, VARIANT_FALSE);
|
||||
test_elem_all((IUnknown*)elem, all_types+1, sizeof(all_types)/sizeof(all_types[0])-1);
|
||||
test_elem_all((IUnknown*)elem, all_types+1, ARRAY_SIZE(all_types)-1);
|
||||
IHTMLElement_Release(elem);
|
||||
|
||||
get_elem_by_id(doc, "xxx", FALSE);
|
||||
|
@ -8964,7 +8964,7 @@ static void test_elems(IHTMLDocument2 *doc)
|
|||
static const elem_type_t select_types[] = { ET_OPTION, ET_OPTION, ET_OPTION };
|
||||
|
||||
test_select_put_length((IUnknown*)elem, 3);
|
||||
test_elem_all((IUnknown*)elem, select_types, sizeof(select_types)/sizeof(*select_types));
|
||||
test_elem_all((IUnknown*)elem, select_types, ARRAY_SIZE(select_types));
|
||||
test_select_put_length((IUnknown*)elem, 1);
|
||||
test_elem_all((IUnknown*)elem, select_types, 1);
|
||||
IHTMLElement_Release(elem);
|
||||
|
@ -9204,7 +9204,7 @@ static void test_elem_names(IHTMLDocument2 *doc)
|
|||
test_elem_set_innerhtml((IUnknown*)body,
|
||||
"<input name=\"test\"><a name=\"test\"></a><a name=\"xxx\"></a><div id=\"test\"></div>");
|
||||
col = doc_get_elems_by_name(doc, "test");
|
||||
test_elem_collection((IUnknown*)col, test1_types, sizeof(test1_types)/sizeof(*test1_types));
|
||||
test_elem_collection((IUnknown*)col, test1_types, ARRAY_SIZE(test1_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
col = doc_get_elems_by_name(doc, "yyy");
|
||||
|
@ -9252,7 +9252,7 @@ static void test_elems2(IHTMLDocument2 *doc)
|
|||
elem2 = get_doc_elem_by_id(doc, "innerid");
|
||||
ok(elem2 != NULL, "elem2 == NULL\n");
|
||||
test_elem_set_outerhtml((IUnknown*)elem2, "<br><a href=\"about:blank\" id=\"aid\">a</a>");
|
||||
test_elem_all((IUnknown*)div, outer_types, sizeof(outer_types)/sizeof(*outer_types));
|
||||
test_elem_all((IUnknown*)div, outer_types, ARRAY_SIZE(outer_types));
|
||||
IHTMLElement_Release(elem2);
|
||||
|
||||
elem2 = get_doc_elem_by_id(doc, "aid");
|
||||
|
@ -9407,8 +9407,7 @@ static void test_form_element(IHTMLDocument2 *doc, IHTMLElement *parent)
|
|||
test_form_put_encoding((IUnknown*)elem, S_OK, "multipart/form-data");
|
||||
test_form_put_encoding((IUnknown*)elem, E_INVALIDARG, "image/png");
|
||||
test_form_encoding((IUnknown*)elem, "multipart/form-data");
|
||||
test_form_elements((IUnknown*)elem, elems_textarea_input,
|
||||
sizeof(elems_textarea_input)/sizeof(*elems_textarea_input));
|
||||
test_form_elements((IUnknown*)elem, elems_textarea_input, ARRAY_SIZE(elems_textarea_input));
|
||||
test_form_reset((IUnknown*)elem);
|
||||
test_form_target((IUnknown*)elem);
|
||||
|
||||
|
@ -9495,7 +9494,7 @@ static void test_create_elems(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLElement_get_all(body, &disp);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)disp, types1, sizeof(types1)/sizeof(types1[0]));
|
||||
test_elem_collection((IUnknown*)disp, types1, ARRAY_SIZE(types1));
|
||||
IDispatch_Release(disp);
|
||||
|
||||
test_node_remove_child((IUnknown*)body, node);
|
||||
|
@ -9636,12 +9635,12 @@ static void test_noscript(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
body = doc_get_body(doc);
|
||||
test_elem_set_innerhtml((IUnknown*)body, "<div>test</div><noscript><a href=\"about:blank\">A</a></noscript>");
|
||||
test_elem_all((IUnknown*)body, body_all_types, sizeof(body_all_types)/sizeof(*body_all_types));
|
||||
test_elem_all((IUnknown*)body, body_all_types, ARRAY_SIZE(body_all_types));
|
||||
IHTMLElement_Release(body);
|
||||
}
|
||||
|
||||
|
@ -9703,12 +9702,12 @@ static void test_create_stylesheet(IHTMLDocument2 *doc)
|
|||
ET_DIV
|
||||
};
|
||||
|
||||
test_doc_all(doc, all_types, sizeof(all_types)/sizeof(*all_types));
|
||||
test_doc_all(doc, all_types, ARRAY_SIZE(all_types));
|
||||
|
||||
hres = IHTMLDocument2_createStyleSheet(doc, NULL, -1, &stylesheet);
|
||||
ok(hres == S_OK, "createStyleSheet failed: %08x\n", hres);
|
||||
|
||||
test_doc_all(doc, all_types2, sizeof(all_types2)/sizeof(*all_types2));
|
||||
test_doc_all(doc, all_types2, ARRAY_SIZE(all_types2));
|
||||
|
||||
doc_elem = get_doc_elem(doc);
|
||||
|
||||
|
@ -9773,7 +9772,7 @@ static void test_indent(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
range = test_create_body_range(doc);
|
||||
|
@ -9782,7 +9781,7 @@ static void test_indent(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, indent_types, sizeof(indent_types)/sizeof(indent_types[0]));
|
||||
test_elem_collection((IUnknown*)col, indent_types, ARRAY_SIZE(indent_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
}
|
||||
|
||||
|
@ -9801,7 +9800,7 @@ static void test_cond_comment(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
}
|
||||
|
||||
|
@ -10116,7 +10115,7 @@ static void test_docfrag(IHTMLDocument2 *doc)
|
|||
|
||||
hres = IHTMLDocument2_get_all(doc, &col);
|
||||
ok(hres == S_OK, "get_all failed: %08x\n", hres);
|
||||
test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
|
||||
test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
|
||||
IHTMLElementCollection_Release(col);
|
||||
|
||||
div = test_create_elem(frag, "div");
|
||||
|
|
|
@ -6456,7 +6456,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
|
|||
static void test_OleCommandTarget(IHTMLDocument2 *doc)
|
||||
{
|
||||
IOleCommandTarget *cmdtrg;
|
||||
OLECMD cmds[sizeof(expect_cmds)/sizeof(*expect_cmds)-1];
|
||||
OLECMD cmds[ARRAY_SIZE(expect_cmds)-1];
|
||||
int i;
|
||||
HRESULT hres;
|
||||
|
||||
|
@ -6465,19 +6465,19 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
|
|||
if(FAILED(hres))
|
||||
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].cmdf = 0xf0f0;
|
||||
}
|
||||
|
||||
SET_EXPECT(QueryStatus_OPEN);
|
||||
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);
|
||||
CHECK_CALLED(QueryStatus_OPEN);
|
||||
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);
|
||||
if(i+1 == OLECMDID_FIND)
|
||||
continue;
|
||||
|
@ -7332,7 +7332,7 @@ static void test_enum_objects(IOleContainer *container)
|
|||
ok(enum_unknown != NULL, "enum_unknown == NULL\n");
|
||||
|
||||
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(!fetched, "fetched = %d\n", fetched);
|
||||
ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
|
||||
|
@ -7764,7 +7764,7 @@ static void test_cookies(IHTMLDocument2 *doc)
|
|||
hres = IHTMLDocument2_get_cookie(doc, &str);
|
||||
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
|
||||
if(str) {
|
||||
size = sizeof(buf)/sizeof(WCHAR);
|
||||
size = ARRAY_SIZE(buf);
|
||||
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
|
||||
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
|
||||
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)
|
|||
hres = IHTMLDocument2_get_cookie(doc, &str2);
|
||||
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
|
||||
ok(str2 != NULL, "cookie = NULL\n");
|
||||
size = sizeof(buf)/sizeof(WCHAR);
|
||||
size = ARRAY_SIZE(buf);
|
||||
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
|
||||
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
|
||||
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)
|
|||
hres = IHTMLDocument2_get_cookie(doc, &str2);
|
||||
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
|
||||
ok(str2 != NULL, "cookie = NULL\n");
|
||||
size = sizeof(buf)/sizeof(WCHAR);
|
||||
size = ARRAY_SIZE(buf);
|
||||
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
|
||||
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
|
||||
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)
|
|||
if(FAILED(hres))
|
||||
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);
|
||||
ok(hres == S_OK, "%s: CreateURLMoniker failed: 0x%08x\n", test->name, hres);
|
||||
if(FAILED(hres)){
|
||||
|
@ -381,7 +381,7 @@ START_TEST(htmllocation)
|
|||
|
||||
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);
|
||||
|
||||
CoUninitialize();
|
||||
|
|
|
@ -271,7 +271,7 @@ static void test_res_url(const char *url_suffix)
|
|||
HRESULT hres;
|
||||
|
||||
memcpy(url, res_url_base, res_url_base_len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, url_suffix, -1, url+res_url_base_len, sizeof(url)/sizeof(WCHAR)-res_url_base_len);
|
||||
MultiByteToWideChar(CP_ACP, 0, url_suffix, -1, url+res_url_base_len, ARRAY_SIZE(url)-res_url_base_len);
|
||||
|
||||
hres = CoCreateInstance(&CLSID_ResProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void**)&protocol);
|
||||
ok(hres == S_OK, "Could not create ResProtocol instance: %08x\n", hres);
|
||||
|
@ -296,13 +296,13 @@ static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
|
|||
|
||||
static const WCHAR fileW[] = {'f','i','l','e',':','/','/'};
|
||||
|
||||
if(size < sizeof(fileW)/sizeof(WCHAR) || memcmp(url, fileW, sizeof(fileW))) {
|
||||
if(size < ARRAY_SIZE(fileW) || memcmp(url, fileW, sizeof(fileW))) {
|
||||
ok(0, "wrong URL protocol\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
len = SearchPathW(NULL, file, NULL, sizeof(buf)/sizeof(WCHAR), buf, NULL);
|
||||
len = SearchPathW(NULL, file, NULL, ARRAY_SIZE(buf), buf, NULL);
|
||||
if(!len) {
|
||||
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
win_skip("SearchPathW is not implemented\n");
|
||||
|
@ -311,9 +311,9 @@ static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
|
|||
return;
|
||||
}
|
||||
|
||||
len += sizeof(fileW)/sizeof(WCHAR)+1;
|
||||
len += ARRAY_SIZE(fileW)+1;
|
||||
ok(len == size, "wrong size %u, expected %u\n", size, len);
|
||||
ok(!lstrcmpW(url + sizeof(fileW)/sizeof(WCHAR), buf), "wrong file part %s\n", wine_dbgstr_w(url));
|
||||
ok(!lstrcmpW(url + ARRAY_SIZE(fileW), buf), "wrong file part %s\n", wine_dbgstr_w(url));
|
||||
}
|
||||
|
||||
static void test_res_protocol(void)
|
||||
|
@ -355,14 +355,14 @@ static void test_res_protocol(void)
|
|||
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
|
||||
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, i, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
res_sec_url_cmp(buf, size, mshtml_dllW);
|
||||
ok(size == lstrlenW(buf)+1, "size = %d\n", size);
|
||||
|
@ -381,36 +381,32 @@ static void test_res_protocol(void)
|
|||
ok(size == expected_size, "size = %d\n", size);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == MK_E_SYNTAX || hres == E_INVALIDARG,
|
||||
"ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url5, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url6, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == sizeof(blank_url)/sizeof(WCHAR) ||
|
||||
size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
|
||||
"size=%d\n", size);
|
||||
ok(size == ARRAY_SIZE(blank_url) || size == ARRAY_SIZE(buf), /* IE8 */ "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == sizeof(wrong_url1)/sizeof(WCHAR) ||
|
||||
size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
|
||||
"size=%d\n", size);
|
||||
ok(size == ARRAY_SIZE(wrong_url1) || size == ARRAY_SIZE(buf), /* IE8 */ "size=%d\n", size);
|
||||
|
||||
if (0)
|
||||
{
|
||||
|
@ -418,40 +414,40 @@ static void test_res_protocol(void)
|
|||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == 1, "size=%u, expected 1\n", size);
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ARRAY_SIZE(buf), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ARRAY_SIZE(buf), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
}
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
|
||||
0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
0, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
|
@ -693,14 +689,14 @@ static void test_about_protocol(void)
|
|||
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
|
||||
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, i, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
ok(!lstrcmpW(about_blank_url, buf), "buf != blank_url\n");
|
||||
|
||||
|
@ -711,7 +707,7 @@ static void test_about_protocol(void)
|
|||
ok(size == 12, "size = %d\n", size);
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_test_url, PARSE_SECURITY_URL, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
|
||||
ok(!lstrcmpW(about_test_url, buf), "buf != test_url\n");
|
||||
ok(size == 11, "size = %d\n", size);
|
||||
|
@ -719,13 +715,12 @@ static void test_about_protocol(void)
|
|||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?' || buf[0] == '\0' /* Win10 */,
|
||||
"Expected buf to be unchanged or empty, got %s\n",
|
||||
wine_dbgstr_w(buf));
|
||||
ok(size == sizeof(about_blank_url)/sizeof(WCHAR) ||
|
||||
size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
|
||||
ok(size == ARRAY_SIZE(about_blank_url) || size == ARRAY_SIZE(buf), /* IE8 */
|
||||
"size=%d\n", size);
|
||||
|
||||
if (0)
|
||||
|
@ -734,44 +729,44 @@ static void test_about_protocol(void)
|
|||
size = 0xdeadbeef;
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
ok(size == 1, "size=%u, expected 1\n", size);
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ARRAY_SIZE(buf), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
|
||||
buf[0] = '?';
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), NULL, 0);
|
||||
ARRAY_SIZE(buf), NULL, 0);
|
||||
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
|
||||
ok(buf[0] == '?', "buf changed\n");
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_UNESCAPE+1, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
|
||||
0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
0, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
|
||||
URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
|
@ -870,20 +865,20 @@ static void test_javascript_protocol(void)
|
|||
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
|
||||
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, i, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
|
||||
}
|
||||
}
|
||||
|
||||
hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, PARSE_UNESCAPE+1, 0, buf,
|
||||
sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_DEFAULT_ACTION,
|
||||
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
|
||||
|
||||
size = 0xdeadbeef;
|
||||
hres = IInternetProtocolInfo_CombineUrl(protocol_info, javascript_test_url, javascript_test_url,
|
||||
0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
|
||||
0, buf, ARRAY_SIZE(buf), &size, 0);
|
||||
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
|
||||
ok(size == 0xdeadbeef, "size=%d\n", size);
|
||||
|
||||
|
@ -1007,7 +1002,8 @@ static void test_com_aggregation(const CLSID *clsid)
|
|||
|
||||
START_TEST(protocol)
|
||||
{
|
||||
res_url_base_len = 6 + GetModuleFileNameW(NULL, res_url_base + 6 /* strlen("res://") */, sizeof(res_url_base)/sizeof(WCHAR)-6);
|
||||
res_url_base_len = 6 + GetModuleFileNameW(NULL, res_url_base + 6 /* strlen("res://") */,
|
||||
ARRAY_SIZE(res_url_base)-6);
|
||||
|
||||
OleInitialize(NULL);
|
||||
|
||||
|
|
|
@ -3378,9 +3378,9 @@ static void run_js_script(const char *test_name)
|
|||
trace("running %s...\n", test_name);
|
||||
|
||||
ptr = url + lstrlenW(url);
|
||||
ptr += GetModuleFileNameW(NULL, ptr, url + sizeof(url)/sizeof(WCHAR) - ptr);
|
||||
ptr += GetModuleFileNameW(NULL, ptr, url + ARRAY_SIZE(url) - 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);
|
||||
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 *
|
|||
SysFreeString(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;
|
||||
hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
|
||||
|
@ -905,7 +905,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url, const char
|
|||
SysFreeString(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;
|
||||
hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
|
||||
|
|
Loading…
Reference in a new issue