Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2002 13:11:25 -0700
From:      Chad David <davidc@acns.ab.ca>
To:        Alexey Zelkin <phantom@FreeBSD.ORG>
Cc:        Chad David <davidc@acns.ab.ca>, "Andrey A. Chernov" <ache@nagual.pp.ru>, "Brian F. Feldman" <green@FreeBSD.ORG>, Bruce Evans <bde@zeta.org.au>, arch@FreeBSD.ORG
Subject:   Re: strtod()
Message-ID:  <20020127131125.B42735@colnta.acns.ab.ca>
In-Reply-To: <20020127171925.A14791@phantom.cris.net>; from phantom@FreeBSD.ORG on Sun, Jan 27, 2002 at 05:19:25PM %2B0200
References:  <20020126162924.A7726@colnta.acns.ab.ca> <200201270453.g0R4rwi92912@green.bikeshed.org> <20020127070421.GA13415@nagual.pp.ru> <20020127003719.A38420@colnta.acns.ab.ca> <20020127171925.A14791@phantom.cris.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 27, 2002 at 05:19:25PM +0200, Alexey Zelkin wrote:
> hi,
> 
> On Sun, Jan 27, 2002 at 12:37:19AM -0700, Chad David wrote:
>  
> > The attached patch fixes this case, and probably others.  Comments?
> > 
> > Index: localeconv.c
> > ===================================================================
> > RCS file: /mnt1/ncvs/src/lib/libc/locale/localeconv.c,v
> > retrieving revision 1.3
> > diff -u -d -r1.3 localeconv.c
> > --- localeconv.c	10 Feb 2001 02:00:56 -0000	1.3
>                         ^^^^^^^^^^^
> > +++ localeconv.c	27 Jan 2002 07:28:51 -0000
>                         ^^^^^^^^^^^
> 
> You current seems too old. And I'd suggest to update it first before
> making tests. At the begining of the last year many locale oriented things
> were changed.
> 

Just this one file (as I mentioned in my last email) :(.

The differences between 1.3 are pretty minor though, and they do not
affect this.

colnta->cvs diff -ud -r 1.3 localeconv.c
Index: localeconv.c
===================================================================
RCS file: /mnt1/ncvs/src/lib/libc/locale/localeconv.c,v
retrieving revision 1.3
retrieving revision 1.9
diff -u -d -r1.3 -r1.9
--- localeconv.c        10 Feb 2001 02:00:56 -0000      1.3
+++ localeconv.c        20 Dec 2001 15:30:02 -0000      1.9

[cut copyright]

@@ -29,11 +36,13 @@
 #if 0
 static char sccsid[] = "@(#)localeconv.c       8.1 (Berkeley) 6/4/93";
 #endif
-static char rcsid[] = "$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.3 2001/02/10 02:00:56 ache Exp $";
+static char rcsid[] =
+  "$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.9 2001/12/20 15:30:02 phantom Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <locale.h>
 #include <stdlib.h>
+#include <limits.h>
 #include "lmonetary.h"
 #include "lnumeric.h"
 
@@ -51,7 +60,10 @@
 
 static char
 cnv(char *str) {
-       return (char)strtol(str, NULL, 0);
+       int i = strtol(str, NULL, 10);
+       if (i == -1)
+               i = CHAR_MAX;
+       return (char)i;
 }

This change here detected that strtol() was failing, but didn't fix errno.

-- 
Chad David        davidc@acns.ab.ca
www.FreeBSD.org   davidc@freebsd.org
ACNS Inc.         Calgary, Alberta Canada
Fourthly, The constant breeders, beside the gain of eight shillings
sterling per annum by the sale of their children, will be rid of the
charge of maintaining them after the first year. - Johnathan Swift

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020127131125.B42735>