[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] tests: fix json test for large numbers

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Thu Jun 3 18:50:36 UTC 2021



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
a12d90e2 by Felipe Sateler at 2021-06-03T18:41:39+00:00
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: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/571>

- - - - -


1 changed file:

- src/tests/json-test.c


Changes:

=====================================
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);



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a12d90e2edb24e756510a4f0fc523b42405a5c06

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a12d90e2edb24e756510a4f0fc523b42405a5c06
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20210603/edf3f8a5/attachment-0001.htm>


More information about the pulseaudio-commits mailing list