summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-10-27 15:39:11 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-10-27 15:39:11 (GMT)
commit92c681aa2eddf84cf71f8d3debd36a6d452be888 (patch)
tree9edf4167cc20c7609343bf8cb87d71e5789b4249 /generic/tclCmdAH.c
parent4955bdc67b8a5c3d9d12cf70cfe0b73c8a4f4ca8 (diff)
downloadtcl-92c681aa2eddf84cf71f8d3debd36a6d452be888.zip
tcl-92c681aa2eddf84cf71f8d3debd36a6d452be888.tar.gz
tcl-92c681aa2eddf84cf71f8d3debd36a6d452be888.tar.bz2
backport fixes for 868489 and 1026125
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c60
1 files changed, 13 insertions, 47 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