diff options
author | David Robillard <d@drobilla.net> | 2009-06-16 18:52:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-16 18:52:29 +0000 |
commit | 440c0070df3e0d5afedcda5b7ea40b728a0501c4 (patch) | |
tree | dd93808b7f5307f32e57e58367fcc0b41480d3a7 | |
parent | 762819dcfde67013d8c9ee1f752272abbaf3d82d (diff) | |
download | lilv-440c0070df3e0d5afedcda5b7ea40b728a0501c4.tar.gz lilv-440c0070df3e0d5afedcda5b7ea40b728a0501c4.tar.bz2 lilv-440c0070df3e0d5afedcda5b7ea40b728a0501c4.zip |
Don't kludge locale around queries.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2116 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/query.c | 9 | ||||
-rw-r--r-- | src/scalepoint.c | 1 | ||||
-rw-r--r-- | src/value.c | 10 |
3 files changed, 6 insertions, 14 deletions
diff --git a/src/query.c b/src/query.c index ee709cb..34cb260 100644 --- a/src/query.c +++ b/src/query.c @@ -145,17 +145,8 @@ slv2_plugin_query_sparql(SLV2Plugin plugin, return NULL; } - // 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); - librdf_free_query(query); free(query_str); diff --git a/src/scalepoint.c b/src/scalepoint.c index 769ed1f..3fdbd4f 100644 --- a/src/scalepoint.c +++ b/src/scalepoint.c @@ -21,7 +21,6 @@ #include <stdlib.h> #include <string.h> #include <assert.h> -#include <locale.h> #include <raptor.h> #include "slv2/types.h" #include "slv2/value.h" diff --git a/src/value.c b/src/value.c index 3ef7542..9c5b202 100644 --- a/src/value.c +++ b/src/value.c @@ -32,7 +32,7 @@ static void slv2_value_set_numerics_from_string(SLV2Value val) { - // FIXME: locale kludges to work around librdf bug + // FIXME: locale kludge, need a locale independent strtol and strtod char* locale = strdup(setlocale(LC_NUMERIC, NULL)); if (val->type == SLV2_VALUE_INT) { @@ -227,9 +227,7 @@ slv2_value_get_turtle_token(SLV2Value value) { size_t len = 0; char* result = NULL; - char* locale = strdup(setlocale(LC_NUMERIC, NULL)); - - // FIXME: locale kludges to work around librdf bug + char* locale = NULL; switch (value->type) { case SLV2_VALUE_URI: @@ -243,6 +241,8 @@ slv2_value_get_turtle_token(SLV2Value value) break; case SLV2_VALUE_INT: // INT64_MAX is 9223372036854775807 (19 digits) + 1 for sign + // FIXME: locale kludge, need a locale independent snprintf + locale = strdup(setlocale(LC_NUMERIC, NULL)); len = 20; result = calloc(len, sizeof(char)); setlocale(LC_NUMERIC, "POSIX"); @@ -250,6 +250,8 @@ slv2_value_get_turtle_token(SLV2Value value) setlocale(LC_NUMERIC, locale); break; case SLV2_VALUE_FLOAT: + // FIXME: locale kludge, need a locale independent snprintf + locale = strdup(setlocale(LC_NUMERIC, NULL)); len = 20; // FIXME: proper maximum value? result = calloc(len, sizeof(char)); setlocale(LC_NUMERIC, "POSIX"); |