From owner-freebsd-arch Sun Jan 27 22:38:27 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 9309237B400; Sun, 27 Jan 2002 22:38:21 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAA23804; Mon, 28 Jan 2002 17:38:08 +1100 Date: Mon, 28 Jan 2002 17:40:02 +1100 (EST) From: Bruce Evans X-X-Sender: To: Chad David Cc: Alexey Zelkin , "Andrey A. Chernov" , "Brian F. Feldman" , Subject: Re: strtod() In-Reply-To: <20020127131125.B42735@colnta.acns.ab.ca> Message-ID: <20020128173725.W41376-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 27 Jan 2002, Chad David wrote: > 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 > #include > +#include > #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. This change actually adds 3 style bugs and a magic conversion, but doesn't detect that strtol() fails. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message