From cce33e218de8177de79dfd64f84d928985d040ad Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 May 2008 19:10:44 +0000 Subject: Fix support for plugins where binary is not mentioned in manifest. git-svn-id: http://svn.drobilla.net/lad/slv2@1210 a436a847-0d15-0410-975c-d299462d15a1 --- src/world.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'src/world.c') diff --git a/src/world.c b/src/world.c index 2efcc40..82edbad 100644 --- a/src/world.c +++ b/src/world.c @@ -520,7 +520,7 @@ slv2_world_load_all(SLV2World world) librdf_query_results* results = librdf_query_execute(q, world->model); while (!librdf_query_results_finished(results)) { - + librdf_node* plugin_node = librdf_query_results_get_binding_value(results, 0); librdf_uri* plugin_uri = librdf_node_get_uri(plugin_node); librdf_node* data_node = librdf_query_results_get_binding_value(results, 1); @@ -528,35 +528,30 @@ 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); - + assert(plugin_uri); assert(data_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)); + librdf_uri* binary_uri = binary_node ? librdf_node_get_uri(binary_node) : NULL; + 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 { - fprintf(stderr, "Warning: plugin %s has no binary; ignored.\n", - librdf_uri_as_string(plugin_uri)); + 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)); + librdf_free_node(plugin_node); librdf_free_node(data_node); librdf_free_node(bundle_node); -- cgit v1.2.1