diff options
34 files changed, 139 insertions, 129 deletions
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/SplitList.3 b/doc/SplitList.3 index 070beb0..49498e2 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. 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/generic/tcl.decls b/generic/tcl.decls index 6a969d7..9ac859b 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -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 Tcl_SplitList(Tcl_Interp *interp, const char *listStr, size_t *argcPtr, const char ***argvPtr) } # Obsolete, use Tcl_FSSplitPath declare 243 { - void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr) + void Tcl_SplitPath(const char *path, size_t *argcPtr, const char ***argvPtr) } # Removed in 9.0 (stub entry only) #declare 244 { @@ -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 *Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *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 { diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 15f7ec7..35c70c4 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -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; diff --git a/generic/tclDecls.h b/generic/tclDecls.h index e83a8de..5f616a7 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -659,10 +659,10 @@ EXTERN const char * Tcl_SignalMsg(int sig); EXTERN void Tcl_SourceRCFile(Tcl_Interp *interp); /* 242 */ EXTERN int Tcl_SplitList(Tcl_Interp *interp, - const char *listStr, int *argcPtr, + const char *listStr, size_t *argcPtr, const char ***argvPtr); /* 243 */ -EXTERN void Tcl_SplitPath(const char *path, int *argcPtr, +EXTERN void Tcl_SplitPath(const char *path, size_t *argcPtr, const char ***argvPtr); /* Slot 244 is reserved */ /* Slot 245 is reserved */ @@ -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 * Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *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, @@ -2020,8 +2020,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 (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, size_t *argcPtr, const char ***argvPtr); /* 242 */ + void (*tcl_SplitPath) (const char *path, size_t *argcPtr, const char ***argvPtr); /* 243 */ void (*reserved244)(void); void (*reserved245)(void); void (*reserved246)(void); @@ -2238,11 +2238,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 * (*tcl_FSSplitPath) (Tcl_Obj *pathPtr, size_t *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 */ diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 9c42bb7..f1d5aba 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1966,7 +1966,7 @@ LoadEscapeEncoding( Tcl_DStringInit(&escapeData); while (1) { - int argc; + size_t argc; const char **argv; char *line; Tcl_DString lineString; diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 4131651..efff5b8 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -1524,7 +1524,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. diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index c931866..821347a 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) { @@ -1006,7 +1007,7 @@ TclFileAttrsCmd( * Use objStrings as a list object. */ - if (TclListObjLength_(interp, objStrings, &numObjStrings) != TCL_OK) { + if (Tcl_ListObjLength(interp, objStrings, &numObjStrings) != TCL_OK) { goto end; } attributeStringsAllocated = (const char **) diff --git a/generic/tclFileName.c b/generic/tclFileName.c index e48381d..6b91c7f 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. */ @@ -516,7 +516,7 @@ TclpNativeSplitPath( */ if (lenPtr != NULL) { - TclListObjLength_(NULL, resultPtr, lenPtr); + Tcl_ListObjLength(NULL, resultPtr, lenPtr); } return resultPtr; } @@ -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; @@ -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; 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 77f9927..ee5f5e3 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; /* 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 734f97b..a755959 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; @@ -266,7 +266,7 @@ TclChannelTransform( return TCL_ERROR; } - if (TCL_OK != TclListObjLength_(interp, cmdObjPtr, &objc)) { + if (TCL_OK != Tcl_ListObjLength(interp, cmdObjPtr, &objc)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("-command value is not a list", -1)); return TCL_ERROR; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 558c1aa..7c3032a 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1105,7 +1105,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); @@ -1113,15 +1113,15 @@ FsAddMountsToGlobResult( return; } - if (TclListObjLength_(NULL, mounts, &mLength) != TCL_OK || mLength == 0) { + if (Tcl_ListObjLength(NULL, mounts, &mLength) != TCL_OK || mLength == 0) { goto endOfMounts; } - if (TclListObjLength_(NULL, resultPtr, &gLength) != TCL_OK) { + if (Tcl_ListObjLength(NULL, resultPtr, &gLength) != TCL_OK) { goto endOfMounts; } 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 +1475,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) @@ -3875,13 +3876,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 +3928,7 @@ Tcl_FSSplitPath( for (;;) { const char *elementStart = p; - int length; + size_t length; while ((*p != '\0') && (*p != separator)) { p++; @@ -3950,7 +3951,7 @@ Tcl_FSSplitPath( } if (lenPtr != NULL) { - TclListObjLength_(NULL, result, lenPtr); + Tcl_ListObjLength(NULL, result, lenPtr); } return result; } @@ -3978,7 +3979,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 +4028,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,11 +4070,11 @@ TclFSNonnativePathType( if ((fsRecPtr->fsPtr != &tclNativeFilesystem) && (fsRecPtr->fsPtr->listVolumesProc != NULL)) { - int numVolumes; + size_t numVolumes; Tcl_Obj *thisFsVolumes = fsRecPtr->fsPtr->listVolumesProc(); if (thisFsVolumes != NULL) { - if (TclListObjLength_(NULL, thisFsVolumes, &numVolumes) + if (Tcl_ListObjLength(NULL, thisFsVolumes, &numVolumes) != TCL_OK) { /* * This is VERY bad; the listVolumesProc didn't return a @@ -4084,9 +4085,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 +4095,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 629a107..35d3977 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -478,8 +478,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; @@ -522,7 +522,7 @@ PrefixMatchObjCmd( return TCL_ERROR; } i++; - result = TclListObjLength_(interp, objv[i], &errorLength); + result = Tcl_ListObjLength(interp, objv[i], &errorLength); if (result != TCL_OK) { return TCL_ERROR; } @@ -546,7 +546,7 @@ PrefixMatchObjCmd( * error case regardless of level. */ - result = TclListObjLength_(interp, tablePtr, &dummyLength); + result = Tcl_ListObjLength(interp, tablePtr, &dummyLength); if (result != TCL_OK) { return result; } diff --git a/generic/tclInt.h b/generic/tclInt.h index e9ba3b9..f4d1b25 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3018,7 +3018,7 @@ 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); @@ -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, diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 3c2f2be..0b2e7f7 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -2378,9 +2378,9 @@ ChildBgerror( Tcl_Obj *const objv[]) /* Argument strings. */ { if (objc) { - int length; + size_t length; - if (TCL_ERROR == TclListObjLength_(NULL, objv[0], &length) + if (TCL_ERROR == Tcl_ListObjLength(NULL, objv[0], &length) || (length < 1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "cmdPrefix must be list of length >= 1", -1)); diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 37392e4..973c9cc 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1477,8 +1477,8 @@ TclLsetFlat( /* 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; @@ -1671,13 +1671,13 @@ 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; - TclListObjLength_(NULL, subListPtr, &len); + len = TCL_INDEX_NONE; + Tcl_ListObjLength(NULL, subListPtr, &len); if (valuePtr == NULL) { Tcl_ListObjReplace(NULL, subListPtr, index, 1, 0, NULL); } else if (index == (size_t)len) { 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/tclOOMethod.c b/generic/tclOOMethod.c index d266697..81e94c6 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -335,11 +335,11 @@ TclOONewProcInstanceMethod( * structure's contents. NULL if caller is not * interested. */ { - int argsLen; + size_t argsLen; ProcedureMethod *pmPtr; Tcl_Method method; - if (TclListObjLength_(interp, argsObj, &argsLen) != TCL_OK) { + if (Tcl_ListObjLength(interp, argsObj, &argsLen) != TCL_OK) { return NULL; } pmPtr = (ProcedureMethod *)Tcl_Alloc(sizeof(ProcedureMethod)); diff --git a/generic/tclObj.c b/generic/tclObj.c index d32f9be..8f95260 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -835,13 +835,13 @@ 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. */ - if (TclListObjLength_(interp, objPtr, &numElems) != TCL_OK) { + if (Tcl_ListObjLength(interp, objPtr, &numElems) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index bb60a14..6dd1a4e 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,31 +804,31 @@ 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) { + if (Tcl_ListObjLength(NULL, listObj, &objc) != TCL_OK) { return NULL; } - elements = ((elements >= 0) && (elements <= objc)) ? elements : objc; - TclListObjGetElements_(NULL, listObj, &objc, &objv); + elements = ((elements != TCL_INDEX_NONE) && (elements <= objc)) ? elements : objc; + Tcl_ListObjGetElements(NULL, listObj, &objc, &objv); res = TclJoinPath(elements, objv, 0); return res; } 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; diff --git a/generic/tclProc.c b/generic/tclProc.c index 3908771..138478c 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -919,8 +919,9 @@ TclNRUplevelObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?level? command ?arg ...?"); return TCL_ERROR; } else if (!TclHasStringRep(objv[1]) && objc == 2) { - int status ,llength; - status = TclListObjLength_(interp, objv[1], &llength); + int status; + size_t llength; + status = Tcl_ListObjLength(interp, objv[1], &llength); if (status == TCL_OK && llength > 1) { /* the first argument can't interpreted as a level. Avoid * generating a string representation of the script. */ diff --git a/generic/tclResult.c b/generic/tclResult.c index b447e67..c0467d7 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)) { @@ -750,12 +750,12 @@ TclProcessReturn( * if someone does [return -errorstack [info errorstack]] */ - if (TclListObjGetElements_(interp, valuePtr, &valueObjc, + if (Tcl_ListObjGetElements(interp, valuePtr, &valueObjc, &valueObjv) == TCL_ERROR) { return TCL_ERROR; } iPtr->resetErrorStack = 0; - TclListObjLength_(interp, iPtr->errorStack, &len); + Tcl_ListObjLength(interp, iPtr->errorStack, &len); /* * Reset while keeping the list internalrep as much as possible. @@ -910,9 +910,9 @@ TclMergeReturnOptions( Tcl_DictObjGet(NULL, returnOpts, keys[KEY_ERRORCODE], &valuePtr); if (valuePtr != NULL) { - int length; + size_t length; - if (TCL_ERROR == TclListObjLength_(NULL, valuePtr, &length )) { + if (TCL_ERROR == Tcl_ListObjLength(NULL, valuePtr, &length )) { /* * Value is not a list, which is illegal for -errorcode. */ @@ -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 == Tcl_ListObjLength(NULL, valuePtr, &length)) { /* * Value is not a list, which is illegal for -errorstack. */ diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 5ce4c78..f820ae4 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -557,9 +557,9 @@ 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); + Tcl_ListObjLength(NULL, objPtr, &length); if (length != 1) { return TCL_ERROR; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 98d0d21..74892fe 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -86,7 +86,10 @@ static void uniCodePanic() { #define TclUtfNext Tcl_UtfNext #define TclUtfPrev Tcl_UtfPrev -int TclListObjGetElements_(Tcl_Interp *interp, Tcl_Obj *listPtr, +#define LOGetElements TclListObjGetElements_ +#define LOLength TclListObjLength_ +#define TclDictObjSize_ DOSize +int LOGetElements(Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr) { size_t n; int result = Tcl_ListObjGetElements(interp, listPtr, &n, objvPtr); @@ -95,7 +98,7 @@ int TclListObjGetElements_(Tcl_Interp *interp, Tcl_Obj *listPtr, } return result; } -int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, +int LOLength(Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr) { size_t n; int result = Tcl_ListObjLength(interp, listPtr, &n); @@ -104,7 +107,7 @@ int TclListObjLength_(Tcl_Interp *interp, Tcl_Obj *listPtr, } return result; } -int TclDictObjSize_(Tcl_Interp *interp, Tcl_Obj *dictPtr, +static int DOSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr) { size_t n; int result = Tcl_DictObjSize(interp, dictPtr, &n); diff --git a/generic/tclTrace.c b/generic/tclTrace.c index f469233..1fae619 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -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; @@ -603,7 +603,7 @@ TraceExecutionObjCmd( TclNewLiteralStringObj(opObj, "leavestep"); Tcl_ListObjAppendElement(NULL, elemObjPtr, opObj); } - TclListObjLength_(NULL, elemObjPtr, &numOps); + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); if (0 == numOps) { Tcl_DecrRefCount(elemObjPtr); continue; @@ -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; @@ -798,7 +798,7 @@ TraceCommandObjCmd( TclNewLiteralStringObj(opObj, "delete"); Tcl_ListObjAppendElement(NULL, elemObjPtr, opObj); } - TclListObjLength_(NULL, elemObjPtr, &numOps); + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); if (0 == numOps) { Tcl_DecrRefCount(elemObjPtr); continue; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index fa54310..7ba2008 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -847,15 +847,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) @@ -3464,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" */ @@ -3484,7 +3485,7 @@ GetEndOffsetFromObj( if ((TclMaxListLength(bytes, -1, NULL) > 1) /* If it's possible, do the full list parse. */ - && (TCL_OK == TclListObjLength_(NULL, objPtr, &len)) + && (TCL_OK == Tcl_ListObjLength(NULL, objPtr, &len)) && (len > 1)) { goto parseError; } 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/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 a6ff036..5d54a05 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -240,7 +240,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/tclWinSerial.c b/win/tclWinSerial.c index 220b47b..8384a43 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; |