aboutsummaryrefslogtreecommitdiffstats
path: root/file.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 /file.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 'file.c')
-rw-r--r--file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/file.c b/file.c
index da498995c..b9a598e2a 100644
--- a/file.c
+++ b/file.c
@@ -197,7 +197,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
struct sample *sample;
errno = 0;
- val = strtod(p,&end);
+ val = g_ascii_strtod(p,&end);
if (end == p)
break;
if (errno)