diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCmdAH.c | 60 | ||||
-rw-r--r-- | generic/tclObj.c | 8 |
2 files changed, 15 insertions, 53 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 4bb76d2..4c43b87 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.8 2003/12/12 16:47:47 vincentdarley Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.9 2004/10/27 15:39:35 kennykb Exp $ */ #include "tclInt.h" @@ -2193,55 +2193,21 @@ Tcl_FormatObjCmd(dummy, interp, objc, objv) case 'u': case 'x': case 'X': - size = 40 + precision; - - /* - * Peek what kind of value we've got so as not to be - * converting stuff unduly. [Bug #699060] - */ - if (objv[objIndex]->typePtr == &tclWideIntType) { - Tcl_GetWideIntFromObj(NULL, objv[objIndex], &wideValue); - if (useWide) { - whichValue = WIDE_VALUE; - break; - } else { - whichValue = INT_VALUE; - if (wideValue>ULONG_MAX || wideValue<LONG_MIN) { - /* - * Value too big for type. Generate an error. - */ - Tcl_GetLongFromObj(interp, objv[objIndex], &intValue); - goto fmtError; - } - intValue = Tcl_WideAsLong(wideValue); - } - } else if (objv[objIndex]->typePtr == &tclIntType) { - Tcl_GetLongFromObj(NULL, objv[objIndex], &intValue); - if (useWide) { - whichValue = WIDE_VALUE; - wideValue = Tcl_LongAsWide(intValue); - break; - } else { - whichValue = INT_VALUE; - } - } else { - /* - * No existing numeric interpretation, so we can - * coerce to whichever is convenient. - */ - if (useWide) { - if (Tcl_GetWideIntFromObj(interp, /* INTL: Tcl source. */ - objv[objIndex], &wideValue) != TCL_OK) { - goto fmtError; - } - whichValue = WIDE_VALUE; - break; - } - if (Tcl_GetLongFromObj(interp, /* INTL: Tcl source. */ - objv[objIndex], &intValue) != TCL_OK) { + if ( useWide ) { + if ( Tcl_GetWideIntFromObj( interp, /* INTL: Tcl source. */ + objv[objIndex], &wideValue ) + != TCL_OK ) { goto fmtError; } + whichValue = WIDE_VALUE; + size = 40 + precision; + break; } + if ( Tcl_GetLongFromObj( interp, /* INTL: Tcl source. */ + objv[objIndex], &intValue ) != TCL_OK ) { + goto fmtError; + } + #if (LONG_MAX > INT_MAX) /* * Add the 'l' for long format type because we are on an diff --git a/generic/tclObj.c b/generic/tclObj.c index 8394f46..9c34908 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.42.2.8 2004/09/14 16:30:32 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.42.2.9 2004/10/27 15:39:36 kennykb Exp $ */ #include "tclInt.h" @@ -1118,11 +1118,7 @@ SetBooleanFromAny(interp, objPtr) } else if (objPtr->typePtr == &tclDoubleType) { newBool = (objPtr->internalRep.doubleValue != 0.0); } else if (objPtr->typePtr == &tclWideIntType) { -#ifdef TCL_WIDE_INT_IS_LONG - newBool = (objPtr->internalRep.longValue != 0); -#else /* !TCL_WIDE_INT_IS_LONG */ - newBool = (objPtr->internalRep.wideValue != Tcl_LongAsWide(0)); -#endif /* TCL_WIDE_INT_IS_LONG */ + newBool = (objPtr->internalRep.wideValue != 0); } else { /* * Copy the string converting its characters to lower case. |