diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-05-10 20:53:49 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-05-10 20:53:49 (GMT) |
commit | 180af1f9a5c0b92834d9554ea7df255dd7ea2a28 (patch) | |
tree | 0b9ebdcbed0fcb84474f5e7e29801abfc725f756 /generic/tclTestObj.c | |
parent | 909827f9ee205794641dbf212853e4d66aa6c0fe (diff) | |
parent | c03808607bc887be83b093a4925d764bfb3531fb (diff) | |
download | tcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.zip tcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.tar.gz tcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r-- | generic/tclTestObj.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index e801a2d..14c7c70 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -596,7 +596,7 @@ TestindexobjCmd( result = Tcl_GetIndexFromObj(NULL, objv[1], tablePtr, "token", 0, &index); if (result == TCL_OK) { - Tcl_SetWideIntObj(Tcl_GetObjResult(interp), (Tcl_WideInt)((Tcl_WideUInt)(index + 1U)) - 1); + Tcl_SetWideIntObj(Tcl_GetObjResult(interp), index); } return result; } @@ -624,7 +624,7 @@ TestindexobjCmd( &index); Tcl_Free((void *)argv); if (result == TCL_OK) { - Tcl_SetWideIntObj(Tcl_GetObjResult(interp), (Tcl_WideInt)((Tcl_WideUInt)(index + 1U)) - 1); + Tcl_SetWideIntObj(Tcl_GetObjResult(interp), index); } return result; } @@ -1203,7 +1203,7 @@ TestobjCmd( if (objc != 3) { goto wrongNumArgs; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(varPtr[varIndex]->refCount + 1U)) - 1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(varPtr[varIndex]->refCount)); break; case TESTOBJ_TYPE: if (objc != 3) { @@ -1424,7 +1424,7 @@ TeststringobjCmd( } else { length = TCL_INDEX_NONE; } - Tcl_SetWideIntObj(Tcl_GetObjResult(interp), (Tcl_WideInt)((Tcl_WideUInt)(length + 1U)) - 1); + Tcl_SetWideIntObj(Tcl_GetObjResult(interp), length); break; case 10: { /* range */ Tcl_Size first, last; @@ -1757,10 +1757,10 @@ CheckIfVarUnset( Tcl_Obj ** varPtr, Tcl_Size varIndex) /* Index of the test variable to check. */ { - if (varPtr[varIndex] == NULL) { + if (varIndex < 0 || varPtr[varIndex] == NULL) { char buf[32 + TCL_INTEGER_SPACE]; - snprintf(buf, sizeof(buf), "variable %" TCL_Z_MODIFIER "u is unset (NULL)", varIndex); + snprintf(buf, sizeof(buf), "variable %" TCL_SIZE_MODIFIER "d is unset (NULL)", varIndex); Tcl_ResetResult(interp); Tcl_AppendToObj(Tcl_GetObjResult(interp), buf, -1); return 1; |