Tcl Source Code

Artifact [7b0a7cfc3f]
Login

Artifact 7b0a7cfc3f8da53eafdfd580ca2979ec6844cfc0:

Attachment "strtod.patch" to ticket [440894ffff] added by dgp 2001-07-13 08:43:55.
? solaris
? tip17.patch
? 219210.diff.5
? 403531.patch
? tip17-mac.patch
? init.patch
? inline.patch
? strtod.patch
? doc/FileSystem.3
? unix/server.tcl
? unix/httpd
? unix/fail.tcl
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.494
diff -u -r1.494 ChangeLog
--- ChangeLog	2001/07/12 13:36:09	1.494
+++ ChangeLog	2001/07/13 01:43:32
@@ -1,3 +1,8 @@
+2001-07-12  Don Porter  <[email protected]>
+
+	* compat/strtod.c (strtod):  Fixed failure to handle expressions
+	like 3eq2 and failure to set errno on overflow.  [Bug 440894]
+
 2001-07-12  Donal K. Fellows  <[email protected]>
 
 	* tests/unixInit.test (unixInit-2.8): Added extra constraint,
Index: compat/strtod.c
===================================================================
RCS file: /cvsroot/tcl/tcl/compat/strtod.c,v
retrieving revision 1.2
diff -u -r1.2 strtod.c
--- compat/strtod.c	1998/09/14 18:39:45	1.2
+++ compat/strtod.c	2001/07/13 01:43:32
@@ -19,6 +19,7 @@
 #   include <stdlib.h>
 #endif
 #include <ctype.h>
+#include "tclPort.h"
 
 #ifndef TRUE
 #define TRUE 1
@@ -206,6 +207,10 @@
 	    }
 	    expSign = FALSE;
 	}
+	if (!isdigit(*p)) {
+	    p = pExp;
+	    goto done;
+	}
 	while (isdigit(*p)) {
 	    exp = exp * 10 + (*p - '0');
 	    p += 1;
@@ -232,6 +237,7 @@
     }
     if (exp > maxExponent) {
 	exp = maxExponent;
+	errno = ERANGE;
     }
     dblExp = 1.0;
     for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {