diff options
author | David Robillard <d@drobilla.net> | 2020-07-15 21:04:58 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-07-15 22:34:03 +0200 |
commit | 5a0ddd58f7f7098a088afee22d479eec2d8cc958 (patch) | |
tree | c50669156702ec0ccd34cce9b87d309d32f53d0d /lv2/atom | |
parent | 2f7ffa585fbab18976ecf1f69aa9a28ed04a13ac (diff) | |
download | lv2-5a0ddd58f7f7098a088afee22d479eec2d8cc958.tar.xz |
Fix incorrect printf format specifiers
Diffstat (limited to 'lv2/atom')
-rw-r--r-- | lv2/atom/atom-test-utils.c | 2 | ||||
-rw-r--r-- | lv2/atom/atom-test.c | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lv2/atom/atom-test-utils.c b/lv2/atom/atom-test-utils.c index a9ab74b..50e8887 100644 --- a/lv2/atom/atom-test-utils.c +++ b/lv2/atom/atom-test-utils.c @@ -17,6 +17,7 @@ #include "lv2/atom/atom.h" #include "lv2/atom/forge.h" #include "lv2/atom/util.h" +#include "lv2/log/log.h" #include "lv2/urid/urid.h" #include <stdarg.h> @@ -59,6 +60,7 @@ free_urid_map(void) free(uris); } +LV2_LOG_FUNC(1, 2) static int test_fail(const char* fmt, ...) { diff --git a/lv2/atom/atom-test.c b/lv2/atom/atom-test.c index 5189d9d..6cca789 100644 --- a/lv2/atom/atom-test.c +++ b/lv2/atom/atom-test.c @@ -20,6 +20,7 @@ #include "lv2/atom/util.h" #include "lv2/urid/urid.h" +#include <inttypes.h> #include <stdint.h> #include <stdlib.h> @@ -70,7 +71,7 @@ main(void) LV2_Atom_Long* two = (LV2_Atom_Long*)lv2_atom_forge_deref( &forge, lv2_atom_forge_long(&forge, 2)); if (two->body != 2) { - return test_fail("%ld != 2\n", two->body); + return test_fail("%" PRId64 " != 2\n", two->body); } // eg_three = (Float)3.0 @@ -86,7 +87,7 @@ main(void) LV2_Atom_Double* four = (LV2_Atom_Double*)lv2_atom_forge_deref( &forge, lv2_atom_forge_double(&forge, 4.0)); if (four->body != 4) { - return test_fail("%ld != 4\n", four->body); + return test_fail("%f != 4\n", four->body); } // eg_true = (Bool)1 @@ -94,7 +95,7 @@ main(void) LV2_Atom_Bool* t = (LV2_Atom_Bool*)lv2_atom_forge_deref( &forge, lv2_atom_forge_bool(&forge, true)); if (t->body != 1) { - return test_fail("%ld != 1 (true)\n", t->body); + return test_fail("%d != 1 (true)\n", t->body); } // eg_false = (Bool)0 @@ -102,7 +103,7 @@ main(void) LV2_Atom_Bool* f = (LV2_Atom_Bool*)lv2_atom_forge_deref( &forge, lv2_atom_forge_bool(&forge, false)); if (f->body != 0) { - return test_fail("%ld != 0 (false)\n", f->body); + return test_fail("%d != 0 (false)\n", f->body); } // eg_path = (Path)"/foo/bar" @@ -244,7 +245,7 @@ main(void) } else if (ev->body.type != forge.Int) { return test_fail("Corrupt event %u has bad type\n", n_events); } else if (((LV2_Atom_Int*)&ev->body)->body != (int)n_events + 1) { - return test_fail("Event %u != %d\n", n_events, n_events + 1); + return test_fail("Event %u != %u\n", n_events, n_events + 1); } ++n_events; } @@ -252,15 +253,15 @@ main(void) int n_props = 0; LV2_ATOM_OBJECT_FOREACH((LV2_Atom_Object*)obj, prop) { if (!prop->key) { - return test_fail("Corrupt property %u has no key\n", n_props); + return test_fail("Corrupt property %d has no key\n", n_props); } else if (prop->context) { - return test_fail("Corrupt property %u has context\n", n_props); + return test_fail("Corrupt property %d has context\n", n_props); } ++n_props; } if (n_props != NUM_PROPS) { - return test_fail("Corrupt object has %u properties != %u\n", + return test_fail("Corrupt object has %d properties != %d\n", n_props, NUM_PROPS); } @@ -306,7 +307,7 @@ main(void) int n_matches = lv2_atom_object_query((LV2_Atom_Object*)obj, q); for (int n = 0; n < 2; ++n) { if (n_matches != n_props) { - return test_fail("Query failed, %u matches != %u\n", + return test_fail("Query failed, %d matches != %d\n", n_matches, n_props); } else if (!lv2_atom_equals((LV2_Atom*)one, matches.one)) { return test_fail("Bad match one\n"); |