summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdMZ.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r--generic/tclCmdMZ.c50
1 files changed, 9 insertions, 41 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index b4a7d5a..a016124 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdMZ.c,v 1.131 2005/09/15 16:40:02 dgp Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.132 2005/10/08 14:42:44 dgp Exp $
*/
#include "tclInt.h"
@@ -1530,52 +1530,20 @@ Tcl_StringObjCmd(dummy, interp, objc, objv)
case STR_IS_DOUBLE: {
char *stop;
+ /* TODO */
if ((objPtr->typePtr == &tclDoubleType) ||
- (objPtr->typePtr == &tclIntType)) {
- break;
- }
-
- /*
- * This is adapted from Tcl_GetDouble
- *
- * The danger in this function is that "12345678901234567890" is
- * an acceptable 'double', but will later be interp'd as an int by
- * something like [expr]. Therefore, we check to see if it looks
- * like an int, and if so we do a range check on it. If strtoul
- * gets to the end, we know we either received an acceptable int,
- * or over/underflow.
- */
-
- if (TclLooksLikeInt(string1, length1)) {
- errno = 0;
-#ifdef TCL_WIDE_INT_IS_LONG
- strtoul(string1, &stop, 0); /* INTL: Tcl source. */
-#else
- strtoull(string1, &stop, 0); /* INTL: Tcl source. */
+ (objPtr->typePtr == &tclIntType) ||
+#ifndef NO_WIDE_TYPE
+ (objPtr->typePtr == &tclWideIntType) ||
#endif
- if (stop == end) {
- if (errno == ERANGE) {
- result = 0;
- failat = -1;
- }
- break;
- }
+ (objPtr->typePtr == &tclBignumType)) {
+ break;
}
- errno = 0;
- TclStrToD(string1, (CONST char **) &stop); /* INTL: Tcl source. */
- if (stop == string1) {
- /*
- * In this case, nothing like a number was found.
- */
-
+ if (TclParseNumber( NULL, objPtr, NULL, NULL, -1,
+ (CONST char**) &stop, 0 ) != TCL_OK) {
result = 0;
failat = 0;
} else {
- /*
- * Assume we sucked up one char per byte and then we go onto
- * SPACE, since we are allowed trailing whitespace.
- */
-
failat = stop - string1;
string1 = stop;
chcomp = Tcl_UniCharIsSpace;