diff options
author | David Robillard <d@drobilla.net> | 2020-01-18 17:13:57 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-01-18 17:13:57 +0100 |
commit | bd0d8e69b753903888faaa781661b422793ef4be (patch) | |
tree | 14dee47ee29098f8ba4b5dcab33eef26b97e9e8c | |
parent | f317e39966f709a68ecdb2355cb39c23abc535c8 (diff) | |
download | lilv-bd0d8e69b753903888faaa781661b422793ef4be.tar.gz lilv-bd0d8e69b753903888faaa781661b422793ef4be.tar.bz2 lilv-bd0d8e69b753903888faaa781661b422793ef4be.zip |
Fix cases where incorrect translation is used
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | src/plugin.c | 23 |
2 files changed, 18 insertions, 10 deletions
@@ -1,9 +1,10 @@ lilv (0.24.7) unstable; - * Implement state:freePath feature + * Fix cases where incorrect translation is used * Fix deleting state bundles loaded from the model + * Implement state:freePath feature - -- David Robillard <d@drobilla.net> Sat, 18 Jan 2020 14:28:23 +0000 + -- David Robillard <d@drobilla.net> Sat, 18 Jan 2020 16:10:28 +0000 lilv (0.24.6) stable; diff --git a/src/plugin.c b/src/plugin.c index 534bd1e..3f27a6b 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -135,15 +135,22 @@ lilv_plugin_get_one(const LilvPlugin* plugin, const SordNode* subject, const SordNode* predicate) { - LilvNode* ret = NULL; - SordIter* stream = lilv_world_query_internal( - plugin->world, subject, predicate, NULL); - if (!sord_iter_end(stream)) { - ret = lilv_node_new_from_node(plugin->world, - sord_iter_get_node(stream, SORD_OBJECT)); + /* TODO: This is slower than it could be in some cases, but it's simpler to + use the existing i18n code. */ + + SordIter* stream = + lilv_world_query_internal(plugin->world, subject, predicate, NULL); + + LilvNodes* nodes = lilv_nodes_from_stream_objects( + plugin->world, stream, SORD_OBJECT); + + if (nodes) { + LilvNode* value = lilv_node_duplicate(lilv_nodes_get_first(nodes)); + lilv_nodes_free(nodes); + return value; } - sord_iter_free(stream); - return ret; + + return NULL; } LilvNode* |