From 0383992b80b3581aa853039d7622b0ec1b3cd634 Mon Sep 17 00:00:00 2001 From: CaS Date: Tue, 8 Jul 2003 08:39:45 +0000 Subject: [PATCH] Minor fix git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17173 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSString.m | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 21cc6a007..474950179 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-07-08 Richard Frith-Macdonald + + * Source/NSString.m: Avoid using atof() in parsing plists ... we + don't want libc localised handling of numbers. + 2003-07-08 03:44 Alexander Malmberg * Source/Additions/Unicode.m (GSToUnicode, GSFromUnicode): In iconv diff --git a/Source/NSString.m b/Source/NSString.m index 52f55bcd9..c0aa4cfb9 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -80,6 +80,8 @@ #include "GSPrivate.h" +extern BOOL GSScanDouble(unichar*, unsigned, double*); + @class GSString; @class GSMutableString; @class GSPlaceholderString; @@ -2425,8 +2427,6 @@ handle_printf_atsign (FILE *stream, return [self intValue] != 0 ? YES : NO; } -extern BOOL GSScanDouble(unichar*, unsigned, double*); - /** * Returns the strings content as a double. Skips leading whitespace.
* Conversion is not localised (ie uses '.' as the decimal separator).
@@ -4858,11 +4858,12 @@ static id parsePlItem(pldata* pld) } else if (type == 'R') { - char buf[len+1]; + unichar buf[len]; + double d = 0.0; for (i = 0; i < len; i++) buf[i] = (char)ptr[i]; - buf[len] = '\0'; - result = [[NSNumber alloc] initWithDouble: atof(buf)]; + GSScanDouble(buf, len, &d); + result = [[NSNumber alloc] initWithDouble: d]; } else {