diff options
author | David Robillard <d@drobilla.net> | 2019-03-17 22:01:44 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-17 22:01:44 +0100 |
commit | 18fb67838b5a2468e042cc13e422480ff552667c (patch) | |
tree | 734fa4e2b3cb71578015e20e5758f2a5822dc384 /lv2 | |
parent | 550ac1f25007d336cdb783fee2a3c2568377fa3b (diff) | |
download | lv2-18fb67838b5a2468e042cc13e422480ff552667c.tar.xz |
Actually fix build on old GCC
Probably.
Diffstat (limited to 'lv2')
-rw-r--r-- | lv2/atom/forge-overflow-test.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lv2/atom/forge-overflow-test.c b/lv2/atom/forge-overflow-test.c index daad3f8..b9beacc 100644 --- a/lv2/atom/forge-overflow-test.c +++ b/lv2/atom/forge-overflow-test.c @@ -27,8 +27,9 @@ static int test_string_overflow(void) { - static const size_t max_chars = 15; - static const size_t capacity = 8 + max_chars + 1; +#define MAX_CHARS 15 + + static const size_t capacity = sizeof(LV2_Atom_String) + MAX_CHARS + 1; static const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; uint8_t* buf = (uint8_t*)malloc(capacity); @@ -37,7 +38,7 @@ test_string_overflow(void) lv2_atom_forge_init(&forge, &map); // Check that writing increasingly long strings fails at the right point - for (size_t count = 0; count < max_chars; ++count) { + for (size_t count = 0; count < MAX_CHARS; ++count) { lv2_atom_forge_set_buffer(&forge, buf, capacity); const LV2_Atom_Forge_Ref ref = @@ -49,7 +50,7 @@ test_string_overflow(void) // Failure writing to an exactly full forge LV2_Atom_Forge_Ref ref = 0; - if ((ref = lv2_atom_forge_string(&forge, str, max_chars + 1))) { + if ((ref = lv2_atom_forge_string(&forge, str, MAX_CHARS + 1))) { return test_fail("Successfully wrote past end of buffer\n"); } @@ -66,7 +67,7 @@ test_string_overflow(void) static int test_literal_overflow(void) { - static const size_t capacity = 16 + 2; + static const size_t capacity = sizeof(LV2_Atom_Literal) + 2; uint8_t* buf = (uint8_t*)malloc(capacity); LV2_URID_Map map = { NULL, urid_map }; |