summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-10 20:53:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-05-10 20:53:49 (GMT)
commit180af1f9a5c0b92834d9554ea7df255dd7ea2a28 (patch)
tree0b9ebdcbed0fcb84474f5e7e29801abfc725f756
parent909827f9ee205794641dbf212853e4d66aa6c0fe (diff)
parentc03808607bc887be83b093a4925d764bfb3531fb (diff)
downloadtcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.zip
tcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.tar.gz
tcl-180af1f9a5c0b92834d9554ea7df255dd7ea2a28.tar.bz2
Merge 8.7
-rw-r--r--generic/tclTest.c23
-rw-r--r--generic/tclTestObj.c12
2 files changed, 17 insertions, 18 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c
index b35abe0..2f04f8c 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -3732,7 +3732,7 @@ TestlinkarrayCmd(
static const char *LinkOption[] = {
"update", "remove", "create", NULL
};
- enum LinkOptionEnum {LINK_UPDATE, LINK_REMOVE, LINK_CREATE} optionIndex;
+ enum LinkOptionEnum { LINK_UPDATE, LINK_REMOVE, LINK_CREATE } optionIndex;
static const char *LinkType[] = {
"char", "uchar", "short", "ushort", "int", "uint", "long", "ulong",
"wide", "uwide", "float", "double", "string", "char*", "binary", NULL
@@ -4214,7 +4214,7 @@ PrintParse(
Tcl_Size i;
objPtr = Tcl_GetObjResult(interp);
- if (parsePtr->commentSize + 1 > 1) {
+ if (parsePtr->commentSize > 0) {
Tcl_ListObjAppendElement(NULL, objPtr,
Tcl_NewStringObj(parsePtr->commentStart,
parsePtr->commentSize));
@@ -4652,15 +4652,15 @@ TestregexpObjCmd(
end--;
}
- objs[0] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(start + 1U)) - 1);
- objs[1] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(end + 1U)) - 1);
+ objs[0] = Tcl_NewWideIntObj(start);
+ objs[1] = Tcl_NewWideIntObj(end);
newPtr = Tcl_NewListObj(2, objs);
} else {
if (ii == TCL_INDEX_NONE) {
TclRegExpRangeUniChar(regExpr, ii, &start, &end);
newPtr = Tcl_GetRange(objPtr, start, end);
- } else if (ii > info.nsubs || info.matches[ii].end + 1 <= 1) {
+ } else if (ii > info.nsubs || info.matches[ii].end <= 0) {
newPtr = Tcl_NewObj();
} else {
newPtr = Tcl_GetRange(objPtr, info.matches[ii].start,
@@ -7518,7 +7518,7 @@ TestUtfNextCmd(
}
bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
- if (numBytes + 4 > (Tcl_Size) sizeof(buffer)) {
+ if (numBytes + 4U > sizeof(buffer)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"testutfnext\" can only handle %" TCL_Z_MODIFIER "u bytes",
sizeof(buffer) - 4));
@@ -7689,8 +7689,7 @@ TestGetIntForIndexCmd(
if (Tcl_GetIntForIndex(interp, objv[1], endvalue, &result) != TCL_OK) {
return TCL_ERROR;
}
- /* Make sure that (size_t)-2 is output as "-2" and (size_t)-3 as "-3", even for 32-bit */
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(result + 3U)) - 3));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result));
return TCL_OK;
}
@@ -7930,7 +7929,7 @@ TestNRELevels(
static ptrdiff_t *refDepth = NULL;
ptrdiff_t depth;
Tcl_Obj *levels[6];
- size_t i = 0;
+ Tcl_Size i = 0;
NRE_callback *cbPtr = iPtr->execEnvPtr->callbackPtr;
if (refDepth == NULL) {
@@ -7940,9 +7939,9 @@ TestNRELevels(
depth = (refDepth - &depth);
levels[0] = Tcl_NewWideIntObj(depth);
- levels[1] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->numLevels + 1U)) - 1);
- levels[2] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->cmdFramePtr->level + 1U)) - 1);
- levels[3] = Tcl_NewWideIntObj((Tcl_WideInt)((Tcl_WideUInt)(iPtr->varFramePtr->level + 1U)) - 1);
+ levels[1] = Tcl_NewWideIntObj(iPtr->numLevels);
+ levels[2] = Tcl_NewWideIntObj(iPtr->cmdFramePtr->level);
+ levels[3] = Tcl_NewWideIntObj(iPtr->varFramePtr->level);
levels[4] = Tcl_NewWideIntObj(iPtr->execEnvPtr->execStackPtr->tosPtr
- iPtr->execEnvPtr->execStackPtr->stackWords);
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;