diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-16 22:44:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-16 22:44:17 (GMT) |
commit | b9bd7f6fdaf1ca194954f1aa212a218a36b1948e (patch) | |
tree | 53eae3c07e03b8cbb522544074cc3258fcad3bd4 | |
parent | 6e4a82afe30a901cfee5752a51202440eb06079f (diff) | |
download | tcl-b9bd7f6fdaf1ca194954f1aa212a218a36b1948e.zip tcl-b9bd7f6fdaf1ca194954f1aa212a218a36b1948e.tar.gz tcl-b9bd7f6fdaf1ca194954f1aa212a218a36b1948e.tar.bz2 |
yet more conversions
-rw-r--r-- | generic/tcl.decls | 2 | ||||
-rw-r--r-- | generic/tclDecls.h | 4 | ||||
-rw-r--r-- | generic/tclExecute.c | 20 | ||||
-rw-r--r-- | generic/tclFCmd.c | 33 | ||||
-rw-r--r-- | generic/tclFileName.c | 49 | ||||
-rw-r--r-- | generic/tclHash.c | 2 | ||||
-rw-r--r-- | generic/tclIndexObj.c | 42 |
7 files changed, 78 insertions, 74 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index c43ec58..615a5cc 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1646,7 +1646,7 @@ declare 460 { Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, int 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) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 037dfe1..7d84c89 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1328,7 +1328,7 @@ EXTERN int Tcl_FSConvertToPathType(Tcl_Interp *interp, /* 460 */ EXTERN Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, int 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); @@ -2306,7 +2306,7 @@ typedef struct TclStubs { 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_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, size_t objc, Tcl_Obj *const objv[]); /* 464 */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 54eb2c3..12713d3 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1481,7 +1481,7 @@ CompileExprObj( * TIP #280: No invoker (yet) - Expression compilation. */ - int length; + size_t length; const char *string = TclGetStringFromObj(objPtr, &length); TclInitCompileEnv(interp, &compEnv, string, length, NULL, 0); @@ -2077,8 +2077,9 @@ TEBCresume( Tcl_Obj *objPtr, *valuePtr, *value2Ptr, *part1Ptr, *part2Ptr, *tmpPtr; Tcl_Obj **objv; - 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]; @@ -4374,7 +4375,8 @@ TEBCresume( { int index, numIndices, fromIdx, toIdx; - int nocase, match, length2, cflags, s1len, s2len; + int nocase, match, cflags; + size_t length2, s1len, s2len; const char *s1, *s2; case INST_LIST: @@ -4983,7 +4985,7 @@ TEBCresume( { Tcl_UniChar *ustring1, *ustring2, *ustring3, *end, *p; - int length3; + size_t length3; Tcl_Obj *value3Ptr; case INST_STR_MAP: @@ -5914,9 +5916,10 @@ TEBCresume( Var *iterVarPtr, *listVarPtr; Tcl_Obj *oldValuePtr, *listPtr, **elements; ForeachVarList *varListPtr; - int numLists, iterNum, listTmpIndex, listLen, numVars; + int numLists, iterNum, listTmpIndex, numVars; int varIndex, valIndex, continueLoop, j, iterTmpIndex; long i; + size_t listLen; case INST_FOREACH_START4: /* @@ -6144,11 +6147,12 @@ TEBCresume( Tcl_Obj *emptyPtr, **keyPtrPtr; Tcl_DictSearch *searchPtr; DictUpdateInfo *duiPtr; + size_t size; case INST_DICT_VERIFY: dictPtr = OBJ_AT_TOS; TRACE(("=> ")); - if (Tcl_DictObjSize(interp, dictPtr, &done) != TCL_OK) { + if (Tcl_DictObjSize(interp, dictPtr, &size) != TCL_OK) { TRACE_APPEND(("ERROR verifying dictionary nature of \"%s\": %s\n", O2S(OBJ_AT_DEPTH(opnd)), O2S(Tcl_GetObjResult(interp)))); goto gotError; @@ -8570,7 +8574,7 @@ IllegalExprOperandType( } if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) { - int numBytes; + size_t numBytes; const char *bytes = Tcl_GetStringFromObj(opndPtr, &numBytes); if (numBytes == 0) { diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 33c1496..57fc80f 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -22,9 +22,9 @@ static int CopyRenameOneFile(Tcl_Interp *interp, int copyFlag, int force); static Tcl_Obj * FileBasename(Tcl_Interp *interp, Tcl_Obj *pathPtr); static int FileCopyRename(Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[], int copyFlag); + size_t objc, Tcl_Obj *const objv[], int copyFlag); static int FileForceOption(Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[], int *forcePtr); + size_t objc, Tcl_Obj *const objv[], int*forcePtr); /* *--------------------------------------------------------------------------- @@ -50,7 +50,7 @@ TclFileRenameCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* Interp for error reporting or recursive * calls in the case of a tricky rename. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { return FileCopyRename(interp, objc, objv, 0); @@ -79,7 +79,7 @@ TclFileCopyCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* Used for error reporting or recursive calls * in the case of a tricky copy. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { return FileCopyRename(interp, objc, objv, 1); @@ -105,7 +105,7 @@ TclFileCopyCmd( static int FileCopyRename( Tcl_Interp *interp, /* Used for error reporting. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings passed to Tcl_FileCmd. */ int copyFlag) /* If non-zero, copy source(s). Otherwise, * rename them. */ @@ -216,14 +216,15 @@ int TclFileMakeDirsCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* Used for error reporting. */ - int objc, /* Number of arguments */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { Tcl_Obj *errfile = NULL; - int result, i, j, pobjc; + int result, i, j; Tcl_Obj *split = NULL; Tcl_Obj *target = NULL; Tcl_StatBuf statBuf; + size_t pobjc; result = TCL_OK; for (i = 1; i < objc; i++) { @@ -334,7 +335,7 @@ int TclFileDeleteCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* Used for error reporting */ - int objc, /* Number of arguments */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings passed to Tcl_FileCmd. */ { int i, force, result; @@ -815,7 +816,7 @@ CopyRenameOneFile( static int FileForceOption( Tcl_Interp *interp, /* Interp, for error return. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings. First command line * option, if it exists, begins at 0. */ int *forcePtr) /* If the "-force" was specified, *forcePtr is @@ -870,7 +871,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; @@ -945,14 +946,14 @@ int TclFileAttrsCmd( ClientData clientData, /* Unused */ Tcl_Interp *interp, /* The interpreter for error reporting. */ - int objc, /* Number of command line arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The command line objects. */ { int result; const char *const *attributeStrings; const char **attributeStringsAllocated = NULL; Tcl_Obj *objStrings = NULL; - int numObjStrings = -1; + size_t numObjStrings = TCL_STRLEN; Tcl_Obj *filePtr; if (objc < 2) { @@ -1167,7 +1168,7 @@ int TclFileLinkCmd( ClientData clientData, Tcl_Interp *interp, - int objc, + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) { Tcl_Obj *contents; @@ -1318,7 +1319,7 @@ int TclFileReadLinkCmd( ClientData clientData, Tcl_Interp *interp, - int objc, + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) { Tcl_Obj *contents; @@ -1369,7 +1370,7 @@ int TclFileTemporaryCmd( ClientData clientData, Tcl_Interp *interp, - int objc, + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) { Tcl_Obj *nameVarObj = NULL; /* Variable to store the name of the temporary @@ -1392,7 +1393,7 @@ TclFileTemporaryCmd( TclNewObj(nameObj); } if (objc > 2) { - int length; + size_t length; Tcl_Obj *templateObj = objv[2]; const char *string = TclGetStringFromObj(templateObj, &length); diff --git a/generic/tclFileName.c b/generic/tclFileName.c index b971533..3f8a332 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -386,7 +386,7 @@ TclpGetNativePathType( Tcl_Obj **driveNameRef) { Tcl_PathType type = TCL_PATH_ABSOLUTE; - int pathLen; + size_t pathLen; const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen); if (path[0] == '~') { @@ -550,14 +550,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, len; + size_t i, size, len; char *p; const char *str; @@ -804,7 +804,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) { @@ -852,10 +852,11 @@ TclpNativeJoinPath( Tcl_Obj *prefix, const char *joining) { - int length, needsSep; + int needsSep; char *dest; const char *p; const char *start; + size_t length; start = Tcl_GetStringFromObj(prefix, &length); @@ -972,11 +973,11 @@ TclpNativeJoinPath( char * Tcl_JoinPath( - int argc, + size_t argc, const char *const *argv, Tcl_DString *resultPtr) /* Pointer to previously initialized DString */ { - int i, len; + size_t i, len; Tcl_Obj *listObj = Tcl_NewObj(); Tcl_Obj *resultObj; const char *resultStr; @@ -1222,11 +1223,12 @@ int Tcl_GlobObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + size_t 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; char *string; + size_t length; const char *separators; Tcl_Obj *typePtr, *look; Tcl_Obj *pathOrDir = NULL; @@ -1355,7 +1357,7 @@ Tcl_GlobObjCmd( } if (dir == PATH_GENERAL) { - int pathlength; + size_t pathlength; const char *last; const char *first = Tcl_GetStringFromObj(pathOrDir,&pathlength); @@ -1456,7 +1458,7 @@ Tcl_GlobObjCmd( globTypes->macCreator = NULL; while (--length >= 0) { - int len; + size_t len; const char *str; Tcl_ListObjIndex(interp, typePtr, length, &look); @@ -1825,7 +1827,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); @@ -1893,8 +1895,9 @@ TclGlob( */ if (pathPrefix == NULL) { - int driveNameLen; + size_t driveNameLen; Tcl_Obj *driveName; + if (TclFSNonnativePathType(tail, strlen(tail), NULL, &driveNameLen, &driveName) == TCL_PATH_ABSOLUTE) { pathPrefix = driveName; @@ -1978,9 +1981,8 @@ TclGlob( */ if (globFlags & TCL_GLOBMODE_TAILS) { - int objc, i; Tcl_Obj **objv; - int prefixLen; + size_t objc, i, prefixLen; const char *pre; /* @@ -2008,7 +2010,7 @@ TclGlob( Tcl_ListObjGetElements(NULL, filenamesObj, &objc, &objv); for (i = 0; i< objc; i++) { - int len; + size_t len; const char *oldStr = Tcl_GetStringFromObj(objv[i], &len); Tcl_Obj *elem; @@ -2332,8 +2334,9 @@ DoGlob( pattern, &dirOnly); *p = save; if (result == TCL_OK) { - int subdirc, i, repair = -1; + size_t repair = TCL_STRLEN; Tcl_Obj **subdirv; + size_t subdirc, i; result = Tcl_ListObjGetElements(interp, subdirsPtr, &subdirc, &subdirv); @@ -2350,14 +2353,14 @@ 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; Tcl_ListObjLength(NULL, matchesObj, &end); while (repair < end) { const char *bytes; - int numBytes; + size_t numBytes; Tcl_Obj *fixme, *newObj; Tcl_ListObjIndex(NULL, matchesObj, repair, &fixme); @@ -2367,7 +2370,7 @@ DoGlob( 1, &newObj); repair++; } - repair = -1; + repair = TCL_STRLEN; } } } @@ -2380,7 +2383,7 @@ DoGlob( */ if (*p == '\0') { - int length; + size_t length; Tcl_DString append; /* @@ -2444,7 +2447,7 @@ DoGlob( * The current prefix must end in a separator. */ - int len; + size_t len; const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if (strchr(separators, joined[len-1]) == NULL) { @@ -2481,7 +2484,7 @@ DoGlob( * This behaviour is not currently tested for in the test suite. */ - int len; + size_t len; const char *joined = Tcl_GetStringFromObj(joinedPtr,&len); if (strchr(separators, joined[len-1]) == NULL) { diff --git a/generic/tclHash.c b/generic/tclHash.c index 90be511..a5f8953 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -675,7 +675,7 @@ Tcl_HashStats( */ result = ckalloc((NUM_COUNTERS * 60) + 300); - sprintf(result, "%d entries in table, %d buckets\n", + sprintf(result, "%lu entries in table, %lu buckets\n", tablePtr->numEntries, tablePtr->numBuckets); p = result + strlen(result); for (i = 0; i < NUM_COUNTERS; i++) { diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 731d759..0bd7213 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -26,15 +26,9 @@ static int SetIndexFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfIndex(Tcl_Obj *objPtr); static void DupIndex(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void FreeIndex(Tcl_Obj *objPtr); -static int PrefixAllObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int PrefixLongestObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int PrefixMatchObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); +static Tcl_ObjCmdProc PrefixAllObjCmd; +static Tcl_ObjCmdProc PrefixLongestObjCmd; +static Tcl_ObjCmdProc PrefixMatchObjCmd; static void PrintUsage(Tcl_Interp *interp, const Tcl_ArgvInfo *argTable); @@ -174,8 +168,8 @@ GetIndexFromObjList( int flags, /* 0 or TCL_EXACT */ int *indexPtr) /* Place to store resulting integer index. */ { - - int objc, result, t; + size_t objc, t; + int result; Tcl_Obj **objv; const char **tablePtr; @@ -570,11 +564,11 @@ static int PrefixMatchObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { int flags = 0, result, index; - int dummyLength, i, errorLength; + size_t dummyLength, i, errorLength; Tcl_Obj *errorPtr = NULL; const char *message = "option"; Tcl_Obj *tablePtr, *objPtr, *resultPtr; @@ -694,18 +688,18 @@ static int PrefixAllObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int tableObjc, result, t, length, elemLength; + int result; const char *string, *elemString; Tcl_Obj **tableObjv, *resultPtr; + size_t t, tableObjc, length, elemLength; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "table string"); return TCL_ERROR; } - result = Tcl_ListObjGetElements(interp, objv[1], &tableObjc, &tableObjv); if (result != TCL_OK) { return result; @@ -751,12 +745,13 @@ static int PrefixLongestObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + size_t objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int tableObjc, result, i, t, length, elemLength, resultLength; + int result; const char *string, *elemString, *resultString; Tcl_Obj **tableObjv; + size_t t, i, tableObjc, length, elemLength, resultLength; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "table string"); @@ -869,7 +864,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 @@ -877,9 +872,10 @@ Tcl_WrongNumArgs( * NULL. */ { Tcl_Obj *objPtr; - int i, len, elemLen, flags; + int i, flags; Interp *iPtr = (Interp *) interp; const char *elementStr; + size_t elemLen, len; /* * [incr Tcl] does something fairly horrific when generating error @@ -1093,7 +1089,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 @@ -1120,8 +1116,8 @@ Tcl_ParseArgsObjv( int dstIndex; /* Used to keep track of current arguments * being processed, primarily for error * reporting. */ - int objc; /* # arguments in objv still to process. */ - int length; /* Number of characters in current argument */ + size_t objc; /* # arguments in objv still to process. */ + size_t length; /* Number of characters in current argument */ if (remObjv != NULL) { /* |