diff options
author | David Robillard <d@drobilla.net> | 2009-06-03 21:47:19 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-03 21:47:19 +0000 |
commit | 3ee5e87fc15363c104f08e61ba8ed0da76f97152 (patch) | |
tree | 983ddefeeb5194e0a86887244c6b12ddba38ab1d /src/query.c | |
parent | c220a3ce918293855ed6b53b97dc604573fd031a (diff) | |
download | lilv-3ee5e87fc15363c104f08e61ba8ed0da76f97152.tar.gz lilv-3ee5e87fc15363c104f08e61ba8ed0da76f97152.tar.bz2 lilv-3ee5e87fc15363c104f08e61ba8ed0da76f97152.zip |
Consistent error/warning message output.
Fix crash on invalid plugin files.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2086 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/query.c')
-rw-r--r-- | src/query.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/query.c b/src/query.c index 7176f35..ee709cb 100644 --- a/src/query.c +++ b/src/query.c @@ -64,7 +64,7 @@ slv2_value_from_librdf_node(SLV2World world, librdf_node* node) "http://www.w3.org/2001/XMLSchema#decimal")) type = SLV2_VALUE_FLOAT; else - fprintf(stderr, "Unknown datatype %s\n", librdf_uri_as_string(datatype_uri)); + SLV2_ERRORF("Unknown datatype %s\n", librdf_uri_as_string(datatype_uri)); } result = slv2_value_new(world, type, (const char*)librdf_node_get_literal_value(node)); break; @@ -74,7 +74,7 @@ slv2_value_from_librdf_node(SLV2World world, librdf_node* node) break; case LIBRDF_NODE_TYPE_UNKNOWN: default: - fprintf(stderr, "Unknown RDF node type %d\n", librdf_node_get_type(node)); + SLV2_ERRORF("Unknown RDF node type %d\n", librdf_node_get_type(node)); break; } @@ -96,7 +96,7 @@ slv2_query_get_variable_bindings(SLV2World world, librdf_node* node = librdf_query_results_get_binding_value(results->rdf_results, variable); if (node == NULL) { - fprintf(stderr, "SLV2 ERROR: Variable %d bound to NULL.\n", variable); + SLV2_ERRORF("Variable %d bound to NULL.\n", variable); librdf_query_results_next(results->rdf_results); continue; } @@ -137,21 +137,21 @@ slv2_plugin_query_sparql(SLV2Plugin plugin, char* query_str = slv2_strjoin(slv2_query_prefixes, sparql_str, NULL); - //printf("******** Query \n%s********\n", query_str); - librdf_query* query = librdf_new_query(plugin->world->world, "sparql", NULL, (const unsigned char*)query_str, base_uri); if (!query) { - fprintf(stderr, "ERROR: Could not create query\n"); + SLV2_ERRORF("Failed to create query:\n%s", query_str); return NULL; } - // FIXME: locale kludges to work around librdf bug + // Reset numeric locale to correctly interpret turtle numeric constants char* locale = strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "POSIX"); + librdf_query_results* results = librdf_query_execute(query, plugin->rdf); + + // Restore numeric locale setlocale(LC_NUMERIC, locale); free(locale); |