From a12d90e2edb24e756510a4f0fc523b42405a5c06 Mon Sep 17 00:00:00 2001 From: Felipe Sateler Date: Tue, 1 Jun 2021 20:42:44 -0400 Subject: [PATCH] tests: fix json test for large numbers PRIu64 means print a uint64_t, not an unsigned long. This is warned by the compiler: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'long unsigned int' This causes build failures on some 32-bit archs https://buildd.debian.org/status/fetch.php?pkg=pulseaudio&arch=i386&ver=14.99.1%2Bdfsg1-2&stamp=1622553415&raw=0 Part-of: --- src/tests/json-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tests/json-test.c b/src/tests/json-test.c index 41ac12d..e0030ad 100644 --- a/src/tests/json-test.c +++ b/src/tests/json-test.c @@ -98,7 +98,7 @@ START_TEST(int_test) { unsigned int i; const char *ints_parse[] = { "1", "-1", "1234", "0" }; const int64_t ints_compare[] = { 1, -1, 1234, 0 }; - char *ulong_max_str; + char *uint64_max_str; for (i = 0; i < PA_ELEMENTSOF(ints_parse); i++) { o = pa_json_parse(ints_parse[i]); @@ -111,10 +111,10 @@ START_TEST(int_test) { } /* test that parser would fail on integer overflow */ - ulong_max_str = pa_sprintf_malloc("%"PRIu64, ULONG_MAX); - o = pa_json_parse(ulong_max_str); + uint64_max_str = pa_sprintf_malloc("%"PRIu64, UINT64_MAX); + o = pa_json_parse(uint64_max_str); fail_unless(o == NULL); - pa_xfree(ulong_max_str); + pa_xfree(uint64_max_str); } END_TEST @@ -179,7 +179,7 @@ START_TEST(double_test) { } /* test that parser would fail on double exponent overflow */ - very_large_double_str = pa_sprintf_malloc("%"PRIu64"e%"PRIu64, ULONG_MAX, ULONG_MAX); + very_large_double_str = pa_sprintf_malloc("%"PRIu64"e%"PRIu64, UINT64_MAX, UINT64_MAX); o = pa_json_parse(very_large_double_str); fail_unless(o == NULL); pa_xfree(very_large_double_str); -- 2.7.4