diff options
author | David Robillard <d@drobilla.net> | 2008-01-23 14:32:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-23 14:32:58 +0000 |
commit | eec645b6a811150ae716b7eb591149ad93294481 (patch) | |
tree | 84dfd2a0051f6244438f6f15031e927c4ec65d32 /src | |
parent | 0bf92c1f25a854566212e42deafe72ecd2a5f1a1 (diff) | |
download | lilv-eec645b6a811150ae716b7eb591149ad93294481.tar.gz lilv-eec645b6a811150ae716b7eb591149ad93294481.tar.bz2 lilv-eec645b6a811150ae716b7eb591149ad93294481.zip |
Fix range printing for control ports in lv2_inspect.
Kludge around numeric bugs in locales with ',' for a decimal point.
git-svn-id: http://svn.drobilla.net/lad/slv2@1101 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/value.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/value.c b/src/value.c index 85c9fd0..aed4f65 100644 --- a/src/value.c +++ b/src/value.c @@ -21,6 +21,7 @@ #include <stdlib.h> #include <string.h> #include <assert.h> +#include <locale.h> #include <raptor.h> #include <slv2/value.h> #include "slv2_internal.h" @@ -42,6 +43,18 @@ slv2_value_new(SLV2World world, SLV2ValueType type, const char* str) } else { val->str_val = strdup(str); } + + /* Kludge decimal point to '.' for people in crazy locales that use ',' */ + /* TODO: librdf should probably provide this... */ + if (type == SLV2_VALUE_INT || type == SLV2_VALUE_FLOAT) { + struct lconv* locale = localeconv(); + if (locale->decimal_point && strcmp(locale->decimal_point, ".")) { + assert(strlen(locale->decimal_point) == 1); + char* dec = strchr(str, locale->decimal_point[0]); + if (dec) + *dec = '.'; + } + } if (type == SLV2_VALUE_INT) { char* endptr = 0; |