Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
[PATCH] msvcr120/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcr120/tests/msvcr120.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c
index 152bfdf42e..85e83a6c65 100644
--- a/dlls/msvcr120/tests/msvcr120.c
+++ b/dlls/msvcr120/tests/msvcr120.c
@@ -408,7 +408,7 @@ static void test_lconv(void)
"Japanese", "Korean", "Spanish"
};
- for(i = 0; i < sizeof(locstrs) / sizeof(char *); i ++)
+ for(i = 0; i < ARRAY_SIZE(locstrs); i ++)
test_lconv_helper(locstrs[i]);
}
@@ -445,7 +445,7 @@ static void test__dpcomp(void)
};
int i, ret;
- for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
ret = p__dpcomp(tests[i].x, tests[i].y);
ok(ret == tests[i].ret, "%d) dpcomp(%f, %f) = %x\n", i, tests[i].x, tests[i].y, ret);
}
@@ -473,7 +473,7 @@ static void test____lc_locale_name_func(void)
int i, j;
wchar_t **lc_names;
- for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
if(!p_setlocale(LC_ALL, tests[i].locale))
continue;
@@ -536,12 +536,11 @@ static void test__W_Gettnames(void)
else
ok(size==0x164, "structure size: %x\n", size);
- for(i=0; i<sizeof(str)/sizeof(*str); i++) {
+ for(i=0; i<ARRAY_SIZE(str); i++) {
ok(!strcmp(ret->str[i], str[i]), "ret->str[%d] = %s, expected %s\n",
i, ret->str[i], str[i]);
- MultiByteToWideChar(CP_ACP, 0, str[i], strlen(str[i])+1,
- buf, sizeof(buf)/sizeof(*buf));
+ MultiByteToWideChar(CP_ACP, 0, str[i], strlen(str[i])+1, buf, ARRAY_SIZE(buf));
ok(!lstrcmpW(ret->wstr[i], buf), "ret->wstr[%d] = %s, expected %s\n",
i, wine_dbgstr_w(ret->wstr[i]), wine_dbgstr_w(buf));
}
@@ -640,7 +639,7 @@ static void test_remainder(void)
if(sizeof(void*) != 8) /* errno handling slightly different on 32-bit */
return;
- for(i=0; i<sizeof(tests)/sizeof(*tests); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = -1;
r = p_remainder(tests[i].x, tests[i].y);
e = errno;
@@ -907,7 +906,7 @@ static void test_wctype(void)
};
int i, ret;
- for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(properties); i++) {
ret = p_wctype(properties[i].name);
ok(properties[i].mask == ret, "%d - Expected %x, got %x\n", i, properties[i].mask, ret);
}
--
2.14.4
June 5, 2018
[PATCH] msvcr110/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcr110/tests/msvcr110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvcr110/tests/msvcr110.c b/dlls/msvcr110/tests/msvcr110.c
index 3aa394d981..c0a182f546 100644
--- a/dlls/msvcr110/tests/msvcr110.c
+++ b/dlls/msvcr110/tests/msvcr110.c
@@ -61,7 +61,7 @@ static void test_setlocale(void)
"uz-Latn-uz",
};
- for(i=0; i<sizeof(names)/sizeof(*names); i++) {
+ for(i=0; i<ARRAY_SIZE(names); i++) {
ret = p_setlocale(LC_ALL, names[i]);
ok(ret != NULL, "expected success, but got NULL\n");
ok(!strcmp(ret, names[i]), "expected %s, got %s\n", names[i], ret);
--
2.14.4
June 5, 2018
[PATCH] msvcr90/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcr90/tests/msvcr90.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index dd62f3ae6e..7ee2890e45 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -900,7 +900,7 @@ static void test_bsearch_s(void)
CHECK_CALLED(invalid_parameter_handler, EINVAL);
/* just try all array sizes */
- for (j=1;j<sizeof(arr)/sizeof(arr[0]);j++) {
+ for (j=1; j<ARRAY_SIZE(arr); j++) {
for (i=0;i<j;i++) {
l = arr[i];
g_bsearch_s_context_counter = 0;
@@ -1494,7 +1494,7 @@ static void test__AdjustPointer(void)
void *ret;
int i;
- for(i=0; i<sizeof(data)/sizeof(data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(data); i++) {
ret = p__AdjustPointer(data[i].ptr, &data[i].this_ptr_offsets);
ok(ret == data[i].ret, "%d) __AdjustPointer returned %p, expected %p\n", i, ret, data[i].ret);
}
@@ -1734,7 +1734,7 @@ static void test__fpieee_flt(void)
ok(ret == EXCEPTION_CONTINUE_SEARCH, "_fpieee_flt returned %d\n", ret);
ok(handler_called == 0, "handler_called = %d\n", handler_called);
- for(i=0; i<sizeof(test_data)/sizeof(test_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(test_data); i++) {
ep.ExceptionRecord = &rec;
ep.ContextRecord = &ctx;
memset(&rec, 0, sizeof(rec));
--
2.14.4
June 5, 2018
[PATCH] msvcp140/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcp140/tests/msvcp140.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcp140/tests/msvcp140.c b/dlls/msvcp140/tests/msvcp140.c
index 593e0ce42b..06ea11d55b 100644
--- a/dlls/msvcp140/tests/msvcp140.c
+++ b/dlls/msvcp140/tests/msvcp140.c
@@ -555,11 +555,10 @@ static void test_to_byte(void)
ok(!memcmp(dst, compare, sizeof(compare)), "Destination was modified: %s\n", dst);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
ret = p_To_byte(tests[i], dst);
- expected = WideCharToMultiByte(CP_ACP, 0, tests[i], -1, compare, sizeof(compare) / sizeof(*compare),
- NULL, NULL);
+ expected = WideCharToMultiByte(CP_ACP, 0, tests[i], -1, compare, ARRAY_SIZE(compare), NULL, NULL);
ok(ret == expected, "Got unexpected result %d, expected %d, test case %u\n", ret, expected, i);
ok(!memcmp(dst, compare, sizeof(compare)), "Got unexpected output %s, test case %u\n", dst, i);
}
@@ -601,10 +600,10 @@ static void test_to_wide(void)
ok(!ret, "Got unexpected result %d\n", ret);
ok(!memcmp(dst, compare, sizeof(compare)), "Destination was modified: %s\n", wine_dbgstr_w(dst));
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
ret = p_To_wide(tests[i], dst);
- expected = MultiByteToWideChar(CP_ACP, 0, tests[i], -1, compare, sizeof(compare) / sizeof(*compare));
+ expected = MultiByteToWideChar(CP_ACP, 0, tests[i], -1, compare, ARRAY_SIZE(compare));
ok(ret == expected, "Got unexpected result %d, expected %d, test case %u\n", ret, expected, i);
ok(!memcmp(dst, compare, sizeof(compare)), "Got unexpected output %s, test case %u\n",
wine_dbgstr_w(dst), i);
@@ -829,7 +828,7 @@ static void test_Stat(void)
todo_wine ok(0777 == perms, "_Lstat(): perms expect: 0777, got 0%o\n", perms);
ok(CloseHandle(file), "CloseHandle\n");
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
perms = 0xdeadbeef;
val = p_Stat(tests[i].path, &perms);
todo_wine_if(tests[i].is_todo) {
@@ -1043,7 +1042,7 @@ static void test_Unlink(void)
ret = p_Link(f1W, f1_linkW);
ok(ret == ERROR_SUCCESS, "_Link(): expect: ERROR_SUCCESS, got %d\n", ret);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_Unlink(tests[i].path);
todo_wine_if(tests[i].is_todo)
--
2.14.4
June 5, 2018
[PATCH] msvcp120/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcp120/tests/msvcp120.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 7f72075d84..969902db8b 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -785,7 +785,7 @@ static void test__Xtime_diff_to_millis2(void)
MSVCRT_long ret;
xtime t1, t2;
- for(i = 0; i < sizeof(tests) / sizeof(tests[0]); ++ i)
+ for(i = 0; i < ARRAY_SIZE(tests); ++ i)
{
t1.sec = tests[i].sec_before;
t1.nsec = tests[i].nsec_before;
@@ -805,7 +805,7 @@ static void test_xtime_get(void)
xtime before, after;
int i;
- for(i = 0; i < sizeof(tests) / sizeof(tests[0]); i ++)
+ for(i = 0; i < ARRAY_SIZE(tests); i ++)
{
p_xtime_get(&before, 1);
Sleep(tests[i]);
@@ -1166,7 +1166,7 @@ static void test_tr2_sys__Equivalent(void)
ok(file != INVALID_HANDLE_VALUE, "create file failed: INVALID_HANDLE_VALUE\n");
CloseHandle(file);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
val = p_tr2_sys__Equivalent(tests[i].path1, tests[i].path2);
ok(tests[i].equivalent == val, "tr2_sys__Equivalent(): test %d expect: %d, got %d\n", i+1, tests[i].equivalent, val);
@@ -1272,7 +1272,7 @@ static void test_tr2_sys__Make_dir(void)
{ "??invalid_name>>", -1 }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_tr2_sys__Make_dir(tests[i].path);
ok(ret == tests[i].val, "tr2_sys__Make_dir(): test %d expect: %d, got %d\n", i+1, tests[i].val, ret);
@@ -1301,7 +1301,7 @@ static void test_tr2_sys__Remove_dir(void)
ok(p_tr2_sys__Make_dir("tr2_test_dir"), "tr2_sys__Make_dir() failed\n");
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_tr2_sys__Remove_dir(tests[i].path);
ok(ret == tests[i].val, "test_tr2_sys__Remove_dir(): test %d expect: %d, got %d\n", i+1, tests[i].val, ret);
@@ -1345,7 +1345,7 @@ static void test_tr2_sys__Copy_file(void)
ok(SetEndOfFile(file), "SetEndOfFile failed\n");
CloseHandle(file);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_tr2_sys__Copy_file(tests[i].source, tests[i].dest, tests[i].fail_if_exists);
todo_wine_if(tests[i].is_todo)
@@ -1403,7 +1403,7 @@ static void test_tr2_sys__Rename(void)
ret = p_tr2_sys__Rename("tr2_test_dir\\f1", "tr2_test_dir\\f1");
todo_wine ok(ERROR_SUCCESS == ret, "test_tr2_sys__Rename(): expect: ERROR_SUCCESS, got %d\n", ret);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
if(tests[i].val == ERROR_SUCCESS) {
h1 = CreateFileA(tests[i].old_path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -1542,7 +1542,7 @@ static void test_tr2_sys__Stat(void)
todo_wine ok(ERROR_SUCCESS == err_code, "tr2_sys__Lstat(): err_code expect: ERROR_SUCCESS, got %d\n", err_code);
ok(CloseHandle(file), "CloseHandle\n");
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
err_code = 0xdeadbeef;
val = p_tr2_sys__Stat(tests[i].path, &err_code);
todo_wine_if(tests[i].is_todo)
@@ -1744,7 +1744,7 @@ static void test_tr2_sys__Link(void)
ok(SetEndOfFile(file), "SetEndOfFile failed\n");
CloseHandle(file);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_tr2_sys__Link(tests[i].existing_path, tests[i].new_path);
ok(ret == tests[i].last_error, "tr2_sys__Link(): test %d expect: %d, got %d\n",
@@ -1820,7 +1820,7 @@ static void test_tr2_sys__Symlink(void)
ok(SetEndOfFile(file), "SetEndOfFile failed\n");
CloseHandle(file);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = p_tr2_sys__Symlink(tests[i].existing_path, tests[i].new_path);
@@ -1892,7 +1892,7 @@ static void test_tr2_sys__Unlink(void)
ret = p_tr2_sys__Link("tr2_test_dir/f1", "tr2_test_dir/f1_link");
ok(ret == ERROR_SUCCESS, "tr2_sys__Link(): expect: ERROR_SUCCESS, got %d\n", ret);
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
ret = p_tr2_sys__Unlink(tests[i].path);
todo_wine_if(tests[i].is_todo)
@@ -1949,14 +1949,14 @@ static void test_thrd(void)
};
/* test for equal */
- for(i=0; i<sizeof(testeq)/sizeof(testeq[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(testeq); i++) {
ret = p__Thrd_equal(testeq[i].a, testeq[i].b);
ok(ret == testeq[i].r, "(%p %u) = (%p %u) expected %d, got %d\n",
testeq[i].a.hnd, testeq[i].a.id, testeq[i].b.hnd, testeq[i].b.id, testeq[i].r, ret);
}
/* test for less than */
- for(i=0; i<sizeof(testlt)/sizeof(testlt[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(testlt); i++) {
ret = p__Thrd_lt(testlt[i].a, testlt[i].b);
ok(ret == testlt[i].r, "(%p %u) < (%p %u) expected %d, got %d\n",
testlt[i].a.hnd, testlt[i].a.id, testlt[i].b.hnd, testlt[i].b.id, testlt[i].r, ret);
@@ -2323,7 +2323,7 @@ static void test_vector_base_v4__Segment_index_of(void)
{~0, 8*sizeof(void*)-1}
};
- for(i=0; i<sizeof(tests) / sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
ret = p_vector_base_v4__Segment_index_of(tests[i].x);
ok(ret == tests[i].expect, "expected %ld, got %ld for %ld\n",
(long)tests[i].expect, (long)ret, (long)tests[i].x);
--
2.14.4
June 5, 2018
[PATCH] msvcp90/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcp90/tests/ios.c | 24 ++++++++++++------------
dlls/msvcp90/tests/misc.c | 2 +-
dlls/msvcp90/tests/string.c | 6 +++---
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/msvcp90/tests/ios.c b/dlls/msvcp90/tests/ios.c
index c075f01f8c..8a911173f8 100644
--- a/dlls/msvcp90/tests/ios.c
+++ b/dlls/msvcp90/tests/ios.c
@@ -1137,7 +1137,7 @@ static void test_num_get_get_uint64(void)
{ "0xx10", NULL, FMTFLAG_hex, IOSTATE_failbit, 42, EOF },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1287,7 +1287,7 @@ static void test_num_get_get_double(void)
{ "1.0e1,0", NULL, IOSTATE_goodbit, 10.0, ',' }, /* group in exponent */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1406,7 +1406,7 @@ static void test_num_put_put_double(void)
{ -1.23456789e-9, NULL, 9, FMTFLAG_fixed, "-0.000000001" }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func1(p_basic_stringstream_char_ctor, &ss);
@@ -1499,7 +1499,7 @@ static void test_istream_ipfx(void)
{ "\n\t ws", TRUE, FALSE, TRUE, IOSTATE_goodbit, '\n' },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1579,7 +1579,7 @@ static void test_istream_ignore(void)
{ "ABC ", 42, ' ', IOSTATE_goodbit, EOF }, /* delim at end */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1643,7 +1643,7 @@ static void test_istream_seekg(void)
{ "", 0, SEEKDIR_beg, IOSTATE_failbit, EOF },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1702,7 +1702,7 @@ static void test_istream_seekg_fpos(void)
{ "", 0, IOSTATE_failbit, EOF },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1763,7 +1763,7 @@ static void test_istream_peek(void)
{ "ABCDEF", 'A', 'A', IOSTATE_goodbit },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1834,7 +1834,7 @@ static void test_istream_tellg(void)
{ "ABCDEFGHIJ", -6, -1, -1, 0 }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* stringstream<char> version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1980,7 +1980,7 @@ static void test_istream_getline(void)
{ "this is some text\n", "this is some text\n", '\0', IOSTATE_eofbit, "this is some text\n", '\n', IOSTATE_faileof },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -2208,7 +2208,7 @@ static void test_ostream_print_complex_float(void)
{ {-1.23456789e-9,2.3456789e9}, NULL, 9, FMTFLAG_fixed, "(-0.000000001,2345678848.000000000)" }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func1(p_basic_stringstream_char_ctor, &ss);
if(tests[i].lcl) {
@@ -2331,7 +2331,7 @@ static void test_istream_read_complex_double(void)
{ "(1.0eE10, 3)" , NULL, deadbeef, IOSTATE_failbit, ""},
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func2(p_basic_string_char_ctor_cstr, &str, deadbeef_str);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
p_basic_istream_char_read_complex_double(&ss.base.base1, &val);
diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c
index ffc7b9684f..e9fd1e06be 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -582,7 +582,7 @@ static void test_wctype(void)
};
int i, ret;
- for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(properties); i++) {
ret = p_wctype(properties[i].name);
ok(properties[i].mask == ret, "%d - Expected %x, got %x\n", i, properties[i].mask, ret);
}
diff --git a/dlls/msvcp90/tests/string.c b/dlls/msvcp90/tests/string.c
index 9d46df0f69..a0f16a9908 100644
--- a/dlls/msvcp90/tests/string.c
+++ b/dlls/msvcp90/tests/string.c
@@ -554,7 +554,7 @@ static void test_basic_string_char_rfind(void) {
{ "aaa", "z", 0, 1, *p_basic_string_char_npos } /* can't find */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
ret = (size_t)call_func4(p_basic_string_char_rfind_cstr_substr, &str,
@@ -602,7 +602,7 @@ static void test_basic_string_char_replace(void) {
{ "ABCDEF", 6, *p_basic_string_char_npos, "-", "ABCDEF-" }, /* replace after end with npos */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
ret = call_func4(p_basic_string_char_replace_cstr, &str, tests[i].off, tests[i].len, tests[i].replace);
@@ -756,7 +756,7 @@ static void test_basic_string_char_find_last_not_of(void) {
{ "ABCDE", "", 5, 0, 4 },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func2(p_basic_string_char_ctor_cstr, &str, tests[i].str);
ret = (size_t)call_func4(p_basic_string_char_find_last_not_of_cstr_substr,
--
2.14.4
June 5, 2018
[PATCH] msvcp60/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcp60/tests/ios.c | 18 +++++++++---------
dlls/msvcp60/tests/string.c | 4 ++--
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/msvcp60/tests/ios.c b/dlls/msvcp60/tests/ios.c
index 087aa2cb3f..1938a51df1 100644
--- a/dlls/msvcp60/tests/ios.c
+++ b/dlls/msvcp60/tests/ios.c
@@ -858,7 +858,7 @@ static void test_num_get_get_double(void)
{ "1.0e1,0", NULL, IOSTATE_goodbit, 10.0, ',' }, /* group in exponent */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -982,7 +982,7 @@ static void test_num_put_put_double(void)
{ -1.23456789e-9, NULL, 9, FMTFLAG_fixed, "-0.000000001" }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_stringstream_char_ctor_mode, &ss, OPENMODE_in|OPENMODE_out, TRUE);
@@ -1072,7 +1072,7 @@ static void test_istream_ipfx(void)
{ "\n\t ws", TRUE, FALSE, TRUE, IOSTATE_goodbit, '\n' },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1152,7 +1152,7 @@ static void test_istream_ignore(void)
{ "ABC ", 42, ' ', IOSTATE_goodbit, EOF }, /* delim at end */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1216,7 +1216,7 @@ static void test_istream_seekg(void)
{ "", 0, SEEKDIR_beg, IOSTATE_goodbit, EOF },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1275,7 +1275,7 @@ static void test_istream_seekg_fpos(void)
{ "", 0, IOSTATE_goodbit, EOF },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1336,7 +1336,7 @@ static void test_istream_peek(void)
{ "ABCDEF", 'A', 'A', IOSTATE_goodbit },
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1407,7 +1407,7 @@ static void test_istream_tellg(void)
{ "ABCDEFGHIJ", -6, 0, 0, 0 }
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* stringstream<char> version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
@@ -1554,7 +1554,7 @@ static void test_istream_getline(void)
return;
}
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
/* char version */
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
call_func4(p_basic_stringstream_char_ctor_str, &ss, &str, OPENMODE_out|OPENMODE_in, TRUE);
diff --git a/dlls/msvcp60/tests/string.c b/dlls/msvcp60/tests/string.c
index bf396f7b28..6a0efc178c 100644
--- a/dlls/msvcp60/tests/string.c
+++ b/dlls/msvcp60/tests/string.c
@@ -599,7 +599,7 @@ static void test_basic_string_char_rfind(void) {
{ "aaa", "z", 0, 1, *p_basic_string_char_npos } /* can't find */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
ret = (size_t)call_func4(p_basic_string_char_rfind_cstr_substr, &str,
@@ -647,7 +647,7 @@ static void test_basic_string_char_replace(void) {
{ "ABCDEF", 6, *p_basic_string_char_npos, "-", "ABCDEF-" }, /* replace after end with npos */
};
- for(i=0; i<sizeof(tests)/sizeof(tests[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(tests); i++) {
call_func3(p_basic_string_char_ctor_cstr_alloc, &str, tests[i].str, &fake_allocator);
ret = call_func4(p_basic_string_char_replace_cstr, &str, tests[i].off, tests[i].len, tests[i].replace);
--
2.14.4
June 5, 2018
[PATCH] msvcirt/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msvcirt/tests/msvcirt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 61f166b273..c856b50a41 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -3818,7 +3818,7 @@ static void test_ostream_print(void)
ret = (int) call_func3(p_streambuf_xsputn, &ssb_test3.base, "we're gonna play it 3.14159", 27);
ok(ret == 27, "expected 27 got %d\n", ret);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
os.base_ios.state = tests[i].state;
os.base_ios.flags = tests[i].flags;
os.base_ios.precision = tests[i].precision;
@@ -5635,7 +5635,7 @@ static void test_istream_getint(void)
pis = call_func3(p_istream_sb_ctor, &is, &ssb.base, TRUE);
ok(pis == &is, "wrong return, expected %p got %p\n", &is, pis);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
len = strlen(tests[i].stream_content);
is.base_ios.state = tests[i].initial_state;
is.base_ios.flags = tests[i].flags;
@@ -5747,7 +5747,7 @@ static void test_istream_getdouble(void)
pis = call_func3(p_istream_sb_ctor, &is, &ssb.base, TRUE);
ok(pis == &is, "wrong return, expected %p got %p\n", &is, pis);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
len = strlen(tests[i].stream_content);
is.base_ios.state = tests[i].initial_state;
is.base_ios.flags = tests[i].flags;
@@ -5949,7 +5949,7 @@ static void test_istream_read(void)
pis = call_func3(p_istream_sb_ctor, &is, &ssb.base, TRUE);
ok(pis == &is, "wrong return, expected %p got %p\n", &is, pis);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(tests); i++) {
len = strlen(tests[i].stream_content);
is.base_ios.state = IOSTATE_goodbit;
is.base_ios.flags = tests[i].flags;
--
2.14.4
June 5, 2018
[PATCH] d3d8/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/d3d8/tests/stateblock.c | 14 +++----
dlls/d3d8/tests/visual.c | 88 ++++++++++++++++++++------------------------
2 files changed, 47 insertions(+), 55 deletions(-)
diff --git a/dlls/d3d8/tests/stateblock.c b/dlls/d3d8/tests/stateblock.c
index 3ad9c1c140..83f153a289 100644
--- a/dlls/d3d8/tests/stateblock.c
+++ b/dlls/d3d8/tests/stateblock.c
@@ -1108,7 +1108,7 @@ const D3DRENDERSTATETYPE render_state_indices[] =
struct render_state_data
{
- DWORD states[sizeof(render_state_indices) / sizeof(*render_state_indices)];
+ DWORD states[ARRAY_SIZE(render_state_indices)];
};
struct render_state_arg
@@ -1132,7 +1132,7 @@ static void render_state_apply_data(IDirect3DDevice8 *device, const struct state
unsigned int i;
HRESULT hr;
- for (i = 0; i < sizeof(render_state_indices) / sizeof(*render_state_indices); ++i)
+ for (i = 0; i < ARRAY_SIZE(render_state_indices); ++i)
{
hr = IDirect3DDevice8_SetRenderState(device, render_state_indices[i], rsdata->states[i]);
ok(SUCCEEDED(hr), "SetRenderState returned %#x.\n", hr);
@@ -1147,7 +1147,7 @@ static void render_state_check_data(IDirect3DDevice8 *device, const struct state
unsigned int i;
HRESULT hr;
- for (i = 0; i < sizeof(render_state_indices) / sizeof(*render_state_indices); ++i)
+ for (i = 0; i < ARRAY_SIZE(render_state_indices); ++i)
{
DWORD value = ctx->poison_data_buffer.states[i];
hr = IDirect3DDevice8_GetRenderState(device, render_state_indices[i], &value);
@@ -1244,7 +1244,7 @@ static void render_state_poison_data_init(struct render_state_data *data)
{
unsigned int i;
- for (i = 0; i < sizeof(render_state_indices) / sizeof(*render_state_indices); ++i)
+ for (i = 0; i < ARRAY_SIZE(render_state_indices); ++i)
{
data->states[i] = 0x1337c0de;
}
@@ -1423,10 +1423,10 @@ static HRESULT render_state_test_init(IDirect3DDevice8 *device, struct state_tes
render_state_test_data_init(&ctx->test_data_all_buffer);
render_state_poison_data_init(&ctx->poison_data_buffer);
- for (i = 0; i < sizeof(render_state_indices) / sizeof(*render_state_indices); ++i)
+ for (i = 0; i < ARRAY_SIZE(render_state_indices); ++i)
{
ctx->test_data_vertex_buffer.states[i] = ctx->default_data_buffer.states[i];
- for (j = 0; j < sizeof(states_vertex) / sizeof(*states_vertex); ++j)
+ for (j = 0; j < ARRAY_SIZE(states_vertex); ++j)
{
if (render_state_indices[i] == states_vertex[j])
{
@@ -1436,7 +1436,7 @@ static HRESULT render_state_test_init(IDirect3DDevice8 *device, struct state_tes
}
ctx->test_data_pixel_buffer.states[i] = ctx->default_data_buffer.states[i];
- for (j = 0; j < sizeof(states_pixel) / sizeof(*states_pixel); ++j)
+ for (j = 0; j < ARRAY_SIZE(states_pixel); ++j)
{
if (render_state_indices[i] == states_pixel[j])
{
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index c2a4abfc04..bed70d8a17 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -494,7 +494,7 @@ static void lighting_test(void)
hr = IDirect3DDevice8_LightEnable(device, 0, TRUE);
ok(SUCCEEDED(hr), "Failed to enable light 0, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
hr = IDirect3DDevice8_SetTransform(device, D3DTS_WORLD, tests[i].world_matrix);
ok(SUCCEEDED(hr), "Failed to set world transform, hr %#x.\n", hr);
@@ -706,22 +706,14 @@ static void test_specular_lighting(void)
}
tests[] =
{
- {&directional, FALSE, 30.0f, expected_directional,
- sizeof(expected_directional) / sizeof(expected_directional[0])},
- {&directional, TRUE, 30.0f, expected_directional_local,
- sizeof(expected_directional_local) / sizeof(expected_directional_local[0])},
- {&point, FALSE, 30.0f, expected_point,
- sizeof(expected_point) / sizeof(expected_point[0])},
- {&point, TRUE, 30.0f, expected_point_local,
- sizeof(expected_point_local) / sizeof(expected_point_local[0])},
- {&spot, FALSE, 30.0f, expected_spot,
- sizeof(expected_spot) / sizeof(expected_spot[0])},
- {&spot, TRUE, 30.0f, expected_spot_local,
- sizeof(expected_spot_local) / sizeof(expected_spot_local[0])},
- {&point_range, FALSE, 30.0f, expected_point_range,
- sizeof(expected_point_range) / sizeof(expected_point_range[0])},
- {&point_side, TRUE, 0.0f, expected_point_side,
- sizeof(expected_point_side) / sizeof(expected_point_side[0])},
+ {&directional, FALSE, 30.0f, expected_directional, ARRAY_SIZE(expected_directional)},
+ {&directional, TRUE, 30.0f, expected_directional_local, ARRAY_SIZE(expected_directional_local)},
+ {&point, FALSE, 30.0f, expected_point, ARRAY_SIZE(expected_point)},
+ {&point, TRUE, 30.0f, expected_point_local, ARRAY_SIZE(expected_point_local)},
+ {&spot, FALSE, 30.0f, expected_spot, ARRAY_SIZE(expected_spot)},
+ {&spot, TRUE, 30.0f, expected_spot_local, ARRAY_SIZE(expected_spot_local)},
+ {&point_range, FALSE, 30.0f, expected_point_range, ARRAY_SIZE(expected_point_range)},
+ {&point_side, TRUE, 0.0f, expected_point_side, ARRAY_SIZE(expected_point_side)},
};
IDirect3DDevice8 *device;
D3DMATERIAL8 material;
@@ -795,7 +787,7 @@ static void test_specular_lighting(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_SPECULARENABLE, TRUE);
ok(SUCCEEDED(hr), "Failed to enable specular lighting, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
hr = IDirect3DDevice8_SetLight(device, 0, tests[i].light);
ok(SUCCEEDED(hr), "Failed to set light parameters, hr %#x.\n", hr);
@@ -1480,7 +1472,7 @@ static void fog_with_shader_test(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, end.i);
ok(hr == D3D_OK, "Setting fog end failed (%08x)\n", hr);
- for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]);
ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr);
@@ -2458,7 +2450,7 @@ static void test_scalar_instructions(void)
goto done;
}
- for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff336699, 0.0f, 0);
ok(SUCCEEDED(hr), "%s: Failed to clear, hr %#x.\n", test_data[i].name, hr);
@@ -3100,7 +3092,7 @@ static void texop_test(void)
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0);
ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear failed with 0x%08x\n", hr);
- for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
if (!(caps.TextureOpCaps & test_data[i].caps_flag))
{
@@ -3789,7 +3781,7 @@ static void intz_test(void)
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
get_rt_readback(original_rt, &rb);
- for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
+ for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
D3DCOLOR color = get_readback_color(&rb, expected_colors[i].x, expected_colors[i].y);
ok(color_match(color, expected_colors[i].color, 1),
@@ -3847,7 +3839,7 @@ static void intz_test(void)
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
get_rt_readback(original_rt, &rb);
- for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
+ for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
D3DCOLOR color = get_readback_color(&rb, expected_colors[i].x, expected_colors[i].y);
ok(color_match(color, expected_colors[i].color, 1),
@@ -3915,7 +3907,7 @@ static void intz_test(void)
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
get_rt_readback(original_rt, &rb);
- for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
+ for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
D3DCOLOR color = get_readback_color(&rb, expected_colors[i].x, expected_colors[i].y);
ok(color_match(color, expected_colors[i].color, 1),
@@ -4070,7 +4062,7 @@ static void shadow_test(void)
D3DTTFF_COUNT4 | D3DTTFF_PROJECTED);
ok(SUCCEEDED(hr), "SetTextureStageState failed, hr %#x.\n", hr);
- for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i)
+ for (i = 0; i < ARRAY_SIZE(formats); ++i)
{
D3DFORMAT format = formats[i].format;
IDirect3DTexture8 *texture;
@@ -4132,7 +4124,7 @@ static void shadow_test(void)
IDirect3DTexture8_Release(texture);
get_rt_readback(original_rt, &rb);
- for (j = 0; j < sizeof(expected_colors) / sizeof(*expected_colors); ++j)
+ for (j = 0; j < ARRAY_SIZE(expected_colors); ++j)
{
D3DCOLOR color = get_readback_color(&rb, expected_colors[j].x, expected_colors[j].y);
/* Geforce 7 on Windows returns 1.0 in alpha when the depth format is D24S8 or D24X8,
@@ -4459,7 +4451,7 @@ static void resz_test(void)
hr = IDirect3DDevice8_EndScene(device);
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
- for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
+ for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
D3DCOLOR color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y);
ok(color_match(color, expected_colors[i].color, 1),
@@ -4544,7 +4536,7 @@ static void resz_test(void)
hr = IDirect3DDevice8_EndScene(device);
ok(SUCCEEDED(hr), "EndScene failed, hr %#x.\n", hr);
- for (i = 0; i < sizeof(expected_colors) / sizeof(*expected_colors); ++i)
+ for (i = 0; i < ARRAY_SIZE(expected_colors); ++i)
{
D3DCOLOR color = getPixelColor(device, expected_colors[i].x, expected_colors[i].y);
ok(color_match(color, expected_colors[i].color, 1),
@@ -4891,7 +4883,7 @@ static void fog_special_test(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, conv.d);
ok(SUCCEEDED(hr), "Failed to set fog end, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
@@ -5926,7 +5918,7 @@ static void test_fog_interpolation(void)
hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &ident_mat);
ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
if(!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog)
continue;
@@ -6081,7 +6073,7 @@ static void test_negative_fixedfunction_fog(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE);
ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog)
continue;
@@ -6206,7 +6198,7 @@ static void test_table_fog_zw(void)
hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x000000ff, 1.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
@@ -6414,7 +6406,7 @@ static void test_signed_formats(void)
hr = IDirect3DDevice8_CreatePixelShader(device, shader_code_alpha, &shader_alpha);
ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
- for (i = 0; i < sizeof(formats) / sizeof(*formats); i++)
+ for (i = 0; i < ARRAY_SIZE(formats); i++)
{
hr = IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, formats[i].format);
@@ -6424,7 +6416,7 @@ static void test_signed_formats(void)
continue;
}
- for (j = 0; j < sizeof(tests) / sizeof(*tests); j++)
+ for (j = 0; j < ARRAY_SIZE(tests); j++)
{
texture_sysmem = NULL;
hr = IDirect3DDevice8_CreateTexture(device, tests[j].width, 4, 1, 0,
@@ -6661,7 +6653,7 @@ static void test_updatetexture(void)
hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
ok(hr == D3D_OK, "Failed to set texture stage state, hr %#x.\n", hr);
- for (t = 0; t < sizeof(texture_types) / sizeof(*texture_types); ++t)
+ for (t = 0; t < ARRAY_SIZE(texture_types); ++t)
{
if (!(caps.TextureCaps & texture_types[t].cap))
{
@@ -6683,7 +6675,7 @@ static void test_updatetexture(void)
hr = IDirect3DDevice8_SetVertexShader(device, texture_types[t].fvf);
ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
if (tests[i].src_format == MAKEFOURCC('A','T','I','2') && !ati2n_supported)
continue;
@@ -7253,7 +7245,7 @@ static void test_pointsize(void)
hr = IDirect3DDevice8_SetRenderTarget(device, rt, depthstencil);
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
- for (i = 0; i < sizeof(test_setups) / sizeof(test_setups[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_setups); ++i)
{
if (caps.VertexShaderVersion < test_setups[i].vs->version
|| caps.PixelShaderVersion < test_setups[i].ps->version)
@@ -7285,7 +7277,7 @@ static void test_pointsize(void)
hr = IDirect3DDevice8_SetPixelShader(device, ps);
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
- for (j = 0; j < sizeof(tests) / sizeof(tests[0]); ++j)
+ for (j = 0; j < ARRAY_SIZE(tests); ++j)
{
unsigned int size = tests[j].override_min ? 63 : tests[j].zero_size ? 0 : tests[j].scale
? test_setups[i].scaled_size : test_setups[i].nonscaled_size;
@@ -8116,7 +8108,7 @@ static void test_flip(void)
return;
}
- for (i = 0; i < sizeof(back_buffers) / sizeof(*back_buffers); ++i)
+ for (i = 0; i < ARRAY_SIZE(back_buffers); ++i)
{
hr = IDirect3DDevice8_GetBackBuffer(device, i, D3DBACKBUFFER_TYPE_MONO, &back_buffers[i]);
ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
@@ -8152,7 +8144,7 @@ static void test_flip(void)
IDirect3DSurface8_Release(test_surface);
/* Backbuffer surface pointers are unmodified */
- for (i = 0; i < sizeof(back_buffers) / sizeof(*back_buffers); ++i)
+ for (i = 0; i < ARRAY_SIZE(back_buffers); ++i)
{
hr = IDirect3DDevice8_GetBackBuffer(device, i, D3DBACKBUFFER_TYPE_MONO, &test_surface);
ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#x.\n", hr);
@@ -8184,7 +8176,7 @@ static void test_flip(void)
color = get_surface_color(back_buffers[0], 1, 1);
ok(color == 0xff808080, "Got unexpected color 0x%08x.\n", color);
- for (i = 0; i < sizeof(back_buffers) / sizeof(*back_buffers); ++i)
+ for (i = 0; i < ARRAY_SIZE(back_buffers); ++i)
IDirect3DSurface8_Release(back_buffers[i]);
refcount = IDirect3DDevice8_Release(device);
@@ -8377,7 +8369,7 @@ static void test_uninitialized_varyings(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE);
ok(SUCCEEDED(hr), "Failed to disable culling, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
if (caps.VertexShaderVersion < tests[i].vs_version
|| caps.PixelShaderVersion < tests[i].ps_version)
@@ -8574,7 +8566,7 @@ static void test_shademode(void)
/* Try it first with a TRIANGLESTRIP. Do it with different geometry because
* the color fixups we have to do for FLAT shading will be dependent on that. */
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
if (tests[i].vs->version)
{
@@ -9222,7 +9214,7 @@ static void test_texture_blending(void)
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE);
ok(hr == D3D_OK, "Failed to disable lighting, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
const struct test *current_test = &tests[i];
@@ -9413,7 +9405,7 @@ static void test_color_clamping(void)
hr = IDirect3DDevice8_SetTextureStageState(device, 1, D3DTSS_COLORARG2, D3DTA_CURRENT);
ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
if (caps.VertexShaderVersion < tests[i].vs_version
|| caps.PixelShaderVersion < tests[i].ps_version)
@@ -10118,7 +10110,7 @@ static void test_map_synchronisation(void)
}
size = (tri_count + 2) * sizeof(*quad1.strip);
- for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
hr = IDirect3DDevice8_CreateVertexBuffer(device, size,
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &buffer);
@@ -10228,7 +10220,7 @@ static void test_viewport(void)
/* This crashes on Windows. */
/* hr = IDirect3DDevice8_SetViewport(device, NULL); */
- for (i = 0; i < sizeof(rt_sizes) / sizeof(rt_sizes[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i)
{
if (i)
{
@@ -10244,7 +10236,7 @@ static void test_viewport(void)
ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr);
}
- for (j = 0; j < sizeof(tests) / sizeof(tests[0]); ++j)
+ for (j = 0; j < ARRAY_SIZE(tests); ++j)
{
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x (i %u, j %u).\n", hr, i, j);
--
2.14.4
June 5, 2018
[PATCH] credui/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/credui/tests/credui.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/dlls/credui/tests/credui.c b/dlls/credui/tests/credui.c
index 01d657d580..13fbd41c07 100644
--- a/dlls/credui/tests/credui.c
+++ b/dlls/credui/tests/credui.c
@@ -58,20 +58,20 @@ static void test_CredUIPromptForCredentials(void)
username[0] = '\0';
password[0] = '\0';
ret = CredUIPromptForCredentialsW(NULL, NULL, NULL, 0, username,
- sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
NULL, CREDUI_FLAGS_ALWAYS_SHOW_UI);
ok(ret == ERROR_INVALID_FLAGS, "CredUIPromptForCredentials should have returned ERROR_INVALID_FLAGS instead of %d\n", ret);
ret = CredUIPromptForCredentialsW(NULL, NULL, NULL, 0, username,
- sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
NULL, CREDUI_FLAGS_ALWAYS_SHOW_UI | CREDUI_FLAGS_GENERIC_CREDENTIALS);
ok(ret == ERROR_INVALID_PARAMETER, "CredUIPromptForCredentials should have returned ERROR_INVALID_PARAMETER instead of %d\n", ret);
ret = CredUIPromptForCredentialsW(NULL, wszServerName, NULL, 0, username,
- sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
NULL, CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX);
ok(ret == ERROR_INVALID_PARAMETER, "CredUIPromptForCredentials should have returned ERROR_INVALID_PARAMETER instead of %d\n", ret);
@@ -86,8 +86,8 @@ static void test_CredUIPromptForCredentials(void)
'C','R','E','D','U','I','_','F','L','A','G','S','_','E','X','P','E','C','T','_','C','O','N','F','I','R','M','A','T','I','O','N',0};
ret = CredUIPromptForCredentialsW(NULL, wszServerName, NULL, 0, username,
- sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
&save, CREDUI_FLAGS_EXPECT_CONFIRMATION);
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
if (ret == ERROR_SUCCESS)
@@ -97,10 +97,9 @@ static void test_CredUIPromptForCredentials(void)
}
credui_info.pszCaptionText = wszCaption1;
- ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL,
- ERROR_ACCESS_DENIED,
- username, sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, ERROR_ACCESS_DENIED,
+ username, ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
&save, CREDUI_FLAGS_EXPECT_CONFIRMATION);
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
if (ret == ERROR_SUCCESS)
@@ -111,8 +110,8 @@ static void test_CredUIPromptForCredentials(void)
credui_info.pszCaptionText = wszCaption2;
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
- username, sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ username, ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
NULL, CREDUI_FLAGS_INCORRECT_PASSWORD|CREDUI_FLAGS_EXPECT_CONFIRMATION);
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
if (ret == ERROR_SUCCESS)
@@ -125,8 +124,8 @@ static void test_CredUIPromptForCredentials(void)
save = TRUE;
credui_info.pszCaptionText = wszCaption3;
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
- username, sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ username, ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
&save, CREDUI_FLAGS_DO_NOT_PERSIST|CREDUI_FLAGS_EXPECT_CONFIRMATION);
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
ok(save, "save flag should have been untouched\n");
@@ -134,8 +133,8 @@ static void test_CredUIPromptForCredentials(void)
save = FALSE;
credui_info.pszCaptionText = wszCaption4;
ret = CredUIPromptForCredentialsW(&credui_info, wszServerName, NULL, 0,
- username, sizeof(username)/sizeof(username[0]),
- password, sizeof(password)/sizeof(password[0]),
+ username, ARRAY_SIZE(username),
+ password, ARRAY_SIZE(password),
&save, CREDUI_FLAGS_PERSIST|CREDUI_FLAGS_EXPECT_CONFIRMATION);
ok(ret == ERROR_SUCCESS || ret == ERROR_CANCELLED, "CredUIPromptForCredentials failed with error %d\n", ret);
ok(!save, "save flag should have been untouched\n");
--
2.14.4
June 5, 2018