Attachment "shimmer.patch" to
ticket [1177129fff]
added by
dgp
2005-04-05 21:44:58.
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.94.2.11
diff -u -r1.94.2.11 tclExecute.c
--- generic/tclExecute.c 1 Feb 2005 17:26:32 -0000 1.94.2.11
+++ generic/tclExecute.c 5 Apr 2005 14:06:35 -0000
@@ -5555,11 +5555,7 @@
goto badValue;
}
- if (valuePtr->typePtr == &tclIntType) {
- i = valuePtr->internalRep.longValue;
- } else if (valuePtr->typePtr == &tclWideIntType) {
- TclGetLongFromWide(i,valuePtr);
- } else {
+ if (Tcl_GetLongFromObj(NULL, valuePtr, &i) != TCL_OK) {
/*
* At this point, the only other possible type is double
*/
Index: generic/tclUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
retrieving revision 1.36.2.5
diff -u -r1.36.2.5 tclUtil.c
--- generic/tclUtil.c 14 Oct 2004 15:28:39 -0000 1.36.2.5
+++ generic/tclUtil.c 5 Apr 2005 14:06:35 -0000
@@ -2276,32 +2276,10 @@
int *indexPtr; /* Location filled in with an integer
* representing an index. */
{
- char *bytes;
- int offset;
- Tcl_WideInt wideOffset;
-
- /*
- * If the object is already an integer, use it.
- */
-
- if (objPtr->typePtr == &tclIntType) {
- *indexPtr = (int)objPtr->internalRep.longValue;
+ if (Tcl_GetIntFromObj(NULL, objPtr, indexPtr) == TCL_OK) {
return TCL_OK;
}
- /*
- * If the object is already a wide-int, and it is not out of range
- * for an integer, use it. [Bug #526717]
- */
- if (objPtr->typePtr == &tclWideIntType) {
- TclGetWide(wideOffset,objPtr);
- if (wideOffset >= Tcl_LongAsWide(INT_MIN)
- && wideOffset <= Tcl_LongAsWide(INT_MAX)) {
- *indexPtr = (int) Tcl_WideAsLong(wideOffset);
- return TCL_OK;
- }
- }
-
if (SetEndOffsetFromAny(NULL, objPtr) == TCL_OK) {
/*
* If the object is already an offset from the end of the
@@ -2310,31 +2288,13 @@
*indexPtr = endValue + objPtr->internalRep.longValue;
- } else if (Tcl_GetWideIntFromObj(NULL, objPtr, &wideOffset) == TCL_OK) {
- /*
- * If the object can be converted to a wide integer, use
- * that. [Bug #526717]
- */
-
- offset = (int) Tcl_WideAsLong(wideOffset);
- if (Tcl_LongAsWide(offset) == wideOffset) {
- /*
- * But it is representable as a narrow integer, so we
- * prefer that (so preserving old behaviour in the
- * majority of cases.)
- */
- objPtr->typePtr = &tclIntType;
- objPtr->internalRep.longValue = offset;
- }
- *indexPtr = offset;
-
} else {
/*
* Report a parse error.
*/
if (interp != NULL) {
- bytes = Tcl_GetString(objPtr);
+ char *bytes = Tcl_GetString(objPtr);
/*
* The result might not be empty; this resets it which
* should be both a cheap operation, and of little problem