diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2005-11-29 14:02:02 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2005-11-29 14:02:02 (GMT) |
| commit | 456fa23e952dad7f15de24ab37b8b01dffb5adf8 (patch) | |
| tree | 1128e6e95a2bb6e12506385bd371e00436ad8a4f /generic/tclObj.c | |
| parent | a2a312a663885bd94aaa6a7ae1a1605271df09e8 (diff) | |
| download | tcl-456fa23e952dad7f15de24ab37b8b01dffb5adf8.zip tcl-456fa23e952dad7f15de24ab37b8b01dffb5adf8.tar.gz tcl-456fa23e952dad7f15de24ab37b8b01dffb5adf8.tar.bz2 | |
Fix [Bug 1310081].
Diffstat (limited to 'generic/tclObj.c')
| -rw-r--r-- | generic/tclObj.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 7ae0b5e..9d480d5 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.13 2005/08/04 19:54:29 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.42.2.14 2005/11/29 14:02:04 dkf Exp $ */ #include "tclInt.h" @@ -2574,9 +2574,20 @@ Tcl_GetWideIntFromObj(interp, objPtr, wideIntPtr) register int result; if (objPtr->typePtr == &tclWideIntType) { + gotWide: *wideIntPtr = objPtr->internalRep.wideValue; return TCL_OK; } + if (objPtr->typePtr == &tclIntType) { + /* + * This cast is safe; all valid ints/longs are wides. + */ + + objPtr->internalRep.wideValue = + Tcl_LongAsWide(objPtr->internalRep.longValue); + objPtr->typePtr = &tclWideIntType; + goto gotWide; + } result = SetWideIntFromAny(interp, objPtr); if (result == TCL_OK) { *wideIntPtr = objPtr->internalRep.wideValue; |
