diff options
79 files changed, 981 insertions, 726 deletions
diff --git a/doc/DictObj.3 b/doc/DictObj.3 index 0b4c1ca..73b0da8 100644 --- a/doc/DictObj.3 +++ b/doc/DictObj.3 @@ -70,7 +70,7 @@ Points to a variable that will have the value from a key/value pair placed within it. For \fBTcl_DictObjFirst\fR and \fBTcl_DictObjNext\fR, this may be NULL to indicate that the caller is not interested in the value. -.AP int *sizePtr out +.AP size_t | int *sizePtr out Points to a variable that will have the number of key/value pairs contained within the dictionary placed within it. .AP Tcl_DictSearch *searchPtr in/out diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 index ea12728..5def8df 100644 --- a/doc/FileSystem.3 +++ b/doc/FileSystem.3 @@ -220,9 +220,9 @@ The second of two path values to compare. The value may be converted to \fBpath\fR type. .AP Tcl_Obj *listObj in The list of path elements to operate on with a \fBjoin\fR operation. -.AP int elements in -If non-negative, the number of elements in the \fIlistObj\fR which should -be joined together. If negative, then all elements are joined. +.AP size_t elements in +The number of elements in the \fIlistObj\fR which should +be joined together. If TCL_INDEX_NONE, then all elements are joined. .AP Tcl_Obj **errorPtr out In the case of an error, filled with a value containing the name of the file which caused an error in the various copy/rename operations. diff --git a/doc/ListObj.3 b/doc/ListObj.3 index c5c1dc7..09ab3b7 100644 --- a/doc/ListObj.3 +++ b/doc/ListObj.3 @@ -59,13 +59,13 @@ points to the Tcl value that will be appended to \fIlistPtr\fR. For \fBTcl_SetListObj\fR, this points to the Tcl value that will be converted to a list value containing the \fIobjc\fR elements of the array referenced by \fIobjv\fR. -.AP int *objcPtr in +.AP size_t | int *objcPtr in Points to location where \fBTcl_ListObjGetElements\fR stores the number of element values in \fIlistPtr\fR. .AP Tcl_Obj ***objvPtr out A location where \fBTcl_ListObjGetElements\fR stores a pointer to an array of pointers to the element values of \fIlistPtr\fR. -.AP int objc in +.AP size_t objc in The number of Tcl values that \fBTcl_NewListObj\fR will insert into a new list value, and \fBTcl_ListObjReplace\fR will insert into \fIlistPtr\fR. @@ -76,21 +76,21 @@ An array of pointers to values. \fBTcl_NewListObj\fR will insert these values into a new list value and \fBTcl_ListObjReplace\fR will insert them into an existing \fIlistPtr\fR. Each value will become a separate list element. -.AP int *lengthPtr out +.AP size_t | int *lengthPtr out Points to location where \fBTcl_ListObjLength\fR stores the length of the list. -.AP int index in +.AP size_t index in Index of the list element that \fBTcl_ListObjIndex\fR is to return. The first element has index 0. .AP Tcl_Obj **objPtrPtr out Points to place where \fBTcl_ListObjIndex\fR is to store a pointer to the resulting list element value. -.AP int first in +.AP size_t first in Index of the starting list element that \fBTcl_ListObjReplace\fR is to replace. The list's first element has index 0. -.AP int count in +.AP size_t count in The number of elements that \fBTcl_ListObjReplace\fR is to replace. .BE @@ -162,7 +162,7 @@ Otherwise it returns \fBTCL_OK\fR after storing the count and array pointer. .PP \fBTcl_ListObjLength\fR returns the number of elements in the list value referenced by \fIlistPtr\fR. -It returns this count by storing an integer in the address \fIlengthPtr\fR. +It returns this count by storing a value in the address \fIlengthPtr\fR. If the value is not already a list value, \fBTcl_ListObjLength\fR will attempt to convert it to one; if the conversion fails, it returns \fBTCL_ERROR\fR diff --git a/doc/Method.3 b/doc/Method.3 index ac71890..8409b97 100644 --- a/doc/Method.3 +++ b/doc/Method.3 @@ -58,7 +58,7 @@ Tcl_Method Tcl_Object \fBTcl_ObjectContextObject\fR(\fIcontext\fR) .sp -int +size_t \fBTcl_ObjectContextSkippedArgs\fR(\fIcontext\fR) .SH ARGUMENTS .AS void *clientData in diff --git a/doc/ParseArgs.3 b/doc/ParseArgs.3 index 6c1dcbb..02b52d4 100644 --- a/doc/ParseArgs.3 +++ b/doc/ParseArgs.3 @@ -21,7 +21,7 @@ int Where to store error messages. .AP "const Tcl_ArgvInfo" *argTable in Pointer to array of option descriptors. -.AP int *objcPtr in/out +.AP size_t | int *objcPtr in/out A pointer to variable holding number of arguments in \fIobjv\fR. Will be modified to hold number of arguments left in the unprocessed argument list stored in \fIremObjv\fR. diff --git a/doc/SplitList.3 b/doc/SplitList.3 index 070beb0..696906c 100644 --- a/doc/SplitList.3 +++ b/doc/SplitList.3 @@ -38,14 +38,14 @@ Interpreter to use for error reporting. If NULL, then no error message is left. .AP "const char" *list in Pointer to a string with proper list structure. -.AP int *argcPtr out +.AP size_t | int *argcPtr out Filled in with number of elements in \fIlist\fR. .AP "const char" ***argvPtr out \fI*argvPtr\fR will be filled in with the address of an array of pointers to the strings that are the extracted elements of \fIlist\fR. There will be \fI*argcPtr\fR valid entries in the array, followed by a NULL entry. -.AP int argc in +.AP size_t argc in Number of elements in \fIargv\fR. .AP "const char *const" *argv in Array of strings to merge together into a single list. @@ -81,7 +81,8 @@ For example, suppose that you have called \fBTcl_SplitList\fR with the following code: .PP .CS -int argc, code; +size_t argc; +int code; char *string; char **argv; \&... @@ -92,7 +93,7 @@ Then you should eventually free the storage with a call like the following: .PP .CS -Tcl_Free((char *) argv); +Tcl_Free(argv); .CE .PP \fBTcl_SplitList\fR normally returns \fBTCL_OK\fR, which means the list was diff --git a/doc/SplitPath.3 b/doc/SplitPath.3 index c011194..e7dc0cf 100644 --- a/doc/SplitPath.3 +++ b/doc/SplitPath.3 @@ -25,14 +25,14 @@ Tcl_PathType .AP "const char" *path in File path in a form appropriate for the current platform (see the \fBfilename\fR manual entry for acceptable forms for path names). -.AP int *argcPtr out +.AP size_t | int *argcPtr out Filled in with number of path elements in \fIpath\fR. .AP "const char" ***argvPtr out \fI*argvPtr\fR will be filled in with the address of an array of pointers to the strings that are the extracted elements of \fIpath\fR. There will be \fI*argcPtr\fR valid entries in the array, followed by a NULL entry. -.AP int argc in +.AP size_t argc in Number of elements in \fIargv\fR. .AP "const char *const" *argv in Array of path elements to merge together into a single path. @@ -61,7 +61,7 @@ For example, suppose that you have called \fBTcl_SplitPath\fR with the following code: .PP .CS -int argc; +size_t argc; char *path; char **argv; \&... diff --git a/doc/StringObj.3 b/doc/StringObj.3 index 156618b..859e27a 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -135,7 +135,7 @@ If NULL is passed then the suffix is used. .AP "const char" *format in Format control string including % conversion specifiers. -.AP int objc in +.AP size_t objc in The number of elements to format or concatenate. .AP Tcl_Obj *objv[] in The array of values to format or concatenate. diff --git a/doc/WrongNumArgs.3 b/doc/WrongNumArgs.3 index 533cb4f..b501d36 100644 --- a/doc/WrongNumArgs.3 +++ b/doc/WrongNumArgs.3 @@ -19,7 +19,7 @@ Tcl_WrongNumArgs \- generate standard error message for wrong number of argument .AP Tcl_Interp interp in Interpreter in which error will be reported: error message gets stored in its result value. -.AP int objc in +.AP size_t objc in Number of leading arguments from \fIobjv\fR to include in error message. .AP "Tcl_Obj *const" objv[] in diff --git a/generic/tcl.decls b/generic/tcl.decls index a19ab25..a831c54 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -89,7 +89,7 @@ declare 16 { void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, size_t length) } declare 17 { - Tcl_Obj *Tcl_ConcatObj(int objc, Tcl_Obj *const objv[]) + Tcl_Obj *Tcl_ConcatObj(size_t objc, Tcl_Obj *const objv[]) } declare 18 { int Tcl_ConvertToType(Tcl_Interp *interp, Tcl_Obj *objPtr, @@ -117,7 +117,7 @@ declare 24 { int line) } declare 25 { - Tcl_Obj *Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv, + Tcl_Obj *Tcl_DbNewListObj(size_t objc, Tcl_Obj *const *objv, const char *file, int line) } # Removed in 9.0 (changed to macro): @@ -186,20 +186,20 @@ declare 44 { Tcl_Obj *objPtr) } declare 45 { - int Tcl_ListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, + int TclListObjGetElements_(Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr) } declare 46 { - int Tcl_ListObjIndex(Tcl_Interp *interp, Tcl_Obj *listPtr, int index, + int Tcl_ListObjIndex(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t index, Tcl_Obj **objPtrPtr) } declare 47 { - int Tcl_ListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, + int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr) } declare 48 { - int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, int first, - int count, int objc, Tcl_Obj *const objv[]) + int Tcl_ListObjReplace(Tcl_Interp *interp, Tcl_Obj *listPtr, size_t first, + size_t count, size_t objc, Tcl_Obj *const objv[]) } # Removed in 9.0 (changed to macro): #declare 49 { @@ -216,7 +216,7 @@ declare 51 { # Tcl_Obj *Tcl_NewIntObj(int intValue) #} declare 53 { - Tcl_Obj *Tcl_NewListObj(int objc, Tcl_Obj *const objv[]) + Tcl_Obj *Tcl_NewListObj(size_t objc, Tcl_Obj *const objv[]) } # Removed in 9.0 (changed to macro): #declare 54 { @@ -247,7 +247,7 @@ declare 60 { # void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue) #} declare 62 { - void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]) + void Tcl_SetListObj(Tcl_Obj *objPtr, size_t objc, Tcl_Obj *const objv[]) } # Removed in 9.0 (changed to macro): #declare 63 { @@ -320,7 +320,7 @@ declare 82 { int Tcl_CommandComplete(const char *cmd) } declare 83 { - char *Tcl_Concat(int argc, const char *const *argv) + char *Tcl_Concat(size_t argc, const char *const *argv) } declare 84 { size_t Tcl_ConvertElement(const char *src, char *dst, int flags) @@ -331,12 +331,12 @@ declare 85 { } declare 86 { int Tcl_CreateAlias(Tcl_Interp *childInterp, const char *childCmd, - Tcl_Interp *target, const char *targetCmd, int argc, + Tcl_Interp *target, const char *targetCmd, size_t argc, const char *const *argv) } declare 87 { int Tcl_CreateAliasObj(Tcl_Interp *childInterp, const char *childCmd, - Tcl_Interp *target, const char *targetCmd, int objc, + Tcl_Interp *target, const char *targetCmd, size_t objc, Tcl_Obj *const objv[]) } declare 88 { @@ -685,7 +685,7 @@ declare 185 { } # Obsolete, use Tcl_FSJoinPath declare 186 { - char *Tcl_JoinPath(int argc, const char *const *argv, + char *Tcl_JoinPath(size_t argc, const char *const *argv, Tcl_DString *resultPtr) } declare 187 { @@ -708,7 +708,7 @@ declare 191 { Tcl_Channel Tcl_MakeTcpClientChannel(void *tcpSocket) } declare 192 { - char *Tcl_Merge(int argc, const char *const *argv) + char *Tcl_Merge(size_t argc, const char *const *argv) } declare 193 { Tcl_HashEntry *Tcl_NextHashEntry(Tcl_HashSearch *searchPtr) @@ -725,7 +725,7 @@ declare 196 { Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags) } declare 197 { - Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, + Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, size_t argc, const char **argv, int flags) } # This is obsolete, use Tcl_FSOpenFileChannel @@ -879,12 +879,12 @@ declare 241 { void Tcl_SourceRCFile(Tcl_Interp *interp) } declare 242 { - int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, + int TclSplitList_(Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr) } # Obsolete, use Tcl_FSSplitPath declare 243 { - void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr) + void TclSplitPath_(const char *path, int *argcPtr, const char ***argvPtr) } # Removed in 9.0 (stub entry only) #declare 244 { @@ -968,7 +968,7 @@ declare 263 { size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen) } declare 264 { - void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, + void Tcl_WrongNumArgs(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], const char *message) } declare 265 { @@ -1093,7 +1093,7 @@ declare 291 { int flags) } declare 292 { - int Tcl_EvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], + int Tcl_EvalObjv(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags) } declare 293 { @@ -1699,10 +1699,10 @@ declare 459 { int Tcl_FSConvertToPathType(Tcl_Interp *interp, Tcl_Obj *pathPtr) } declare 460 { - Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, int elements) + Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, size_t elements) } declare 461 { - Tcl_Obj *Tcl_FSSplitPath(Tcl_Obj *pathPtr, int *lenPtr) + Tcl_Obj *TclFSSplitPath_(Tcl_Obj *pathPtr, int *lenPtr) } declare 462 { int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, Tcl_Obj *secondPtr) @@ -1711,7 +1711,7 @@ declare 463 { Tcl_Obj *Tcl_FSGetNormalizedPath(Tcl_Interp *interp, Tcl_Obj *pathPtr) } declare 464 { - Tcl_Obj *Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc, + Tcl_Obj *Tcl_FSJoinToPath(Tcl_Obj *pathPtr, size_t objc, Tcl_Obj *const objv[]) } declare 465 { @@ -1841,7 +1841,7 @@ declare 496 { Tcl_Obj *keyPtr) } declare 497 { - int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr) + int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr) } declare 498 { int Tcl_DictObjFirst(Tcl_Interp *interp, Tcl_Obj *dictPtr, @@ -1857,11 +1857,11 @@ declare 500 { } declare 501 { int Tcl_DictObjPutKeyList(Tcl_Interp *interp, Tcl_Obj *dictPtr, - int keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr) + size_t keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr) } declare 502 { int Tcl_DictObjRemoveKeyList(Tcl_Interp *interp, Tcl_Obj *dictPtr, - int keyc, Tcl_Obj *const *keyv) + size_t keyc, Tcl_Obj *const *keyv) } declare 503 { Tcl_Obj *Tcl_NewDictObj(void) @@ -2143,7 +2143,7 @@ declare 572 { # TIP#268 (extended version numbers and requirements) akupries declare 573 { int Tcl_PkgRequireProc(Tcl_Interp *interp, const char *name, - int objc, Tcl_Obj *const objv[], void *clientDataPtr) + size_t objc, Tcl_Obj *const objv[], void *clientDataPtr) } # TIP#270 (utility C routines for string formatting) dgp @@ -2155,12 +2155,12 @@ declare 575 { size_t length, size_t limit, const char *ellipsis) } declare 576 { - Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, int objc, + Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, size_t objc, Tcl_Obj *const objv[]) } declare 577 { int Tcl_AppendFormatToObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - const char *format, int objc, Tcl_Obj *const objv[]) + const char *format, size_t objc, Tcl_Obj *const objv[]) } declare 578 { Tcl_Obj *Tcl_ObjPrintf(const char *format, ...) @@ -2197,11 +2197,11 @@ declare 584 { int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags) } declare 585 { - int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, + int Tcl_NREvalObjv(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags) } declare 586 { - int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, int objc, + int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, size_t objc, Tcl_Obj *const objv[], int flags) } declare 587 { @@ -2213,7 +2213,7 @@ declare 587 { # classic objProc declare 588 { int Tcl_NRCallObjProc(Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, - void *clientData, int objc, Tcl_Obj *const objv[]) + void *clientData, size_t objc, Tcl_Obj *const objv[]) } # TIP#316 (Tcl_StatBuf reader functions) dkf @@ -2269,7 +2269,7 @@ declare 603 { # TIP#265 (option parser) dkf for Sam Bromley declare 604 { - int Tcl_ParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, + int TclParseArgsObjv_(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) } @@ -2505,6 +2505,33 @@ declare 660 { int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async, int sigNumber) } +# TIP #616 +declare 661 { + int Tcl_ListObjGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, + size_t *objcPtr, Tcl_Obj ***objvPtr) +} +declare 662 { + int Tcl_ListObjLength(Tcl_Interp *interp, Tcl_Obj *listPtr, + size_t *lengthPtr) +} +declare 663 { + int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr) +} +declare 664 { + int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, size_t *argcPtr, + const char ***argvPtr) +} +declare 665 { + void Tcl_SplitPath(const char *path, size_t *argcPtr, const char ***argvPtr) +} +declare 666 { + Tcl_Obj *Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr) +} +declare 667 { + int Tcl_ParseArgsObjv(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, + size_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv) +} + # ----- BASELINE -- FOR -- 8.7.0 ----- # ############################################################################## diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 975906c..1ea3d37 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -1968,7 +1968,7 @@ CreateMirrorJumpTable( AssemblyEnv* assemEnvPtr, /* Assembly environment */ Tcl_Obj* jumps) /* List of alternating keywords and labels */ { - int objc; /* Number of elements in the 'jumps' list */ + size_t objc; /* Number of elements in the 'jumps' list */ Tcl_Obj** objv; /* Pointers to the elements in the list */ CompileEnv* envPtr = assemEnvPtr->envPtr; /* Compilation environment */ @@ -1981,7 +1981,7 @@ CreateMirrorJumpTable( Tcl_HashEntry* hashEntry; /* Entry for a key in the hashtable */ int isNew; /* Flag==1 if the key is not yet in the * table. */ - int i; + size_t i; if (TclListObjGetElements(interp, jumps, &objc, &objv) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b277c5c..92d8abf 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4226,7 +4226,7 @@ int Tcl_EvalObjv( Tcl_Interp *interp, /* Interpreter in which to evaluate the * command. Also used for error reporting. */ - int objc, /* Number of words in command. */ + size_t objc, /* Number of words in command. */ Tcl_Obj *const objv[], /* An array of pointers to objects that are * the words that make up the command. */ int flags) /* Collection of OR-ed bits that control the @@ -4682,7 +4682,7 @@ TEOV_NotFound( { Command * cmdPtr; Interp *iPtr = (Interp *) interp; - int i, newObjc, handlerObjc; + size_t i, newObjc, handlerObjc; Tcl_Obj **newObjv, **handlerObjv; CallFrame *varFramePtr = iPtr->varFramePtr; Namespace *currNsPtr = NULL;/* Used to check for and invoke any registered @@ -5220,7 +5220,7 @@ TclEvalEx( objv[objectsUsed] = Tcl_GetObjResult(interp); Tcl_IncrRefCount(objv[objectsUsed]); if (tokenPtr->type == TCL_TOKEN_EXPAND_WORD) { - int numElements; + size_t numElements; code = TclListObjLength(interp, objv[objectsUsed], &numElements); @@ -5271,7 +5271,7 @@ TclEvalEx( objectsUsed = 0; while (wordIdx--) { if (expand[wordIdx]) { - int numElements; + size_t numElements; Tcl_Obj **elements, *temp = copy[wordIdx]; TclListObjGetElements(NULL, temp, &numElements, @@ -5968,7 +5968,7 @@ TclNREvalObjEx( if (TclListObjIsCanonical(objPtr)) { CmdFrame *eoFramePtr = NULL; - int objc; + size_t objc; Tcl_Obj *listPtr, **objv; /* @@ -8330,7 +8330,7 @@ Tcl_NRCallObjProc( Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, void *clientData, - int objc, + size_t objc, Tcl_Obj *const objv[]) { NRE_callback *rootPtr = TOP_CB(interp); @@ -8430,7 +8430,7 @@ int Tcl_NREvalObjv( Tcl_Interp *interp, /* Interpreter in which to evaluate the * command. Also used for error reporting. */ - int objc, /* Number of words in command. */ + size_t objc, /* Number of words in command. */ Tcl_Obj *const objv[], /* An array of pointers to objects that are * the words that make up the command. */ int flags) /* Collection of OR-ed bits that control the @@ -8445,7 +8445,7 @@ int Tcl_NRCmdSwap( Tcl_Interp *interp, Tcl_Command cmd, - int objc, + size_t objc, Tcl_Obj *const objv[], int flags) { @@ -8637,7 +8637,7 @@ TclNRTailcallEval( Interp *iPtr = (Interp *) interp; Tcl_Obj *listPtr = (Tcl_Obj *)data[0], *nsObjPtr; Tcl_Namespace *nsPtr; - int objc; + size_t objc; Tcl_Obj **objv; TclListObjGetElements(interp, listPtr, &objc, &objv); @@ -9062,7 +9062,7 @@ TclNREvalList( Tcl_Interp *interp, TCL_UNUSED(int) /*result*/) { - int objc; + size_t objc; Tcl_Obj **objv; Tcl_Obj *listPtr = (Tcl_Obj *)data[0]; @@ -9326,7 +9326,7 @@ InjectHandler( Tcl_Obj *listPtr = (Tcl_Obj *)data[1]; int nargs = PTR2INT(data[2]); void *isProbe = data[3]; - int objc; + size_t objc; Tcl_Obj **objv; if (!isProbe) { @@ -9345,7 +9345,7 @@ InjectHandler( * I don't think this is reachable... */ - Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewIntObj(nargs)); + Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewWideIntObj(nargs)); } Tcl_ListObjAppendElement(NULL, listPtr, Tcl_GetObjResult(interp)); } diff --git a/generic/tclBinary.c b/generic/tclBinary.c index c93494e..8eea58c 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1006,7 +1006,7 @@ BinaryFormatCmd( arg++; count = 1; } else { - int listc; + size_t listc; Tcl_Obj **listv; /* @@ -1021,7 +1021,7 @@ BinaryFormatCmd( if (count == BINARY_ALL) { count = listc; - } else if (count > (size_t)listc) { + } else if (count > listc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "number of elements in list does not match count", -1)); @@ -1284,7 +1284,7 @@ BinaryFormatCmd( case 'q': case 'Q': case 'f': { - int listc, i; + size_t listc, i; Tcl_Obj **listv; if (count == BINARY_NOCOUNT) { diff --git a/generic/tclClock.c b/generic/tclClock.c index 620a9d2..c021a31 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -142,17 +142,17 @@ TCL_DECLARE_MUTEX(clockMutex) static int ConvertUTCToLocal(Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, size_t, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); static int ConvertLocalToUTC(Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, size_t, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, - int, Tcl_Obj *const *); + size_t, Tcl_Obj *const *); static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); @@ -747,7 +747,7 @@ ConvertLocalToUTC( Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { - int rowc; /* Number of rows in tzdata */ + size_t rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* @@ -792,11 +792,11 @@ static int ConvertLocalToUTCUsingTable( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Time to convert, with 'seconds' filled in */ - int rowc, /* Number of points at which time changes */ + size_t rowc, /* Number of points at which time changes */ Tcl_Obj *const rowv[]) /* Points at which time changes */ { Tcl_Obj *row; - int cellc; + size_t cellc; Tcl_Obj **cellv; int have[8]; int nHave = 0; @@ -950,7 +950,7 @@ ConvertUTCToLocal( Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { - int rowc; /* Number of rows in tzdata */ + size_t rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* @@ -995,12 +995,12 @@ static int ConvertUTCToLocalUsingTable( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the date */ - int rowc, /* Number of rows in the conversion table + size_t rowc, /* Number of rows in the conversion table * (>= 1) */ Tcl_Obj *const rowv[]) /* Rows of the conversion table */ { Tcl_Obj *row; /* Row containing the current information */ - int cellc; /* Count of cells in the row (must be 4) */ + size_t cellc; /* Count of cells in the row (must be 4) */ Tcl_Obj **cellv; /* Pointers to the cells */ /* @@ -1135,11 +1135,11 @@ static Tcl_Obj * LookupLastTransition( Tcl_Interp *interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ - int rowc, /* Number of rows of tzdata */ + size_t rowc, /* Number of rows of tzdata */ Tcl_Obj *const *rowv) /* Rows in tzdata */ { - int l; - int u; + size_t l; + size_t u; Tcl_Obj *compObj; Tcl_WideInt compVal; diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 9bab9bf..d58b92c 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -27,11 +27,11 @@ struct ForeachState { int bodyIdx; /* The argument index of the body. */ int j, maxj; /* Number of loop iterations. */ int numLists; /* Count of value lists. */ - int *index; /* Array of value list indices. */ - int *varcList; /* # loop variables per list. */ + size_t *index; /* Array of value list indices. */ + size_t *varcList; /* # loop variables per list. */ Tcl_Obj ***varvList; /* Array of var name lists. */ Tcl_Obj **vCopyList; /* Copies of var name list arguments. */ - int *argcList; /* Array of value list sizes. */ + size_t *argcList; /* Array of value list sizes. */ Tcl_Obj ***argvList; /* Array of value lists. */ Tcl_Obj **aCopyList; /* Copies of value list arguments. */ Tcl_Obj *resultList; /* List of result values from the loop body, @@ -2500,16 +2500,16 @@ EachloopCmd( */ statePtr = (struct ForeachState *)TclStackAlloc(interp, - sizeof(struct ForeachState) + 3 * numLists * sizeof(int) + sizeof(struct ForeachState) + 3 * numLists * sizeof(size_t) + 2 * numLists * (sizeof(Tcl_Obj **) + sizeof(Tcl_Obj *))); memset(statePtr, 0, - sizeof(struct ForeachState) + 3 * numLists * sizeof(int) + sizeof(struct ForeachState) + 3 * numLists * sizeof(size_t) + 2 * numLists * (sizeof(Tcl_Obj **) + sizeof(Tcl_Obj *))); statePtr->varvList = (Tcl_Obj ***) (statePtr + 1); statePtr->argvList = statePtr->varvList + numLists; statePtr->vCopyList = (Tcl_Obj **) (statePtr->argvList + numLists); statePtr->aCopyList = statePtr->vCopyList + numLists; - statePtr->index = (int *) (statePtr->aCopyList + numLists); + statePtr->index = (size_t *) (statePtr->aCopyList + numLists); statePtr->varcList = statePtr->index + numLists; statePtr->argcList = statePtr->varcList + numLists; @@ -2671,7 +2671,8 @@ ForeachAssignments( Tcl_Interp *interp, struct ForeachState *statePtr) { - int i, v, k; + int i; + size_t v, k; Tcl_Obj *valuePtr, *varValuePtr; for (i=0 ; i<statePtr->numLists ; i++) { diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 4eff6f5..261cc65 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -70,7 +70,7 @@ typedef struct { * NULL if no indexes supplied, and points to * singleIndex field when only one * supplied. */ - int indexc; /* Number of indexes in indexv array. */ + size_t indexc; /* Number of indexes in indexv array. */ int singleIndex; /* Static space for common index case. */ int unique; int numElements; @@ -2180,8 +2180,7 @@ Tcl_JoinObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - size_t length; - int listLen; + size_t length, listLen; Tcl_Obj *resObjPtr = NULL, *joinObjPtr, **elemPtrs; if ((objc < 2) || (objc > 3)) { @@ -2216,7 +2215,7 @@ Tcl_JoinObjCmd( if (length == 0) { resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0); } else { - int i; + size_t i; resObjPtr = Tcl_NewObj(); for (i = 0; i < listLen; i++) { @@ -2268,7 +2267,7 @@ Tcl_LassignObjCmd( { Tcl_Obj *listCopyPtr; Tcl_Obj **listObjv; /* The contents of the list. */ - int listObjc; /* The length of the list. */ + size_t listObjc; /* The length of the list. */ int code = TCL_OK; if (objc < 2) { @@ -2399,8 +2398,8 @@ Tcl_LinsertObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *listPtr; - size_t index; - int len, result; + size_t len, index; + int result; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "list index ?element ...?"); @@ -2422,7 +2421,7 @@ Tcl_LinsertObjCmd( if (result != TCL_OK) { return result; } - if (index + 1 > (size_t)len + 1) { + if (index + 1 > len + 1) { index = len; } @@ -2436,7 +2435,7 @@ Tcl_LinsertObjCmd( listPtr = TclListObjCopy(NULL, listPtr); } - if ((objc == 4) && (index == (size_t)len)) { + if ((objc == 4) && (index == len)) { /* * Special case: insert one element at the end of the list. */ @@ -2518,7 +2517,8 @@ Tcl_LlengthObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { - int listLen, result; + size_t listLen; + int result; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "list"); @@ -2564,7 +2564,8 @@ Tcl_LpopObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { - int listLen, result; + size_t listLen; + int result; Tcl_Obj *elemPtr, *stored; Tcl_Obj *listPtr, **elemPtrs; @@ -2665,8 +2666,8 @@ Tcl_LrangeObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { - int listLen, result; - size_t first, last; + int result; + size_t listLen, first, last; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "list first last"); @@ -2733,8 +2734,8 @@ Tcl_LremoveObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i, idxc, listLen, prevIdx, first, num; - size_t *idxv; + int i, idxc, prevIdx, first, num; + size_t *idxv, listLen; Tcl_Obj *listObj; /* @@ -2794,7 +2795,7 @@ Tcl_LremoveObjCmd( continue; } prevIdx = idx; - if (idx < 0 || idx >= listLen) { + if (idx < 0 || idx >= (int)listLen) { continue; } @@ -2962,8 +2963,8 @@ Tcl_LreplaceObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *listPtr; - size_t first, last; - int listLen, numToDelete, result; + size_t numToDelete, listLen, first, last; + int result; if (objc < 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2994,11 +2995,11 @@ Tcl_LreplaceObjCmd( if (first == TCL_INDEX_NONE) { first = 0; - } else if (first > (size_t)listLen) { + } else if (first > listLen) { first = listLen; } - if (last + 1 > (size_t)listLen) { + if (last + 1 > listLen) { last = listLen - 1; } if (first + 1 <= last + 1) { @@ -3063,7 +3064,7 @@ Tcl_LreverseObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { Tcl_Obj **elemv; - int elemc, i, j; + size_t elemc, i, j; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "list"); @@ -3142,8 +3143,8 @@ Tcl_LsearchObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { const char *bytes, *patternBytes; - int i, match, index, result=TCL_OK, listc, bisect; - size_t length = 0, elemLen, start, groupSize, groupOffset, lower, upper; + int match, index, result=TCL_OK, bisect; + size_t i, length = 0, listc, elemLen, start, groupSize, groupOffset, lower, upper; int allocatedIndexVector = 0; int dataType, isIncreasing; Tcl_WideInt patWide, objWide, wide; @@ -3202,7 +3203,7 @@ Tcl_LsearchObjCmd( return TCL_ERROR; } - for (i = 1; i < objc-2; i++) { + for (i = 1; i < (size_t)objc-2; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index) != TCL_OK) { result = TCL_ERROR; @@ -3271,7 +3272,7 @@ Tcl_LsearchObjCmd( Tcl_DecrRefCount(startPtr); startPtr = NULL; } - if (i > objc-4) { + if (i + 4 > (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing starting index", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); @@ -3294,7 +3295,7 @@ Tcl_LsearchObjCmd( Tcl_IncrRefCount(startPtr); break; case LSEARCH_STRIDE: /* -stride */ - if (i > objc-4) { + if (i + 4 > (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-stride\" option must be " "followed by stride length", -1)); @@ -3319,13 +3320,13 @@ Tcl_LsearchObjCmd( break; case LSEARCH_INDEX: { /* -index */ Tcl_Obj **indices; - int j; + size_t j; if (allocatedIndexVector) { TclStackFree(interp, sortInfo.indexv); allocatedIndexVector = 0; } - if (i > objc-4) { + if (i + 4 > (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-index\" option must be followed by list index", -1)); @@ -3382,7 +3383,7 @@ Tcl_LsearchObjCmd( } if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( - "\n (-index option item number %d)", j)); + "\n (-index option item number %" TCL_Z_MODIFIER "d)", j)); goto done; } sortInfo.indexv[j] = encoded; @@ -3693,7 +3694,7 @@ Tcl_LsearchObjCmd( if (allMatches) { listPtr = Tcl_NewListObj(0, NULL); } - for (i = start; i < listc; i += groupSize) { + for (i = start; i < (size_t)listc; i += groupSize) { match = 0; if (sortInfo.indexc != 0) { itemPtr = SelectObjFromSublist(listv[i+groupOffset], &sortInfo); @@ -3805,7 +3806,7 @@ Tcl_LsearchObjCmd( Tcl_ListObjAppendElement(interp, listPtr, itemPtr); } } else if (returnSubindices) { - int j; + size_t j; TclNewIndexObj(itemPtr, i+groupOffset); for (j=0 ; j<sortInfo.indexc ; j++) { @@ -3829,7 +3830,7 @@ Tcl_LsearchObjCmd( Tcl_SetObjResult(interp, listPtr); } else if (!inlineReturn) { if (returnSubindices) { - int j; + size_t j; TclNewIndexObj(itemPtr, index+groupOffset); for (j=0 ; j<sortInfo.indexc ; j++) { @@ -3986,13 +3987,13 @@ Tcl_LsortObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - int i, index, indices, length, nocase = 0, indexc; + int index, indices, nocase = 0, indexc; int sortMode = SORTMODE_ASCII; int group, allocatedIndexVector = 0; - size_t j, idx, groupSize, groupOffset; + size_t j, idx, groupSize, groupOffset, length; Tcl_WideInt wide; Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr; - size_t elmArrSize; + size_t i, elmArrSize; SortElement *elementArray = NULL, *elementPtr; SortInfo sortInfo; /* Information about this sort that needs to * be passed to the comparison function. */ @@ -4036,7 +4037,7 @@ Tcl_LsortObjCmd( groupSize = 1; groupOffset = 0; indexPtr = NULL; - for (i = 1; i < objc-1; i++) { + for (i = 1; i < (size_t)objc-1; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], switches, "option", 0, &index) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; @@ -4047,7 +4048,7 @@ Tcl_LsortObjCmd( sortInfo.sortMode = SORTMODE_ASCII; break; case LSORT_COMMAND: - if (i == objc-2) { + if (i + 2 == (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-command\" option must be followed " "by comparison command", -1)); @@ -4069,10 +4070,10 @@ Tcl_LsortObjCmd( sortInfo.isIncreasing = 1; break; case LSORT_INDEX: { - int sortindex; + size_t sortindex; Tcl_Obj **indexv; - if (i == objc-2) { + if (i + 2 == (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-index\" option must be followed by list index", -1)); @@ -4094,7 +4095,7 @@ Tcl_LsortObjCmd( * options is done. */ - for (j=0 ; j<(size_t)sortindex ; j++) { + for (j=0 ; j<sortindex ; j++) { int encoded = 0; int result = TclIndexEncode(interp, indexv[j], TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded); @@ -4134,7 +4135,7 @@ Tcl_LsortObjCmd( indices = 1; break; case LSORT_STRIDE: - if (i == objc-2) { + if (i + 2 == (size_t)objc) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-stride\" option must be " "followed by stride length", -1)); @@ -4328,7 +4329,7 @@ Tcl_LsortObjCmd( } if (!elementArray) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "no enough memory to proccess sort of %d items", length)); + "no enough memory to proccess sort of %" TCL_Z_MODIFIER "u items", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); sortInfo.resultCode = TCL_ERROR; goto done; @@ -4626,7 +4627,7 @@ SortCompare( order = ((a >= b) - (a <= b)); } else { Tcl_Obj **objv, *paramObjv[2]; - int objc; + size_t objc; Tcl_Obj *objPtr1, *objPtr2; if (infoPtr->resultCode != TCL_OK) { @@ -4844,7 +4845,7 @@ SelectObjFromSublist( SortInfo *infoPtr) /* Information passed from the top-level * "lsearch" or "lsort" command. */ { - int i; + size_t i; /* * Quick check for case when no "-index" option is there. @@ -4860,7 +4861,8 @@ SelectObjFromSublist( */ for (i=0 ; i<infoPtr->indexc ; i++) { - int listLen, index; + size_t listLen; + int index; Tcl_Obj *currentObj; if (TclListObjLength(infoPtr->interp, objPtr, &listLen) != TCL_OK) { diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 85174ec..736aadb 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,8 +487,8 @@ Tcl_RegsubObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int result, cflags, all, match, command, numParts; - size_t idx, wlen, wsublen = 0, offset, numMatches; + int result, cflags, all, match, command; + size_t idx, wlen, wsublen = 0, offset, numMatches, numParts; size_t start, end, subStart, subEnd; Tcl_RegExp regExpr; Tcl_RegExpInfo info; @@ -775,7 +775,7 @@ Tcl_RegsubObjCmd( if (command) { Tcl_Obj **args = NULL, **parts; - int numArgs; + size_t numArgs; TclListObjGetElements(interp, subPtr, &numParts, &parts); numArgs = numParts + info.nsubs + 1; @@ -1525,9 +1525,8 @@ StringIsCmd( { const char *string1, *end, *stop; int (*chcomp)(int) = NULL; /* The UniChar comparison function. */ - int i, result = 1, strict = 0, index, length3; - size_t failat = 0; - size_t length1, length2; + int i, result = 1, strict = 0, index; + size_t failat = 0, length1, length2, length3; Tcl_Obj *objPtr, *failVarObj = NULL; Tcl_WideInt w; @@ -1631,7 +1630,8 @@ StringIsCmd( chcomp = Tcl_UniCharIsControl; break; case STR_IS_DICT: { - int dresult, dsize; + int dresult; + size_t dsize; dresult = Tcl_DictObjSize(interp, objPtr, &dsize); Tcl_ResetResult(interp); @@ -1994,7 +1994,8 @@ StringMapCmd( if (!TclHasStringRep(objv[objc-2]) && TclHasInternalRep(objv[objc-2], &tclDictType)) { - int i, done; + size_t i; + int done; Tcl_DictSearch search; /* @@ -2028,7 +2029,7 @@ StringMapCmd( } Tcl_DictObjDone(&search); } else { - int i; + size_t i; if (TclListObjGetElements(interp, objv[objc-2], &i, &mapElemv) != TCL_OK) { return TCL_ERROR; @@ -3576,9 +3577,10 @@ TclNRSwitchObjCmd( splitObjs = 0; if (objc == 1) { Tcl_Obj **listv; + size_t listc; blist = objv[0]; - if (TclListObjGetElements(interp, objv[0], &objc, &listv) != TCL_OK) { + if (TclListObjGetElements(interp, objv[0], &listc, &listv) != TCL_OK) { return TCL_ERROR; } @@ -3586,11 +3588,12 @@ TclNRSwitchObjCmd( * Ensure that the list is non-empty. */ - if (objc < 1) { + if (listc < 1 || listc > INT_MAX) { Tcl_WrongNumArgs(interp, 1, savedObjv, "?-option ...? string {?pattern body ...? ?default body?}"); return TCL_ERROR; } + objc = listc; objv = listv; splitObjs = 1; } @@ -3952,7 +3955,7 @@ Tcl_ThrowObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *options; - int len; + size_t len; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "type message"); @@ -4668,7 +4671,8 @@ TclNRTryObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *bodyObj, *handlersObj, *finallyObj = NULL; - int i, bodyShared, haveHandlers, dummy, code; + int i, bodyShared, haveHandlers, code; + size_t dummy; static const char *const handlerNames[] = { "finally", "on", "trap", NULL }; @@ -4865,8 +4869,8 @@ TryPostBody( int result) { Tcl_Obj *resultObj, *options, *handlersObj, *finallyObj, *cmdObj, **objv; - int i, code, objc; - int numHandlers = 0; + int code, objc; + size_t i, numHandlers = 0; handlersObj = (Tcl_Obj *)data[0]; finallyObj = (Tcl_Obj *)data[1]; @@ -4916,7 +4920,7 @@ TryPostBody( TclListObjGetElements(NULL, handlersObj, &numHandlers, &handlers); for (i=0 ; i<numHandlers ; i++) { Tcl_Obj *handlerBodyObj; - int numElems = 0; + size_t numElems = 0; TclListObjGetElements(NULL, handlers[i], &numElems, &info); if (!found) { @@ -4934,7 +4938,7 @@ TryPostBody( if (code == TCL_ERROR) { Tcl_Obj *errorCodeName, *errcode, **bits1, **bits2; - int len1, len2, j; + size_t len1, len2, j; TclNewLiteralStringObj(errorCodeName, "-errorcode"); Tcl_DictObjGet(NULL, options, errorCodeName, &errcode); diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 82d09ac..a9024b3 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -286,7 +286,8 @@ TclCompileArraySetCmd( DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr, *dataTokenPtr; int isScalar, localIndex, code = TCL_OK; - int isDataLiteral, isDataValid, isDataEven, len; + int isDataLiteral, isDataValid, isDataEven; + size_t len; int keyVar, valVar, infoIndex; int fwd, offsetBack, offsetFwd; Tcl_Obj *literalObj; @@ -890,8 +891,7 @@ TclCompileConcatCmd( if (listObj != NULL) { Tcl_Obj **objs; const char *bytes; - int len; - size_t slen; + size_t len, slen; TclListObjGetElements(NULL, listObj, &len, &objs); objPtr = Tcl_ConcatObj(len, objs); @@ -1528,7 +1528,8 @@ CompileDictEachCmd( Tcl_Token *varsTokenPtr, *dictTokenPtr, *bodyTokenPtr; int keyVarIndex, valueVarIndex, nameChars, loopRange, catchRange; int infoIndex, jumpDisplacement, bodyTargetOffset, emptyTargetOffset; - int numVars, endTargetOffset; + size_t numVars; + int endTargetOffset; int collectVar = -1; /* Index of temp var holding the result * dict. */ const char **argv; @@ -2688,7 +2689,8 @@ CompileEachloopCmd( Tcl_Token *tokenPtr, *bodyTokenPtr; int jumpBackOffset, infoIndex, range; - int numWords, numLists, i, j, code = TCL_OK; + int numWords, numLists, i, code = TCL_OK; + size_t j; Tcl_Obj *varListObj = NULL; /* @@ -2740,7 +2742,7 @@ CompileEachloopCmd( i < numWords-1; i++, tokenPtr = TokenAfter(tokenPtr)) { ForeachVarList *varListPtr; - int numVars; + size_t numVars; if (i%2 != 1) { continue; diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index ecd087e..bb1c21b 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -2399,7 +2399,8 @@ TclCompileReturnCmd( * General syntax: [return ?-option value ...? ?result?] * An even number of words means an explicit result argument is present. */ - int level, code, objc, size, status = TCL_OK; + int level, code, objc, status = TCL_OK; + size_t size; int numWords = parsePtr->numWords; int explicitResult = (0 == (numWords % 2)); int numOptionWords = numWords - 1 - explicitResult; diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index dc07e49..08508f0 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -917,8 +917,7 @@ TclCompileStringMapCmd( Tcl_Token *mapTokenPtr, *stringTokenPtr; Tcl_Obj *mapObj, **objv; const char *bytes; - int len; - size_t slen; + size_t len, slen; /* * We only handle the case: @@ -2711,7 +2710,8 @@ TclCompileThrowCmd( int numWords = parsePtr->numWords; Tcl_Token *codeToken, *msgToken; Tcl_Obj *objPtr; - int codeKnown, codeIsList, codeIsValid, len; + int codeKnown, codeIsList, codeIsValid; + size_t len; if (numWords != 3) { return TCL_ERROR; @@ -2852,7 +2852,7 @@ TclCompileTryCmd( for (i=0 ; i<numHandlers ; i++) { Tcl_Obj *tmpObj, **objv; - int objc; + size_t objc; if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { goto failedToCompile; @@ -3047,8 +3047,8 @@ IssueTryClausesInstructions( { DefineLineInformation; /* TIP #280 */ int range, resultVar, optionsVar; - int i, j, len, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0; - size_t slen; + int i, j, forwardsNeedFixing = 0, trapZero = 0, afterBody = 0; + size_t slen, len; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; int *noError; char buf[TCL_INTEGER_SPACE]; @@ -3258,11 +3258,11 @@ IssueTryClausesFinallyInstructions( Tcl_Token *finallyToken) /* Not NULL */ { DefineLineInformation; /* TIP #280 */ - int range, resultVar, optionsVar, i, j, len, forwardsNeedFixing = 0; + int range, resultVar, optionsVar, i, j, forwardsNeedFixing = 0; int trapZero = 0, afterBody = 0, finalOK, finalError, noFinalError; int *addrsToFix, *forwardsToFix, notCodeJumpSource, notECJumpSource; char buf[TCL_INTEGER_SPACE]; - size_t slen; + size_t slen, len; resultVar = AnonymousLocal(envPtr); optionsVar = AnonymousLocal(envPtr); diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index d58dd24..937e71e 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2218,7 +2218,7 @@ TclCompileExpr( * Valid parse; compile the tree. */ - int objc; + size_t objc; Tcl_Obj *const *litObjv; Tcl_Obj **funcObjv; diff --git a/generic/tclConfig.c b/generic/tclConfig.c index 09b1b27..08d5f1b 100644 --- a/generic/tclConfig.c +++ b/generic/tclConfig.c @@ -199,8 +199,8 @@ QueryConfigObjCmd( QCCD *cdPtr = (QCCD *)clientData; Tcl_Obj *pkgName = cdPtr->pkg; Tcl_Obj *pDB, *pkgDict, *val, *listPtr; - size_t n = 0; - int index, m; + size_t m, n = 0; + int index; static const char *const subcmdStrings[] = { "get", "list", NULL }; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c5b6bd7..d899962 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -92,7 +92,7 @@ EXTERN void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...); EXTERN void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, size_t length); /* 17 */ -EXTERN Tcl_Obj * Tcl_ConcatObj(int objc, Tcl_Obj *const objv[]); +EXTERN Tcl_Obj * Tcl_ConcatObj(size_t objc, Tcl_Obj *const objv[]); /* 18 */ EXTERN int Tcl_ConvertToType(Tcl_Interp *interp, Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); @@ -113,7 +113,7 @@ EXTERN Tcl_Obj * Tcl_DbNewByteArrayObj(const unsigned char *bytes, EXTERN Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue, const char *file, int line); /* 25 */ -EXTERN Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv, +EXTERN Tcl_Obj * Tcl_DbNewListObj(size_t objc, Tcl_Obj *const *objv, const char *file, int line); /* Slot 26 is reserved */ /* 27 */ @@ -163,20 +163,20 @@ EXTERN int Tcl_ListObjAppendList(Tcl_Interp *interp, EXTERN int Tcl_ListObjAppendElement(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 45 */ -EXTERN int Tcl_ListObjGetElements(Tcl_Interp *interp, +EXTERN int TclListObjGetElements_(Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 46 */ EXTERN int Tcl_ListObjIndex(Tcl_Interp *interp, - Tcl_Obj *listPtr, int index, + Tcl_Obj *listPtr, size_t index, Tcl_Obj **objPtrPtr); /* 47 */ -EXTERN int Tcl_ListObjLength(Tcl_Interp *interp, +EXTERN int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 48 */ EXTERN int Tcl_ListObjReplace(Tcl_Interp *interp, - Tcl_Obj *listPtr, int first, int count, - int objc, Tcl_Obj *const objv[]); + Tcl_Obj *listPtr, size_t first, size_t count, + size_t objc, Tcl_Obj *const objv[]); /* Slot 49 is reserved */ /* 50 */ EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes, @@ -185,7 +185,7 @@ EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes, EXTERN Tcl_Obj * Tcl_NewDoubleObj(double doubleValue); /* Slot 52 is reserved */ /* 53 */ -EXTERN Tcl_Obj * Tcl_NewListObj(int objc, Tcl_Obj *const objv[]); +EXTERN Tcl_Obj * Tcl_NewListObj(size_t objc, Tcl_Obj *const objv[]); /* Slot 54 is reserved */ /* 55 */ EXTERN Tcl_Obj * Tcl_NewObj(void); @@ -202,7 +202,7 @@ EXTERN void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, EXTERN void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue); /* Slot 61 is reserved */ /* 62 */ -EXTERN void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, +EXTERN void Tcl_SetListObj(Tcl_Obj *objPtr, size_t objc, Tcl_Obj *const objv[]); /* Slot 63 is reserved */ /* 64 */ @@ -246,7 +246,7 @@ EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, /* 82 */ EXTERN int Tcl_CommandComplete(const char *cmd); /* 83 */ -EXTERN char * Tcl_Concat(int argc, const char *const *argv); +EXTERN char * Tcl_Concat(size_t argc, const char *const *argv); /* 84 */ EXTERN size_t Tcl_ConvertElement(const char *src, char *dst, int flags); @@ -256,12 +256,12 @@ EXTERN size_t Tcl_ConvertCountedElement(const char *src, /* 86 */ EXTERN int Tcl_CreateAlias(Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, - const char *targetCmd, int argc, + const char *targetCmd, size_t argc, const char *const *argv); /* 87 */ EXTERN int Tcl_CreateAliasObj(Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, - const char *targetCmd, int objc, + const char *targetCmd, size_t objc, Tcl_Obj *const objv[]); /* 88 */ EXTERN Tcl_Channel Tcl_CreateChannel(const Tcl_ChannelType *typePtr, @@ -517,7 +517,7 @@ EXTERN int Tcl_InterpDeleted(Tcl_Interp *interp); /* 185 */ EXTERN int Tcl_IsSafe(Tcl_Interp *interp); /* 186 */ -EXTERN char * Tcl_JoinPath(int argc, const char *const *argv, +EXTERN char * Tcl_JoinPath(size_t argc, const char *const *argv, Tcl_DString *resultPtr); /* 187 */ EXTERN int Tcl_LinkVar(Tcl_Interp *interp, const char *varName, @@ -530,7 +530,7 @@ EXTERN int Tcl_MakeSafe(Tcl_Interp *interp); /* 191 */ EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(void *tcpSocket); /* 192 */ -EXTERN char * Tcl_Merge(int argc, const char *const *argv); +EXTERN char * Tcl_Merge(size_t argc, const char *const *argv); /* 193 */ EXTERN Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr); /* 194 */ @@ -543,8 +543,8 @@ EXTERN Tcl_Obj * Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags); /* 197 */ -EXTERN Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, - const char **argv, int flags); +EXTERN Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, + size_t argc, const char **argv, int flags); /* 198 */ EXTERN Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, const char *fileName, const char *modeString, @@ -658,11 +658,11 @@ EXTERN const char * Tcl_SignalMsg(int sig); /* 241 */ EXTERN void Tcl_SourceRCFile(Tcl_Interp *interp); /* 242 */ -EXTERN int Tcl_SplitList(Tcl_Interp *interp, +EXTERN int TclSplitList_(Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 243 */ -EXTERN void Tcl_SplitPath(const char *path, int *argcPtr, +EXTERN void TclSplitPath_(const char *path, int *argcPtr, const char ***argvPtr); /* Slot 244 is reserved */ /* Slot 245 is reserved */ @@ -714,7 +714,7 @@ EXTERN void * Tcl_VarTraceInfo2(Tcl_Interp *interp, EXTERN size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen); /* 264 */ -EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, +EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], const char *message); /* 265 */ EXTERN int Tcl_DumpActiveMemory(const char *fileName); @@ -773,7 +773,7 @@ EXTERN void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, EXTERN int Tcl_EvalEx(Tcl_Interp *interp, const char *script, size_t numBytes, int flags); /* 292 */ -EXTERN int Tcl_EvalObjv(Tcl_Interp *interp, int objc, +EXTERN int Tcl_EvalObjv(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags); /* 293 */ EXTERN int Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, @@ -1196,9 +1196,9 @@ EXTERN int Tcl_FSChdir(Tcl_Obj *pathPtr); EXTERN int Tcl_FSConvertToPathType(Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 460 */ -EXTERN Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, int elements); +EXTERN Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, size_t elements); /* 461 */ -EXTERN Tcl_Obj * Tcl_FSSplitPath(Tcl_Obj *pathPtr, int *lenPtr); +EXTERN Tcl_Obj * TclFSSplitPath_(Tcl_Obj *pathPtr, int *lenPtr); /* 462 */ EXTERN int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); @@ -1206,7 +1206,7 @@ EXTERN int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, EXTERN Tcl_Obj * Tcl_FSGetNormalizedPath(Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 464 */ -EXTERN Tcl_Obj * Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc, +EXTERN Tcl_Obj * Tcl_FSJoinToPath(Tcl_Obj *pathPtr, size_t objc, Tcl_Obj *const objv[]); /* 465 */ EXTERN void * Tcl_FSGetInternalRep(Tcl_Obj *pathPtr, @@ -1293,7 +1293,7 @@ EXTERN int Tcl_DictObjGet(Tcl_Interp *interp, Tcl_Obj *dictPtr, EXTERN int Tcl_DictObjRemove(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 497 */ -EXTERN int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, +EXTERN int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr); /* 498 */ EXTERN int Tcl_DictObjFirst(Tcl_Interp *interp, @@ -1308,11 +1308,11 @@ EXTERN void Tcl_DictObjNext(Tcl_DictSearch *searchPtr, EXTERN void Tcl_DictObjDone(Tcl_DictSearch *searchPtr); /* 501 */ EXTERN int Tcl_DictObjPutKeyList(Tcl_Interp *interp, - Tcl_Obj *dictPtr, int keyc, + Tcl_Obj *dictPtr, size_t keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr); /* 502 */ EXTERN int Tcl_DictObjRemoveKeyList(Tcl_Interp *interp, - Tcl_Obj *dictPtr, int keyc, + Tcl_Obj *dictPtr, size_t keyc, Tcl_Obj *const *keyv); /* 503 */ EXTERN Tcl_Obj * Tcl_NewDictObj(void); @@ -1511,7 +1511,7 @@ EXTERN const char * Tcl_GetEncodingNameFromEnvironment( Tcl_DString *bufPtr); /* 573 */ EXTERN int Tcl_PkgRequireProc(Tcl_Interp *interp, - const char *name, int objc, + const char *name, size_t objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 574 */ EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, @@ -1522,11 +1522,11 @@ EXTERN void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, size_t limit, const char *ellipsis); /* 576 */ EXTERN Tcl_Obj * Tcl_Format(Tcl_Interp *interp, const char *format, - int objc, Tcl_Obj *const objv[]); + size_t objc, Tcl_Obj *const objv[]); /* 577 */ EXTERN int Tcl_AppendFormatToObj(Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, - int objc, Tcl_Obj *const objv[]); + size_t objc, Tcl_Obj *const objv[]); /* 578 */ EXTERN Tcl_Obj * Tcl_ObjPrintf(const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 579 */ @@ -1551,11 +1551,12 @@ EXTERN Tcl_Command Tcl_NRCreateCommand(Tcl_Interp *interp, EXTERN int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 585 */ -EXTERN int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, +EXTERN int Tcl_NREvalObjv(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags); /* 586 */ EXTERN int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, - int objc, Tcl_Obj *const objv[], int flags); + size_t objc, Tcl_Obj *const objv[], + int flags); /* 587 */ EXTERN void Tcl_NRAddCallback(Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr, void *data0, @@ -1563,7 +1564,7 @@ EXTERN void Tcl_NRAddCallback(Tcl_Interp *interp, /* 588 */ EXTERN int Tcl_NRCallObjProc(Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, void *clientData, - int objc, Tcl_Obj *const objv[]); + size_t objc, Tcl_Obj *const objv[]); /* 589 */ EXTERN unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr); /* 590 */ @@ -1598,7 +1599,7 @@ EXTERN int Tcl_SetEnsembleParameterList(Tcl_Interp *interp, EXTERN int Tcl_GetEnsembleParameterList(Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 604 */ -EXTERN int Tcl_ParseArgsObjv(Tcl_Interp *interp, +EXTERN int TclParseArgsObjv_(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 605 */ @@ -1757,6 +1758,30 @@ EXTERN int Tcl_UniCharIsUnicode(int ch); /* 660 */ EXTERN int Tcl_AsyncMarkFromSignal(Tcl_AsyncHandler async, int sigNumber); +/* 661 */ +EXTERN int Tcl_ListObjGetElements(Tcl_Interp *interp, + Tcl_Obj *listPtr, size_t *objcPtr, + Tcl_Obj ***objvPtr); +/* 662 */ +EXTERN int Tcl_ListObjLength(Tcl_Interp *interp, + Tcl_Obj *listPtr, size_t *lengthPtr); +/* 663 */ +EXTERN int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, + size_t *sizePtr); +/* 664 */ +EXTERN int Tcl_SplitList(Tcl_Interp *interp, + const char *listStr, size_t *argcPtr, + const char ***argvPtr); +/* 665 */ +EXTERN void Tcl_SplitPath(const char *path, size_t *argcPtr, + const char ***argvPtr); +/* 666 */ +EXTERN Tcl_Obj * Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr); +/* 667 */ +EXTERN int Tcl_ParseArgsObjv(Tcl_Interp *interp, + const Tcl_ArgvInfo *argTable, + size_t *objcPtr, Tcl_Obj *const *objv, + Tcl_Obj ***remObjv); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -1785,7 +1810,7 @@ typedef struct TclStubs { int (*tcl_AppendAllObjTypes) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 14 */ void (*tcl_AppendStringsToObj) (Tcl_Obj *objPtr, ...); /* 15 */ void (*tcl_AppendToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length); /* 16 */ - Tcl_Obj * (*tcl_ConcatObj) (int objc, Tcl_Obj *const objv[]); /* 17 */ + Tcl_Obj * (*tcl_ConcatObj) (size_t objc, Tcl_Obj *const objv[]); /* 17 */ int (*tcl_ConvertToType) (Tcl_Interp *interp, Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 18 */ void (*tcl_DbDecrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 19 */ void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */ @@ -1793,7 +1818,7 @@ typedef struct TclStubs { void (*reserved22)(void); Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, size_t numBytes, const char *file, int line); /* 23 */ Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */ - Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */ + Tcl_Obj * (*tcl_DbNewListObj) (size_t objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */ void (*reserved26)(void); Tcl_Obj * (*tcl_DbNewObj) (const char *file, int line); /* 27 */ Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, size_t length, const char *file, int line); /* 28 */ @@ -1813,15 +1838,15 @@ typedef struct TclStubs { void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */ int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */ int (*tcl_ListObjAppendElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 44 */ - int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 45 */ - int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj **objPtrPtr); /* 46 */ - int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */ - int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */ + int (*tclListObjGetElements_) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 45 */ + int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t index, Tcl_Obj **objPtrPtr); /* 46 */ + int (*tclListObjLength_) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */ + int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t first, size_t count, size_t objc, Tcl_Obj *const objv[]); /* 48 */ void (*reserved49)(void); Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, size_t numBytes); /* 50 */ Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */ void (*reserved52)(void); - Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */ + Tcl_Obj * (*tcl_NewListObj) (size_t objc, Tcl_Obj *const objv[]); /* 53 */ void (*reserved54)(void); Tcl_Obj * (*tcl_NewObj) (void); /* 55 */ Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, size_t length); /* 56 */ @@ -1830,7 +1855,7 @@ typedef struct TclStubs { void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, size_t numBytes); /* 59 */ void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */ void (*reserved61)(void); - void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */ + void (*tcl_SetListObj) (Tcl_Obj *objPtr, size_t objc, Tcl_Obj *const objv[]); /* 62 */ void (*reserved63)(void); void (*tcl_SetObjLength) (Tcl_Obj *objPtr, size_t length); /* 64 */ void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, size_t length); /* 65 */ @@ -1851,11 +1876,11 @@ typedef struct TclStubs { void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, void *clientData); /* 80 */ void (*reserved81)(void); int (*tcl_CommandComplete) (const char *cmd); /* 82 */ - char * (*tcl_Concat) (int argc, const char *const *argv); /* 83 */ + char * (*tcl_Concat) (size_t argc, const char *const *argv); /* 83 */ size_t (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */ size_t (*tcl_ConvertCountedElement) (const char *src, size_t length, char *dst, int flags); /* 85 */ - int (*tcl_CreateAlias) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, int argc, const char *const *argv); /* 86 */ - int (*tcl_CreateAliasObj) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */ + int (*tcl_CreateAlias) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, size_t argc, const char *const *argv); /* 86 */ + int (*tcl_CreateAliasObj) (Tcl_Interp *childInterp, const char *childCmd, Tcl_Interp *target, const char *targetCmd, size_t objc, Tcl_Obj *const objv[]); /* 87 */ Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, void *instanceData, int mask); /* 88 */ void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, void *clientData); /* 89 */ void (*tcl_CreateCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, void *clientData); /* 90 */ @@ -1954,18 +1979,18 @@ typedef struct TclStubs { int (*tcl_InputBuffered) (Tcl_Channel chan); /* 183 */ int (*tcl_InterpDeleted) (Tcl_Interp *interp); /* 184 */ int (*tcl_IsSafe) (Tcl_Interp *interp); /* 185 */ - char * (*tcl_JoinPath) (int argc, const char *const *argv, Tcl_DString *resultPtr); /* 186 */ + char * (*tcl_JoinPath) (size_t argc, const char *const *argv, Tcl_DString *resultPtr); /* 186 */ int (*tcl_LinkVar) (Tcl_Interp *interp, const char *varName, void *addr, int type); /* 187 */ void (*reserved188)(void); Tcl_Channel (*tcl_MakeFileChannel) (void *handle, int mode); /* 189 */ int (*tcl_MakeSafe) (Tcl_Interp *interp); /* 190 */ Tcl_Channel (*tcl_MakeTcpClientChannel) (void *tcpSocket); /* 191 */ - char * (*tcl_Merge) (int argc, const char *const *argv); /* 192 */ + char * (*tcl_Merge) (size_t argc, const char *const *argv); /* 192 */ Tcl_HashEntry * (*tcl_NextHashEntry) (Tcl_HashSearch *searchPtr); /* 193 */ void (*tcl_NotifyChannel) (Tcl_Channel channel, int mask); /* 194 */ Tcl_Obj * (*tcl_ObjGetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags); /* 195 */ Tcl_Obj * (*tcl_ObjSetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags); /* 196 */ - Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, int argc, const char **argv, int flags); /* 197 */ + Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, size_t argc, const char **argv, int flags); /* 197 */ Tcl_Channel (*tcl_OpenFileChannel) (Tcl_Interp *interp, const char *fileName, const char *modeString, int permissions); /* 198 */ Tcl_Channel (*tcl_OpenTcpClient) (Tcl_Interp *interp, int port, const char *address, const char *myaddr, int myport, int async); /* 199 */ Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, void *callbackData); /* 200 */ @@ -2010,8 +2035,8 @@ typedef struct TclStubs { const char * (*tcl_SignalId) (int sig); /* 239 */ const char * (*tcl_SignalMsg) (int sig); /* 240 */ void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */ - int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */ - void (*tcl_SplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */ + int (*tclSplitList_) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */ + void (*tclSplitPath_) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */ void (*reserved244)(void); void (*reserved245)(void); void (*reserved246)(void); @@ -2032,7 +2057,7 @@ typedef struct TclStubs { void (*reserved261)(void); void * (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, void *prevClientData); /* 262 */ size_t (*tcl_Write) (Tcl_Channel chan, const char *s, size_t slen); /* 263 */ - void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */ + void (*tcl_WrongNumArgs) (Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], const char *message); /* 264 */ int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */ void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */ void (*reserved267)(void); @@ -2060,7 +2085,7 @@ typedef struct TclStubs { void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 289 */ void (*reserved290)(void); int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, size_t numBytes, int flags); /* 291 */ - int (*tcl_EvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 292 */ + int (*tcl_EvalObjv) (Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags); /* 292 */ int (*tcl_EvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 293 */ TCL_NORETURN1 void (*tcl_ExitThread) (int status); /* 294 */ int (*tcl_ExternalToUtf) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, size_t srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, size_t dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 295 */ @@ -2228,11 +2253,11 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_FSGetCwd) (Tcl_Interp *interp); /* 457 */ int (*tcl_FSChdir) (Tcl_Obj *pathPtr); /* 458 */ int (*tcl_FSConvertToPathType) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 459 */ - Tcl_Obj * (*tcl_FSJoinPath) (Tcl_Obj *listObj, int elements); /* 460 */ - Tcl_Obj * (*tcl_FSSplitPath) (Tcl_Obj *pathPtr, int *lenPtr); /* 461 */ + Tcl_Obj * (*tcl_FSJoinPath) (Tcl_Obj *listObj, size_t elements); /* 460 */ + Tcl_Obj * (*tclFSSplitPath_) (Tcl_Obj *pathPtr, int *lenPtr); /* 461 */ int (*tcl_FSEqualPaths) (Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); /* 462 */ Tcl_Obj * (*tcl_FSGetNormalizedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 463 */ - Tcl_Obj * (*tcl_FSJoinToPath) (Tcl_Obj *pathPtr, int objc, Tcl_Obj *const objv[]); /* 464 */ + Tcl_Obj * (*tcl_FSJoinToPath) (Tcl_Obj *pathPtr, size_t objc, Tcl_Obj *const objv[]); /* 464 */ void * (*tcl_FSGetInternalRep) (Tcl_Obj *pathPtr, const Tcl_Filesystem *fsPtr); /* 465 */ Tcl_Obj * (*tcl_FSGetTranslatedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 466 */ int (*tcl_FSEvalFile) (Tcl_Interp *interp, Tcl_Obj *fileName); /* 467 */ @@ -2265,12 +2290,12 @@ typedef struct TclStubs { int (*tcl_DictObjPut) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); /* 494 */ int (*tcl_DictObjGet) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 495 */ int (*tcl_DictObjRemove) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 496 */ - int (*tcl_DictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr); /* 497 */ + int (*tclDictObjSize_) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr); /* 497 */ int (*tcl_DictObjFirst) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 498 */ void (*tcl_DictObjNext) (Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 499 */ void (*tcl_DictObjDone) (Tcl_DictSearch *searchPtr); /* 500 */ - int (*tcl_DictObjPutKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr); /* 501 */ - int (*tcl_DictObjRemoveKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int keyc, Tcl_Obj *const *keyv); /* 502 */ + int (*tcl_DictObjPutKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr); /* 501 */ + int (*tcl_DictObjRemoveKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t keyc, Tcl_Obj *const *keyv); /* 502 */ Tcl_Obj * (*tcl_NewDictObj) (void); /* 503 */ Tcl_Obj * (*tcl_DbNewDictObj) (const char *file, int line); /* 504 */ void (*tcl_RegisterConfig) (Tcl_Interp *interp, const char *pkgName, const Tcl_Config *configuration, const char *valEncoding); /* 505 */ @@ -2341,11 +2366,11 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_GetEncodingSearchPath) (void); /* 570 */ int (*tcl_SetEncodingSearchPath) (Tcl_Obj *searchPath); /* 571 */ const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */ - int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */ + int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, size_t objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */ void (*tcl_AppendObjToErrorInfo) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 574 */ void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, size_t length, size_t limit, const char *ellipsis); /* 575 */ - Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, int objc, Tcl_Obj *const objv[]); /* 576 */ - int (*tcl_AppendFormatToObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, int objc, Tcl_Obj *const objv[]); /* 577 */ + Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, size_t objc, Tcl_Obj *const objv[]); /* 576 */ + int (*tcl_AppendFormatToObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, size_t objc, Tcl_Obj *const objv[]); /* 577 */ Tcl_Obj * (*tcl_ObjPrintf) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 578 */ void (*tcl_AppendPrintfToObj) (Tcl_Obj *objPtr, const char *format, ...) TCL_FORMAT_PRINTF(2, 3); /* 579 */ int (*tcl_CancelEval) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr, void *clientData, int flags); /* 580 */ @@ -2353,10 +2378,10 @@ typedef struct TclStubs { int (*tcl_CreatePipe) (Tcl_Interp *interp, Tcl_Channel *rchan, Tcl_Channel *wchan, int flags); /* 582 */ Tcl_Command (*tcl_NRCreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc, void *clientData, Tcl_CmdDeleteProc *deleteProc); /* 583 */ int (*tcl_NREvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 584 */ - int (*tcl_NREvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 585 */ - int (*tcl_NRCmdSwap) (Tcl_Interp *interp, Tcl_Command cmd, int objc, Tcl_Obj *const objv[], int flags); /* 586 */ + int (*tcl_NREvalObjv) (Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[], int flags); /* 585 */ + int (*tcl_NRCmdSwap) (Tcl_Interp *interp, Tcl_Command cmd, size_t objc, Tcl_Obj *const objv[], int flags); /* 586 */ void (*tcl_NRAddCallback) (Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr, void *data0, void *data1, void *data2, void *data3); /* 587 */ - int (*tcl_NRCallObjProc) (Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, void *clientData, int objc, Tcl_Obj *const objv[]); /* 588 */ + int (*tcl_NRCallObjProc) (Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, void *clientData, size_t objc, Tcl_Obj *const objv[]); /* 588 */ unsigned (*tcl_GetFSDeviceFromStat) (const Tcl_StatBuf *statPtr); /* 589 */ unsigned (*tcl_GetFSInodeFromStat) (const Tcl_StatBuf *statPtr); /* 590 */ unsigned (*tcl_GetModeFromStat) (const Tcl_StatBuf *statPtr); /* 591 */ @@ -2372,7 +2397,7 @@ typedef struct TclStubs { unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf *statPtr); /* 601 */ int (*tcl_SetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 602 */ int (*tcl_GetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 603 */ - int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */ + int (*tclParseArgsObjv_) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */ int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */ void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */ void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int code, Tcl_Interp *targetInterp); /* 607 */ @@ -2429,6 +2454,13 @@ typedef struct TclStubs { void (*reserved658)(void); void (*reserved659)(void); int (*tcl_AsyncMarkFromSignal) (Tcl_AsyncHandler async, int sigNumber); /* 660 */ + int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *objcPtr, Tcl_Obj ***objvPtr); /* 661 */ + int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t *lengthPtr); /* 662 */ + int (*tcl_DictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, size_t *sizePtr); /* 663 */ + int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, size_t *argcPtr, const char ***argvPtr); /* 664 */ + void (*tcl_SplitPath) (const char *path, size_t *argcPtr, const char ***argvPtr); /* 665 */ + Tcl_Obj * (*tcl_FSSplitPath) (Tcl_Obj *pathPtr, size_t *lenPtr); /* 666 */ + int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, size_t *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 667 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -2530,12 +2562,12 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_ListObjAppendList) /* 43 */ #define Tcl_ListObjAppendElement \ (tclStubsPtr->tcl_ListObjAppendElement) /* 44 */ -#define Tcl_ListObjGetElements \ - (tclStubsPtr->tcl_ListObjGetElements) /* 45 */ +#define TclListObjGetElements_ \ + (tclStubsPtr->tclListObjGetElements_) /* 45 */ #define Tcl_ListObjIndex \ (tclStubsPtr->tcl_ListObjIndex) /* 46 */ -#define Tcl_ListObjLength \ - (tclStubsPtr->tcl_ListObjLength) /* 47 */ +#define TclListObjLength_ \ + (tclStubsPtr->tclListObjLength_) /* 47 */ #define Tcl_ListObjReplace \ (tclStubsPtr->tcl_ListObjReplace) /* 48 */ /* Slot 49 is reserved */ @@ -2899,10 +2931,10 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_SignalMsg) /* 240 */ #define Tcl_SourceRCFile \ (tclStubsPtr->tcl_SourceRCFile) /* 241 */ -#define Tcl_SplitList \ - (tclStubsPtr->tcl_SplitList) /* 242 */ -#define Tcl_SplitPath \ - (tclStubsPtr->tcl_SplitPath) /* 243 */ +#define TclSplitList_ \ + (tclStubsPtr->tclSplitList_) /* 242 */ +#define TclSplitPath_ \ + (tclStubsPtr->tclSplitPath_) /* 243 */ /* Slot 244 is reserved */ /* Slot 245 is reserved */ /* Slot 246 is reserved */ @@ -3302,8 +3334,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_FSConvertToPathType) /* 459 */ #define Tcl_FSJoinPath \ (tclStubsPtr->tcl_FSJoinPath) /* 460 */ -#define Tcl_FSSplitPath \ - (tclStubsPtr->tcl_FSSplitPath) /* 461 */ +#define TclFSSplitPath_ \ + (tclStubsPtr->tclFSSplitPath_) /* 461 */ #define Tcl_FSEqualPaths \ (tclStubsPtr->tcl_FSEqualPaths) /* 462 */ #define Tcl_FSGetNormalizedPath \ @@ -3374,8 +3406,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_DictObjGet) /* 495 */ #define Tcl_DictObjRemove \ (tclStubsPtr->tcl_DictObjRemove) /* 496 */ -#define Tcl_DictObjSize \ - (tclStubsPtr->tcl_DictObjSize) /* 497 */ +#define TclDictObjSize_ \ + (tclStubsPtr->tclDictObjSize_) /* 497 */ #define Tcl_DictObjFirst \ (tclStubsPtr->tcl_DictObjFirst) /* 498 */ #define Tcl_DictObjNext \ @@ -3587,8 +3619,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_SetEnsembleParameterList) /* 602 */ #define Tcl_GetEnsembleParameterList \ (tclStubsPtr->tcl_GetEnsembleParameterList) /* 603 */ -#define Tcl_ParseArgsObjv \ - (tclStubsPtr->tcl_ParseArgsObjv) /* 604 */ +#define TclParseArgsObjv_ \ + (tclStubsPtr->tclParseArgsObjv_) /* 604 */ #define Tcl_GetErrorLine \ (tclStubsPtr->tcl_GetErrorLine) /* 605 */ #define Tcl_SetErrorLine \ @@ -3699,6 +3731,20 @@ extern const TclStubs *tclStubsPtr; /* Slot 659 is reserved */ #define Tcl_AsyncMarkFromSignal \ (tclStubsPtr->tcl_AsyncMarkFromSignal) /* 660 */ +#define Tcl_ListObjGetElements \ + (tclStubsPtr->tcl_ListObjGetElements) /* 661 */ +#define Tcl_ListObjLength \ + (tclStubsPtr->tcl_ListObjLength) /* 662 */ +#define Tcl_DictObjSize \ + (tclStubsPtr->tcl_DictObjSize) /* 663 */ +#define Tcl_SplitList \ + (tclStubsPtr->tcl_SplitList) /* 664 */ +#define Tcl_SplitPath \ + (tclStubsPtr->tcl_SplitPath) /* 665 */ +#define Tcl_FSSplitPath \ + (tclStubsPtr->tcl_FSSplitPath) /* 666 */ +#define Tcl_ParseArgsObjv \ + (tclStubsPtr->tcl_ParseArgsObjv) /* 667 */ #endif /* defined(USE_TCL_STUBS) */ @@ -3900,6 +3946,34 @@ extern const TclStubs *tclStubsPtr; # define Tcl_UtfToWChar (sizeof(wchar_t) != sizeof(short) \ ? (int (*)(const char *, wchar_t *))tclStubsPtr->tcl_UtfToUniChar \ : (int (*)(const char *, wchar_t *))Tcl_UtfToChar16) +# undef Tcl_ListObjGetElements +# define Tcl_ListObjGetElements(interp, listPtr, objcPtr, objvPtr) (sizeof(*objcPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_ListObjGetElements((interp), (listPtr), (size_t *)(void *)(objcPtr), (objvPtr)) \ + : tclStubsPtr->tclListObjGetElements_((interp), (listPtr), (int *)(void *)(objcPtr), (objvPtr))) +# undef Tcl_ListObjLength +# define Tcl_ListObjLength(interp, listPtr, lengthPtr) (sizeof(*lengthPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_ListObjLength((interp), (listPtr), (size_t *)(void *)(lengthPtr)) \ + : tclStubsPtr->tclListObjLength_((interp), (listPtr), (int *)(void *)(lengthPtr))) +# undef Tcl_DictObjSize +# define Tcl_DictObjSize(interp, dictPtr, sizePtr) (sizeof(*sizePtr) != sizeof(int) \ + ? tclStubsPtr->tcl_DictObjSize((interp), (dictPtr), (size_t *)(void *)(sizePtr)) \ + : tclStubsPtr->tclDictObjSize_((interp), (dictPtr), (int *)(void *)(sizePtr))) +# undef Tcl_SplitList +# define Tcl_SplitList(interp, listStr, argcPtr, argvPtr) (sizeof(*argcPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_SplitList((interp), (listStr), (size_t *)(void *)(argcPtr), (argvPtr)) \ + : tclStubsPtr->tclSplitList_((interp), (listStr), (int *)(void *)(argcPtr), (argvPtr))) +# undef Tcl_SplitPath +# define Tcl_SplitPath(path, argcPtr, argvPtr) (sizeof(*argcPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_SplitPath((path), (size_t *)(void *)(argcPtr), (argvPtr)) \ + : tclStubsPtr->tclSplitPath_((path), (int *)(void *)(argcPtr), (argvPtr))) +# undef Tcl_FSSplitPath +# define Tcl_FSSplitPath(pathPtr, lenPtr) (sizeof(*lenPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_FSSplitPath((pathPtr), (size_t *)(void *)(lenPtr)) \ + : tclStubsPtr->tclFSSplitPath_((pathPtr), (int *)(void *)(lenPtr))) +# undef Tcl_ParseArgsObjv +# define Tcl_ParseArgsObjv(interp, argTable, objcPtr, objv, remObjv) (sizeof(*objcPtr) != sizeof(int) \ + ? tclStubsPtr->tcl_ParseArgsObjv((interp), (argTable), (size_t *)(void *)(objcPtr), (objv), (remObjv)) \ + : tclStubsPtr->tclParseArgsObjv_((interp), (argTable), (int *)(void *)(objcPtr), (objv), (remObjv))) #else # define Tcl_WCharToUtfDString (sizeof(wchar_t) != sizeof(short) \ ? (char *(*)(const wchar_t *, size_t, Tcl_DString *))Tcl_UniCharToUtfDString \ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index c316d4d..b5599db 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -602,7 +602,7 @@ SetDictFromAny( */ if (TclHasInternalRep(objPtr, &tclListType)) { - int objc, i; + size_t objc, i; Tcl_Obj **objv; /* Cannot fail, we already know the Tcl_ObjType is "list". */ @@ -1065,7 +1065,7 @@ int Tcl_DictObjSize( Tcl_Interp *interp, Tcl_Obj *dictPtr, - int *sizePtr) + size_t *sizePtr) { Dict *dict; @@ -1278,7 +1278,7 @@ int Tcl_DictObjPutKeyList( Tcl_Interp *interp, Tcl_Obj *dictPtr, - int keyc, + size_t keyc, Tcl_Obj *const keyv[], Tcl_Obj *valuePtr) { @@ -1289,7 +1289,7 @@ Tcl_DictObjPutKeyList( if (Tcl_IsShared(dictPtr)) { Tcl_Panic("%s called with shared object", "Tcl_DictObjPutKeyList"); } - if (keyc < 1) { + if (keyc + 1 < 2) { Tcl_Panic("%s called with empty key list", "Tcl_DictObjPutKeyList"); } @@ -1339,7 +1339,7 @@ int Tcl_DictObjRemoveKeyList( Tcl_Interp *interp, Tcl_Obj *dictPtr, - int keyc, + size_t keyc, Tcl_Obj *const keyv[]) { Dict *dict; @@ -2021,7 +2021,8 @@ DictSizeCmd( int objc, Tcl_Obj *const *objv) { - int result, size; + int result; + size_t size; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); @@ -2459,7 +2460,8 @@ DictForNRCmd( Tcl_Obj *scriptObj, *keyVarObj, *valueVarObj; Tcl_Obj **varv, *keyObj, *valueObj; Tcl_DictSearch *searchPtr; - int varc, done; + size_t varc; + int done; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2653,7 +2655,8 @@ DictMapNRCmd( Interp *iPtr = (Interp *) interp; Tcl_Obj **varv, *keyObj, *valueObj; DictMapStorage *storagePtr; - int varc, done; + size_t varc; + int done; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, @@ -2991,7 +2994,8 @@ DictFilterCmd( Tcl_Obj *scriptObj, *keyVarObj, *valueVarObj; Tcl_Obj **varv, *keyObj = NULL, *valueObj = NULL, *resultObj, *boolObj; Tcl_DictSearch search; - int index, varc, done, result, satisfied; + int index, done, result, satisfied; + size_t varc; const char *pattern; if (objc < 3) { @@ -3268,7 +3272,8 @@ DictUpdateCmd( { Interp *iPtr = (Interp *) interp; Tcl_Obj *dictPtr, *objPtr; - int i, dummy; + int i; + size_t dummy; if (objc < 5 || !(objc & 1)) { Tcl_WrongNumArgs(interp, 1, objv, @@ -3321,7 +3326,7 @@ FinalizeDictUpdate( { Tcl_Obj *dictPtr, *objPtr, **objv; Tcl_InterpState state; - int i, objc; + size_t i, objc; Tcl_Obj *varName = (Tcl_Obj *)data[0]; Tcl_Obj *argsObj = (Tcl_Obj *)data[1]; @@ -3471,7 +3476,7 @@ FinalizeDictWith( int result) { Tcl_Obj **pathv; - int pathc; + size_t pathc; Tcl_InterpState state; Tcl_Obj *varName = (Tcl_Obj *)data[0]; Tcl_Obj *keysPtr = (Tcl_Obj *)data[1]; @@ -3548,14 +3553,14 @@ Tcl_Obj * TclDictWithInit( Tcl_Interp *interp, Tcl_Obj *dictPtr, - int pathc, + size_t pathc, Tcl_Obj *const pathv[]) { Tcl_DictSearch s; Tcl_Obj *keyPtr, *valPtr, *keysPtr; int done; - if (pathc > 0) { + if (pathc + 1 > 1) { dictPtr = TclTraceDictPath(interp, dictPtr, pathc, pathv, DICT_PATH_READ); if (dictPtr == NULL) { @@ -3635,7 +3640,7 @@ TclDictWithFinish( * the result value from TclDictWithInit. */ { Tcl_Obj *dictPtr, *leafPtr, *valPtr; - int i, allocdict, keyc; + size_t i, allocdict, keyc; Tcl_Obj **keyv; /* diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index f946221..9d30b09 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -688,7 +688,7 @@ TclGetInnerContext( const unsigned char *pc, Tcl_Obj **tosPtr) { - int objc = 0, off = 0; + size_t objc = 0; Tcl_Obj *result; Interp *iPtr = (Interp *) interp; @@ -757,7 +757,7 @@ TclGetInnerContext( iPtr->innerContext = result = Tcl_NewListObj(objc + 1, NULL); Tcl_IncrRefCount(result); } else { - int len; + size_t len; /* * Reset while keeping the list internalrep as much as possible. @@ -771,7 +771,7 @@ TclGetInnerContext( for (; objc>0 ; objc--) { Tcl_Obj *objPtr; - objPtr = tosPtr[1 - objc + off]; + objPtr = tosPtr[1 - objc]; if (!objPtr) { Tcl_Panic("InnerContext: bad tos -- appending null object"); } diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1b33ca4..0faa614 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -368,7 +368,7 @@ int Tcl_SetEncodingSearchPath( Tcl_Obj *searchPath) { - int dummy; + size_t dummy; if (TCL_ERROR == TclListObjLength(NULL, searchPath, &dummy)) { return TCL_ERROR; @@ -415,7 +415,7 @@ void TclSetLibraryPath( Tcl_Obj *path) { - int dummy; + size_t dummy; if (TCL_ERROR == TclListObjLength(NULL, path, &dummy)) { return; @@ -451,7 +451,7 @@ TclSetLibraryPath( static void FillEncodingFileMap(void) { - int i, numDirs = 0; + size_t i, numDirs = 0; Tcl_Obj *map, *searchPath; searchPath = Tcl_GetEncodingSearchPath(); @@ -460,13 +460,13 @@ FillEncodingFileMap(void) map = Tcl_NewDictObj(); Tcl_IncrRefCount(map); - for (i = numDirs-1; i >= 0; i--) { + for (i = numDirs-1; i != TCL_INDEX_NONE; i--) { /* * Iterate backwards through the search path so as we overwrite * entries found, we favor files earlier on the search path. */ - int j, numFiles; + size_t j, numFiles; Tcl_Obj *directory, *matchFileList; Tcl_Obj **filev; Tcl_GlobTypeData readableFiles = { @@ -1465,7 +1465,7 @@ OpenEncodingFileChannel( Tcl_Obj *map = TclGetProcessGlobalValue(&encodingFileMap); Tcl_Obj **dir, *path, *directory = NULL; Tcl_Channel chan = NULL; - int i, numDirs; + size_t i, numDirs; TclListObjGetElements(NULL, searchPath, &numDirs, &dir); Tcl_IncrRefCount(nameObj); @@ -1966,7 +1966,7 @@ LoadEscapeEncoding( Tcl_DStringInit(&escapeData); while (1) { - int argc; + size_t argc; const char **argv; char *line; Tcl_DString lineString; @@ -3841,7 +3841,7 @@ InitializeEncodingSearchPath( Tcl_Encoding *encodingPtr) { const char *bytes; - int i, numDirs; + size_t i, numDirs; size_t numBytes; Tcl_Obj *libPathObj, *encodingObj, *searchPathObj; diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 5949fe9..69b20a2 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -187,7 +187,8 @@ TclNamespaceEnsembleCmd( switch ((enum EnsSubcmds) index) { case ENS_CREATE: { const char *name; - int len, allocatedMapFlag = 0; + size_t len; + int allocatedMapFlag = 0; /* * Defaults */ @@ -498,7 +499,8 @@ TclNamespaceEnsembleCmd( Tcl_SetObjResult(interp, resultObj); } else { - int len, allocatedMapFlag = 0; + size_t len; + int allocatedMapFlag = 0; Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, *paramObj = NULL, *unknownObj = NULL; /* Defaults, silence gcc 4 warnings */ int permitPrefix, flags = 0; /* silence gcc 4 warning */ @@ -788,7 +790,7 @@ Tcl_SetEnsembleSubcommandList( return TCL_ERROR; } if (subcmdList != NULL) { - int length; + size_t length; if (TclListObjLength(interp, subcmdList, &length) != TCL_OK) { return TCL_ERROR; @@ -855,7 +857,7 @@ Tcl_SetEnsembleParameterList( Command *cmdPtr = (Command *) token; EnsembleConfig *ensemblePtr; Tcl_Obj *oldList; - int length; + size_t length; if (cmdPtr->objProc != TclEnsembleImplementationCmd) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -940,7 +942,8 @@ Tcl_SetEnsembleMappingDict( return TCL_ERROR; } if (mapDict != NULL) { - int size, done; + size_t size; + int done; Tcl_DictSearch search; Tcl_Obj *valuePtr; @@ -1039,7 +1042,7 @@ Tcl_SetEnsembleUnknownHandler( return TCL_ERROR; } if (unknownList != NULL) { - int length; + size_t length; if (TclListObjLength(interp, unknownList, &length) != TCL_OK) { return TCL_ERROR; @@ -1523,7 +1526,8 @@ TclMakeEnsemble( Tcl_DString buf, hiddenBuf; const char **nameParts = NULL; const char *cmdName = NULL; - int i, nameCount = 0, ensembleFlags = 0, hiddenLen; + size_t i, nameCount = 0; + int ensembleFlags = 0, hiddenLen; /* * Construct the path for the ensemble namespace and create it. @@ -1882,7 +1886,7 @@ NsEnsembleImplementationCmdNR( Tcl_Obj *copyPtr; /* The list of words to dispatch on. * Will be freed by the dispatch engine. */ Tcl_Obj **copyObjv; - int copyObjc, prefixObjc; + size_t copyObjc, prefixObjc; TclListObjLength(NULL, prefixObj, &prefixObjc); @@ -2278,7 +2282,9 @@ EnsembleUnknownCallback( Tcl_Obj *const objv[], Tcl_Obj **prefixObjPtr) { - int paramc, i, result, prefixObjc; + size_t paramc; + int result; + size_t i, prefixObjc; Tcl_Obj **paramv, *unknownCmd, *ensObj; /* @@ -2289,7 +2295,7 @@ EnsembleUnknownCallback( TclNewObj(ensObj); Tcl_GetCommandFullName(interp, ensemblePtr->token, ensObj); Tcl_ListObjAppendElement(NULL, unknownCmd, ensObj); - for (i=1 ; i<objc ; i++) { + for (i = 1 ; i < (size_t)objc ; i++) { Tcl_ListObjAppendElement(NULL, unknownCmd, objv[i]); } TclListObjGetElements(NULL, unknownCmd, ¶mc, ¶mv); @@ -2577,7 +2583,7 @@ BuildEnsembleConfig( Tcl_InitHashTable(hash, TCL_STRING_KEYS); if (subList) { - int subc; + size_t subc; Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj; const char *name; @@ -2593,7 +2599,7 @@ BuildEnsembleConfig( * as the dict mapping to targets. */ - for (i = 0; i < (size_t)subc; i += 2) { + for (i = 0; i < subc; i += 2) { name = TclGetString(subv[i]); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); if (!isNew) { @@ -2617,7 +2623,7 @@ BuildEnsembleConfig( * Usual case where we can freely act on the list and dict. */ - for (i = 0; i < (size_t)subc; i++) { + for (i = 0; i < subc; i++) { name = TclGetString(subv[i]); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); if (!isNew) { @@ -2907,9 +2913,9 @@ TclCompileEnsemble( Tcl_Obj *replaced, *replacement; Tcl_Command ensemble = (Tcl_Command) cmdPtr; Command *oldCmdPtr = cmdPtr, *newCmdPtr; - int len, result, flags = 0, i, depth = 1, invokeAnyway = 0; + int result, flags = 0, depth = 1, invokeAnyway = 0; int ourResult = TCL_ERROR; - size_t numBytes; + size_t i, len, numBytes; const char *word; TclNewObj(replaced); @@ -3377,8 +3383,8 @@ CompileToInvokedCommand( Tcl_Token *tokPtr; Tcl_Obj *objPtr, **words; const char *bytes; - int i, numWords, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME; - size_t length; + int i, cmdLit, extraLiteralFlags = LITERAL_CMD_NAME; + size_t numWords, length; /* * Push the words of the command. Take care; the command words may be @@ -3389,7 +3395,7 @@ CompileToInvokedCommand( TclListObjGetElements(NULL, replacements, &numWords, &words); for (i = 0, tokPtr = parsePtr->tokenPtr; i < parsePtr->numWords; i++, tokPtr = TokenAfter(tokPtr)) { - if (i > 0 && i < numWords+1) { + if (i > 0 && (size_t)i <= numWords) { bytes = Tcl_GetStringFromObj(words[i-1], &length); PushLiteral(envPtr, bytes, length); continue; diff --git a/generic/tclEvent.c b/generic/tclEvent.c index acc74f8..21647e4 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -207,7 +207,8 @@ HandleBgErrors( Tcl_Preserve(assocPtr); Tcl_Preserve(interp); while (assocPtr->firstBgPtr != NULL) { - int code, prefixObjc; + int code; + size_t prefixObjc; Tcl_Obj **prefixObjv, **tempObjv; /* diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 9fe6179..73d9d42 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2048,8 +2048,9 @@ TEBCresume( Tcl_Obj *objPtr, *valuePtr, *value2Ptr, *part1Ptr, *part2Ptr, *tmpPtr; Tcl_Obj **objv = NULL; - int objc = 0; - int opnd, length, pcAdjustment; + size_t objc = 0; + int opnd, pcAdjustment; + size_t length; Var *varPtr, *arrayPtr; #ifdef TCL_COMPILE_DEBUG char cmdNameBuf[21]; @@ -2657,11 +2658,11 @@ TEBCresume( /* Ugly abuse! */ starting = 1; #endif - TRACE(("=> drop %d items\n", objc)); + TRACE(("=> drop %" TCL_Z_MODIFIER "d items\n", objc)); NEXT_INST_V(1, objc, 0); case INST_EXPAND_STKTOP: { - int i; + size_t i; ptrdiff_t moved; /* @@ -2785,11 +2786,11 @@ TEBCresume( #ifdef TCL_COMPILE_DEBUG if (tclTraceExec >= 2) { - int i; + size_t i; if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); - TRACE(("%u => call ", objc)); + TRACE(("%" TCL_Z_MODIFIER "u => call ", objc)); } else { fprintf(stdout, "%d: (%u) invoking ", iPtr->numLevels, (unsigned)(pc - codePtr->codeStart)); @@ -2832,11 +2833,11 @@ TEBCresume( cleanup = objc; #ifdef TCL_COMPILE_DEBUG if (tclTraceExec >= 2) { - int i; + size_t i; if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); - TRACE(("%u => call (implementation %s) ", objc, O2S(objPtr))); + TRACE(("%" TCL_Z_MODIFIER "u => call (implementation %s) ", objc, O2S(objPtr))); } else { fprintf(stdout, "%d: (%u) invoking (using implementation %s) ", @@ -3042,7 +3043,8 @@ TEBCresume( */ { - int storeFlags, len; + int storeFlags; + size_t len; case INST_STORE_ARRAY4: opnd = TclGetUInt4AtPtr(pc+1); @@ -4908,7 +4910,7 @@ TEBCresume( } match = 0; if (length > 0) { - int i = 0; + size_t i = 0; Tcl_Obj *o; /* @@ -6217,10 +6219,9 @@ TEBCresume( ForeachInfo *infoPtr; Tcl_Obj *listPtr, **elements; ForeachVarList *varListPtr; - int numLists, listLen, numVars; - int listTmpDepth; - size_t iterNum, iterMax, iterTmp; - int varIndex, valIndex, j; + int numLists, numVars, listTmpDepth; + size_t iterNum, iterMax, iterTmp, listLen, valIndex; + int varIndex, j; long i; case INST_FOREACH_START: @@ -6483,22 +6484,25 @@ TEBCresume( */ { - int opnd2, allocateDict, done, i, allocdict; + int opnd2, allocateDict, done, allocdict; + size_t i; Tcl_Obj *dictPtr, *statePtr, *keyPtr, *listPtr, *varNamePtr, *keysPtr; Tcl_Obj *emptyPtr, **keyPtrPtr; Tcl_DictSearch *searchPtr; DictUpdateInfo *duiPtr; - case INST_DICT_VERIFY: + case INST_DICT_VERIFY: { + size_t size; dictPtr = OBJ_AT_TOS; TRACE(("\"%.30s\" => ", O2S(dictPtr))); - if (Tcl_DictObjSize(interp, dictPtr, &done) != TCL_OK) { + if (Tcl_DictObjSize(interp, dictPtr, &size) != TCL_OK) { TRACE_APPEND(("ERROR verifying dictionary nature of \"%.30s\": %s\n", O2S(dictPtr), O2S(Tcl_GetObjResult(interp)))); goto gotError; } TRACE_APPEND(("OK\n")); NEXT_INST_F(1, 1, 0); + } break; case INST_DICT_EXISTS: { @@ -6942,7 +6946,7 @@ TEBCresume( TRACE_ERROR(interp); goto gotError; } - if ((size_t)length != duiPtr->length) { + if (length != duiPtr->length) { Tcl_Panic("dictUpdateStart argument length mismatch"); } for (i=0 ; i<length ; i++) { diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 7770fb2..183b88a 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -220,7 +220,8 @@ TclFileMakeDirsCmd( Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { Tcl_Obj *errfile = NULL; - int result, i, j, pobjc; + int result, i; + size_t j, pobjc; Tcl_Obj *split = NULL; Tcl_Obj *target = NULL; Tcl_StatBuf statBuf; @@ -873,7 +874,7 @@ FileBasename( Tcl_Interp *interp, /* Interp, for error return. */ Tcl_Obj *pathPtr) /* Path whose basename to extract. */ { - int objc; + size_t objc; Tcl_Obj *splitPtr; Tcl_Obj *resultPtr = NULL; @@ -955,7 +956,7 @@ TclFileAttrsCmd( const char *const *attributeStrings; const char **attributeStringsAllocated = NULL; Tcl_Obj *objStrings = NULL; - int numObjStrings = -1; + size_t numObjStrings = TCL_INDEX_NONE; Tcl_Obj *filePtr; if (objc < 2) { @@ -979,7 +980,7 @@ TclFileAttrsCmd( attributeStrings = Tcl_FSFileAttrStrings(filePtr, &objStrings); if (attributeStrings == NULL) { - int index; + size_t index; Tcl_Obj *objPtr; if (objStrings == NULL) { diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 67c0048..38e87e0 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -381,7 +381,7 @@ Tcl_GetPathType( Tcl_PathType TclpGetNativePathType( Tcl_Obj *pathPtr, /* Native path of interest */ - int *driveNameLengthPtr, /* Returns length of drive, if non-NULL and + size_t *driveNameLengthPtr, /* Returns length of drive, if non-NULL and * path was absolute */ Tcl_Obj **driveNameRef) { @@ -493,7 +493,7 @@ TclpGetNativePathType( Tcl_Obj * TclpNativeSplitPath( Tcl_Obj *pathPtr, /* Path to split. */ - int *lenPtr) /* int to store number of path elements. */ + size_t *lenPtr) /* int to store number of path elements. */ { Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */ @@ -549,15 +549,14 @@ TclpNativeSplitPath( void Tcl_SplitPath( const char *path, /* Pointer to string containing a path. */ - int *argcPtr, /* Pointer to location to fill in with the + size_t *argcPtr, /* Pointer to location to fill in with the * number of elements in the path. */ const char ***argvPtr) /* Pointer to place to store pointer to array * of pointers to path elements. */ { Tcl_Obj *resultPtr = NULL; /* Needed only to prevent gcc warnings. */ Tcl_Obj *tmpPtr, *eltPtr; - int i; - size_t size, len; + size_t i, size, len; char *p; const char *str; @@ -807,7 +806,7 @@ SplitWinPath( Tcl_Obj * Tcl_FSJoinToPath( Tcl_Obj *pathPtr, /* Valid path or NULL. */ - int objc, /* Number of array elements to join */ + size_t objc, /* Number of array elements to join */ Tcl_Obj *const objv[]) /* Path elements to join. */ { if (pathPtr == NULL) { @@ -823,7 +822,7 @@ Tcl_FSJoinToPath( pair[1] = objv[0]; return TclJoinPath(2, pair, 0); } else { - int elemc = objc + 1; + size_t elemc = objc + 1; Tcl_Obj *ret, **elemv = (Tcl_Obj**)Tcl_Alloc(elemc*sizeof(Tcl_Obj *)); elemv[0] = pathPtr; @@ -976,12 +975,11 @@ TclpNativeJoinPath( char * Tcl_JoinPath( - int argc, + size_t argc, const char *const *argv, Tcl_DString *resultPtr) /* Pointer to previously initialized DString */ { - int i; - size_t len; + size_t i, len; Tcl_Obj *listObj; Tcl_Obj *resultObj; const char *resultStr; @@ -1230,7 +1228,8 @@ Tcl_GlobObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int index, i, globFlags, length, join, dir, result; + int index, i, globFlags, join, dir, result; + size_t length; char *string; const char *separators; Tcl_Obj *typePtr, *look; @@ -1457,7 +1456,7 @@ Tcl_GlobObjCmd( */ TclListObjLength(interp, typePtr, &length); - if (length <= 0) { + if (length == 0) { goto skipTypes; } globTypes = (Tcl_GlobTypeData *)TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); @@ -1466,7 +1465,7 @@ Tcl_GlobObjCmd( globTypes->macType = NULL; globTypes->macCreator = NULL; - while (--length >= 0) { + while (length-- > 0) { size_t len; const char *str; @@ -1525,7 +1524,7 @@ Tcl_GlobObjCmd( } else { Tcl_Obj *item; - int llen; + size_t llen; if ((TclListObjLength(NULL, look, &llen) == TCL_OK) && (llen == 3)) { @@ -1836,7 +1835,7 @@ TclGlob( Tcl_IncrRefCount(pathPrefix); } else if (pathPrefix == NULL && (tail[0] == '/' || (tail[0] == '\\' && tail[1] == '\\'))) { - int driveNameLen; + size_t driveNameLen; Tcl_Obj *driveName; Tcl_Obj *temp = Tcl_NewStringObj(tail, -1); Tcl_IncrRefCount(temp); @@ -1904,9 +1903,9 @@ TclGlob( */ if (pathPrefix == NULL) { - int driveNameLen; + size_t driveNameLen; Tcl_Obj *driveName; - if (TclFSNonnativePathType(tail, (int) strlen(tail), NULL, + if (TclFSNonnativePathType(tail, strlen(tail), NULL, &driveNameLen, &driveName) == TCL_PATH_ABSOLUTE) { pathPrefix = driveName; tail += driveNameLen; @@ -1989,7 +1988,7 @@ TclGlob( */ if (globFlags & TCL_GLOBMODE_TAILS) { - int objc, i; + size_t objc, i; Tcl_Obj **objv; size_t prefixLen; const char *pre; @@ -2343,7 +2342,7 @@ DoGlob( pattern, &dirOnly); *p = save; if (result == TCL_OK) { - int subdirc, i, repair = -1; + size_t i, subdirc, repair = TCL_INDEX_NONE; Tcl_Obj **subdirv; result = TclListObjGetElements(interp, subdirsPtr, @@ -2361,12 +2360,12 @@ DoGlob( result = DoGlob(interp, matchesObj, separators, subdirv[i], 1, p+1, types); if (copy) { - int end; + size_t end; Tcl_DecrRefCount(subdirv[i]); subdirv[i] = copy; TclListObjLength(NULL, matchesObj, &end); - while (repair < end) { + while (repair + 1 <= end) { const char *bytes; size_t numBytes; Tcl_Obj *fixme, *newObj; @@ -2378,7 +2377,7 @@ DoGlob( 1, &newObj); repair++; } - repair = -1; + repair = TCL_INDEX_NONE; } } } diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h index 684407c..20d730f 100644 --- a/generic/tclFileSystem.h +++ b/generic/tclFileSystem.h @@ -48,13 +48,13 @@ MODULE_SCOPE const Tcl_Filesystem tclNativeFilesystem; MODULE_SCOPE Tcl_PathType TclFSGetPathType(Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr); + size_t *driveNameLengthPtr); MODULE_SCOPE Tcl_PathType TclFSNonnativePathType(const char *pathPtr, - int pathLen, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr, Tcl_Obj **driveNameRef); + size_t pathLen, const Tcl_Filesystem **filesystemPtrPtr, + size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE Tcl_PathType TclGetPathType(Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr, Tcl_Obj **driveNameRef); + size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE int TclFSEpochOk(size_t filesystemEpoch); MODULE_SCOPE int TclFSCwdIsNative(void); MODULE_SCOPE Tcl_Obj * TclWinVolumeRelativeNormalize(Tcl_Interp *interp, diff --git a/generic/tclIO.c b/generic/tclIO.c index 55a4792..8745b09 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -7661,7 +7661,7 @@ Tcl_BadChannelOption( const char *genericopt = "blocking buffering buffersize encoding eofchar translation"; const char **argv; - int argc, i; + size_t argc, i; Tcl_DString ds; Tcl_Obj *errObj; @@ -7952,7 +7952,7 @@ Tcl_SetChannelOption( ChannelState *statePtr = chanPtr->state; /* State info for channel */ size_t len; /* Length of optionName string. */ - int argc; + size_t argc; const char **argv; /* @@ -10910,7 +10910,8 @@ static Tcl_Obj * FixLevelCode( Tcl_Obj *msg) { - int explicitResult, numOptions, lc, lcn; + int explicitResult, numOptions, lcn; + size_t lc; Tcl_Obj **lv, **lvn; int res, i, j, val, lignore, cignore; int newlevel = -1, newcode = -1; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 61aa585..fbb16dc 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -1117,7 +1117,8 @@ Tcl_OpenObjCmd( if (!pipeline) { chan = Tcl_FSOpenFileChannel(interp, objv[1], modeString, prot); } else { - int mode, seekFlag, cmdObjc, binary; + int mode, seekFlag, binary; + size_t cmdObjc; const char **cmdArgv; if (Tcl_SplitList(interp, what+1, &cmdObjc, &cmdArgv) != TCL_OK) { diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index 5ed36ee..3091467 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -258,7 +258,7 @@ TclChannelTransform( Channel *chanPtr; /* The actual channel. */ ChannelState *statePtr; /* State info for channel. */ int mode; /* Read/write mode of the channel. */ - int objc; + size_t objc; TransformChannelData *dataPtr; Tcl_DString ds; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 9cd9b96..7588ffa 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -513,7 +513,7 @@ TclChanCreateObjCmd( Tcl_Obj *cmdNameObj; /* Command name */ Tcl_Channel chan; /* Token for the new channel */ Tcl_Obj *modeObj; /* mode in obj form for method call */ - int listc; /* Result of 'initialize', and of */ + size_t listc; /* Result of 'initialize', and of */ Tcl_Obj **listv; /* its sublist in the 2nd element */ int methIndex; /* Encoded method name */ int result; /* Result code for 'initialize' */ @@ -1047,10 +1047,10 @@ UnmarshallErrorResult( Tcl_Interp *interp, Tcl_Obj *msgObj) { - int lc; + size_t lc; Tcl_Obj **lv; int explicitResult; - int numOptions; + size_t numOptions; /* * Process the caught message. @@ -1912,7 +1912,8 @@ ReflectGetOption( ReflectedChannel *rcPtr = (ReflectedChannel *)clientData; Tcl_Obj *optionObj; Tcl_Obj *resObj; /* Result data for 'configure' */ - int listc, result = TCL_OK; + size_t listc; + int result = TCL_OK; Tcl_Obj **listv; MethodName method; @@ -2005,7 +2006,7 @@ ReflectGetOption( Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Expected list with even number of " - "elements, got %d element%s instead", listc, + "elements, got %" TCL_Z_MODIFIER "d element%s instead", listc, (listc == 1 ? "" : "s"))); goto error; } else { @@ -2134,7 +2135,7 @@ EncodeEventMask( int *mask) { int events; /* Mask of events to post */ - int listc; /* #elements in eventspec list */ + size_t listc; /* #elements in eventspec list */ Tcl_Obj **listv; /* Elements of eventspec list */ int evIndex; /* Id of event for an element of the eventspec * list. */ @@ -3304,7 +3305,7 @@ ForwardProc( * NOTE (4) as well. */ - int listc; + size_t listc; Tcl_Obj **listv; if (TclListObjGetElements(interp, resObj, &listc, @@ -3319,7 +3320,7 @@ ForwardProc( char *buf = (char *)Tcl_Alloc(200); sprintf(buf, - "{Expected list with even number of elements, got %d %s instead}", + "{Expected list with even number of elements, got %" TCL_Z_MODIFIER "d %s instead}", listc, (listc == 1 ? "element" : "elements")); ForwardSetDynamicError(paramPtr, buf); diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index bf8f469..bbfa46a 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -511,7 +511,7 @@ TclChanPushObjCmd( Tcl_Obj *cmdNameObj; /* Command name */ Tcl_Obj *rtId; /* Handle of the new transform (channel) */ Tcl_Obj *modeObj; /* mode in obj form for method call */ - int listc; /* Result of 'initialize', and of */ + size_t listc; /* Result of 'initialize', and of */ Tcl_Obj **listv; /* its sublist in the 2nd element */ int methIndex; /* Encoded method name */ int result; /* Result code for 'initialize' */ @@ -820,10 +820,10 @@ UnmarshallErrorResult( Tcl_Interp *interp, Tcl_Obj *msgObj) { - int lc; + size_t lc; Tcl_Obj **lv; int explicitResult; - int numOptions; + size_t numOptions; /* * Process the caught message. @@ -1719,9 +1719,8 @@ NewReflectedTransform( Tcl_Channel parentChan) { ReflectedTransform *rtPtr; - int listc; + size_t i, listc; Tcl_Obj **listv; - int i; rtPtr = (ReflectedTransform *)Tcl_Alloc(sizeof(ReflectedTransform)); diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 46ec1f1..822eeef 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -989,7 +989,8 @@ Tcl_FSMatchInDirectory( { const Tcl_Filesystem *fsPtr; Tcl_Obj *cwd, *tmpResultPtr, **elemsPtr; - int resLength, i, ret = -1; + size_t resLength, i; + int ret = -1; if (types != NULL && (types->type & TCL_GLOB_TYPE_MOUNT)) { /* @@ -1105,7 +1106,7 @@ FsAddMountsToGlobResult( * directory flag is particularly significant. */ { - int mLength, gLength, i; + size_t mLength, gLength, i; int dir = (types == NULL || (types->type & TCL_GLOB_TYPE_DIR)); Tcl_Obj *mounts = FsListMounts(pathPtr, pattern); @@ -1121,7 +1122,7 @@ FsAddMountsToGlobResult( } for (i=0 ; i<mLength ; i++) { Tcl_Obj *mElt; - int j; + size_t j; int found = 0; Tcl_ListObjIndex(NULL, mounts, i, &mElt); @@ -1475,7 +1476,8 @@ TclGetOpenModeEx( * configure the channel for binary * operations after opening the file. */ { - int mode, modeArgc, c, i, gotRW; + int mode, c, gotRW; + size_t modeArgc, i; const char **modeArgv, *flag; #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) @@ -2474,7 +2476,7 @@ TclFSFileAttrIndex( * It's a non-constant attribute list, so do a literal search. */ - int i, objc; + size_t i, objc; Tcl_Obj **objv; if (TclListObjGetElements(NULL, listObj, &objc, &objv) != TCL_OK) { @@ -3875,13 +3877,13 @@ FsListMounts( Tcl_Obj * Tcl_FSSplitPath( Tcl_Obj *pathPtr, /* The pathname to split. */ - int *lenPtr) /* A place to hold the number of pathname + size_t *lenPtr) /* A place to hold the number of pathname * elements. */ { Tcl_Obj *result = NULL; /* Just to squelch gcc warnings. */ const Tcl_Filesystem *fsPtr; char separator = '/'; - int driveNameLength; + size_t driveNameLength; const char *p; /* @@ -3927,7 +3929,7 @@ Tcl_FSSplitPath( for (;;) { const char *elementStart = p; - int length; + size_t length; while ((*p != '\0') && (*p != separator)) { p++; @@ -3978,7 +3980,7 @@ TclGetPathType( /* If not NULL, a place in which to store a * pointer to the filesystem for this pathname * if it is absolute. */ - int *driveNameLengthPtr, /* If not NULL, a place in which to store the + size_t *driveNameLengthPtr, /* If not NULL, a place in which to store the * length of the volume name. */ Tcl_Obj **driveNameRef) /* If not NULL, for an absolute pathname, a * place to store a pointer to an object with a @@ -4027,12 +4029,12 @@ TclGetPathType( Tcl_PathType TclFSNonnativePathType( const char *path, /* Pathname to determine the type of. */ - int pathLen, /* Length of the pathname. */ + size_t pathLen, /* Length of the pathname. */ const Tcl_Filesystem **filesystemPtrPtr, /* If not NULL, a place to store a pointer to * the filesystem for this pathname when it is * an absolute pathname. */ - int *driveNameLengthPtr, /* If not NULL, a place to store the length of + size_t *driveNameLengthPtr, /* If not NULL, a place to store the length of * the volume name if the pathname is absolute. */ Tcl_Obj **driveNameRef) /* If not NULL, a place to store a pointer to @@ -4069,7 +4071,7 @@ TclFSNonnativePathType( if ((fsRecPtr->fsPtr != &tclNativeFilesystem) && (fsRecPtr->fsPtr->listVolumesProc != NULL)) { - int numVolumes; + size_t numVolumes; Tcl_Obj *thisFsVolumes = fsRecPtr->fsPtr->listVolumesProc(); if (thisFsVolumes != NULL) { @@ -4084,9 +4086,9 @@ TclFSNonnativePathType( * Tcl_Panic seems a bit excessive. */ - numVolumes = -1; + numVolumes = TCL_INDEX_NONE; } - while (numVolumes > 0) { + while (numVolumes + 1 > 1) { Tcl_Obj *vol; size_t len; const char *strVol; @@ -4094,7 +4096,7 @@ TclFSNonnativePathType( numVolumes--; Tcl_ListObjIndex(NULL, thisFsVolumes, numVolumes, &vol); strVol = Tcl_GetStringFromObj(vol,&len); - if ((size_t) pathLen < len) { + if (pathLen < len) { continue; } if (strncmp(strVol, path, len) == 0) { diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index d7c3ab7..4fa05f1 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -112,7 +112,8 @@ GetIndexFromObjList( int *indexPtr) /* Place to store resulting integer index. */ { - int objc, result, t; + size_t objc, t; + int result; Tcl_Obj **objv; const char **tablePtr; @@ -504,8 +505,8 @@ PrefixMatchObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int flags = 0, result, index; - int dummyLength, i, errorLength; + int flags = 0, result, index, i; + size_t dummyLength, errorLength; Tcl_Obj *errorPtr = NULL; const char *message = "option"; Tcl_Obj *tablePtr, *objPtr, *resultPtr; @@ -628,8 +629,8 @@ PrefixAllObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int tableObjc, result, t; - size_t length, elemLength; + int result; + size_t length, elemLength, tableObjc, t; const char *string, *elemString; Tcl_Obj **tableObjv, *resultPtr; @@ -686,8 +687,8 @@ PrefixLongestObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int tableObjc, result, t; - size_t i, length, elemLength, resultLength; + int result; + size_t i, length, elemLength, resultLength, tableObjc, t; const char *string, *elemString, *resultString; Tcl_Obj **tableObjv; @@ -802,7 +803,7 @@ PrefixLongestObjCmd( void Tcl_WrongNumArgs( Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments to print from objv. */ + size_t objc, /* Number of arguments to print from objv. */ Tcl_Obj *const objv[], /* Initial argument objects, which should be * included in the error message. */ const char *message) /* Error message to print after the leading @@ -810,8 +811,7 @@ Tcl_WrongNumArgs( * NULL. */ { Tcl_Obj *objPtr; - int i; - size_t len, elemLen; + size_t i, len, elemLen; char flags; Interp *iPtr = (Interp *)interp; const char *elementStr; @@ -831,8 +831,8 @@ Tcl_WrongNumArgs( */ if (iPtr->ensembleRewrite.sourceObjs != NULL) { - int toSkip = iPtr->ensembleRewrite.numInsertedObjs; - int toPrint = iPtr->ensembleRewrite.numRemovedObjs; + size_t toSkip = iPtr->ensembleRewrite.numInsertedObjs; + size_t toPrint = iPtr->ensembleRewrite.numRemovedObjs; Tcl_Obj *const *origObjv = TclEnsembleGetRewriteValues(interp); /* @@ -890,7 +890,7 @@ Tcl_WrongNumArgs( * moderately complex condition here). */ - if (i<toPrint-1 || objc!=0 || message!=NULL) { + if (i+1<toPrint || objc!=0 || message!=NULL) { Tcl_AppendStringsToObj(objPtr, " ", NULL); } } @@ -987,7 +987,7 @@ Tcl_ParseArgsObjv( Tcl_Interp *interp, /* Place to store error message. */ const Tcl_ArgvInfo *argTable, /* Array of option descriptions. */ - int *objcPtr, /* Number of arguments in objv. Modified to + size_t *objcPtr, /* Number of arguments in objv. Modified to * hold # args left in objv at end. */ Tcl_Obj *const *objv, /* Array of arguments to be parsed. */ Tcl_Obj ***remObjv) /* Pointer to array of arguments that were not @@ -997,7 +997,7 @@ Tcl_ParseArgsObjv( Tcl_Obj **leftovers; /* Array to write back to remObjv on * successful exit. Will include the name of * the command. */ - int nrem; /* Size of leftovers.*/ + size_t nrem; /* Size of leftovers.*/ const Tcl_ArgvInfo *infoPtr; /* Pointer to the current entry in the table * of argument descriptions. */ @@ -1009,12 +1009,12 @@ Tcl_ParseArgsObjv( * quick check for matching; use 2nd char. * because first char. will almost always be * '-'). */ - int srcIndex; /* Location from which to read next argument + size_t srcIndex; /* Location from which to read next argument * from objv. */ - int dstIndex; /* Used to keep track of current arguments + size_t dstIndex; /* Used to keep track of current arguments * being processed, primarily for error * reporting. */ - int objc; /* # arguments in objv still to process. */ + size_t objc; /* # arguments in objv still to process. */ size_t length; /* Number of characters in current argument */ if (remObjv != NULL) { @@ -1052,7 +1052,7 @@ Tcl_ParseArgsObjv( } /* - * Loop throught the argument descriptors searching for one with the + * Loop through the argument descriptors searching for one with the * matching key string. If found, leave a pointer to it in matchPtr. */ @@ -1168,14 +1168,22 @@ Tcl_ParseArgsObjv( break; } case TCL_ARGV_GENFUNC: { + int i = (int)objc; + + if (objc > INT_MAX) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "too many (%" TCL_Z_MODIFIER "u) arguments for TCL_ARGV_GENFUNC", objc)); + goto error; + } Tcl_ArgvGenFuncProc *handlerProc = (Tcl_ArgvGenFuncProc *) infoPtr->srcPtr; - objc = handlerProc(infoPtr->clientData, interp, objc, + i = handlerProc(infoPtr->clientData, interp, i, &objv[srcIndex], infoPtr->dstPtr); - if (objc < 0) { + if (i < 0) { goto error; } + objc = i; break; } case TCL_ARGV_HELP: diff --git a/generic/tclInt.decls b/generic/tclInt.decls index ff1f546..1c05eeb 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -339,7 +339,7 @@ declare 165 { # New function due to TIP #33 declare 166 { int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr, - int index, Tcl_Obj *valuePtr) + size_t index, Tcl_Obj *valuePtr) } # variant of Tcl_UtfNCmp that takes n as bytes, not chars diff --git a/generic/tclInt.h b/generic/tclInt.h index 30d108b..b94b4d8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2381,8 +2381,8 @@ typedef enum TclEolTranslation { typedef struct List { size_t refCount; - int maxElemCount; /* Total number of element array slots. */ - int elemCount; /* Current number of list elements. */ + size_t maxElemCount; /* Total number of element array slots. */ + size_t elemCount; /* Current number of list elements. */ int canonicalFlag; /* Set if the string representation was * derived from the list representation. May * be ignored if there is no string rep at @@ -3018,14 +3018,14 @@ MODULE_SCOPE void TclInitObjSubsystem(void); MODULE_SCOPE int TclInterpReady(Tcl_Interp *interp); MODULE_SCOPE int TclIsDigitProc(int byte); MODULE_SCOPE int TclIsBareword(int byte); -MODULE_SCOPE Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[], +MODULE_SCOPE Tcl_Obj * TclJoinPath(size_t elements, Tcl_Obj * const objv[], int forceRelative); MODULE_SCOPE int TclJoinThread(Tcl_ThreadId id, int *result); MODULE_SCOPE void TclLimitRemoveAllHandlers(Tcl_Interp *interp); MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *argPtr); MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, - int indexCount, Tcl_Obj *const indexArray[]); + size_t indexCount, Tcl_Obj *const indexArray[]); /* TIP #280 */ MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n, int *lines, Tcl_Obj *const *elems); @@ -3035,7 +3035,7 @@ MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, size_t fromIdx, MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *indexPtr, Tcl_Obj *valuePtr); MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, - int indexCount, Tcl_Obj *const indexArray[], + size_t indexCount, Tcl_Obj *const indexArray[], Tcl_Obj *valuePtr); MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name, const EnsembleImplMap map[]); @@ -3111,9 +3111,9 @@ MODULE_SCOPE int TclpMatchFiles(Tcl_Interp *interp, char *separators, MODULE_SCOPE int TclpObjNormalizePath(Tcl_Interp *interp, Tcl_Obj *pathPtr, int nextCheckpoint); MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, const char *joining); -MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr); +MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr); MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr, - int *driveNameLengthPtr, Tcl_Obj **driveNameRef); + size_t *driveNameLengthPtr, Tcl_Obj **driveNameRef); MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp, Tcl_Obj *source, Tcl_Obj *target); MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp, @@ -3322,7 +3322,7 @@ MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr, Tcl_Obj *part2Ptr, int index, int pathc, Tcl_Obj *const pathv[], Tcl_Obj *keysPtr); MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr, - int pathc, Tcl_Obj *const pathv[]); + size_t pathc, Tcl_Obj *const pathv[]); MODULE_SCOPE int Tcl_DisassembleObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 101aedb..5dd8196 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -357,7 +357,7 @@ EXTERN void TclExpandCodeArray(void *envPtr); EXTERN void TclpSetInitialEncodings(void); /* 166 */ EXTERN int TclListObjSetElement(Tcl_Interp *interp, - Tcl_Obj *listPtr, int index, + Tcl_Obj *listPtr, size_t index, Tcl_Obj *valuePtr); /* Slot 167 is reserved */ /* Slot 168 is reserved */ @@ -748,7 +748,7 @@ typedef struct TclIntStubs { const void * (*tclGetInstructionTable) (void); /* 163 */ void (*tclExpandCodeArray) (void *envPtr); /* 164 */ void (*tclpSetInitialEncodings) (void); /* 165 */ - int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */ + int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, size_t index, Tcl_Obj *valuePtr); /* 166 */ void (*reserved167)(void); void (*reserved168)(void); int (*tclpUtfNcmp2) (const char *s1, const char *s2, size_t n); /* 169 */ diff --git a/generic/tclInterp.c b/generic/tclInterp.c index adf113d..24118bb 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1199,12 +1199,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); @@ -1254,7 +1254,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; @@ -2320,7 +2320,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; @@ -2378,7 +2378,7 @@ ChildBgerror( Tcl_Obj *const objv[]) /* Argument strings. */ { if (objc) { - int length; + size_t length; if (TCL_ERROR == TclListObjLength(NULL, objv[0], &length) || (length < 1)) { @@ -2424,7 +2424,8 @@ ChildCreate( InterpInfo *parentInfoPtr; Tcl_HashEntry *hPtr; const char *path; - int isNew, objc; + int isNew; + size_t objc; Tcl_Obj **objv; if (TclListObjGetElements(interp, pathPtr, &objc, &objv) != TCL_OK) { diff --git a/generic/tclLink.c b/generic/tclLink.c index e554b0a..4684dae 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -763,9 +763,8 @@ LinkTraceProc( Tcl_WideInt valueWide; Tcl_WideUInt valueUWide; double valueDouble; - int objc; + size_t objc, i; Tcl_Obj **objv; - int i; /* * If the variable is being unset, then just re-create it (with a trace) @@ -948,7 +947,7 @@ LinkTraceProc( if (linkPtr->flags & LINK_ALLOC_LAST) { if (TclListObjGetElements(NULL, (valueObj), &objc, &objv) == TCL_ERROR - || (size_t)objc != linkPtr->numElems) { + || objc != linkPtr->numElems) { return (char *) "wrong dimension"; } } @@ -956,7 +955,7 @@ LinkTraceProc( switch (linkPtr->type) { case TCL_LINK_INT: if (linkPtr->flags & LINK_ALLOC_LAST) { - for (i=0; i < objc; i++) { + for (i = 0; i < objc; i++) { int *varPtr = &linkPtr->lastValue.iPtr[i]; if (GetInt(objv[i], varPtr)) { diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 0d5aad5..f7c32ef 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -18,9 +18,9 @@ * Prototypes for functions defined later in this file: */ -static List * AttemptNewList(Tcl_Interp *interp, int objc, +static List * AttemptNewList(Tcl_Interp *interp, size_t objc, Tcl_Obj *const objv[]); -static List * NewListIntRep(int objc, Tcl_Obj *const objv[], int p); +static List * NewListIntRep(size_t objc, Tcl_Obj *const objv[], size_t p); static void DupListInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); static void FreeListInternalRep(Tcl_Obj *listPtr); static int SetListFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -99,31 +99,12 @@ const Tcl_ObjType tclListType = { static List * NewListIntRep( - int objc, + size_t objc, Tcl_Obj *const objv[], - int p) + size_t p) { List *listRepPtr; - if (objc <= 0) { - Tcl_Panic("NewListIntRep: expects postive element count"); - } - - /* - * First check to see if we'd overflow and try to allocate an object - * larger than our memory allocator allows. Note that this is actually a - * fairly small value when you're on a serious 64-bit machine, but that - * requires API changes to fix. See [Bug 219196] for a discussion. - */ - - if ((size_t)objc > LIST_MAX) { - if (p) { - Tcl_Panic("max length of a Tcl list (%d elements) exceeded", - LIST_MAX); - } - return NULL; - } - listRepPtr = (List *)Tcl_AttemptAlloc(LIST_SIZE(objc)); if (listRepPtr == NULL) { if (p) { @@ -139,7 +120,7 @@ NewListIntRep( if (objv) { Tcl_Obj **elemPtrs; - int i; + size_t i; listRepPtr->elemCount = objc; elemPtrs = &listRepPtr->elements; @@ -166,7 +147,7 @@ NewListIntRep( static List * AttemptNewList( Tcl_Interp *interp, - int objc, + size_t objc, Tcl_Obj *const objv[]) { List *listRepPtr = NewListIntRep(objc, objv, 0); @@ -214,7 +195,7 @@ AttemptNewList( Tcl_Obj * Tcl_NewListObj( - int objc, /* Count of objects referenced by objv. */ + size_t objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[]) /* An array of pointers to Tcl objects. */ { return Tcl_DbNewListObj(objc, objv, "unknown", 0); @@ -224,7 +205,7 @@ Tcl_NewListObj( Tcl_Obj * Tcl_NewListObj( - int objc, /* Count of objects referenced by objv. */ + size_t objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[]) /* An array of pointers to Tcl objects. */ { List *listRepPtr; @@ -232,7 +213,7 @@ Tcl_NewListObj( TclNewObj(listPtr); - if (objc <= 0) { + if (objc + 1 <= 1) { return listPtr; } @@ -271,7 +252,7 @@ Tcl_NewListObj( Tcl_Obj * Tcl_DbNewListObj( - int objc, /* Count of objects referenced by objv. */ + size_t objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[], /* An array of pointers to Tcl objects. */ const char *file, /* The name of the source file calling this * function; used for debugging. */ @@ -283,7 +264,7 @@ Tcl_DbNewListObj( TclDbNewObj(listPtr, file, line); - if (objc <= 0) { + if (objc + 1 <= 1) { return listPtr; } @@ -307,7 +288,7 @@ Tcl_DbNewListObj( Tcl_Obj * Tcl_DbNewListObj( - int objc, /* Count of objects referenced by objv. */ + size_t objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[], /* An array of pointers to Tcl objects. */ TCL_UNUSED(const char *) /*file*/, TCL_UNUSED(int) /*line*/) @@ -330,7 +311,7 @@ Tcl_DbNewListObj( void Tcl_SetListObj( Tcl_Obj *objPtr, /* Object whose internal rep to init. */ - int objc, /* Count of objects referenced by objv. */ + size_t objc, /* Count of objects referenced by objv. */ Tcl_Obj *const objv[]) /* An array of pointers to Tcl objects. */ { List *listRepPtr; @@ -431,7 +412,7 @@ TclListObjRange( size_t toIdx) /* Index of last element to include. */ { Tcl_Obj **elemPtrs; - int listLen; + size_t listLen; size_t i, newLen; List *listRepPtr; @@ -440,7 +421,7 @@ TclListObjRange( if (fromIdx == TCL_INDEX_NONE) { fromIdx = 0; } - if (toIdx + 1 >= (size_t)listLen + 1) { + if (toIdx + 1 >= listLen + 1) { toIdx = listLen-1; } if (fromIdx + 1 > toIdx + 1) { @@ -527,7 +508,7 @@ Tcl_ListObjGetElements( Tcl_Interp *interp, /* Used to report errors if not NULL. */ Tcl_Obj *listPtr, /* List object for which an element array is * to be returned. */ - int *objcPtr, /* Where to store the count of objects + size_t *objcPtr, /* Where to store the count of objects * referenced by objv. */ Tcl_Obj ***objvPtr) /* Where to store the pointer to an array of * pointers to the list's objects. */ @@ -593,7 +574,7 @@ Tcl_ListObjAppendList( Tcl_Obj *listPtr, /* List object to append elements to. */ Tcl_Obj *elemListPtr) /* List obj with elements to append. */ { - int objc; + size_t objc; Tcl_Obj **objv; if (Tcl_IsShared(listPtr)) { @@ -653,7 +634,8 @@ Tcl_ListObjAppendElement( Tcl_Obj *objPtr) /* Object to append to listPtr's list. */ { List *listRepPtr, *newPtr = NULL; - int numElems, numRequired, needGrow, isShared, attempt; + size_t numElems, numRequired; + int needGrow, isShared, attempt; if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjAppendElement"); @@ -829,7 +811,7 @@ int Tcl_ListObjIndex( Tcl_Interp *interp, /* Used to report errors if not NULL. */ Tcl_Obj *listPtr, /* List object to index into. */ - int index, /* Index of element to return. */ + size_t index, /* Index of element to return. */ Tcl_Obj **objPtrPtr) /* The resulting Tcl_Obj* is stored here. */ { List *listRepPtr; @@ -851,7 +833,7 @@ Tcl_ListObjIndex( ListGetIntRep(listPtr, listRepPtr); } - if ((index < 0) || (index >= listRepPtr->elemCount)) { + if (index >= listRepPtr->elemCount) { *objPtrPtr = NULL; } else { *objPtrPtr = (&listRepPtr->elements)[index]; @@ -887,7 +869,7 @@ int Tcl_ListObjLength( Tcl_Interp *interp, /* Used to report errors if not NULL. */ Tcl_Obj *listPtr, /* List object whose #elements to return. */ - int *intPtr) /* The resulting int is stored here. */ + size_t *intPtr) /* The resulting size_t is stored here. */ { List *listRepPtr; @@ -955,15 +937,16 @@ int Tcl_ListObjReplace( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *listPtr, /* List object whose elements to replace. */ - int first, /* Index of first element to replace. */ - int count, /* Number of elements to replace. */ - int objc, /* Number of objects to insert. */ + size_t first, /* Index of first element to replace. */ + size_t count, /* Number of elements to replace. */ + size_t objc, /* Number of objects to insert. */ Tcl_Obj *const objv[]) /* An array of objc pointers to Tcl objects to * insert. */ { List *listRepPtr; Tcl_Obj **elemPtrs; - int needGrow, numElems, numRequired, numAfterLast, start, i, j, isShared; + size_t numElems, numRequired, numAfterLast, start, i, j; + int needGrow, isShared; if (Tcl_IsShared(listPtr)) { Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace"); @@ -1000,13 +983,13 @@ Tcl_ListObjReplace( elemPtrs = &listRepPtr->elements; numElems = listRepPtr->elemCount; - if (first < 0) { + if (first == TCL_INDEX_NONE) { first = 0; } if (first >= numElems) { first = numElems; /* So we'll insert after last element. */ } - if (count < 0) { + if (count == TCL_INDEX_NONE) { count = 0; } else if (first > INT_MAX - count /* Handle integer overflow */ || numElems < first+count) { @@ -1014,14 +997,6 @@ Tcl_ListObjReplace( count = numElems - first; } - if (objc > LIST_MAX - (numElems - count)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "max length of a Tcl list (%d elements) exceeded", - LIST_MAX)); - } - return TCL_ERROR; - } isShared = (listRepPtr->refCount > 1); numRequired = numElems - count + objc; /* Known <= LIST_MAX */ needGrow = numRequired > listRepPtr->maxElemCount; @@ -1033,7 +1008,7 @@ Tcl_ListObjReplace( if (needGrow && !isShared) { /* Try to use realloc */ List *newPtr = NULL; - int attempt = 2 * numRequired; + size_t attempt = 2 * numRequired; if (attempt <= LIST_MAX) { newPtr = (List *)Tcl_AttemptRealloc(listRepPtr, LIST_SIZE(attempt)); } @@ -1311,17 +1286,17 @@ Tcl_Obj * TclLindexFlat( Tcl_Interp *interp, /* Tcl interpreter. */ Tcl_Obj *listPtr, /* Tcl object representing the list. */ - int indexCount, /* Count of indices. */ + size_t indexCount, /* Count of indices. */ Tcl_Obj *const indexArray[])/* Array of pointers to Tcl objects that * represent the indices in the list. */ { - int i; + size_t i; Tcl_IncrRefCount(listPtr); for (i=0 ; i<indexCount && listPtr ; i++) { size_t index; - int listLen = 0; + size_t listLen = 0; Tcl_Obj **elemPtrs = NULL, *sublistCopy; /* @@ -1401,7 +1376,7 @@ TclLsetList( Tcl_Obj *indexArgPtr, /* Index or index-list arg to 'lset'. */ Tcl_Obj *valuePtr) /* Value arg to 'lset' or NULL to 'lpop'. */ { - int indexCount = 0; /* Number of indices in the index list. */ + size_t indexCount = 0; /* Number of indices in the index list. */ Tcl_Obj **indices = NULL; /* Vector of indices in the index list. */ Tcl_Obj *retValuePtr; /* Pointer to the list to be returned. */ size_t index; /* Current index in the list - discarded. */ @@ -1497,13 +1472,13 @@ Tcl_Obj * TclLsetFlat( Tcl_Interp *interp, /* Tcl interpreter. */ Tcl_Obj *listPtr, /* Pointer to the list being modified. */ - int indexCount, /* Number of index args. */ + size_t indexCount, /* Number of index args. */ Tcl_Obj *const indexArray[], /* Index args. */ Tcl_Obj *valuePtr) /* Value arg to 'lset' or NULL to 'lpop'. */ { - size_t index; - int result, len; + size_t index, len; + int result; Tcl_Obj *subListPtr, *retValuePtr, *chainPtr; Tcl_ObjInternalRep *irPtr; @@ -1548,7 +1523,7 @@ TclLsetFlat( */ do { - int elemCount; + size_t elemCount; Tcl_Obj *parentList, **elemPtrs; /* @@ -1576,8 +1551,8 @@ TclLsetFlat( } indexArray++; - if (index > (size_t)elemCount - || (valuePtr == NULL && index >= (size_t)elemCount)) { + if (index > elemCount + || (valuePtr == NULL && index >= elemCount)) { /* ...the index points outside the sublist. */ if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -1696,12 +1671,12 @@ TclLsetFlat( } /* - * Store valuePtr in proper sublist and return. The -1 is to avoid a - * compiler warning (not a problem because we checked that we have a - * proper list - or something convertible to one - above). + * Store valuePtr in proper sublist and return. The TCL_INDEX_NONE is + * to avoid a compiler warning (not a problem because we checked that + * we have a proper list - or something convertible to one - above). */ - len = -1; + len = TCL_INDEX_NONE; TclListObjLength(NULL, subListPtr, &len); if (valuePtr == NULL) { Tcl_ListObjReplace(NULL, subListPtr, index, 1, 0, NULL); @@ -1762,14 +1737,14 @@ TclListObjSetElement( * if not NULL. */ Tcl_Obj *listPtr, /* List object in which element should be * stored. */ - int index, /* Index of element to store. */ + size_t index, /* Index of element to store. */ Tcl_Obj *valuePtr) /* Tcl object to store in the designated list * element. */ { List *listRepPtr; /* Internal representation of the list being * modified. */ Tcl_Obj **elemPtrs; /* Pointers to elements of the list. */ - int elemCount; /* Number of elements in the list. */ + size_t elemCount; /* Number of elements in the list. */ /* * Ensure that the listPtr parameter designates an unshared list. @@ -1788,7 +1763,7 @@ TclListObjSetElement( if (length == 0) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%d\" out of range", index)); + "index \"%" TCL_Z_MODIFIER "d\" out of range", index)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", "OUTOFRANGE", NULL); } @@ -1807,10 +1782,10 @@ TclListObjSetElement( * Ensure that the index is in bounds. */ - if (index<0 || index>=elemCount) { + if (index>=elemCount) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "index \"%d\" out of range", index)); + "index \"%" TCL_Z_MODIFIER "d\" out of range", index)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", "OUTOFRANGE", NULL); } @@ -1986,7 +1961,8 @@ SetListFromAny( if (!TclHasStringRep(objPtr) && TclHasInternalRep(objPtr, &tclDictType)) { Tcl_Obj *keyPtr, *valuePtr; Tcl_DictSearch search; - int done, size; + int done; + size_t size; /* * Create the new list representation. Note that we do not need to do @@ -2018,7 +1994,7 @@ SetListFromAny( Tcl_DictObjNext(&search, &keyPtr, &valuePtr, &done); } } else { - int estCount; + size_t estCount; size_t length; const char *limit, *nextElem = Tcl_GetStringFromObj(objPtr, &length); @@ -2117,7 +2093,7 @@ UpdateStringOfList( { # define LOCAL_SIZE 64 char localFlags[LOCAL_SIZE], *flagPtr = NULL; - int numElems, i; + size_t numElems, i; size_t length, bytesNeeded = 0; const char *elem, *start; char *dst; diff --git a/generic/tclLoad.c b/generic/tclLoad.c index cca5b7a..8fc10ac 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -310,7 +310,7 @@ Tcl_LoadObjCmd( Tcl_DStringAppend(&pfx, prefix, -1); } else { Tcl_Obj *splitPtr, *pkgGuessPtr; - int pElements; + size_t pElements; const char *pkgGuess; /* diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 7f034fe..e503c30 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -4036,8 +4036,8 @@ NamespacePathCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp); - size_t i; - int nsObjc, result = TCL_ERROR; + size_t nsObjc, i; + int result = TCL_ERROR; Tcl_Obj **nsObjv; Tcl_Namespace **namespaceList = NULL; @@ -4075,7 +4075,7 @@ NamespacePathCmd( namespaceList = (Tcl_Namespace **)TclStackAlloc(interp, sizeof(Tcl_Namespace *) * nsObjc); - for (i=0 ; i<(size_t)nsObjc ; i++) { + for (i = 0; i < nsObjc; i++) { if (TclGetNamespaceFromObj(interp, nsObjv[i], &namespaceList[i]) != TCL_OK) { goto badNamespace; @@ -4428,7 +4428,7 @@ Tcl_SetNamespaceUnknownHandler( Tcl_Namespace *nsPtr, /* Namespace which is being updated. */ Tcl_Obj *handlerPtr) /* The new handler, or NULL to reset. */ { - int lstlen = 0; + size_t lstlen = 0; Namespace *currNsPtr = (Namespace *) nsPtr; /* @@ -5010,7 +5010,7 @@ TclLogCommandInfo( iPtr->errorStack = newObj; } if (iPtr->resetErrorStack) { - int len; + size_t len; iPtr->resetErrorStack = 0; TclListObjLength(interp, iPtr->errorStack, &len); @@ -5095,7 +5095,7 @@ TclErrorStackResetIf( iPtr->errorStack = newObj; } if (iPtr->resetErrorStack) { - int len; + size_t len; iPtr->resetErrorStack = 0; TclListObjLength(interp, iPtr->errorStack, &len); diff --git a/generic/tclOO.c b/generic/tclOO.c index b9c976e..da5723b 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -308,7 +308,7 @@ InitFoundation( Tcl_Obj *namePtr; Tcl_DString buffer; Command *cmdPtr; - int i; + size_t i; /* * Initialize the structure that holds the OO system core. This is @@ -960,7 +960,7 @@ TclOOReleaseClassContents( Object *oPtr) /* The object representing the class. */ { FOREACH_HASH_DECLS; - int i; + size_t i; Class *clsPtr = oPtr->classPtr, *tmpClsPtr; Method *mPtr; Foundation *fPtr = oPtr->fPtr; @@ -1121,7 +1121,7 @@ ObjectNamespaceDeleted( Tcl_Obj *filterObj, *variableObj; PrivateVariableMapping *privateVariable; Tcl_Interp *interp = oPtr->fPtr->interp; - int i; + size_t i; if (Destructing(oPtr)) { /* @@ -1362,7 +1362,8 @@ TclOORemoveFromInstances( Class *clsPtr) /* The class (possibly) containing the * reference to the instance. */ { - int i, res = 0; + size_t i; + int res = 0; Object *instPtr; FOREACH(instPtr, clsPtr->instances) { @@ -1424,7 +1425,8 @@ TclOORemoveFromMixins( Object *oPtr) /* The object (possibly) containing the * reference to the mixin. */ { - int i, res = 0; + size_t i; + int res = 0; Class *mixPtr; FOREACH(mixPtr, oPtr->mixins) { @@ -1459,7 +1461,8 @@ TclOORemoveFromSubclasses( Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { - int i, res = 0; + size_t i; + int res = 0; Class *subclsPtr; FOREACH(subclsPtr, superPtr->subclasses) { @@ -1523,7 +1526,8 @@ TclOORemoveFromMixinSubs( Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { - int i, res = 0; + size_t i; + int res = 0; Class *subclsPtr; FOREACH(subclsPtr, superPtr->mixinSubs) { @@ -1663,7 +1667,7 @@ Tcl_NewObjectInstance( const char *nsNameStr, /* Name of namespace to create inside object, * or NULL to ask the code to pick its own * unique name. */ - int objc, /* Number of arguments. Negative value means + size_t objc1, /* Number of arguments. Negative value means * do not call constructor. */ Tcl_Obj *const *objv, /* Argument list. */ int skip) /* Number of arguments to _not_ pass to the @@ -1672,6 +1676,7 @@ Tcl_NewObjectInstance( Class *classPtr = (Class *) cls; Object *oPtr; ClientData clientData[4]; + int objc = objc1; oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); if (oPtr == NULL) { @@ -1928,7 +1933,8 @@ Tcl_CopyObjectInstance( CallContext *contextPtr; Tcl_Obj *keyPtr, *filterObj, *variableObj, *args[3]; PrivateVariableMapping *privateVariable; - int i, result; + size_t i; + int result; /* * Sanity check. @@ -2551,7 +2557,7 @@ TclOOInvokeObject( * (PRIVATE_METHOD), or a *really* private * context (any other value; conventionally * 0). */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Array of argument objects. It is assumed * that the name of the method to invoke will * be at index 1. */ @@ -2622,7 +2628,7 @@ int TclOOObjectCmdCore( Object *oPtr, /* The object being invoked. */ Tcl_Interp *interp, /* The interpreter containing the object. */ - int objc, /* How many arguments are being passed in. */ + size_t objc1, /* How many arguments are being passed in. */ Tcl_Obj *const *objv, /* The array of arguments. */ int flags, /* Whether this is an invocation through the * public or the private command interface. */ @@ -2637,6 +2643,7 @@ TclOOObjectCmdCore( Object *callerObjPtr = NULL; Class *callerClsPtr = NULL; int result; + int objc = objc1; /* * If we've no method name, throw this directly into the unknown @@ -2794,7 +2801,7 @@ int Tcl_ObjectContextInvokeNext( Tcl_Interp *interp, Tcl_ObjectContext context, - int objc, + size_t objc1, Tcl_Obj *const *objv, int skip) { @@ -2802,6 +2809,7 @@ Tcl_ObjectContextInvokeNext( int savedIndex = contextPtr->index; int savedSkip = contextPtr->skip; int result; + int objc = objc1; if (contextPtr->index + 1 >= contextPtr->callPtr->numChain) { /* @@ -2995,7 +3003,7 @@ TclOOIsReachable( Class *targetPtr, Class *startPtr) { - int i; + size_t i; Class *superPtr; tailRecurse: @@ -3088,7 +3096,7 @@ Tcl_ObjectContextObject( return (Tcl_Object) ((CallContext *)context)->oPtr; } -int +size_t Tcl_ObjectContextSkippedArgs( Tcl_ObjectContext context) { diff --git a/generic/tclOO.decls b/generic/tclOO.decls index c6ffccd..14eafe3 100644 --- a/generic/tclOO.decls +++ b/generic/tclOO.decls @@ -68,7 +68,7 @@ declare 12 { } declare 13 { Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls, - const char *nameStr, const char *nsNameStr, int objc, + const char *nameStr, const char *nsNameStr, size_t objc, Tcl_Obj *const *objv, int skip) } declare 14 { @@ -84,7 +84,7 @@ declare 17 { Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context) } declare 18 { - int Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context) + size_t Tcl_ObjectContextSkippedArgs(Tcl_ObjectContext context) } declare 19 { void *Tcl_ClassGetMetadata(Tcl_Class clazz, @@ -104,7 +104,7 @@ declare 22 { } declare 23 { int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp, - Tcl_ObjectContext context, int objc, Tcl_Obj *const *objv, + Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv, int skip) } declare 24 { @@ -170,7 +170,7 @@ declare 4 { ProcedureMethod **pmPtrPtr) } declare 5 { - int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, int objc, + int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, size_t objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls) } declare 6 { @@ -200,16 +200,16 @@ declare 10 { } declare 11 { int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object, - Tcl_Class startCls, int publicPrivate, int objc, + Tcl_Class startCls, int publicPrivate, size_t objc, Tcl_Obj *const *objv) } declare 12 { - void TclOOObjectSetFilters(Object *oPtr, int numFilters, + void TclOOObjectSetFilters(Object *oPtr, size_t numFilters, Tcl_Obj *const *filters) } declare 13 { void TclOOClassSetFilters(Tcl_Interp *interp, Class *classPtr, - int numFilters, Tcl_Obj *const *filters) + size_t numFilters, Tcl_Obj *const *filters) } declare 14 { void TclOOObjectSetMixins(Object *oPtr, int numMixins, diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index eb929c8..9573720 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -85,11 +85,11 @@ TclOO_Class_Constructor( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); Tcl_Obj **invoke, *nameObj; - if (objc-1 > Tcl_ObjectContextSkippedArgs(context)) { + if (objc-1 > (int)Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "?definitionScript?"); return TCL_ERROR; - } else if (objc == Tcl_ObjectContextSkippedArgs(context)) { + } else if (objc == (int)Tcl_ObjectContextSkippedArgs(context)) { return TCL_OK; } @@ -366,7 +366,7 @@ TclOO_Object_Destroy( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); CallContext *contextPtr; - if (objc != Tcl_ObjectContextSkippedArgs(context)) { + if (objc != (int)Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -636,7 +636,7 @@ TclOO_Object_LinkVar( Namespace *savedNsPtr; int i; - if (objc-Tcl_ObjectContextSkippedArgs(context) < 0) { + if ((size_t)objc < Tcl_ObjectContextSkippedArgs(context)) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "?varName ...?"); return TCL_ERROR; @@ -738,7 +738,7 @@ TclOO_Object_VarName( CallFrame *framePtr = ((Interp *) interp)->varFramePtr; const char *arg; - if (Tcl_ObjectContextSkippedArgs(context)+1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context)+1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "varName"); return TCL_ERROR; @@ -777,7 +777,7 @@ TclOO_Object_VarName( Method *mPtr = callerContext->callPtr->chain[ callerContext->index].mPtr; PrivateVariableMapping *pvPtr; - int i; + size_t i; if (mPtr->declaringObjectPtr == oPtr) { FOREACH_STRUCT(pvPtr, oPtr->privateVariables) { diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 60666f4..c25d951 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -137,7 +137,7 @@ static inline int IsStillValid(CallChain *callPtr, Object *oPtr, int flags, int reuseMask); static Tcl_NRPostProc ResetFilterFlags; static Tcl_NRPostProc SetFilterFlags; -static int SortMethodNames(Tcl_HashTable *namesPtr, int flags, +static size_t SortMethodNames(Tcl_HashTable *namesPtr, int flags, const char ***stringsPtr); static inline void StashCallChain(Tcl_Obj *objPtr, CallChain *callPtr); @@ -445,7 +445,7 @@ TclOOGetSortedMethodList( * at. Is set-like in nature and keyed by * pointer to class. */ FOREACH_HASH_DECLS; - int i, numStrings; + size_t i, numStrings; Class *mixinPtr; Tcl_Obj *namePtr; Method *mPtr; @@ -521,7 +521,7 @@ TclOOGetSortedMethodList( return numStrings; } -int +size_t TclOOGetSortedClassMethodList( Class *clsPtr, /* The class to get the method names for. */ int flags, /* Whether we just want the public method @@ -535,7 +535,7 @@ TclOOGetSortedClassMethodList( /* Used to track what classes have been looked * at. Is set-like in nature and keyed by * pointer to class. */ - int numStrings; + size_t numStrings; Tcl_InitObjHashTable(&names); Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS); @@ -580,7 +580,7 @@ TclOOGetSortedClassMethodList( * ---------------------------------------------------------------------- */ -static int +static size_t SortMethodNames( Tcl_HashTable *namesPtr, /* The table of names; unsorted, but contains * whether the names are wanted and under what @@ -686,7 +686,7 @@ AddClassMethodNames( * pointers to the classes, and the values are * immaterial. */ { - int i; + size_t i; /* * If we've already started looking at this class, stop working on it now @@ -877,7 +877,8 @@ AddSimpleChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i, foundPrivate = 0, blockedUnexported = 0; + size_t i; + int foundPrivate = 0, blockedUnexported = 0; Tcl_HashEntry *hPtr; Method *mPtr; @@ -1149,7 +1150,8 @@ TclOOGetCallContext( CallContext *contextPtr; CallChain *callPtr; struct ChainBuilder cb; - int i, count, doFilters, donePrivate = 0; + size_t i, count; + int doFilters, donePrivate = 0; Tcl_HashEntry *hPtr; Tcl_HashTable doneFilters; @@ -1309,7 +1311,7 @@ TclOOGetCallContext( * cacheing of the method implementation (if relevant). */ - if (count == callPtr->numChain) { + if ((int)count == callPtr->numChain) { /* * Method does not actually exist. If we're dealing with constructors * or destructors, this isn't a problem. @@ -1326,12 +1328,13 @@ TclOOGetCallContext( oPtr->fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL); callPtr->flags |= OO_UNKNOWN_METHOD; callPtr->epoch = 0; - if (count == callPtr->numChain) { + if ((int)count == callPtr->numChain) { TclOODeleteChain(callPtr); return NULL; } } else if (doFilters && !donePrivate) { if (hPtr == NULL) { + int isNew; if (oPtr->flags & USE_CLASS_CACHE) { if (oPtr->selfCls->classChainCache == NULL) { oPtr->selfCls->classChainCache = @@ -1340,7 +1343,7 @@ TclOOGetCallContext( Tcl_InitObjHashTable(oPtr->selfCls->classChainCache); } hPtr = Tcl_CreateHashEntry(oPtr->selfCls->classChainCache, - (char *) methodNameObj, &i); + (char *) methodNameObj, &isNew); } else { if (oPtr->chainCache == NULL) { oPtr->chainCache = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable)); @@ -1348,7 +1351,7 @@ TclOOGetCallContext( Tcl_InitObjHashTable(oPtr->chainCache); } hPtr = Tcl_CreateHashEntry(oPtr->chainCache, - (char *) methodNameObj, &i); + (char *) methodNameObj, &isNew); } } callPtr->refCount++; @@ -1542,7 +1545,8 @@ AddClassFiltersToCallContext( int flags) /* Whether we've gone along a mixin link * yet. */ { - int i, clearedFlags = + size_t i; + int clearedFlags = flags & ~(TRAVERSED_MIXIN|OBJECT_MIXIN|BUILDING_MIXINS); Class *superPtr, *mixinPtr; Tcl_Obj *filterObj; @@ -1631,7 +1635,7 @@ AddPrivatesFromClassChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i; + size_t i; Class *superPtr; /* @@ -1709,7 +1713,8 @@ AddSimpleClassChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i, privateDanger = 0; + size_t i; + int privateDanger = 0; Class *superPtr; /* @@ -1794,7 +1799,7 @@ TclOORenderCallChain( Tcl_Obj *filterLiteral, *methodLiteral, *objectLiteral, *privateLiteral; Tcl_Obj *resultObj, *descObjs[4], **objv; Foundation *fPtr = TclOOGetFoundation(interp); - int i; + size_t i; /* * Allocate the literals (potentially) used in our description. @@ -1822,7 +1827,7 @@ TclOORenderCallChain( */ objv = (Tcl_Obj **)TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); - for (i = 0 ; i < callPtr->numChain ; i++) { + for (i = 0 ; i < (size_t)callPtr->numChain ; i++) { struct MInvoke *miPtr = &callPtr->chain[i]; descObjs[0] = @@ -1950,7 +1955,7 @@ AddSimpleDefineNamespaces( * building. */ { Class *mixinPtr; - int i; + size_t i; FOREACH(mixinPtr, oPtr->mixins) { AddSimpleClassDefineNamespaces(mixinPtr, definePtr, @@ -1979,7 +1984,7 @@ AddSimpleClassDefineNamespaces( int flags) /* What sort of define chain are we * building. */ { - int i; + size_t i; Class *superPtr; /* diff --git a/generic/tclOODecls.h b/generic/tclOODecls.h index 6ba5d14..3e31bc9 100644 --- a/generic/tclOODecls.h +++ b/generic/tclOODecls.h @@ -69,7 +69,7 @@ TCLAPI Tcl_Method Tcl_NewMethod(Tcl_Interp *interp, Tcl_Class cls, /* 13 */ TCLAPI Tcl_Object Tcl_NewObjectInstance(Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, - const char *nsNameStr, int objc, + const char *nsNameStr, size_t objc, Tcl_Obj *const *objv, int skip); /* 14 */ TCLAPI int Tcl_ObjectDeleted(Tcl_Object object); @@ -81,7 +81,7 @@ TCLAPI Tcl_Method Tcl_ObjectContextMethod(Tcl_ObjectContext context); /* 17 */ TCLAPI Tcl_Object Tcl_ObjectContextObject(Tcl_ObjectContext context); /* 18 */ -TCLAPI int Tcl_ObjectContextSkippedArgs( +TCLAPI size_t Tcl_ObjectContextSkippedArgs( Tcl_ObjectContext context); /* 19 */ TCLAPI void * Tcl_ClassGetMetadata(Tcl_Class clazz, @@ -99,7 +99,7 @@ TCLAPI void Tcl_ObjectSetMetadata(Tcl_Object object, void *metadata); /* 23 */ TCLAPI int Tcl_ObjectContextInvokeNext(Tcl_Interp *interp, - Tcl_ObjectContext context, int objc, + Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv, int skip); /* 24 */ TCLAPI Tcl_ObjectMapMethodNameProc * Tcl_ObjectGetMethodNameMapper( @@ -145,17 +145,17 @@ typedef struct TclOOStubs { Tcl_Obj * (*tcl_MethodName) (Tcl_Method method); /* 10 */ Tcl_Method (*tcl_NewInstanceMethod) (Tcl_Interp *interp, Tcl_Object object, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 11 */ Tcl_Method (*tcl_NewMethod) (Tcl_Interp *interp, Tcl_Class cls, Tcl_Obj *nameObj, int flags, const Tcl_MethodType *typePtr, void *clientData); /* 12 */ - Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, int objc, Tcl_Obj *const *objv, int skip); /* 13 */ + Tcl_Object (*tcl_NewObjectInstance) (Tcl_Interp *interp, Tcl_Class cls, const char *nameStr, const char *nsNameStr, size_t objc, Tcl_Obj *const *objv, int skip); /* 13 */ int (*tcl_ObjectDeleted) (Tcl_Object object); /* 14 */ int (*tcl_ObjectContextIsFiltering) (Tcl_ObjectContext context); /* 15 */ Tcl_Method (*tcl_ObjectContextMethod) (Tcl_ObjectContext context); /* 16 */ Tcl_Object (*tcl_ObjectContextObject) (Tcl_ObjectContext context); /* 17 */ - int (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */ + size_t (*tcl_ObjectContextSkippedArgs) (Tcl_ObjectContext context); /* 18 */ void * (*tcl_ClassGetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr); /* 19 */ void (*tcl_ClassSetMetadata) (Tcl_Class clazz, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 20 */ void * (*tcl_ObjectGetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr); /* 21 */ void (*tcl_ObjectSetMetadata) (Tcl_Object object, const Tcl_ObjectMetadataType *typePtr, void *metadata); /* 22 */ - int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, int objc, Tcl_Obj *const *objv, int skip); /* 23 */ + int (*tcl_ObjectContextInvokeNext) (Tcl_Interp *interp, Tcl_ObjectContext context, size_t objc, Tcl_Obj *const *objv, int skip); /* 23 */ Tcl_ObjectMapMethodNameProc * (*tcl_ObjectGetMethodNameMapper) (Tcl_Object object); /* 24 */ void (*tcl_ObjectSetMethodNameMapper) (Tcl_Object object, Tcl_ObjectMapMethodNameProc *mapMethodNameProc); /* 25 */ void (*tcl_ClassSetConstructor) (Tcl_Interp *interp, Tcl_Class clazz, Tcl_Method method); /* 26 */ diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index aa93e4e..d832d73 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -249,10 +249,10 @@ RecomputeClassCacheFlag( void TclOOObjectSetFilters( Object *oPtr, - int numFilters, + size_t numFilters, Tcl_Obj *const *filters) { - int i; + size_t i; if (oPtr->filters.num) { Tcl_Obj *filterObj; @@ -309,10 +309,10 @@ void TclOOClassSetFilters( Tcl_Interp *interp, Class *classPtr, - int numFilters, + size_t numFilters, Tcl_Obj *const *filters) { - int i; + size_t i; if (classPtr->filters.num) { Tcl_Obj *filterObj; @@ -375,7 +375,7 @@ TclOOObjectSetMixins( Class *const *mixins) { Class *mixinPtr; - int i; + size_t i; if (numMixins == 0) { if (oPtr->mixins.num != 0) { @@ -436,7 +436,7 @@ TclOOClassSetMixins( Class *const *mixins) { Class *mixinPtr; - int i; + size_t i; if (numMixins == 0) { if (classPtr->mixins.num != 0) { @@ -485,11 +485,12 @@ TclOOClassSetMixins( static inline void InstallStandardVariableMapping( VariableNameList *vnlPtr, - int varc, + size_t varc, Tcl_Obj *const *varv) { Tcl_Obj *variableObj; - int i, n, created; + size_t i, n; + int created; Tcl_HashTable uniqueTable; for (i=0 ; i<varc ; i++) { @@ -534,12 +535,13 @@ InstallStandardVariableMapping( static inline void InstallPrivateVariableMapping( PrivateVariableList *pvlPtr, - int varc, + size_t varc, Tcl_Obj *const *varv, int creationEpoch) { PrivateVariableMapping *privatePtr; - int i, n, created; + size_t i, n; + int created; Tcl_HashTable uniqueTable; for (i=0 ; i<varc ; i++) { @@ -1032,7 +1034,8 @@ MagicDefinitionInvoke( { Tcl_Obj *objPtr, *obj2Ptr, **objs; Tcl_Command cmd; - int isRoot, dummy, result, offset = cmdIndex + 1; + int isRoot, result, offset = cmdIndex + 1; + size_t dummy; /* * More than one argument: fire them through the ensemble processing @@ -2322,9 +2325,9 @@ ClassFilterGet( { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj, *filterObj; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2355,10 +2358,10 @@ ClassFilterSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int filterc; + size_t filterc; Tcl_Obj **filterv; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "filterList"); return TCL_ERROR; @@ -2403,9 +2406,9 @@ ClassMixinGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; Class *mixinPtr; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2438,11 +2441,11 @@ ClassMixinSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int mixinc, i; + size_t mixinc, i; Tcl_Obj **mixinv; Class **mixins; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "mixinList"); return TCL_ERROR; @@ -2509,9 +2512,9 @@ ClassSuperGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; Class *superPtr; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2543,11 +2546,12 @@ ClassSuperSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int superc, i, j; + size_t superc, j; + size_t i; Tcl_Obj **superv; Class **superclasses, *superPtr; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "superclassList"); return TCL_ERROR; @@ -2675,9 +2679,9 @@ ClassVarsGet( { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2718,11 +2722,11 @@ ClassVarsSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int varc; - Tcl_Obj **varv; int i; + size_t varc; + Tcl_Obj **varv; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "filterList"); return TCL_ERROR; @@ -2741,7 +2745,7 @@ ClassVarsSet( return TCL_ERROR; } - for (i = 0; i < varc; i++) { + for (i = 0; i < (int)varc; i++) { const char *varName = TclGetString(varv[i]); if (strstr(varName, "::") != NULL) { @@ -2790,9 +2794,9 @@ ObjFilterGet( { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj, *filterObj; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2817,10 +2821,10 @@ ObjFilterSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int filterc; + size_t filterc; Tcl_Obj **filterv; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "filterList"); return TCL_ERROR; @@ -2859,9 +2863,9 @@ ObjMixinGet( Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; Class *mixinPtr; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2889,12 +2893,12 @@ ObjMixinSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int mixinc; + int i; + size_t mixinc; Tcl_Obj **mixinv; Class **mixins; - int i; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "mixinList"); return TCL_ERROR; @@ -2909,7 +2913,7 @@ ObjMixinSet( mixins = (Class **)TclStackAlloc(interp, sizeof(Class *) * mixinc); - for (i = 0; i < mixinc; i++) { + for (i = 0; i < (int)mixinc; i++) { mixins[i] = GetClassInOuterContext(interp, mixinv[i], "may only mix in classes"); if (mixins[i] == NULL) { @@ -2944,9 +2948,9 @@ ObjVarsGet( { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); Tcl_Obj *resultObj; - int i; + size_t i; - if (Tcl_ObjectContextSkippedArgs(context) != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, NULL); return TCL_ERROR; @@ -2981,10 +2985,10 @@ ObjVarsSet( Tcl_Obj *const *objv) { Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp); - int varc, i; + size_t varc, i; Tcl_Obj **varv; - if (Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { + if ((int)Tcl_ObjectContextSkippedArgs(context) + 1 != objc) { Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, "variableList"); return TCL_ERROR; diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c index ede00b8..8123cd2 100644 --- a/generic/tclOOInfo.c +++ b/generic/tclOOInfo.c @@ -194,7 +194,7 @@ InfoObjectClassCmd( return TCL_OK; } else { Class *mixinPtr, *o2clsPtr; - int i; + size_t i; o2clsPtr = GetClassFromObj(interp, objv[2]); if (o2clsPtr == NULL) { @@ -307,7 +307,7 @@ InfoObjectFiltersCmd( int objc, Tcl_Obj *const objv[]) { - int i; + size_t i; Tcl_Obj *filterObj, *resultObj; Object *oPtr; @@ -410,7 +410,8 @@ InfoObjectIsACmd( IsClass, IsMetaclass, IsMixin, IsObject, IsType }; Object *oPtr, *o2Ptr; - int idx, i, result = 0; + int idx, result = 0; + size_t i; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "category objName ?arg ...?"); @@ -702,7 +703,7 @@ InfoObjectMixinsCmd( Class *mixinPtr; Object *oPtr; Tcl_Obj *resultObj; - int i; + size_t i; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "objName"); @@ -809,7 +810,8 @@ InfoObjectVariablesCmd( { Object *oPtr; Tcl_Obj *resultObj; - int i, isPrivate = 0; + size_t i; + int isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?"); @@ -1145,7 +1147,7 @@ InfoClassFiltersCmd( int objc, Tcl_Obj *const objv[]) { - int i; + size_t i; Tcl_Obj *filterObj, *resultObj; Class *clsPtr; @@ -1236,7 +1238,7 @@ InfoClassInstancesCmd( { Object *oPtr; Class *clsPtr; - int i; + size_t i; const char *pattern = NULL; Tcl_Obj *resultObj; @@ -1359,7 +1361,7 @@ InfoClassMethodsCmd( TclNewObj(resultObj); if (recurse) { const char **names; - int i, numNames = TclOOGetSortedClassMethodList(clsPtr, flag, &names); + size_t i, numNames = TclOOGetSortedClassMethodList(clsPtr, flag, &names); for (i=0 ; i<numNames ; i++) { Tcl_ListObjAppendElement(NULL, resultObj, @@ -1452,7 +1454,7 @@ InfoClassMixinsCmd( { Class *clsPtr, *mixinPtr; Tcl_Obj *resultObj; - int i; + size_t i; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1494,7 +1496,7 @@ InfoClassSubsCmd( { Class *clsPtr, *subclassPtr; Tcl_Obj *resultObj; - int i; + size_t i; const char *pattern = NULL; if (objc != 2 && objc != 3) { @@ -1549,7 +1551,7 @@ InfoClassSupersCmd( { Class *clsPtr, *superPtr; Tcl_Obj *resultObj; - int i; + size_t i; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "className"); @@ -1588,7 +1590,8 @@ InfoClassVariablesCmd( { Class *clsPtr; Tcl_Obj *resultObj; - int i, isPrivate = 0; + size_t i; + int isPrivate = 0; if (objc != 2 && objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?"); diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 342def6..5ded108 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -149,9 +149,9 @@ typedef struct { */ #define LIST_STATIC(listType_t) \ - struct { int num; listType_t *list; } + struct { size_t num; listType_t *list; } #define LIST_DYNAMIC(listType_t) \ - struct { int num, size; listType_t *list; } + struct { size_t num, size; listType_t *list; } /* * These types are needed in function arguments. @@ -604,7 +604,7 @@ MODULE_SCOPE Foundation *TclOOGetFoundation(Tcl_Interp *interp); MODULE_SCOPE Tcl_Obj * TclOOGetFwdFromMethod(Method *mPtr); MODULE_SCOPE Proc * TclOOGetProcFromMethod(Method *mPtr); MODULE_SCOPE Tcl_Obj * TclOOGetMethodBody(Method *mPtr); -MODULE_SCOPE int TclOOGetSortedClassMethodList(Class *clsPtr, +MODULE_SCOPE size_t TclOOGetSortedClassMethodList(Class *clsPtr, int flags, const char ***stringsPtr); MODULE_SCOPE int TclOOGetSortedMethodList(Object *oPtr, Object *contextObj, Class *contextCls, int flags, diff --git a/generic/tclOOIntDecls.h b/generic/tclOOIntDecls.h index 6a5cfd3..9fa90fb 100644 --- a/generic/tclOOIntDecls.h +++ b/generic/tclOOIntDecls.h @@ -42,7 +42,7 @@ TCLAPI Method * TclOONewProcMethod(Tcl_Interp *interp, Class *clsPtr, ProcedureMethod **pmPtrPtr); /* 5 */ TCLAPI int TclOOObjectCmdCore(Object *oPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv, + size_t objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 6 */ TCLAPI int TclOOIsReachable(Class *targetPtr, Class *startPtr); @@ -75,14 +75,14 @@ TCLAPI Tcl_Method TclOONewProcMethodEx(Tcl_Interp *interp, /* 11 */ TCLAPI int TclOOInvokeObject(Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, - int publicPrivate, int objc, + int publicPrivate, size_t objc, Tcl_Obj *const *objv); /* 12 */ -TCLAPI void TclOOObjectSetFilters(Object *oPtr, int numFilters, - Tcl_Obj *const *filters); +TCLAPI void TclOOObjectSetFilters(Object *oPtr, + size_t numFilters, Tcl_Obj *const *filters); /* 13 */ TCLAPI void TclOOClassSetFilters(Tcl_Interp *interp, - Class *classPtr, int numFilters, + Class *classPtr, size_t numFilters, Tcl_Obj *const *filters); /* 14 */ TCLAPI void TclOOObjectSetMixins(Object *oPtr, int numMixins, @@ -101,15 +101,15 @@ typedef struct TclOOIntStubs { Tcl_Method (*tclOOMakeProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, const char *namePtr, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, const Tcl_MethodType *typePtr, void *clientData, Proc **procPtrPtr); /* 2 */ Method * (*tclOONewProcInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 3 */ Method * (*tclOONewProcMethod) (Tcl_Interp *interp, Class *clsPtr, int flags, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, ProcedureMethod **pmPtrPtr); /* 4 */ - int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */ + int (*tclOOObjectCmdCore) (Object *oPtr, Tcl_Interp *interp, size_t objc, Tcl_Obj *const *objv, int publicOnly, Class *startCls); /* 5 */ int (*tclOOIsReachable) (Class *targetPtr, Class *startPtr); /* 6 */ Method * (*tclOONewForwardMethod) (Tcl_Interp *interp, Class *clsPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 7 */ Method * (*tclOONewForwardInstanceMethod) (Tcl_Interp *interp, Object *oPtr, int isPublic, Tcl_Obj *nameObj, Tcl_Obj *prefixObj); /* 8 */ Tcl_Method (*tclOONewProcInstanceMethodEx) (Tcl_Interp *interp, Tcl_Object oPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 9 */ Tcl_Method (*tclOONewProcMethodEx) (Tcl_Interp *interp, Tcl_Class clsPtr, TclOO_PreCallProc *preCallPtr, TclOO_PostCallProc *postCallPtr, ProcErrorProc *errProc, void *clientData, Tcl_Obj *nameObj, Tcl_Obj *argsObj, Tcl_Obj *bodyObj, int flags, void **internalTokenPtr); /* 10 */ - int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, int objc, Tcl_Obj *const *objv); /* 11 */ - void (*tclOOObjectSetFilters) (Object *oPtr, int numFilters, Tcl_Obj *const *filters); /* 12 */ - void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, int numFilters, Tcl_Obj *const *filters); /* 13 */ + int (*tclOOInvokeObject) (Tcl_Interp *interp, Tcl_Object object, Tcl_Class startCls, int publicPrivate, size_t objc, Tcl_Obj *const *objv); /* 11 */ + void (*tclOOObjectSetFilters) (Object *oPtr, size_t numFilters, Tcl_Obj *const *filters); /* 12 */ + void (*tclOOClassSetFilters) (Tcl_Interp *interp, Class *classPtr, size_t numFilters, Tcl_Obj *const *filters); /* 13 */ void (*tclOOObjectSetMixins) (Object *oPtr, int numMixins, Class *const *mixins); /* 14 */ void (*tclOOClassSetMixins) (Tcl_Interp *interp, Class *classPtr, int numMixins, Class *const *mixins); /* 15 */ } TclOOIntStubs; diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index b205043..3d81912 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -335,7 +335,7 @@ TclOONewProcInstanceMethod( * structure's contents. NULL if caller is not * interested. */ { - int argsLen; + size_t argsLen; ProcedureMethod *pmPtr; Tcl_Method method; @@ -387,13 +387,13 @@ TclOONewProcMethod( * structure's contents. NULL if caller is not * interested. */ { - int argsLen; /* -1 => delete argsObj before exit */ + size_t argsLen; /* TCL_INDEX_NONE => delete argsObj before exit */ ProcedureMethod *pmPtr; const char *procName; Tcl_Method method; if (argsObj == NULL) { - argsLen = -1; + argsLen = TCL_INDEX_NONE; TclNewObj(argsObj); Tcl_IncrRefCount(argsObj); procName = "<destructor>"; @@ -412,7 +412,7 @@ TclOONewProcMethod( method = TclOOMakeProcMethod(interp, clsPtr, flags, nameObj, procName, argsObj, bodyObj, &procMethodType, pmPtr, &pmPtr->procPtr); - if (argsLen == -1) { + if (argsLen == TCL_INDEX_NONE) { Tcl_DecrRefCount(argsObj); } if (method == NULL) { @@ -987,8 +987,8 @@ ProcedureMethodCompiledVarConnect( Tcl_Obj *variableObj; PrivateVariableMapping *privateVar; Tcl_HashEntry *hPtr; - int i, isNew, cacheIt; - size_t varLen, len; + int isNew, cacheIt; + size_t i, varLen, len; const char *match, *varName; /* @@ -1387,7 +1387,7 @@ TclOONewForwardInstanceMethod( Tcl_Obj *prefixObj) /* List of arguments that form the command * prefix to forward to. */ { - int prefixLen; + size_t prefixLen; ForwardMethod *fmPtr; if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) { @@ -1426,7 +1426,7 @@ TclOONewForwardMethod( Tcl_Obj *prefixObj) /* List of arguments that form the command * prefix to forward to. */ { - int prefixLen; + size_t prefixLen; ForwardMethod *fmPtr; if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) { @@ -1468,7 +1468,9 @@ InvokeForwardMethod( CallContext *contextPtr = (CallContext *) context; ForwardMethod *fmPtr = (ForwardMethod *)clientData; Tcl_Obj **argObjs, **prefixObjs; - int numPrefixes, len, skip = contextPtr->skip; + size_t numPrefixes; + int len; + int skip = contextPtr->skip; /* * Build the real list of arguments to use. Note that we know that the diff --git a/generic/tclObj.c b/generic/tclObj.c index 09d8168..41f3a14 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -835,7 +835,7 @@ Tcl_AppendAllObjTypes( { Tcl_HashEntry *hPtr; Tcl_HashSearch search; - int numElems; + size_t numElems; /* * Get the test for a valid list out of the way first. diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 9f655ea..8c81568 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -476,7 +476,7 @@ Tcl_PathType TclFSGetPathType( Tcl_Obj *pathPtr, const Tcl_Filesystem **filesystemPtrPtr, - int *driveNameLengthPtr) + size_t *driveNameLengthPtr) { FsPath *fsPathPtr; @@ -666,7 +666,7 @@ TclPathPart( goto standardPath; } } else { - int splitElements; + size_t splitElements; Tcl_Obj *splitPtr, *resultPtr; standardPath: @@ -804,17 +804,17 @@ Tcl_Obj * Tcl_FSJoinPath( Tcl_Obj *listObj, /* Path elements to join, may have a zero * reference count. */ - int elements) /* Number of elements to use (-1 = all) */ + size_t elements) /* Number of elements to use (-1 = all) */ { Tcl_Obj *res; - int objc; + size_t objc; Tcl_Obj **objv; if (TclListObjLength(NULL, listObj, &objc) != TCL_OK) { return NULL; } - elements = ((elements >= 0) && (elements <= objc)) ? elements : objc; + elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc; TclListObjGetElements(NULL, listObj, &objc, &objv); res = TclJoinPath(elements, objv, 0); return res; @@ -822,13 +822,13 @@ Tcl_FSJoinPath( Tcl_Obj * TclJoinPath( - int elements, /* Number of elements to use (-1 = all) */ + size_t elements, /* Number of elements to use */ Tcl_Obj * const objv[], /* Path elements to join */ int forceRelative) /* If non-zero, assume all more paths are * relative (e. g. simple normalization) */ { Tcl_Obj *res = NULL; - int i; + size_t i; const Tcl_Filesystem *fsPtr = NULL; assert ( elements >= 0 ); @@ -934,7 +934,7 @@ TclJoinPath( assert ( res == NULL ); for (i = 0; i < elements; i++) { - int driveNameLength; + size_t driveNameLength; size_t strEltLen, length; Tcl_PathType type; char *strElt, *ptr; @@ -2310,7 +2310,7 @@ SetFsPathFromAny( * beginning with ~ are part of the native filesystem. */ - int objc; + size_t objc; Tcl_Obj **objv; Tcl_Obj *parts = TclpNativeSplitPath(pathPtr, NULL); diff --git a/generic/tclPipe.c b/generic/tclPipe.c index b9c37e0..aac031b 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -1021,7 +1021,7 @@ Tcl_Channel Tcl_OpenCommandChannel( Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be * NULL. */ - int argc, /* How many arguments. */ + size_t argc, /* How many arguments. */ const char **argv, /* Array of arguments for command pipe. */ int flags) /* Or'ed combination of TCL_STDIN, TCL_STDOUT, * TCL_STDERR, and TCL_ENFORCE_MODE. */ diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 2871068..348d0c0 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -426,7 +426,7 @@ Tcl_PkgRequireProc( Tcl_Interp *interp, /* Interpreter in which package is now * available. */ const char *name, /* Name of desired package. */ - int reqc, /* Requirements constraining the desired + size_t reqc, /* Requirements constraining the desired * version. */ Tcl_Obj *const reqv[], /* 0 means to use the latest version * available. */ @@ -1079,7 +1079,8 @@ TclNRPackageObjCmd( PKG_VERSIONS, PKG_VSATISFIES }; Interp *iPtr = (Interp *) interp; - int optionIndex, exact, i, newobjc, satisfies; + int optionIndex, exact, satisfies; + size_t i, newobjc; PkgAvail *availPtr, *prevPtr; Package *pkgPtr; Tcl_HashEntry *hPtr; @@ -1123,7 +1124,7 @@ TclNRPackageObjCmd( PkgFiles *pkgFiles = (PkgFiles *) Tcl_GetAssocData(interp, "tclPkgFiles", NULL); - for (i = 2; i < objc; i++) { + for (i = 2; i < (size_t)objc; i++) { keyString = TclGetString(objv[i]); if (pkgFiles) { hPtr = Tcl_FindHashEntry(&pkgFiles->table, keyString); diff --git a/generic/tclProc.c b/generic/tclProc.c index 9b5d163..c7c5de0 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -404,10 +404,10 @@ TclCreateProc( Interp *iPtr = (Interp *) interp; Proc *procPtr = NULL; - int i, result, numArgs; + size_t i, numArgs; CompiledLocal *localPtr = NULL; Tcl_Obj **argArray; - int precompiled = 0; + int precompiled = 0, result; ProcGetIntRep(bodyPtr, procPtr); if (procPtr != NULL) { @@ -490,9 +490,9 @@ TclCreateProc( } if (precompiled) { - if (numArgs > procPtr->numArgs) { + if (numArgs > (size_t)procPtr->numArgs) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": arg list contains %d entries, " + "procedure \"%s\": arg list contains %" TCL_Z_MODIFIER "d entries, " "precompiled header expects %d", procName, numArgs, procPtr->numArgs)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", @@ -507,8 +507,7 @@ TclCreateProc( for (i = 0; i < numArgs; i++) { const char *argname, *argnamei, *argnamelast; - int fieldCount; - size_t nameLength; + size_t fieldCount, nameLength; Tcl_Obj **fieldValues; /* @@ -583,12 +582,12 @@ TclCreateProc( if ((localPtr->nameLength != nameLength) || (memcmp(localPtr->name, argname, nameLength) != 0) - || (localPtr->frameIndex != i) + || ((size_t)localPtr->frameIndex != i) || !(localPtr->flags & VAR_ARGUMENT) || (localPtr->defValuePtr == NULL && fieldCount == 2) || (localPtr->defValuePtr != NULL && fieldCount != 2)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": formal parameter %d is " + "procedure \"%s\": formal parameter %" TCL_Z_MODIFIER "d is " "inconsistent with precompiled body", procName, i)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); @@ -919,7 +918,8 @@ TclNRUplevelObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?level? command ?arg ...?"); return TCL_ERROR; } else if (!TclHasStringRep(objv[1]) && objc == 2) { - int status ,llength; + int status; + size_t llength; status = TclListObjLength(interp, objv[1], &llength); if (status == TCL_OK && llength > 1) { /* the first argument can't interpreted as a level. Avoid @@ -2383,7 +2383,8 @@ SetLambdaFromAny( Interp *iPtr = (Interp *) interp; const char *name; Tcl_Obj *argsPtr, *bodyPtr, *nsObjPtr, **objv; - int isNew, objc, result; + int isNew, result; + size_t objc; CmdFrame *cfPtr = NULL; Proc *procPtr; diff --git a/generic/tclProcess.c b/generic/tclProcess.c index c7139aa..484314fc 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -463,10 +463,9 @@ ProcessStatusObjCmd( Tcl_HashEntry *entry; Tcl_HashSearch search; ProcessInfo *info; - int numPids; + size_t i, numPids; Tcl_Obj **pidObjs; int result; - int i; int pid; Tcl_Obj *const *savedobjv = objv; static const char *const switches[] = { @@ -609,11 +608,9 @@ ProcessPurgeObjCmd( Tcl_HashEntry *entry; Tcl_HashSearch search; ProcessInfo *info; - int numPids; + size_t i, numPids; Tcl_Obj **pidObjs; - int result; - int i; - int pid; + int result, pid; if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pids?"); diff --git a/generic/tclResult.c b/generic/tclResult.c index 82abbaa..b5573ae 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -733,7 +733,7 @@ TclProcessReturn( Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORSTACK], &valuePtr); if (valuePtr != NULL) { - int len, valueObjc; + size_t len, valueObjc; Tcl_Obj **valueObjv; if (Tcl_IsShared(iPtr->errorStack)) { @@ -910,7 +910,7 @@ TclMergeReturnOptions( Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr); if (valuePtr != NULL) { - int length; + size_t length; if (TCL_ERROR == TclListObjLength(NULL, valuePtr, &length )) { /* @@ -932,9 +932,9 @@ TclMergeReturnOptions( Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORSTACK], &valuePtr); if (valuePtr != NULL) { - int length; + size_t length; - if (TCL_ERROR == TclListObjLength(NULL, valuePtr, &length )) { + if (TCL_ERROR == TclListObjLength(NULL, valuePtr, &length)) { /* * Value is not a list, which is illegal for -errorstack. */ @@ -1100,7 +1100,8 @@ Tcl_SetReturnOptions( Tcl_Interp *interp, Tcl_Obj *options) { - int objc, level, code; + size_t objc; + int level, code; Tcl_Obj **objv, *mergedOpts; Tcl_IncrRefCount(options); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index f6156d1..e672ea8 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -556,7 +556,7 @@ TclParseNumber( return TCL_ERROR; } if (TclHasInternalRep(objPtr, &tclListType)) { - int length; + size_t length; /* A list can only be a (single) number if its length == 1 */ TclListObjLength(NULL, objPtr, &length); if (length != 1) { diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 9d28868..9fa9290 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -466,7 +466,7 @@ int TclCheckEmptyString( Tcl_Obj *objPtr) { - int length = -1; + size_t length = TCL_INDEX_NONE; if (objPtr->bytes == &tclEmptyString) { return TCL_EMPTYSTRING_YES; @@ -1717,12 +1717,12 @@ Tcl_AppendFormatToObj( Tcl_Interp *interp, Tcl_Obj *appendObj, const char *format, - int objc, + size_t objc, Tcl_Obj *const objv[]) { const char *span = format, *msg, *errCode; - int objIndex = 0, gotXpg = 0, gotSequential = 0; - size_t originalLength, limit, numBytes = 0; + int gotXpg = 0, gotSequential = 0; + size_t objIndex = 0, originalLength, limit, numBytes = 0; Tcl_UniChar ch = 0; static const char *mixedXPG = "cannot mix \"%\" and \"%n$\" conversion specifiers"; @@ -1814,7 +1814,7 @@ Tcl_AppendFormatToObj( } gotSequential = 1; } - if ((objIndex < 0) || (objIndex >= objc)) { + if (objIndex >= objc) { msg = badIndex[gotXpg]; errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH"; goto errorMsg; @@ -2484,7 +2484,7 @@ Tcl_Obj * Tcl_Format( Tcl_Interp *interp, const char *format, - int objc, + size_t objc, Tcl_Obj *const objv[]) { int result; @@ -2517,7 +2517,8 @@ AppendPrintfToObjVA( const char *format, va_list argList) { - int code, objc; + int code; + size_t objc; Tcl_Obj **objv, *list; const char *p; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 1759171..97e2fdd 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -86,6 +86,106 @@ static void uniCodePanic() { #define TclUtfNext Tcl_UtfNext #define TclUtfPrev Tcl_UtfPrev +#define TclListObjGetElements_ LOGetElements +#define TclListObjLength_ LOLength +#define TclDictObjSize_ DOSize +#define TclSplitList_ SplitList +#define TclSplitPath_ SplitPath +#define TclFSSplitPath_ FSSplitPath +#define TclParseArgsObjv_ ParseArgsObjv +int LOGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, + int *objcPtr, Tcl_Obj ***objvPtr) { + size_t n = TCL_INDEX_NONE; + int result = Tcl_ListObjGetElements(interp, listPtr, &n, objvPtr); + if (objcPtr) { + if ((result == TCL_OK) && (n > INT_MAX)) { + if (interp) { + Tcl_AppendResult(interp, "List too large to be processed", NULL); + } + return TCL_ERROR; + } + *objcPtr = n; + } + return result; +} +int LOLength(Tcl_Interp *interp, Tcl_Obj *listPtr, + int *lengthPtr) { + size_t n = TCL_INDEX_NONE; + int result = TclListObjLength(interp, listPtr, &n); + if (lengthPtr) { + if ((result == TCL_OK) && (n > INT_MAX)) { + if (interp) { + Tcl_AppendResult(interp, "List too large to be processed", NULL); + } + return TCL_ERROR; + } + *lengthPtr = n; + } + return result; +} +static int DOSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, + int *sizePtr) { + size_t n = TCL_INDEX_NONE; + int result = Tcl_DictObjSize(interp, dictPtr, &n); + if (sizePtr) { + if ((result == TCL_OK) && (n > INT_MAX)) { + if (interp) { + Tcl_AppendResult(interp, "Dict too large to be processed", NULL); + } + return TCL_ERROR; + } + *sizePtr = n; + } + return result; +} +static int SplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, + const char ***argvPtr) { + size_t n = TCL_INDEX_NONE; + int result = Tcl_SplitList(interp, listStr, &n, argvPtr); + if (argcPtr) { + if ((result == TCL_OK) && (n > INT_MAX)) { + if (interp) { + Tcl_AppendResult(interp, "List too large to be processed", NULL); + } + Tcl_Free((void *)*argvPtr); + return TCL_ERROR; + } + *argcPtr = n; + } + return result; +} +static void SplitPath(const char *path, int *argcPtr, const char ***argvPtr) { + size_t n = TCL_INDEX_NONE; + Tcl_SplitPath(path, &n, argvPtr); + if (argcPtr) { + if (n > INT_MAX) { + n = TCL_INDEX_NONE; /* No other way to return an error-situation */ + Tcl_Free((void *)*argvPtr); + *argvPtr = NULL; + } + *argcPtr = n; + } +} +static Tcl_Obj *FSSplitPath(Tcl_Obj *pathPtr, int *lenPtr) { + size_t n = TCL_INDEX_NONE; + Tcl_Obj *result = Tcl_FSSplitPath(pathPtr, &n); + if (lenPtr) { + if (result && (n > INT_MAX)) { + Tcl_DecrRefCount(result); + return NULL; + } + *lenPtr = n; + } + return result; +} +static int ParseArgsObjv(Tcl_Interp *interp, + const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, + Tcl_Obj ***remObjv) { + size_t n = (*objcPtr < 0) ? TCL_INDEX_NONE: (size_t)*objcPtr ; + int result = Tcl_ParseArgsObjv(interp, argTable, &n, objv, remObjv); + *objcPtr = (int)n; + return result; +} #define TclBN_mp_add mp_add #define TclBN_mp_add_d mp_add_d @@ -736,9 +836,9 @@ const TclStubs tclStubs = { Tcl_InvalidateStringRep, /* 42 */ Tcl_ListObjAppendList, /* 43 */ Tcl_ListObjAppendElement, /* 44 */ - Tcl_ListObjGetElements, /* 45 */ + TclListObjGetElements_, /* 45 */ Tcl_ListObjIndex, /* 46 */ - Tcl_ListObjLength, /* 47 */ + TclListObjLength_, /* 47 */ Tcl_ListObjReplace, /* 48 */ 0, /* 49 */ Tcl_NewByteArrayObj, /* 50 */ @@ -933,8 +1033,8 @@ const TclStubs tclStubs = { Tcl_SignalId, /* 239 */ Tcl_SignalMsg, /* 240 */ Tcl_SourceRCFile, /* 241 */ - Tcl_SplitList, /* 242 */ - Tcl_SplitPath, /* 243 */ + TclSplitList_, /* 242 */ + TclSplitPath_, /* 243 */ 0, /* 244 */ 0, /* 245 */ 0, /* 246 */ @@ -1152,7 +1252,7 @@ const TclStubs tclStubs = { Tcl_FSChdir, /* 458 */ Tcl_FSConvertToPathType, /* 459 */ Tcl_FSJoinPath, /* 460 */ - Tcl_FSSplitPath, /* 461 */ + TclFSSplitPath_, /* 461 */ Tcl_FSEqualPaths, /* 462 */ Tcl_FSGetNormalizedPath, /* 463 */ Tcl_FSJoinToPath, /* 464 */ @@ -1188,7 +1288,7 @@ const TclStubs tclStubs = { Tcl_DictObjPut, /* 494 */ Tcl_DictObjGet, /* 495 */ Tcl_DictObjRemove, /* 496 */ - Tcl_DictObjSize, /* 497 */ + TclDictObjSize_, /* 497 */ Tcl_DictObjFirst, /* 498 */ Tcl_DictObjNext, /* 499 */ Tcl_DictObjDone, /* 500 */ @@ -1295,7 +1395,7 @@ const TclStubs tclStubs = { Tcl_GetBlockSizeFromStat, /* 601 */ Tcl_SetEnsembleParameterList, /* 602 */ Tcl_GetEnsembleParameterList, /* 603 */ - Tcl_ParseArgsObjv, /* 604 */ + TclParseArgsObjv_, /* 604 */ Tcl_GetErrorLine, /* 605 */ Tcl_SetErrorLine, /* 606 */ Tcl_TransferResult, /* 607 */ @@ -1352,6 +1452,13 @@ const TclStubs tclStubs = { 0, /* 658 */ 0, /* 659 */ Tcl_AsyncMarkFromSignal, /* 660 */ + Tcl_ListObjGetElements, /* 661 */ + Tcl_ListObjLength, /* 662 */ + Tcl_DictObjSize, /* 663 */ + Tcl_SplitList, /* 664 */ + Tcl_SplitPath, /* 665 */ + Tcl_FSSplitPath, /* 666 */ + Tcl_ParseArgsObjv, /* 667 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 1794723..69b40d7 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -419,8 +419,8 @@ TraceExecutionObjCmd( switch ((enum traceOptions) optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { - int flags = 0; - int i, listLen, result; + int flags = 0, result; + size_t i, listLen; Tcl_Obj **elemPtrs; if (objc != 6) { @@ -575,7 +575,7 @@ TraceExecutionObjCmd( resultListPtr = Tcl_NewListObj(0, NULL); FOREACH_COMMAND_TRACE(interp, name, clientData) { - int numOps = 0; + size_t numOps = 0; Tcl_Obj *opObj, *eachTraceObjPtr, *elemObjPtr; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)clientData; @@ -660,8 +660,8 @@ TraceCommandObjCmd( switch ((enum traceOptions) optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { - int flags = 0; - int i, listLen, result; + int flags = 0, result; + size_t i, listLen; Tcl_Obj **elemPtrs; if (objc != 6) { @@ -778,7 +778,7 @@ TraceCommandObjCmd( resultListPtr = Tcl_NewListObj(0, NULL); FOREACH_COMMAND_TRACE(interp, name, clientData) { - int numOps = 0; + size_t numOps = 0; Tcl_Obj *opObj, *eachTraceObjPtr, *elemObjPtr; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *)clientData; @@ -859,8 +859,8 @@ TraceVariableObjCmd( switch ((enum traceOptions) optionIndex) { case TRACE_ADD: case TRACE_REMOVE: { - int flags = 0; - int i, listLen, result; + int flags = 0, result; + size_t i, listLen; Tcl_Obj **elemPtrs; if (objc != 6) { diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d05402b..bda3494 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -849,15 +849,15 @@ Tcl_SplitList( Tcl_Interp *interp, /* Interpreter to use for error reporting. If * NULL, no error message is left. */ const char *list, /* Pointer to string with list structure. */ - int *argcPtr, /* Pointer to location to fill in with the + size_t *argcPtr, /* Pointer to location to fill in with the * number of elements in the list. */ const char ***argvPtr) /* Pointer to place to store pointer to array * of pointers to list elements. */ { const char **argv, *end, *element; char *p; - int length, size, i, result; - size_t elSize; + int result; + size_t length, size, i, elSize; /* * Allocate enough space to work in. A (const char *) for each (possible) @@ -1558,13 +1558,12 @@ TclConvertElement( char * Tcl_Merge( - int argc, /* How many strings to merge. */ + size_t argc, /* How many strings to merge. */ const char *const *argv) /* Array of string values. */ { #define LOCAL_SIZE 64 char localFlags[LOCAL_SIZE], *flagPtr = NULL; - int i; - size_t bytesNeeded = 0; + size_t i, bytesNeeded = 0; char *result, *dst; /* @@ -1847,11 +1846,10 @@ TclTrim( char * Tcl_Concat( - int argc, /* Number of strings to concatenate. */ + size_t argc, /* Number of strings to concatenate. */ const char *const *argv) /* Array of strings to concatenate. */ { - int i; - size_t needSpace = 0, bytesNeeded = 0; + size_t i, needSpace = 0, bytesNeeded = 0; char *result, *p; /* @@ -1937,11 +1935,11 @@ Tcl_Concat( Tcl_Obj * Tcl_ConcatObj( - int objc, /* Number of objects to concatenate. */ + size_t objc, /* Number of objects to concatenate. */ Tcl_Obj *const objv[]) /* Array of objects to concatenate. */ { - int i, needSpace = 0; - size_t bytesNeeded = 0, elemLength; + int needSpace = 0; + size_t i, bytesNeeded = 0, elemLength; const char *element; Tcl_Obj *objPtr, *resPtr; @@ -3466,7 +3464,8 @@ GetEndOffsetFromObj( if (*bytes != 'e') { int numType; const char *opPtr; - int len, t1 = 0, t2 = 0; + int t1 = 0, t2 = 0; + size_t len; /* Value doesn't start with "e" */ diff --git a/generic/tclVar.c b/generic/tclVar.c index e8376db..6636328 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -2812,9 +2812,9 @@ Tcl_LappendObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValuePtr, *newValuePtr; - int numElems, createdNewObj; + size_t numElems; Var *varPtr, *arrayPtr; - int result; + int result, createdNewObj; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -3030,7 +3030,8 @@ ArrayForNRCmd( Tcl_Obj *varListObj, *arrayNameObj, *scriptObj; ArraySearch *searchPtr = NULL; Var *varPtr; - int isArray, numVars; + int isArray; + size_t numVars; /* * array for {k v} a body @@ -3106,7 +3107,8 @@ ArrayForLoopCallback( Tcl_Obj *keyObj, *valueObj; Var *varPtr; Var *arrayPtr; - int done, varc; + int done; + size_t varc; /* * Process the result from the previous execution of the script body. @@ -3614,7 +3616,8 @@ ArrayGetCmd( Tcl_Obj **nameObjPtr, *patternObj; Tcl_HashSearch search; const char *pattern; - int i, count, result, isArray; + size_t i, count; + int result, isArray; switch (objc) { case 2: @@ -3938,7 +3941,8 @@ ArraySetCmd( Tcl_Obj *arrayNameObj; Tcl_Obj *arrayElemObj; Var *varPtr, *arrayPtr; - int result, i; + int result; + size_t i; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName list"); @@ -3973,11 +3977,12 @@ ArraySetCmd( Tcl_Obj *keyPtr, *valuePtr; Tcl_DictSearch search; int done; + size_t size; - if (Tcl_DictObjSize(interp, arrayElemObj, &done) != TCL_OK) { + if (Tcl_DictObjSize(interp, arrayElemObj, &size) != TCL_OK) { return TCL_ERROR; } - if (done == 0) { + if (size == 0) { /* * Empty, so we'll just force the array to be properly existing * instead. @@ -4016,7 +4021,7 @@ ArraySetCmd( * -compatibility reasons) a list. */ - int elemLen; + size_t elemLen; Tcl_Obj **elemPtrs, *copyListObj; result = TclListObjGetElements(interp, arrayElemObj, @@ -6182,7 +6187,8 @@ AppendLocals( { Interp *iPtr = (Interp *) interp; Var *varPtr; - int i, localVarCt, added; + size_t i, localVarCt; + int added; Tcl_Obj *objNamePtr; const char *varName; TclVarHashTable *localVarTablePtr; diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b63cce7..c421635 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -2994,8 +2994,8 @@ ZipFSMkZipOrImg( * there's no password protection. */ { Tcl_Channel out; - int pwlen = 0, slen = 0, count, ret = TCL_ERROR, lobjc; - size_t len, i = 0; + int pwlen = 0, slen = 0, count, ret = TCL_ERROR; + size_t lobjc, len, i = 0; long long directoryStartOffset; /* The overall file offset of the start of the * central directory. */ diff --git a/generic/tclZlib.c b/generic/tclZlib.c index a833d04..00b262d 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1327,8 +1327,8 @@ Tcl_ZlibStreamGet( * may get less! */ { ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle; - int e, i, listLen; - size_t itemLen = 0, dataPos = 0; + int e; + size_t listLen, i, itemLen = 0, dataPos = 0; Tcl_Obj *itemObj; unsigned char *dataPtr, *itemPtr; size_t existing = 0; @@ -2409,7 +2409,8 @@ ZlibPushSubcmd( const char *const *pushOptions = pushDecompressOptions; enum pushOptionsEnum {poDictionary, poHeader, poLevel, poLimit}; Tcl_Obj *headerObj = NULL, *compDictObj = NULL; - int limit = DEFAULT_BUFFER_SIZE, dummy; + int limit = DEFAULT_BUFFER_SIZE; + size_t dummy; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "mode channel ?options...?"); diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 25bc70f..62a8c16 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -596,7 +596,7 @@ TtySetOptionProc( TtyState *fsPtr = (TtyState *)instanceData; size_t len, vlen; TtyAttrs tty; - int argc; + size_t argc; const char **argv; struct termios iostate; @@ -731,7 +731,8 @@ TtySetOptionProc( if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) { #if defined(TIOCMGET) && defined(TIOCMSET) - int i, control, flag; + int control, flag; + size_t i; if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) { return TCL_ERROR; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index f8bca0f..104f001 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -478,7 +478,7 @@ TclpInitLibraryPath( if ((str != NULL) && (str[0] != '\0')) { Tcl_DString ds; - int pathc; + size_t pathc; const char **pathv; char installLib[LIBRARY_SIZE]; diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index e1825c7..35cde8e 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -381,7 +381,7 @@ TclpCreateProcess( * occurred when creating the child process. * Error messages from the child process * itself are sent to errorFile. */ - size_t argc, /* Number of arguments in following array. */ + size_t argc1, /* Number of arguments in following array. */ const char **argv, /* Array of argument strings in UTF-8. * argv[0] contains the name of the executable * translated using Tcl_TranslateFileName @@ -410,8 +410,8 @@ TclpCreateProcess( char errSpace[200 + TCL_INTEGER_SPACE]; Tcl_DString *dsArray; char **newArgv; - int pid; - size_t i; + int pid, i; + int argc = argc1; errPipeIn = NULL; errPipeOut = NULL; diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index dc67c45..025ac4b 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -309,7 +309,7 @@ DoRenameFile( if (srcAttr & FILE_ATTRIBUTE_DIRECTORY) { WCHAR *nativeSrcRest, *nativeDstRest; const char **srcArgv, **dstArgv; - int size, srcArgc, dstArgc; + size_t size, srcArgc, dstArgc; WCHAR nativeSrcPath[MAX_PATH]; WCHAR nativeDstPath[MAX_PATH]; Tcl_DString srcString, dstString; @@ -1595,7 +1595,7 @@ ConvertFileNameFormat( int longShort, /* 0 to short name, 1 to long name. */ Tcl_Obj **attributePtrPtr) /* A pointer to return the object with. */ { - int pathc, i; + size_t pathc, i; Tcl_Obj *splitPath; size_t length; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 64b3b5a..55588e6 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -198,7 +198,7 @@ AppendEnvironment( Tcl_Obj *pathPtr, const char *lib) { - int pathc; + size_t pathc; WCHAR wBuf[MAX_PATH]; char buf[MAX_PATH * 3]; Tcl_Obj *objPtr; diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 2477778..e7f00d4 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -911,7 +911,7 @@ TclpCreateProcess( * occurred when creating the child process. * Error messages from the child process * itself are sent to errorFile. */ - size_t argc, /* Number of arguments in following array. */ + size_t argc1, /* Number of arguments in following array. */ const char **argv, /* Array of argument strings. argv[0] contains * the name of the executable converted to * native format (using the @@ -943,6 +943,7 @@ TclpCreateProcess( HANDLE hProcess, h, inputHandle, outputHandle, errorHandle; char execPath[MAX_PATH * 3]; WinFile *filePtr; + int argc = argc1; PipeInit(); diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 220b47b..b6abb50 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1630,7 +1630,7 @@ SerialSetOptionProc( size_t len, vlen; Tcl_DString ds; const WCHAR *native; - int argc; + size_t argc; const char **argv; infoPtr = (SerialInfo *) instanceData; @@ -1826,7 +1826,8 @@ SerialSetOptionProc( */ if ((len > 4) && (strncmp(optionName, "-ttycontrol", len) == 0)) { - int i, res = TCL_OK; + size_t i; + int res = TCL_OK; if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) { return TCL_ERROR; |