summaryrefslogtreecommitdiffstats
path: root/src/plugininstance.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-04 01:37:51 +0000
committerDavid Robillard <d@drobilla.net>2011-02-04 01:37:51 +0000
commit5b8c788cc4a42f9424d5cca7ca46ceb3cb427af7 (patch)
tree1c7f67590c255d27ae587ed27e026cae1d2958bf /src/plugininstance.c
parentcded478d952f14fee667e5ba9407923b17daaa65 (diff)
downloadlilv-5b8c788cc4a42f9424d5cca7ca46ceb3cb427af7.tar.gz
lilv-5b8c788cc4a42f9424d5cca7ca46ceb3cb427af7.tar.bz2
lilv-5b8c788cc4a42f9424d5cca7ca46ceb3cb427af7.zip
Drop librdf in favour of serd/sord.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2895 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugininstance.c')
-rw-r--r--src/plugininstance.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/plugininstance.c b/src/plugininstance.c
index 7a0fa6e..2229424 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -44,7 +44,7 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
local_features[0] = NULL;
}
- const char* const lib_uri = slv2_value_as_uri(slv2_plugin_get_library_uri(plugin));
+ const char* const lib_uri = slv2_value_as_uri(slv2_plugin_get_library_uri(plugin));
const char* const lib_path = slv2_uri_to_path(lib_uri);
if (!lib_path)
@@ -80,11 +80,31 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
dlclose(lib);
break; // return NULL
} else {
- librdf_uri* absolute_uri = librdf_new_uri_relative_to_base(
- librdf_node_get_uri(slv2_value_as_node(
- slv2_plugin_get_bundle_uri(plugin))),
- (const uint8_t*)ld->URI);
- if (!strcmp((const char*)librdf_uri_as_string(absolute_uri),
+ // FIXME: duplicated/common code, put this in serd
+ SerdURI uri;
+ if (!serd_uri_parse((const uint8_t*)ld->URI, &uri)) {
+ SLV2_ERROR("Failed to parse library URI\n");
+ dlclose(lib);
+ break;
+ }
+
+ SerdURI base_uri;
+ if (!serd_uri_parse(
+ (const uint8_t*)slv2_value_as_uri(slv2_plugin_get_bundle_uri(plugin)),
+ &base_uri)) {
+ dlclose(lib);
+ break;
+ }
+
+ SerdURI abs_uri;
+ if (!serd_uri_resolve(&uri, &base_uri, &abs_uri)) {
+ fprintf(stderr, "error: failed to resolve new base URI\n");
+ return false;
+ }
+
+ SerdNode abs_uri_node = serd_node_new_uri(&abs_uri, &base_uri);
+
+ if (!strcmp((const char*)abs_uri_node.buf,
slv2_value_as_uri(slv2_plugin_get_uri(plugin)))) {
assert(plugin->plugin_uri);
assert(ld->instantiate);
@@ -98,10 +118,10 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
impl->lib_handle = lib;
result->pimpl = impl;
- librdf_free_uri(absolute_uri);
+ serd_node_free(&abs_uri_node);
break;
} else {
- librdf_free_uri(absolute_uri);
+ serd_node_free(&abs_uri_node);
}
}
}