From eec645b6a811150ae716b7eb591149ad93294481 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 23 Jan 2008 14:32:58 +0000 Subject: 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 --- src/value.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/value.c') 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 #include #include +#include #include #include #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; -- cgit v1.2.1