summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2001-09-04 23:16:17 (GMT)
committerdgp <dgp@users.sourceforge.net>2001-09-04 23:16:17 (GMT)
commit8630a6230da60b4f52db4b419fcc0cb4535b3bd1 (patch)
tree6f9d2e96f95f9c5f4bf15afad5f9f7573a68eb0c
parent921c8122821c7c92afea0c3d225caaf02c3af8d2 (diff)
downloadtcl-8630a6230da60b4f52db4b419fcc0cb4535b3bd1.zip
tcl-8630a6230da60b4f52db4b419fcc0cb4535b3bd1.tar.gz
tcl-8630a6230da60b4f52db4b419fcc0cb4535b3bd1.tar.bz2
* Fixed failure to handle expressions
like 3eq2 and failure to set errno on overflow. [Bug 440894]
-rw-r--r--ChangeLog6
-rw-r--r--compat/strtod.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b47413..513c810 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,13 @@
+2001-09-04 Don Porter <dgp@users.sourceforge.net>
+
+ * compat/strtod.c (strtod): Fixed failure to handle expressions
+ like 3eq2 and failure to set errno on overflow. [Bug 440894]
+
2001-09-04 Miguel Sofer <msofer@users.sourceforge.net>
* generic/tclProc.c:
* tests/proc.test: made [proc] check that formal args have
simple names [Bug: 458548]
-
2001-09-04 Vince Darley <vincentdarley@users.sourceforge.net>
diff --git a/compat/strtod.c b/compat/strtod.c
index 744c7c8..22d8d92 100644
--- a/compat/strtod.c
+++ b/compat/strtod.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: strtod.c,v 1.2 1998/09/14 18:39:45 stanton Exp $
+ * RCS: @(#) $Id: strtod.c,v 1.3 2001/09/04 23:16:18 dgp Exp $
*/
#include "tcl.h"
@@ -19,6 +19,7 @@
# include <stdlib.h>
#endif
#include <ctype.h>
+#include "tclPort.h"
#ifndef TRUE
#define TRUE 1
@@ -206,6 +207,10 @@ strtod(string, endPtr)
}
expSign = FALSE;
}
+ if (!isdigit(*p)) {
+ p = pExp;
+ goto done;
+ }
while (isdigit(*p)) {
exp = exp * 10 + (*p - '0');
p += 1;
@@ -232,6 +237,7 @@ strtod(string, endPtr)
}
if (exp > maxExponent) {
exp = maxExponent;
+ errno = ERANGE;
}
dblExp = 1.0;
for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {