test/atom: use correct format specifier for size_t

From MSVC:

test\atom.c(98): note: consider using '%zu' in the format string
test\atom.c(98): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
test\atom.c(100): note: consider using '%zu' in the format string
test\atom.c(100): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
test\atom.c(114): note: consider using '%zu' in the format string
test\atom.c(114): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
test\atom.c(128): note: consider using '%zu' in the format string
test\atom.c(128): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
test\atom.c(130): note: consider using '%zu' in the format string
test\atom.c(130): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
test\atom.c(137): note: consider using '%zu' in the format string
test\atom.c(137): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 2 has type 'size_t'

Signed-off-by: Ran Benita <ran@unusedvar.com>
master
Ran Benita 2019-12-28 14:11:27 +02:00
parent da4a90c13e
commit d1e39c111e
2 changed files with 7 additions and 7 deletions

View File

@ -75,7 +75,7 @@ main(void)
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL); xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_CRITICAL);
xkb_context_set_log_verbosity(ctx, 0); xkb_context_set_log_verbosity(ctx, 0);
srand(time(NULL)); srand((unsigned) time(NULL));
bench_start(&bench); bench_start(&bench);
bench_key_proc(state); bench_key_proc(state);

View File

@ -95,9 +95,9 @@ test_random_strings(void)
if (arr[i].len != strlen(string) || if (arr[i].len != strlen(string) ||
strncmp(string, arr[i].string, arr[i].len) != 0) { strncmp(string, arr[i].string, arr[i].len) != 0) {
fprintf(stderr, "got a collision, but strings don't match!\n"); fprintf(stderr, "got a collision, but strings don't match!\n");
fprintf(stderr, "existing length %lu, string %s\n", fprintf(stderr, "existing length %zu, string %s\n",
strlen(string), string); strlen(string), string);
fprintf(stderr, "new length %lu, string %.*s\n", fprintf(stderr, "new length %zu, string %.*s\n",
arr[i].len, (int) arr[i].len, arr[i].string); arr[i].len, (int) arr[i].len, arr[i].string);
fprintf(stderr, "seed: %u\n", seed); fprintf(stderr, "seed: %u\n", seed);
assert(false); assert(false);
@ -111,7 +111,7 @@ test_random_strings(void)
arr[i].atom = atom_intern(table, arr[i].string, arr[i].len, true); arr[i].atom = atom_intern(table, arr[i].string, arr[i].len, true);
if (arr[i].atom == XKB_ATOM_NONE) { if (arr[i].atom == XKB_ATOM_NONE) {
fprintf(stderr, "failed to intern! len: %lu, string: %.*s\n", fprintf(stderr, "failed to intern! len: %zu, string: %.*s\n",
arr[i].len, (int) arr[i].len, arr[i].string); arr[i].len, (int) arr[i].len, arr[i].string);
fprintf(stderr, "seed: %u\n", seed); fprintf(stderr, "seed: %u\n", seed);
assert(false); assert(false);
@ -125,16 +125,16 @@ test_random_strings(void)
if (arr[i].len != strlen(string) || if (arr[i].len != strlen(string) ||
strncmp(string, arr[i].string, arr[i].len) != 0) { strncmp(string, arr[i].string, arr[i].len) != 0) {
fprintf(stderr, "looked-up string doesn't match!\n"); fprintf(stderr, "looked-up string doesn't match!\n");
fprintf(stderr, "found length %lu, string %s\n", fprintf(stderr, "found length %zu, string %s\n",
strlen(string), string); strlen(string), string);
fprintf(stderr, "expected length %lu, string %.*s\n", fprintf(stderr, "expected length %zu, string %.*s\n",
arr[i].len, (int) arr[i].len, arr[i].string); arr[i].len, (int) arr[i].len, arr[i].string);
/* Since this is random, we need to dump the failing data, /* Since this is random, we need to dump the failing data,
* so we might have some chance to reproduce. */ * so we might have some chance to reproduce. */
fprintf(stderr, "START dump of arr, N=%d\n", N); fprintf(stderr, "START dump of arr, N=%d\n", N);
for (int j = 0; j < N; j++) { for (int j = 0; j < N; j++) {
fprintf(stderr, "%u\t\t%lu\t\t%.*s\n", arr[i].atom, fprintf(stderr, "%u\t\t%zu\t\t%.*s\n", arr[i].atom,
arr[i].len, (int) arr[i].len, arr[i].string); arr[i].len, (int) arr[i].len, arr[i].string);
} }
fprintf(stderr, "END\n"); fprintf(stderr, "END\n");