summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-23 14:32:58 +0000
committerDavid Robillard <d@drobilla.net>2008-01-23 14:32:58 +0000
commiteec645b6a811150ae716b7eb591149ad93294481 (patch)
tree84dfd2a0051f6244438f6f15031e927c4ec65d32
parent0bf92c1f25a854566212e42deafe72ecd2a5f1a1 (diff)
downloadlilv-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
-rw-r--r--src/value.c13
-rw-r--r--utils/lv2_inspect.c3
2 files changed, 16 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;
diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c
index 585678f..7b31e01 100644
--- a/utils/lv2_inspect.c
+++ b/utils/lv2_inspect.c
@@ -203,6 +203,9 @@ main(int argc, char** argv)
SLV2World world = slv2_world_new();
slv2_world_load_all(world);
+ event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT);
+ control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL);
+
if (argc != 2) {
print_usage();
return -1;