Mail Archives: djgpp-workers/2008/04/08/13:45:58
Fixed as discussed.
2008-04-08 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
Diffs against djgpp CVS head of 2008-04-08.
* src/libc/ansi/stdlib/strtod.c: Return the mantissa of a floating point
number even if the exponent could not be converted.
* src/libc/c99/stdlib/strtof.c: Return the mantissa of a floating point
number even if the exponent could not be converted.
diff -aprNU3 djgpp.orig/src/libc/ansi/stdlib/strtod.c djgpp/src/libc/ansi/stdlib/strtod.c
--- djgpp.orig/src/libc/ansi/stdlib/strtod.c 2003-11-08 12:19:40 +0000
+++ djgpp/src/libc/ansi/stdlib/strtod.c 2008-04-08 19:19:00 +0000
@@ -32,9 +32,6 @@ strtod(const char *s, char **sret)
e = 0;
esign = 1;
- if (sret)
- *sret = unconst(s, char *);
-
while (isspace((unsigned char) *s))
s++;
@@ -75,7 +72,7 @@ strtod(const char *s, char **sret)
/* Handle NAN and NAN(<whatever>). */
if ( ! strnicmp( "NAN", s, 3 ) )
{
- _double_union_t t;
+ _double_union_t t;
t.d = NAN;
@@ -139,10 +136,11 @@ strtod(const char *s, char **sret)
}
if (flags == 0)
- return 0;
-
- if (sret)
- *sret = unconst(s, char *);
+ {
+ if (sret)
+ *sret = unconst(s, char *);
+ return 0.0;
+ }
if ((*s == 'e') || (*s == 'E'))
{
@@ -154,9 +152,6 @@ strtod(const char *s, char **sret)
s++;
esign = -1;
}
- if ((*s < '0') || (*s > '9'))
- return r * sign;
-
while ((*s >= '0') && (*s <= '9'))
{
e *= 10;
diff -aprNU3 djgpp.orig/src/libc/c99/stdlib/strtof.c djgpp/src/libc/c99/stdlib/strtof.c
--- djgpp.orig/src/libc/c99/stdlib/strtof.c 2003-11-08 12:19:40 +0000
+++ djgpp/src/libc/c99/stdlib/strtof.c 2008-04-08 19:25:32 +0000
@@ -34,9 +34,6 @@ strtof(const char *s, char **sret)
e = 0;
esign = 1;
- if (sret)
- *sret = unconst(s, char *);
-
while (isspace((unsigned char) *s))
s++;
@@ -141,12 +138,12 @@ strtof(const char *s, char **sret)
d *= 0.1L;
}
}
-
if (flags == 0)
- return 0;
-
- if (sret)
- *sret = unconst(s, char *);
+ {
+ if (sret)
+ *sret = unconst(s, char *);
+ return 0.0;
+ }
if ((*s == 'e') || (*s == 'E'))
{
@@ -158,9 +155,6 @@ strtof(const char *s, char **sret)
s++;
esign = -1;
}
- if ((*s < '0') || (*s > '9'))
- return r * sign;
-
while ((*s >= '0') && (*s <= '9'))
{
e *= 10;
- Raw text -