Skip to content

Commit

Permalink
Remaining fixes for [26870862f0]: Wrong sentinel in Tcl_SetErrorCode …
Browse files Browse the repository at this point in the history
…usage
  • Loading branch information
jan.nijtmans committed Oct 22, 2023
1 parent 17d4530 commit 91e57c2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions generic/tclBinary.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ TclGetBytesFromObj(
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"byte sequence length exceeds INT_MAX", -1));
Tcl_SetErrorCode(interp, "TCL", "API", "OUTDATED", NULL);
Tcl_SetErrorCode(interp, "TCL", "API", "OUTDATED", (void *)NULL);
}
return NULL;
} else {
Expand Down Expand Up @@ -519,7 +519,7 @@ MakeByteArray(
"expected byte sequence but character %"
TCL_Z_MODIFIER "u was '%1s' (U+%06X)",
dst - byteArrayPtr->bytes, src, ch));
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", (void *)NULL);
}
Tcl_Free(byteArrayPtr);
*byteArrayPtrPtr = NULL;
Expand Down
2 changes: 1 addition & 1 deletion generic/tclCompile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ TclCompileScript(
Tcl_ObjPrintf("Script length %" TCL_SIZE_MODIFIER
"d exceeds max permitted length %d.",
numBytes, INT_MAX-1));
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "SCRIPTLENGTH", NULL);
Tcl_SetErrorCode(interp, "TCL", "LIMIT", "SCRIPTLENGTH", (void *)NULL);
TclCompileSyntaxError(interp, envPtr);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion generic/tclIOGT.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ ExecuteCallback(
}
nonBytes:
Tcl_AppendResult(interp, "chan transform callback received non-bytes",
NULL);
(void *)NULL);
Tcl_Release(eval);
return TCL_ERROR;

Expand Down
6 changes: 3 additions & 3 deletions generic/tclObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -3658,9 +3658,9 @@ Tcl_GetNumber(
}
if (numBytes > INT_MAX) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"max size for a Tcl value (%d bytes) exceeded", INT_MAX));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"max size for a Tcl value (%d bytes) exceeded", INT_MAX));
Tcl_SetErrorCode(interp, "TCL", "MEMORY", (void *)NULL);
}
return TCL_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion generic/tclScan.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ ValidateFormat(
ull,
(Tcl_Size)TCL_SIZE_MAX-1));
Tcl_SetErrorCode(
interp, "TCL", "FORMAT", "WIDTHLIMIT", NULL);
interp, "TCL", "FORMAT", "WIDTHLIMIT", (void *)NULL);
goto error;
}
flags |= SCAN_WIDTH;
Expand Down
8 changes: 4 additions & 4 deletions generic/tclStubInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int TclListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr,
if (objcPtr) {
if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) {
if (interp) {
Tcl_AppendResult(interp, "List too large to be processed", NULL);
Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -127,7 +127,7 @@ int TclListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr,
if (lengthPtr) {
if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) {
if (interp) {
Tcl_AppendResult(interp, "List too large to be processed", NULL);
Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -142,7 +142,7 @@ int TclDictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr,
if (sizePtr) {
if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) {
if (interp) {
Tcl_AppendResult(interp, "Dict too large to be processed", NULL);
Tcl_AppendResult(interp, "Dict too large to be processed", (void *)NULL);
}
return TCL_ERROR;
}
Expand All @@ -157,7 +157,7 @@ int TclSplitList(Tcl_Interp *interp, const char *listStr, void *argcPtr,
if (argcPtr) {
if ((sizeof(int) != sizeof(size_t)) && (result == TCL_OK) && (n > INT_MAX)) {
if (interp) {
Tcl_AppendResult(interp, "List too large to be processed", NULL);
Tcl_AppendResult(interp, "List too large to be processed", (void *)NULL);
}
Tcl_Free((void *)*argvPtr);
return TCL_ERROR;
Expand Down
7 changes: 1 addition & 6 deletions generic/tclUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -3925,12 +3925,7 @@ TclIndexEncode(
Tcl_SetObjResult(
interp,
Tcl_ObjPrintf("index \"%s\" out of range", TclGetString(objPtr)));
Tcl_SetErrorCode(interp,
"TCL",
"VALUE",
"INDEX"
"OUTOFRANGE",
NULL);
Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", "OUTOFRANGE", (void *)NULL);
}
return TCL_ERROR;
}
Expand Down

0 comments on commit 91e57c2

Please sign in to comment.