From 16dd9d7496ca907a68f9bae2aa92a5069fe9ef62 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 8 Mar 2012 17:55:39 +0000 Subject: Add base_uri parameter to lilv_state_to_string(). git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4032 a436a847-0d15-0410-975c-d299462d15a1 --- lilv/lilv.h | 3 ++- src/state.c | 8 +++++--- test/lilv_test.c | 2 +- wscript | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lilv/lilv.h b/lilv/lilv.h index 7975945..cb9f172 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -1372,7 +1372,8 @@ lilv_state_to_string(LilvWorld* world, LV2_URID_Map* map, LV2_URID_Unmap* unmap, const LilvState* state, - const char* uri); + const char* uri, + const char* base_uri); /** @} diff --git a/src/state.c b/src/state.c index 1149b32..1d36f34 100644 --- a/src/state.c +++ b/src/state.c @@ -696,7 +696,7 @@ static SerdWriter* ttl_writer(SerdSink sink, void* stream, const SerdNode* base, SerdEnv** new_env) { SerdURI base_uri = SERD_URI_NULL; - if (base) { + if (base && base->buf) { serd_uri_parse(base->buf, &base_uri); } @@ -996,11 +996,13 @@ lilv_state_to_string(LilvWorld* world, LV2_URID_Map* map, LV2_URID_Unmap* unmap, const LilvState* state, - const char* uri) + const char* uri, + const char* base_uri) { SerdChunk chunk = { NULL, 0 }; SerdEnv* env = NULL; - SerdWriter* writer = ttl_writer(serd_chunk_sink, &chunk, NULL, &env); + SerdNode base = serd_node_from_string(SERD_URI, USTR(base_uri)); + SerdWriter* writer = ttl_writer(serd_chunk_sink, &chunk, &base, &env); lilv_state_write(world, map, unmap, state, writer, uri, NULL); diff --git a/test/lilv_test.c b/test/lilv_test.c index 5e2c54a..804b813 100644 --- a/test/lilv_test.c +++ b/test/lilv_test.c @@ -1214,7 +1214,7 @@ test_state(void) // Save state to a string char* state1_str = lilv_state_to_string( - world, &map, &unmap, state, "http://example.org/state1"); + world, &map, &unmap, state, "http://example.org/state1", NULL); // Restore from string LilvState* from_str = lilv_state_new_from_string(world, &map, state1_str); diff --git a/wscript b/wscript index 680f07c..d676a71 100644 --- a/wscript +++ b/wscript @@ -8,7 +8,7 @@ import waflib.Options as Options import waflib.Logs as Logs # Version of this package (even if built as a child) -LILV_VERSION = '0.12.0' +LILV_VERSION = '0.13.0' LILV_MAJOR_VERSION = '0' # Library version (UNIX style major, minor, micro) -- cgit v1.2.1