[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strtod bugs
From: |
Eric Blake |
Subject: |
Re: strtod bugs |
Date: |
Sun, 30 Mar 2008 08:17:56 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Jim Meyering on 3/30/2008 7:31 AM:
|
| The buildbot is also showing a new compile failure:
|
| http://buildbot.proulx.com:9000/
|
| cc1: warnings being treated as errors
Thanks for the report; I'm applying this:
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkfvoRQACgkQ84KuGfSFAYAMCACcDFqpa7PPWopxrOs8jDI6+Ngh
viQAoKd32rH6WpPnYku/2DaQ4QlmEZDH
=Ph66
-----END PGP SIGNATURE-----
>From a9b486446b726424252a50491ad5721b1bc4467a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sun, 30 Mar 2008 08:07:51 -0600
Subject: [PATCH] strtod touchups.
* lib/strtod.c (strtod): Avoid compiler warnings.
Reported by Jim Meyering.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
lib/strtod.c | 13 +++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d941dd1..5225d25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-30 Eric Blake <address@hidden>
+
+ strtod touchups.
+ * lib/strtod.c (strtod): Avoid compiler warnings.
+ Reported by Jim Meyering.
+
2008-03-30 Bruno Haible <address@hidden>
* lib/unistdio/u-vsprintf.h (EOVERFLOW): Remove fallback.
diff --git a/lib/strtod.c b/lib/strtod.c
index 0ebbb33..a2a4d3d 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -51,7 +51,8 @@ strtod (const char *nptr, char **endptr)
goto noconv;
}
- s = nptr;
+ /* Use unsigned char for the ctype routines. */
+ s = (unsigned char *) nptr;
/* Eat whitespace. */
while (isspace (*s))
@@ -191,11 +192,11 @@ strtod (const char *nptr, char **endptr)
/* Get the exponent specified after the `e' or `E'. */
int save = errno;
char *end;
- long int exp;
+ long int value;
errno = 0;
++s;
- exp = strtol (s, &end, 10);
+ value = strtol ((char *) s, &end, 10);
if (errno == ERANGE && num)
{
/* The exponent overflowed a `long int'. It is probably a safe
@@ -203,7 +204,7 @@ strtod (const char *nptr, char **endptr)
a `long int' exceeds the limits of a `double'. */
if (endptr != NULL)
*endptr = end;
- if (exp < 0)
+ if (value < 0)
goto underflow;
else
goto overflow;
@@ -213,8 +214,8 @@ strtod (const char *nptr, char **endptr)
the 'e' or 'E', so *ENDPTR will be set there. */
end = (char *) s - 1;
errno = save;
- s = end;
- exponent += exp;
+ s = (unsigned char *) end;
+ exponent += value;
}
if (num == 0.0)
--
1.5.4
- strtod bugs, Eric Blake, 2008/03/29
- Re: strtod bugs, Eric Blake, 2008/03/29
- Re: strtod bugs, Jim Meyering, 2008/03/30
- Re: strtod bugs, Jim Meyering, 2008/03/30
- Re: strtod bugs,
Eric Blake <=
- Re: strtod bugs, Eric Blake, 2008/03/30
- Re: strtod bugs, Jim Meyering, 2008/03/30
- Re: strtod bugs, Eric Blake, 2008/03/30
- Re: strtod bugs, Eric Blake, 2008/03/30
- Re: strtod bugs, Jim Meyering, 2008/03/31
- Re: strtod bugs, Eric Blake, 2008/03/31
- Re: strtod bugs, Eric Blake, 2008/03/31
- Re: strtod bugs, Bruno Haible, 2008/03/31
- Re: strtod bugs, Jim Meyering, 2008/03/31
Re: strtod bugs, Bruno Haible, 2008/03/30