diff options
author | David Robillard <d@drobilla.net> | 2013-01-22 05:07:11 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-22 05:07:11 +0000 |
commit | 48c2c0f44d12e530261d202662f00b676c826fc1 (patch) | |
tree | 77ccf2a34e692b9beb8116100f75f3028b8b21b0 | |
parent | 1e195032cdc8e8f4f81713941b287749e2d8619d (diff) | |
download | sratom-48c2c0f44d12e530261d202662f00b676c826fc1.tar.gz sratom-48c2c0f44d12e530261d202662f00b676c826fc1.tar.bz2 sratom-48c2c0f44d12e530261d202662f00b676c826fc1.zip |
Fix serialisation of nested tuples.
git-svn-id: http://svn.drobilla.net/lad/trunk/sratom@5004 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/sratom.c | 4 | ||||
-rw-r--r-- | tests/sratom_test.c | 18 |
3 files changed, 22 insertions, 3 deletions
@@ -1,10 +1,11 @@ sratom (0.4.1) unstable; + * Fix serialisation of nested tuples * Fix memory leaks * Disable timestamps in HTML documentation for reproducible build * Update to waf 1.7.8 and autowaf r90 (install docs to versioned directory) - -- David Robillard <d@drobilla.net> Sat, 22 Dec 2012 20:18:15 -0500 + -- David Robillard <d@drobilla.net> Tue, 22 Jan 2013 00:06:31 -0500 sratom (0.4.0) stable; diff --git a/src/sratom.c b/src/sratom.c index 7792b9c..bd778d8 100644 --- a/src/sratom.c +++ b/src/sratom.c @@ -186,7 +186,11 @@ start_object(Sratom* sratom, if (subject && predicate) { sratom->write_statement(sratom->handle, *flags|SERD_ANON_O_BEGIN, NULL, subject, predicate, node, NULL, NULL); + // Start abbreviating object properties *flags |= SERD_ANON_CONT; + + // Object is in a list, stop list abbreviating if necessary + *flags &= ~SERD_LIST_CONT; } if (type) { SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "type"); diff --git a/tests/sratom_test.c b/tests/sratom_test.c index f76c246..c103d09 100644 --- a/tests/sratom_test.c +++ b/tests/sratom_test.c @@ -105,8 +105,9 @@ test(bool top_level) LV2_URID eg_blob = urid_map(NULL, "http://example.org/n-blob"); LV2_URID eg_blank = urid_map(NULL, "http://example.org/o-blank"); LV2_URID eg_tuple = urid_map(NULL, "http://example.org/p-tuple"); - LV2_URID eg_vector = urid_map(NULL, "http://example.org/q-vector"); - LV2_URID eg_seq = urid_map(NULL, "http://example.org/r-seq"); + LV2_URID eg_rectup = urid_map(NULL, "http://example.org/q-rectup"); + LV2_URID eg_vector = urid_map(NULL, "http://example.org/r-vector"); + LV2_URID eg_seq = urid_map(NULL, "http://example.org/s-seq"); uint8_t buf[1024]; lv2_atom_forge_set_buffer(&forge, buf, sizeof(buf)); @@ -203,6 +204,19 @@ test(bool top_level) lv2_atom_forge_bool(&forge, true); lv2_atom_forge_pop(&forge, &tuple_frame); + // eg_rectup = "foo",true,("bar",false) + lv2_atom_forge_property_head(&forge, eg_rectup, 0); + LV2_Atom_Forge_Frame rectup_frame; + lv2_atom_forge_tuple(&forge, &rectup_frame); + lv2_atom_forge_string(&forge, "foo", strlen("foo")); + lv2_atom_forge_bool(&forge, true); + LV2_Atom_Forge_Frame subrectup_frame; + lv2_atom_forge_tuple(&forge, &subrectup_frame); + lv2_atom_forge_string(&forge, "bar", strlen("bar")); + lv2_atom_forge_bool(&forge, false); + lv2_atom_forge_pop(&forge, &subrectup_frame); + lv2_atom_forge_pop(&forge, &rectup_frame); + // eg_vector = (Vector<Int32>)1,2,3,4 lv2_atom_forge_property_head(&forge, eg_vector, 0); int32_t elems[] = { 1, 2, 3, 4 }; |