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

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-05-30 21:15:39 +02:00 committed by Alexandre Julliard
parent 3f3083d7f3
commit 840d1e153d
2 changed files with 12 additions and 12 deletions

View File

@ -703,7 +703,7 @@ static void test_math_errors(void)
/* necessary so that exp(1e100)==INFINITY on glibc, we can remove this if we change our implementation */
p_fesetround(FE_TONEAREST);
for(i = 0; i < sizeof(testsd)/sizeof(testsd[0]); i++) {
for(i = 0; i < ARRAY_SIZE(testsd); i++) {
p_funcd = (void*)GetProcAddress(module, testsd[i].func);
*p_errno() = -1;
exception.type = -1;
@ -717,7 +717,7 @@ static void test_math_errors(void)
"%s(%f) got exception arg1 %f\n", testsd[i].func, testsd[i].x, exception.arg1);
}
for(i = 0; i < sizeof(tests2d)/sizeof(tests2d[0]); i++) {
for(i = 0; i < ARRAY_SIZE(tests2d); i++) {
p_func2d = (void*)GetProcAddress(module, tests2d[i].func);
*p_errno() = -1;
exception.type = -1;
@ -733,7 +733,7 @@ static void test_math_errors(void)
"%s(%f, %f) got exception arg2 %f\n", tests2d[i].func, tests2d[i].a, tests2d[i].b, exception.arg2);
}
for(i = 0; i < sizeof(testsdl)/sizeof(testsdl[0]); i++) {
for(i = 0; i < ARRAY_SIZE(testsdl); i++) {
p_funcdl = (void*)GetProcAddress(module, testsdl[i].func);
*p_errno() = -1;
exception.type = -1;

View File

@ -171,7 +171,7 @@ static void test_snprintf (void)
unsigned int i;
/* Legacy _snprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const char *fmt = tests[i];
const int expect = strlen(fmt) > bufsiz ? -1 : strlen(fmt);
const int n = vsprintf_wrapper (UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, buffer, bufsiz, fmt);
@ -184,7 +184,7 @@ static void test_snprintf (void)
}
/* C99 snprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const char *fmt = tests[i];
const int expect = strlen(fmt);
const int n = vsprintf_wrapper (UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, buffer, bufsiz, fmt);
@ -199,7 +199,7 @@ static void test_snprintf (void)
}
/* swprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const char *fmt = tests[i];
const int expect = strlen(fmt) >= bufsiz ? -2 : strlen(fmt);
const int n = vsprintf_wrapper (0, buffer, bufsiz, fmt);
@ -242,11 +242,11 @@ static void test_swprintf (void)
wchar_t buffer[8];
char narrow[8], narrow_fmt[16];
const int bufsiz = sizeof buffer / sizeof buffer[0];
const int bufsiz = ARRAY_SIZE(buffer);
unsigned int i;
/* Legacy _snprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const wchar_t *fmt = tests[i];
const int expect = wcslen(fmt) > bufsiz ? -1 : wcslen(fmt);
const int n = vswprintf_wrapper (UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, buffer, bufsiz, fmt);
@ -261,7 +261,7 @@ static void test_swprintf (void)
}
/* C99 snprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const wchar_t *fmt = tests[i];
const int expect = wcslen(fmt);
const int n = vswprintf_wrapper (UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, buffer, bufsiz, fmt);
@ -278,7 +278,7 @@ static void test_swprintf (void)
}
/* swprintf style termination */
for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
for (i = 0; i < ARRAY_SIZE(tests); i++) {
const wchar_t *fmt = tests[i];
const int expect = wcslen(fmt) >= bufsiz ? -2 : wcslen(fmt);
const int n = vswprintf_wrapper (0, buffer, bufsiz, fmt);
@ -411,12 +411,12 @@ static void test_fwprintf(void)
p_fclose(fp);
fp = p_fopen(file_name, "rb");
p_fgetws(bufw, sizeof(bufw)/sizeof(bufw[0]), fp);
p_fgetws(bufw, ARRAY_SIZE(bufw), fp);
ret = p_ftell(fp);
ok(ret == 24, "ftell returned %d\n", ret);
ok(!wcscmp(bufw, simple), "buf = %s\n", wine_dbgstr_w(bufw));
p_fgetws(bufw, sizeof(bufw)/sizeof(bufw[0]), fp);
p_fgetws(bufw, ARRAY_SIZE(bufw), fp);
ret = p_ftell(fp);
ok(ret == 52, "ret = %d\n", ret);
ok(!memcmp(bufw, cont, 28), "buf = %s\n", wine_dbgstr_w(bufw));