From d20428973acbd9dd052ae5213098f5ff59df924a Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Mon, 3 Sep 2012 11:49:38 -0700 Subject: 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 Root-caused-by: Jef Driesen Cc: Dirk Hohndel Cc: Lubomir I. Ivanov Signed-off-by: Linus Torvalds --- file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'file.c') 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) -- cgit v1.2.3-70-g09d2