summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-21 05:11:27 +0000
committerDavid Robillard <d@drobilla.net>2012-02-21 05:11:27 +0000
commit0dc45244615ff7e8c76b1a8a5f585f03dbc6a0bc (patch)
tree6544d1986c81ca9839dd550d44527e883dfd1817 /src
parent3ece29105d12819e602dbd0309f4ffda321a2ea3 (diff)
downloadsratom-0dc45244615ff7e8c76b1a8a5f585f03dbc6a0bc.tar.gz
sratom-0dc45244615ff7e8c76b1a8a5f585f03dbc6a0bc.tar.bz2
sratom-0dc45244615ff7e8c76b1a8a5f585f03dbc6a0bc.zip
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/seriatom@3991 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/atom_to_rdf.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/atom_to_rdf.c b/src/atom_to_rdf.c
index 11b2d38..f5d9858 100644
--- a/src/atom_to_rdf.c
+++ b/src/atom_to_rdf.c
@@ -68,8 +68,8 @@ string_sink(const void* buf, size_t len, void* stream)
static void
gensym(SerdNode* out, char c, unsigned num)
{
- out->n_bytes = out->n_chars = snprintf((char*)out->buf, 10,
- "%c%u", c, num);
+ out->n_bytes = out->n_chars = snprintf(
+ (char*)out->buf, 10, "%c%u", c, num);
}
static void
@@ -205,17 +205,14 @@ atom_to_rdf(Seriatom* seriatom,
object = serd_node_from_string(SERD_LITERAL,
USTR(val ? "true" : "false"));
} else if (!strcmp(type, LV2_ATOM__Tuple)) {
- const LV2_Atom_Tuple* tup = (const LV2_Atom_Tuple*)atom;
gensym(&id, 't', seriatom->next_id++);
start_object(seriatom, flags, subject, predicate, &id, type);
- SerdNode s = id;
SerdNode p = serd_node_from_string(SERD_URI, NS_RDF "value");
flags |= SERD_LIST_O_BEGIN;
- LV2_TUPLE_FOREACH(tup, i) {
- list_append(seriatom, &flags, &s, &p, &node, i);
+ LV2_TUPLE_FOREACH((LV2_Atom_Tuple*)atom, i) {
+ list_append(seriatom, &flags, &id, &p, &node, i);
}
- list_end(writer, unmap, &flags, &s, &p);
-
+ list_end(writer, unmap, &flags, &id, &p);
serd_writer_end_anon(writer, &id);
} else if (!strcmp(type, LV2_ATOM__Blank)) {
const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom;
@@ -251,21 +248,18 @@ atom_to_turtle(Seriatom* seriatom,
const SerdNode* predicate,
const LV2_Atom* atom)
{
- SerdURI base_uri = SERD_URI_NULL;
- SerdEnv* env = serd_env_new(NULL);
- String str = { NULL, 0 };
+ SerdURI base_uri = SERD_URI_NULL;
+ SerdEnv* env = serd_env_new(NULL);
+ String str = { NULL, 0 };
serd_env_set_prefix_from_strings(env, USTR("atom"),
USTR(LV2_ATOM_URI "#"));
serd_env_set_prefix_from_strings(env, USTR("rdf"), NS_RDF);
serd_env_set_prefix_from_strings(env, USTR("xsd"), NS_XSD);
-
seriatom->writer = serd_writer_new(
SERD_TURTLE,
SERD_STYLE_ABBREVIATED|SERD_STYLE_RESOLVED|SERD_STYLE_CURIED,
- /* SERD_NTRIPLES,
- 0,*/
env, &base_uri, string_sink, &str);
atom_to_rdf(seriatom, subject, predicate, atom, 0);