summaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-05-03 23:47:32 +0000
committerDavid Robillard <d@drobilla.net>2008-05-03 23:47:32 +0000
commit2534a5a90aa3f07af7762da946ca5567e295941a (patch)
treebefabc581e52ba6f2a1af98d6261f2b3fbe441b3 /src/world.c
parent3f69656ed2a8dee9f5a67041daa8b27e2cd13895 (diff)
downloadlilv-2534a5a90aa3f07af7762da946ca5567e295941a.tar.gz
lilv-2534a5a90aa3f07af7762da946ca5567e295941a.tar.bz2
lilv-2534a5a90aa3f07af7762da946ca5567e295941a.zip
Handle plugins with missing binaries more gracefully.
git-svn-id: http://svn.drobilla.net/lad/slv2@1197 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/world.c b/src/world.c
index 1d2f339..2efcc40 100644
--- a/src/world.c
+++ b/src/world.c
@@ -528,33 +528,35 @@ slv2_world_load_all(SLV2World world)
librdf_node* bundle_node = librdf_query_results_get_binding_value(results, 2);
librdf_uri* bundle_uri = librdf_node_get_uri(bundle_node);
librdf_node* binary_node = librdf_query_results_get_binding_value(results, 3);
- librdf_uri* binary_uri = binary_node ? librdf_node_get_uri(binary_node) : NULL;
assert(plugin_uri);
assert(data_uri);
- // printf("PLUGIN: %s\n", librdf_uri_as_string(plugin_uri));
-
- SLV2Value uri = slv2_value_new_librdf_uri(world, plugin_uri);
-
- SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins, uri);
-
- // Create a new SLV2Plugin
- if (!plugin) {
- plugin = slv2_plugin_new(world, uri, bundle_uri, binary_uri);
- raptor_sequence_push(world->plugins, plugin);
- // FIXME: Slow! ORDER BY broken in certain versions of redland?
- raptor_sequence_sort(world->plugins, slv2_plugin_compare_by_uri);
+ if (binary_node) {
+ librdf_uri* binary_uri = librdf_node_get_uri(binary_node);
+ SLV2Value uri = slv2_value_new_librdf_uri(world, plugin_uri);
+ SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins, uri);
+
+ // Create a new SLV2Plugin
+ if (!plugin) {
+ plugin = slv2_plugin_new(world, uri, bundle_uri, binary_uri);
+ raptor_sequence_push(world->plugins, plugin);
+ // FIXME: Slow! ORDER BY broken in certain versions of redland?
+ raptor_sequence_sort(world->plugins, slv2_plugin_compare_by_uri);
+ } else {
+ slv2_value_free(uri);
+ }
+
+ plugin->world = world;
+
+ // FIXME: check for duplicates
+ raptor_sequence_push(plugin->data_uris,
+ slv2_value_new_librdf_uri(plugin->world, data_uri));
} else {
- slv2_value_free(uri);
+ fprintf(stderr, "Warning: plugin %s has no binary; ignored.\n",
+ librdf_uri_as_string(plugin_uri));
}
- plugin->world = world;
-
- // FIXME: check for duplicates
- raptor_sequence_push(plugin->data_uris,
- slv2_value_new_librdf_uri(plugin->world, data_uri));
-
librdf_free_node(plugin_node);
librdf_free_node(data_node);
librdf_free_node(bundle_node);