summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--slv2/pluginclass.h1
-rw-r--r--src/plugin.c1
-rw-r--r--src/pluginclass.c7
-rw-r--r--src/plugininstance.c2
-rw-r--r--src/pluginui.c12
-rw-r--r--src/pluginuiinstance.c3
-rw-r--r--src/query.c1
-rw-r--r--src/world.c22
8 files changed, 29 insertions, 20 deletions
diff --git a/slv2/pluginclass.h b/slv2/pluginclass.h
index 74c594e..3dacfd7 100644
--- a/slv2/pluginclass.h
+++ b/slv2/pluginclass.h
@@ -33,6 +33,7 @@ extern "C" {
/** Get the URI of this class' superclass.
*
* Returned value is owned by \a plugin_class and must not be freed by caller.
+ * Returned value may be NULL, if class has no parent.
*
* Time = O(1)
*/
diff --git a/src/plugin.c b/src/plugin.c
index 73a3ebf..f40cff5 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -167,6 +167,7 @@ slv2_plugin_load(SLV2Plugin p)
while (!librdf_query_results_finished(results)) {
librdf_node* class_node = librdf_query_results_get_binding_value(results, 0);
librdf_uri* class_uri = librdf_node_get_uri(class_node);
+ assert(class_uri);
const char* class_uri_str = (const char*)librdf_uri_as_string(class_uri);
if ( ! librdf_uri_equals(class_uri, p->world->lv2_plugin_class->uri) ) {
diff --git a/src/pluginclass.c b/src/pluginclass.c
index c41ce79..b3da0b5 100644
--- a/src/pluginclass.c
+++ b/src/pluginclass.c
@@ -18,6 +18,7 @@
#define _XOPEN_SOURCE 500
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <slv2/pluginclass.h>
@@ -52,13 +53,17 @@ slv2_plugin_class_free(SLV2PluginClass plugin_class)
const char*
slv2_plugin_class_get_parent_uri(SLV2PluginClass plugin_class)
{
- return (const char*)librdf_uri_as_string(plugin_class->parent_uri);
+ if (plugin_class->parent_uri)
+ return (const char*)librdf_uri_as_string(plugin_class->parent_uri);
+ else
+ return NULL;
}
const char*
slv2_plugin_class_get_uri(SLV2PluginClass plugin_class)
{
+ assert(plugin_class->uri);
return (const char*)librdf_uri_as_string(plugin_class->uri);
}
diff --git a/src/plugininstance.c b/src/plugininstance.c
index f57de33..4e405a7 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -80,6 +80,8 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
dlclose(lib);
break; // return NULL
} else if (!strcmp(ld->URI, slv2_plugin_get_uri(plugin))) {
+
+ assert(plugin->plugin_uri);
printf("Found %s at index %u in:\n\t%s\n\n",
librdf_uri_as_string(plugin->plugin_uri), i, lib_path);
diff --git a/src/pluginui.c b/src/pluginui.c
index 9237382..1e358e9 100644
--- a/src/pluginui.c
+++ b/src/pluginui.c
@@ -28,14 +28,20 @@
/* private */
SLV2UI
slv2_ui_new(SLV2World world,
- librdf_uri* uri,
- librdf_uri* type_uri,
- librdf_uri* binary_uri)
+ librdf_uri* uri,
+ librdf_uri* type_uri,
+ librdf_uri* binary_uri)
{
+ assert(uri);
+ assert(type_uri);
+ assert(binary_uri);
+
struct _SLV2UI* ui = malloc(sizeof(struct _SLV2UI));
ui->uri = librdf_new_uri_from_uri(uri);
ui->binary_uri = librdf_new_uri_from_uri(binary_uri);
+ assert(ui->binary_uri);
+
// FIXME: kludge
char* bundle = strdup((const char*)librdf_uri_as_string(ui->binary_uri));
char* last_slash = strrchr(bundle, '/') + 1;
diff --git a/src/pluginuiinstance.c b/src/pluginuiinstance.c
index 3fe98e6..c7ac53b 100644
--- a/src/pluginuiinstance.c
+++ b/src/pluginuiinstance.c
@@ -85,6 +85,9 @@ slv2_ui_instantiate(SLV2Plugin plugin,
break; // return NULL
} else if (!strcmp(ld->URI, slv2_ui_get_uri(ui))) {
+
+ assert(plugin->plugin_uri);
+
printf("Found UI %s at index %u in:\n\t%s\n\n",
librdf_uri_as_string(plugin->plugin_uri), i, lib_path);
diff --git a/src/query.c b/src/query.c
index f11d1d3..00f08e6 100644
--- a/src/query.c
+++ b/src/query.c
@@ -74,6 +74,7 @@ slv2_query_get_variable_bindings(librdf_query_results* results,
switch (librdf_node_get_type(node)) {
case LIBRDF_NODE_TYPE_RESOURCE:
type = SLV2_VALUE_URI;
+ assert(librdf_node_get_uri(node));
str_val = (const char*)librdf_uri_as_string(librdf_node_get_uri(node));
break;
case LIBRDF_NODE_TYPE_LITERAL:
diff --git a/src/world.c b/src/world.c
index c3d500c..4b832b7 100644
--- a/src/world.c
+++ b/src/world.c
@@ -335,18 +335,6 @@ slv2_world_load_path(SLV2World world,
}
-/** comparator for sorting */
-/*int
-slv2_plugin_compare_by_uri(const void* a, const void* b)
-{
- SLV2Plugin plugin_a = *(SLV2Plugin*)a;
- SLV2Plugin plugin_b = *(SLV2Plugin*)b;
-
- return strcmp((const char*)librdf_uri_as_string(plugin_a->plugin_uri),
- (const char*)librdf_uri_as_string(plugin_b->plugin_uri));
-}
-*/
-
void
slv2_world_load_specifications(SLV2World world)
{
@@ -410,8 +398,10 @@ slv2_world_load_plugin_classes(SLV2World world)
librdf_node* label_node = librdf_query_results_get_binding_value(results, 2);
const char* label = (const char*)librdf_node_get_literal_value(label_node);
+ assert(class_uri);
+
SLV2PluginClass plugin_class = slv2_plugin_class_new(world,
- (const char*)librdf_uri_as_string(parent_uri),
+ parent_uri ? (const char*)librdf_uri_as_string(parent_uri) : NULL,
(const char*)librdf_uri_as_string(class_uri),
label);
raptor_sequence_push(world->plugin_classes, plugin_class);
@@ -502,6 +492,9 @@ slv2_world_load_all(SLV2World world)
librdf_node* binary_node = librdf_query_results_get_binding_value(results, 3);
librdf_uri* binary_uri = librdf_node_get_uri(binary_node);
+ assert(plugin_uri);
+ assert(data_uri);
+
SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins,
(const char*)librdf_uri_as_string(plugin_uri));
@@ -525,9 +518,6 @@ slv2_world_load_all(SLV2World world)
librdf_query_results_next(results);
}
- // 'ORDER BY ?plugin' guarantees this
- //raptor_sequence_sort(world->plugins, slv2_plugin_compare_by_uri);
-
if (results)
librdf_free_query_results(results);