Commit 1281a687 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent ff84b2f2
......@@ -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. */
......
......@@ -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; i<sizeof(in)/sizeof(WCHAR*); i++) {
for(i = 0; i < ARRAY_SIZE(in); i++) {
hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
if(hres == S_OK) {
......@@ -1625,7 +1625,7 @@ static void test_InternetGetSecurityUrlEx(void)
ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08x, expected E_INVALIDARG\n", hr);
ok(result == (void*) 0xdeadbeef, "'result' was %p\n", result);
for(i = 0; i < sizeof(sec_url_ex_tests)/sizeof(sec_url_ex_tests[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(sec_url_ex_tests); ++i) {
LPWSTR uriW = a2w(sec_url_ex_tests[i].uri);
uri = NULL;
......@@ -1827,7 +1827,7 @@ static void test_SecurityManagerEx2(void)
IUri_Release(uri);
for(i = 0; i < sizeof(sec_mgr_ex2_tests)/sizeof(sec_mgr_ex2_tests[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(sec_mgr_ex2_tests); ++i) {
LPWSTR uriW = a2w(sec_mgr_ex2_tests[i].uri);
uri = NULL;
......@@ -1925,7 +1925,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%x)\n", hres);
for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
for(i = 0; i < ARRAY_SIZE(testcases); i++) {
if(hres==S_OK && testcases[i].flags == GET_FEATURE_FROM_PROCESS)
testcases[i].policy_flags = URLPOLICY_ALLOW;
}
......@@ -1940,7 +1940,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
return;
}
for(i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++) {
for(i = 0; i < ARRAY_SIZE(testcases); i++) {
url_from = a2w(testcases[i].url_from);
url_to = a2w(testcases[i].url_to);
......
......@@ -2901,7 +2901,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
}
if(url_a)
MultiByteToWideChar(CP_ACP, 0, url_a, -1, current_url, sizeof(current_url)/sizeof(*current_url));
MultiByteToWideChar(CP_ACP, 0, url_a, -1, current_url, ARRAY_SIZE(current_url));
test_redirect = (flags & BINDTEST_REDIRECT) != 0;
use_cache_file = (flags & BINDTEST_USE_CACHE) != 0;
......
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