diff options
author | Hanspeter Portner <dev@open-music-kontrollers.ch> | 2016-07-18 19:35:19 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-24 09:51:21 -0400 |
commit | bb2fdc70a61751d289f84b48dd016a68b045a50f (patch) | |
tree | 41baab129d799410dd4fca76742e28003d60004b /src | |
parent | d75e983c6e00fefdca561230cd21907a6deae98e (diff) | |
download | sratom-bb2fdc70a61751d289f84b48dd016a68b045a50f.tar.gz sratom-bb2fdc70a61751d289f84b48dd016a68b045a50f.tar.bz2 sratom-bb2fdc70a61751d289f84b48dd016a68b045a50f.zip |
Fix vector padding
A Vector must be padded properly, or a Vector with, for example, an odd
number of Int elements will cause the rest of the containing Atom to be
invalid.
Diffstat (limited to 'src')
-rw-r--r-- | src/sratom.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/sratom.c b/src/sratom.c index 7966e65..9a55b25 100644 --- a/src/sratom.c +++ b/src/sratom.c @@ -709,8 +709,12 @@ read_node(Sratom* sratom, map->handle, (const char*)sord_node_get_string(child_type_node)); uint32_t child_size = atom_size(sratom, child_type); if (child_size > 0) { - lv2_atom_forge_vector_head(forge, &frame, child_size, child_type); + LV2_Atom_Forge_Ref ref = lv2_atom_forge_vector_head( + forge, &frame, child_size, child_type); read_list_value(sratom, forge, world, model, value, MODE_BODY); + lv2_atom_forge_pop(forge, &frame); + frame.ref = 0; + lv2_atom_forge_pad(forge, lv2_atom_forge_deref(forge, ref)->size); } sord_node_free(world, child_type_node); } else if (value && sord_node_equals(sord_node_get_datatype(value), @@ -730,6 +734,7 @@ read_node(Sratom* sratom, lv2_atom_forge_object(forge, &frame, 0, type_urid); read_resource(sratom, forge, world, model, node, type_urid); } + if (frame.ref) { lv2_atom_forge_pop(forge, &frame); } |