From 6c3ab050cfbbbd80dd795643dcf65e6c5915dec4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 24 Jan 2008 01:28:18 +0000 Subject: Kludge around string<->number issues in locales with a ',' decimal point, and locale bugs in librdf. git-svn-id: http://svn.drobilla.net/lad/slv2@1110 a436a847-0d15-0410-975c-d299462d15a1 --- src/query.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/query.c') diff --git a/src/query.c b/src/query.c index 54dcda4..988e117 100644 --- a/src/query.c +++ b/src/query.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,11 @@ slv2_query_get_variable_bindings(SLV2World world, librdf_node* node = librdf_query_results_get_binding_value(results, variable); - assert(node); + if (!node) { + fprintf(stderr, "SLV2 ERROR: Variable %d bound to NULL.\n", variable); + librdf_query_results_next(results); + continue; + } librdf_uri* datatype_uri = NULL; SLV2ValueType type = SLV2_VALUE_STRING; @@ -138,7 +143,14 @@ slv2_plugin_query(SLV2Plugin plugin, return NULL; } + // FIXME: locale kludges to work around librdf bug + char* locale = strdup(setlocale(LC_NUMERIC, NULL)); + + setlocale(LC_NUMERIC, "POSIX"); librdf_query_results* results = librdf_query_execute(query, plugin->rdf); + setlocale(LC_NUMERIC, locale); + + free(locale); librdf_free_query(query); free(query_str); -- cgit v1.2.1