summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-09-03 11:49:38 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-09-03 11:49:38 -0700
commitd20428973acbd9dd052ae5213098f5ff59df924a (patch)
treecbb1fce7b489a36822330c2e86736d89526bd693 /parse-xml.c
parent9b1f9cfd3a80d39c62b9bcf412b0c5ca79bbb71c (diff)
downloadsubsurface-d20428973acbd9dd052ae5213098f5ff59df924a.tar.gz
Make xml (and CSV) parsing use 'g_ascii_strtod()' rather than 'strtod()'
GTK messes up the standard C library locales by default (instead of just taking locale information into account internally). Which breaks 'strtod()' and 'printf()' etc. Since they screwed that up, they then added helper functions for undoing that braindamage. Use it. I'd like to blame the GTK people, but the standard C libary people bear *some* responsibility for this. One of the reasons why people do not use "setlocale()" in many normal programs is exactly because it messes up core libc functionality - with number conversion being the main thing. Doing things like converting numbers in a locale-specific manner is something people do want to do, but not *always*. So the C library locale code should always had defaulted to C locale, with some *extra* marker (like a printf/scanf modifier) to say "print/scan in the current locale". Because many things absoilutely need to be non-localized. You don't want your internal file format to magically change just because you want to show things to the user in France, for example. Reported-by: Ivan Habunek <ivan.habunek@gmail.com> Root-caused-by: Jef Driesen <jefdriesen@telenet.be> Cc: Dirk Hohndel <dirk@hohndel.org> Cc: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 5159a334f..59e9278ad 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -294,7 +294,7 @@ static enum number_type integer_or_float(char *buffer, union int_or_float *res)
/* Looks like it might be floating point? */
if (*end == '.') {
errno = 0;
- fp = strtod(buffer, &end);
+ fp = g_ascii_strtod(buffer, &end);
if (!errno) {
res->fp = fp;
return FLOAT;