diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-08 10:23:13 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-06-08 10:23:13 (GMT) |
| commit | 8ef685ede6f3371073dfb6f84eff77b62398787c (patch) | |
| tree | fd4894d3b57bc034901dff8f04b0b9b465057ce1 /generic/tclInterp.c | |
| parent | aa312430e34a7bd58cddb79b7dd6840e86ced518 (diff) | |
| parent | bdccbf1c921b2158d107e97cc64b72ab81a05ee5 (diff) | |
| download | tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.zip tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.gz tcl-8ef685ede6f3371073dfb6f84eff77b62398787c.tar.bz2 | |
TIP #616: Tcl lists > 2^31 elements
Diffstat (limited to 'generic/tclInterp.c')
| -rw-r--r-- | generic/tclInterp.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 8f30128..fd3264f 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1197,12 +1197,12 @@ Tcl_CreateAlias( const char *childCmd, /* Command to install in child. */ Tcl_Interp *targetInterp, /* Interpreter for target command. */ const char *targetCmd, /* Name of target command. */ - int argc, /* How many additional arguments? */ + size_t argc, /* How many additional arguments? */ const char *const *argv) /* These are the additional args. */ { Tcl_Obj *childObjPtr, *targetObjPtr; Tcl_Obj **objv; - int i; + size_t i; int result; objv = (Tcl_Obj **)TclStackAlloc(childInterp, sizeof(Tcl_Obj *) * argc); @@ -1252,7 +1252,7 @@ Tcl_CreateAliasObj( const char *childCmd, /* Command to install in child. */ Tcl_Interp *targetInterp, /* Interpreter for target command. */ const char *targetCmd, /* Name of target command. */ - int objc, /* How many additional arguments? */ + size_t objc, /* How many additional arguments? */ Tcl_Obj *const objv[]) /* Argument vector. */ { Tcl_Obj *childObjPtr, *targetObjPtr; @@ -2318,7 +2318,7 @@ GetInterp( Tcl_HashEntry *hPtr; /* Search element. */ Child *childPtr; /* Interim child record. */ Tcl_Obj **objv; - int objc, i; + size_t objc, i; Tcl_Interp *searchInterp; /* Interim storage for interp. to find. */ InterpInfo *parentInfoPtr; @@ -2376,7 +2376,7 @@ ChildBgerror( Tcl_Obj *const objv[]) /* Argument strings. */ { if (objc) { - int length; + size_t length; if (TCL_ERROR == TclListObjLengthM(NULL, objv[0], &length) || (length < 1)) { @@ -2422,7 +2422,8 @@ ChildCreate( InterpInfo *parentInfoPtr; Tcl_HashEntry *hPtr; const char *path; - int isNew, objc; + int isNew; + size_t objc; Tcl_Obj **objv; if (TclListObjGetElementsM(interp, pathPtr, &objc, &objv) != TCL_OK) { @@ -2990,7 +2991,7 @@ ChildRecursionLimit( Tcl_Obj *const objv[]) /* Argument strings. */ { Interp *iPtr; - int limit; + Tcl_WideInt limit; if (objc) { if (Tcl_IsSafe(interp)) { @@ -3000,12 +3001,12 @@ ChildRecursionLimit( NULL); return TCL_ERROR; } - if (TclGetIntFromObj(interp, objv[0], &limit) == TCL_ERROR) { + if (TclGetWideIntFromObj(interp, objv[0], &limit) == TCL_ERROR) { return TCL_ERROR; } - if (limit <= 0) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "recursion limit must be > 0", -1)); + if (limit <= 0 || (size_t)limit >= ((Tcl_WideUInt)WIDE_MAX & TCL_INDEX_NONE)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "recursion limit must be > 0 and < %" TCL_LL_MODIFIER "u", (Tcl_WideUInt)WIDE_MAX & TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP", "BADLIMIT", NULL); return TCL_ERROR; @@ -3979,7 +3980,7 @@ Tcl_LimitTypeReset( void Tcl_LimitSetCommands( Tcl_Interp *interp, - int commandLimit) + size_t commandLimit) { Interp *iPtr = (Interp *) interp; @@ -4310,7 +4311,7 @@ SetScriptLimitCallback( key.type = type; if (scriptObj == NULL) { - hashPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key); + hashPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, &key); if (hashPtr != NULL) { Tcl_LimitRemoveHandler(targetInterp, type, CallScriptLimitCallback, Tcl_GetHashValue(hashPtr)); @@ -4513,7 +4514,7 @@ ChildCommandLimitCmd( TclNewObj(dictPtr); key.interp = childInterp; key.type = TCL_LIMIT_COMMANDS; - hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key); + hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, &key); if (hPtr != NULL) { limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr); if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) { @@ -4555,7 +4556,7 @@ ChildCommandLimitCmd( case OPT_CMD: key.interp = childInterp; key.type = TCL_LIMIT_COMMANDS; - hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key); + hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, &key); if (hPtr != NULL) { limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr); if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) { @@ -4701,7 +4702,7 @@ ChildTimeLimitCmd( TclNewObj(dictPtr); key.interp = childInterp; key.type = TCL_LIMIT_TIME; - hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key); + hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, &key); if (hPtr != NULL) { limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr); if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) { @@ -4749,7 +4750,7 @@ ChildTimeLimitCmd( case OPT_CMD: key.interp = childInterp; key.type = TCL_LIMIT_TIME; - hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key); + hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, &key); if (hPtr != NULL) { limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr); if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) { |
