summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;