From 1281a687c8e43f2fc4e22168f98b79aaed698dfe Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 15 Jun 2018 00:04:43 +0200 Subject: [PATCH] urlmon/tests: Use the available ARRAY_SIZE() macro. Signed-off-by: Michael Stefaniuc Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/urlmon/tests/misc.c | 66 +++++++++++++++++--------------------- dlls/urlmon/tests/protocol.c | 26 +++++++-------- dlls/urlmon/tests/sec_mgr.c | 20 ++++++------ dlls/urlmon/tests/uri.c | 76 ++++++++++++++++++++++---------------------- dlls/urlmon/tests/url.c | 2 +- 5 files changed, 91 insertions(+), 99 deletions(-) diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c index e88c9604979..ff0f24ed764 100644 --- a/dlls/urlmon/tests/misc.c +++ b/dlls/urlmon/tests/misc.c @@ -85,7 +85,7 @@ static HRESULT (WINAPI *pIEInstallScope)(DWORD*); static int strcmp_wa(const WCHAR *strw, const char *stra) { WCHAR buf[512]; - MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf)); return lstrcmpW(strw, buf); } @@ -367,23 +367,23 @@ static void test_CoInternetParseUrl(void) 3, &size, 0); ok(hres == E_POINTER, "schema failed: %08x, expected E_POINTER\n", hres); - for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(parse_tests); i++) { memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08x, expected %08x\n", i, hres, parse_tests[i].secur_hres); memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres); ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i); ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i); memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n", i, hres, parse_tests[i].path_hres); if(parse_tests[i].path) { @@ -393,7 +393,7 @@ static void test_CoInternetParseUrl(void) memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SCHEMA, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres); ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i); ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i); @@ -402,7 +402,7 @@ static void test_CoInternetParseUrl(void) && memcmp(parse_tests[i].url, wszAbout, 5*sizeof(WCHAR))) { memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08x\n", i, hres); if(parse_tests[i].domain) ok(!lstrcmpW(parse_tests[i].domain, buf), "[%d] wrong domain, received %s\n", i, wine_dbgstr_w(buf)); @@ -410,7 +410,7 @@ static void test_CoInternetParseUrl(void) memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ROOTDOCUMENT, 0, buf, - sizeof(buf)/sizeof(WCHAR), &size, 0); + ARRAY_SIZE(buf), &size, 0); ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08x\n", i, hres); if(parse_tests[i].rootdocument) ok(!lstrcmpW(parse_tests[i].rootdocument, buf), "[%d] wrong rootdocument, received %s\n", i, wine_dbgstr_w(buf)); @@ -451,7 +451,7 @@ static void test_CoInternetQueryInfo(void) DWORD cb, i; HRESULT hres; - for(i=0; i < sizeof(query_info_tests)/sizeof(query_info_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(query_info_tests); i++) { cb = 0xdeadbeef; memset(buf, '?', sizeof(buf)); hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), &cb, 0); @@ -724,7 +724,7 @@ static void test_FindMimeFromData(void) static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n',0}; - for(i=0; isizeof(wszFile)/sizeof(WCHAR) && + ok(lstrlenW(sec_url) > ARRAY_SIZE(wszFile) && !memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)), "Encoded url = %s\n", wine_dbgstr_w(sec_url)); CoTaskMemFree(sec_url); @@ -1084,8 +1081,7 @@ static void test_NameSpace(void) hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL, @@ -1103,8 +1099,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1116,8 +1111,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1130,8 +1124,7 @@ static void test_NameSpace(void) SET_EXPECT(QI_IInternetProtocolInfo); SET_EXPECT(ParseUrl); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); CHECK_CALLED(QI_IInternetProtocolInfo); @@ -1149,8 +1142,7 @@ static void test_NameSpace(void) hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest); ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres); - hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR), - &size, 0); + hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres); IInternetSession_Release(session); @@ -1627,7 +1619,7 @@ static void test_MkParseDisplayNameEx(void) CreateBindCtx(0, &bctx); - for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++) + for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++) { eaten = 0xdeadbeef; mon = (IMoniker *)0xdeadbeef; @@ -1643,7 +1635,7 @@ static void test_MkParseDisplayNameEx(void) hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon); ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres); - ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); + ok(eaten == ARRAY_SIZE(url9)-1, "eaten=%d\n", eaten); ok(mon != NULL, "mon == NULL\n"); hres = IMoniker_GetDisplayName(mon, NULL, 0, &name); @@ -1659,7 +1651,7 @@ static void test_MkParseDisplayNameEx(void) hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon); ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres); - ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); + ok(eaten == ARRAY_SIZE(clsid_nameW)-1, "eaten=%d\n", eaten); ok(mon != NULL, "mon == NULL\n"); hres = IMoniker_IsSystemMoniker(mon, &issys); @@ -1733,7 +1725,7 @@ static void test_internet_feature_defaults(void) { HRESULT hres; DWORD i; - for(i = 0; i < sizeof(default_feature_tests)/sizeof(default_feature_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(default_feature_tests); ++i) { hres = pCoInternetIsFeatureEnabled(default_feature_tests[i].feature, default_feature_tests[i].get_flags); todo_wine_if (default_feature_tests[i].todo) ok(hres == default_feature_tests[i].expected, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n", @@ -1880,7 +1872,7 @@ static void test_CoInternetSetFeatureEnabled(void) { hres = pCoInternetSetFeatureEnabled(FEATURE_ENTRY_COUNT,SET_FEATURE_ON_PROCESS,TRUE); ok(hres == E_FAIL, "CoInternetSetFeatureEnabled returned %08x, expected E_FAIL\n", hres); - for(i = 0; i < sizeof(internet_feature_tests)/sizeof(internet_feature_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(internet_feature_tests); ++i) { hres = pCoInternetSetFeatureEnabled(internet_feature_tests[i].feature, internet_feature_tests[i].set_flags, internet_feature_tests[i].enable); todo_wine_if (internet_feature_tests[i].set_todo) diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index 0ca8feebcb1..999b591f5f9 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -824,7 +824,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, if (winetest_debug > 1) { - if (ulStatusCode < sizeof(status_names)/sizeof(status_names[0])) + if (ulStatusCode < ARRAY_SIZE(status_names)) trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) ); else trace( "progress: %u %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) ); @@ -3051,55 +3051,55 @@ static void test_file_protocol(void) { test_file_protocol_url(index_url); memcpy(buf, wszFile, sizeof(wszFile)); - len = sizeof(wszFile)/sizeof(WCHAR)-1; - len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len); + len = ARRAY_SIZE(wszFile)-1; + len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\\'; memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - file_name = buf + sizeof(wszFile)/sizeof(WCHAR)-1; + file_name = buf + ARRAY_SIZE(wszFile)-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); memcpy(buf, wszFile2, sizeof(wszFile2)); - len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf); + len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\\'; memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+sizeof(wszFile2)/sizeof(WCHAR)-1, file_name_buf); + lstrcpyW(buf+ARRAY_SIZE(wszFile2)-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); - buf[sizeof(wszFile2)/sizeof(WCHAR)] = '|'; + buf[ARRAY_SIZE(wszFile2)] = '|'; test_file_protocol_url(buf); memcpy(buf, wszFile3, sizeof(wszFile3)); - len = sizeof(wszFile3)/sizeof(WCHAR)-1; - len += GetCurrentDirectoryW(sizeof(buf)/sizeof(WCHAR)-len, buf+len); + len = ARRAY_SIZE(wszFile3)-1; + len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\\'; memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - file_name = buf + sizeof(wszFile3)/sizeof(WCHAR)-1; + file_name = buf + ARRAY_SIZE(wszFile3)-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); memcpy(buf, wszFile4, sizeof(wszFile4)); - len = GetCurrentDirectoryW(sizeof(file_name_buf)/sizeof(WCHAR), file_name_buf); + len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\\'; memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+sizeof(wszFile4)/sizeof(WCHAR)-1, file_name_buf); + lstrcpyW(buf+ARRAY_SIZE(wszFile4)-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf); - buf[sizeof(wszFile4)/sizeof(WCHAR)] = '|'; + buf[ARRAY_SIZE(wszFile4)] = '|'; test_file_protocol_url(buf); /* Fragment part of URL is skipped if the file doesn't exist. */ diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c index 411a3b7781e..2974eecc36d 100644 --- a/dlls/urlmon/tests/sec_mgr.c +++ b/dlls/urlmon/tests/sec_mgr.c @@ -221,7 +221,7 @@ static LONG myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) dwMaxSubkeyLen++; dwMaxValueLen++; dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); - if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR)) + if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(CHAR)))) @@ -381,7 +381,7 @@ static void test_SecurityManager(void) if(FAILED(hres)) return; - for(i=0; i < sizeof(secmgr_tests)/sizeof(secmgr_tests[0]); i++) { + for(i = 0; i < ARRAY_SIZE(secmgr_tests); i++) { zone = 100; hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url, &zone, 0); @@ -785,7 +785,7 @@ static BOOL register_zone_domains(void) res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains); ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res); - for(i = 0; i < sizeof(zone_domain_mappings)/sizeof(zone_domain_mappings[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) { const zone_domain_mapping *test = zone_domain_mappings+i; HKEY domain; @@ -830,7 +830,7 @@ static void unregister_zone_domains(void) res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains); ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res); - for(i = 0; i < sizeof(zone_domain_mappings)/sizeof(zone_domain_mappings[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) { const zone_domain_mapping *test = zone_domain_mappings+i; /* FIXME: Uses the "cludge" approach to remove the test data from the registry! @@ -936,7 +936,7 @@ static void test_zone_domain_mappings(void) RegCloseKey(domains); } - for(i = 0; i < sizeof(zone_mapping_tests)/sizeof(zone_mapping_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(zone_mapping_tests); ++i) { const zone_mapping_test *test = zone_mapping_tests+i; LPWSTR urlW = a2w(test->url); zone = URLZONE_INVALID; @@ -1360,7 +1360,7 @@ static void test_InternetGetSecurityUrl(void) trace("testing CoInternetGetSecurityUrl...\n"); - for(i=0; iexpected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8703,7 +8703,7 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -8737,7 +8737,7 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui if(SUCCEEDED(hr)) { DWORD i; - for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8755,7 +8755,7 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -8790,7 +8790,7 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_ if(SUCCEEDED(hr)) { DWORD i; - for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) { uri_builder_str_property prop = test->expected_str_props[i]; BSTR received = NULL; @@ -8808,7 +8808,7 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_ SysFreeString(received); } - for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) { uri_builder_dword_property prop = test->expected_dword_props[i]; DWORD received = -2; @@ -9051,7 +9051,7 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT) prop = &(test->properties[i]); } @@ -9146,7 +9146,7 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST) prop = &(test->properties[i]); } @@ -9241,7 +9241,7 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD) prop = &(test->properties[i]); } @@ -9336,7 +9336,7 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH) prop = &(test->properties[i]); } @@ -9498,7 +9498,7 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY) prop = &(test->properties[i]); } @@ -9593,7 +9593,7 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME) prop = &(test->properties[i]); } @@ -9688,7 +9688,7 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder const uri_builder_property *prop = NULL; /* Check if the property was set earlier. */ - for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(test->properties); ++i) { if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME) prop = &(test->properties[i]); } @@ -9780,7 +9780,7 @@ static void test_IUriBuilder(void) { IUriBuilder *builder; DWORD i; - for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) { IUri *uri = NULL; uri_builder_test test = uri_builder_tests[i]; LPWSTR uriW = NULL; @@ -10132,7 +10132,7 @@ static void test_IUriBuilder_RemoveProperties(void) { } if(builder) IUriBuilder_Release(builder); - for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) { uri_builder_remove_test test = uri_builder_remove_tests[i]; IUri *uri = NULL; LPWSTR uriW; @@ -10328,7 +10328,7 @@ static void test_CoInternetCombineIUri(void) { if(base) IUri_Release(base); if(relative) IUri_Release(relative); - for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) { LPWSTR baseW = a2w(uri_combine_tests[i].base_uri); hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base); @@ -10349,7 +10349,7 @@ static void test_CoInternetCombineIUri(void) { if(SUCCEEDED(hr)) { DWORD j; - for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) { uri_combine_str_property prop = uri_combine_tests[i].str_props[j]; BSTR received; @@ -10366,7 +10366,7 @@ static void test_CoInternetCombineIUri(void) { SysFreeString(received); } - for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) { uri_dword_property prop = uri_combine_tests[i].dword_props[j]; DWORD received; @@ -10619,7 +10619,7 @@ static void test_CoInternetCombineUrlEx(void) { hr, E_POINTER); if(base) IUri_Release(base); - for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) { LPWSTR baseW = a2w(uri_combine_tests[i].base_uri); hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base); @@ -10636,7 +10636,7 @@ static void test_CoInternetCombineUrlEx(void) { if(SUCCEEDED(hr)) { DWORD j; - for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) { uri_combine_str_property prop = uri_combine_tests[i].str_props[j]; BSTR received; LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value; @@ -10654,7 +10654,7 @@ static void test_CoInternetCombineUrlEx(void) { SysFreeString(received); } - for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) { + for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) { uri_dword_property prop = uri_combine_tests[i].dword_props[j]; DWORD received; @@ -10776,7 +10776,7 @@ static void test_CoInternetParseIUri_InvalidArgs(void) { len = INTERNET_MAX_URL_LENGTH*2; longurl = heap_alloc((len+1)*sizeof(WCHAR)); memcpy(longurl, http_urlW, sizeof(http_urlW)); - for(i = sizeof(http_urlW)/sizeof(WCHAR)-1; i < len; i++) + for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++) longurl[i] = 'x'; longurl[len] = 0; @@ -10803,7 +10803,7 @@ static void test_CoInternetParseIUri_InvalidArgs(void) { static void test_CoInternetParseIUri(void) { DWORD i; - for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) { + for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) { HRESULT hr; IUri *uri; LPWSTR uriW; @@ -11001,7 +11001,7 @@ static void test_CreateURLMoniker(void) IUri *uri, *base_uri; HRESULT hres; - for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) { + for(test = create_urlmon_tests; test < create_urlmon_tests + ARRAY_SIZE(create_urlmon_tests); test++) { url = a2w(test->url); base_url = a2w(test->base_url); @@ -11100,7 +11100,7 @@ static void test_IPersistStream(void) props_order[Uri_PROPERTY_SCHEME_NAME] = 8; props_order[Uri_PROPERTY_USER_NAME] = 9; - for(i=0; i