diff options
| -rw-r--r-- | doc/info.n | 4 | ||||
| -rw-r--r-- | generic/tclAssembly.c | 2 | ||||
| -rw-r--r-- | generic/tclBasic.c | 3 | ||||
| -rw-r--r-- | generic/tclCompile.c | 19 | ||||
| -rw-r--r-- | generic/tclCompile.h | 2 | ||||
| -rw-r--r-- | generic/tclTest.c | 9 | ||||
| -rw-r--r-- | generic/tclThreadAlloc.c | 26 | ||||
| -rw-r--r-- | generic/tclTrace.c | 12 | ||||
| -rw-r--r-- | generic/tclZlib.c | 2 |
9 files changed, 28 insertions, 51 deletions
@@ -212,7 +212,7 @@ procedures nested in statically defined procedures, and literal eval scripts in files or statically defined procedures, its type is \fBsource\fR and its location is the absolute line number in the script. Otherwise, its type is \fBproc\fR and its location is its line number within the body of the -procedure. +procedure. .PP In contrast, procedure definitions and \fBeval\fR within a dynamically \fBeval\fRuated environment count line numbers relative to the start of @@ -300,7 +300,7 @@ described \fBOBJECT INTROSPECTION\fR below. .TP \fBinfo patchlevel\fR . -Returns the value of the global variable \fBtcl_patchLevel\fR, in which the +Returns the value of the global variable \fBtcl_patchLevel\fR, in which the exact version of the Tcl library initially stored. .TP \fBinfo procs \fR?\fIpattern\fR? diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index b311552..a9eb6b2 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -1065,7 +1065,7 @@ TclAssembleCode( */ if (parsePtr->numWords > 0) { - int instLen = parsePtr->commandSize; + size_t instLen = parsePtr->commandSize; /* Length in bytes of the current command */ if (parsePtr->term == parsePtr->commandStart + instLen - 1) { diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c8a732e..e116698 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4836,7 +4836,8 @@ TclEvalEx( Tcl_Obj **objv, **objvSpace; int *expand, *lines, *lineSpace; Tcl_Token *tokenPtr; - int commandLength, bytesLeft, expandRequested, code = TCL_OK; + int bytesLeft, expandRequested, code = TCL_OK; + size_t commandLength; CallFrame *savedVarFramePtr;/* Saves old copy of iPtr->varFramePtr in case * TCL_EVAL_GLOBAL was set. */ int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS); diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 486b98f..019b5b1 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -677,8 +677,8 @@ static void StartExpanding(CompileEnv *envPtr); * commands. */ static void EnterCmdWordData(ExtCmdLoc *eclPtr, int srcOffset, - Tcl_Token *tokenPtr, const char *cmd, int len, - int numWords, int line, int *clNext, int **lines, + Tcl_Token *tokenPtr, const char *cmd, + size_t numWords, int line, int *clNext, int **lines, CompileEnv *envPtr); static void ReleaseCmdWordData(ExtCmdLoc *eclPtr); @@ -1769,7 +1769,7 @@ TclWordKnownAtCompileTime( static int ExpandRequested( Tcl_Token *tokenPtr, - int numWords) + size_t numWords) { /* Determine whether any words of the command require expansion */ while (numWords--) { @@ -1811,10 +1811,11 @@ TclCompileInvocation( Tcl_Interp *interp, Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, - int numWords, + size_t numWords, CompileEnv *envPtr) { - int wordIdx = 0, depth = TclGetStackDepth(envPtr); + size_t wordIdx = 0; + int depth = TclGetStackDepth(envPtr); DefineLineInformation; if (cmdObj) { @@ -2029,7 +2030,7 @@ CompileCommandTokens( EnterCmdWordData(eclPtr, parsePtr->commandStart - envPtr->source, parsePtr->tokenPtr, parsePtr->commandStart, - parsePtr->commandSize, parsePtr->numWords, cmdLine, + parsePtr->numWords, cmdLine, clNext, &wlines, envPtr); wlineat = eclPtr->nuloc - 1; @@ -3238,8 +3239,7 @@ EnterCmdWordData( int srcOffset, /* Offset of first char of the command. */ Tcl_Token *tokenPtr, const char *cmd, - int len, - int numWords, + size_t numWords, int line, int *clNext, int **wlines, @@ -3247,7 +3247,8 @@ EnterCmdWordData( { ECL *ePtr; const char *last; - int wordIdx, wordLine, *wwlines, *wordNext; + size_t wordIdx; + int wordLine, *wwlines, *wordNext; if (eclPtr->nuloc >= eclPtr->nloc) { /* diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 44bde7a..614215c 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1077,7 +1077,7 @@ MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp, Tcl_Token *tokenPtr, int numWords, CompileEnv *envPtr); MODULE_SCOPE void TclCompileInvocation(Tcl_Interp *interp, - Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords, + Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, size_t numWords, CompileEnv *envPtr); MODULE_SCOPE void TclCompileScript(Tcl_Interp *interp, const char *script, size_t numBytes, diff --git a/generic/tclTest.c b/generic/tclTest.c index 4953133..ff35754 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3765,7 +3765,8 @@ TestregexpObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i, ii, indices, stringLength, match, about; + int i, indices, stringLength, match, about; + size_t ii; int hasxflags, cflags, eflags; Tcl_RegExp regExpr; const char *string; @@ -3922,11 +3923,11 @@ TestregexpObjCmd( Tcl_Obj *newPtr, *varPtr, *valuePtr; varPtr = objv[i]; - ii = ((cflags®_EXPECT) && i == objc-1) ? -1 : i; + ii = ((cflags®_EXPECT) && i == objc-1) ? TCL_INDEX_NONE : (size_t)i; if (indices) { Tcl_Obj *objs[2]; - if (ii == -1) { + if (ii == TCL_INDEX_NONE) { TclRegExpRangeUniChar(regExpr, ii, &start, &end); } else if (ii > info.nsubs) { start = -1; @@ -3950,7 +3951,7 @@ TestregexpObjCmd( newPtr = Tcl_NewListObj(2, objs); } else { - if (ii == -1) { + if (ii == TCL_INDEX_NONE) { TclRegExpRangeUniChar(regExpr, ii, &start, &end); newPtr = Tcl_GetRange(objPtr, start, end); } else if (ii > info.nsubs) { diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index cf275c8..77fdd70 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -308,19 +308,6 @@ TclpAlloc( register int bucket; size_t size; -#ifndef __LP64__ - if (sizeof(int) >= sizeof(size_t)) { - /* An unsigned int overflow can also be a size_t overflow */ - const size_t zero = 0; - const size_t max = ~zero; - - if (reqSize > max - sizeof(Block) - RCHECK) { - /* Requested allocation exceeds memory */ - return NULL; - } - } -#endif - GETCACHE(cachePtr); /* @@ -450,19 +437,6 @@ TclpRealloc( return TclpAlloc(reqSize); } -#ifndef __LP64__ - if (sizeof(int) >= sizeof(size_t)) { - /* An unsigned int overflow can also be a size_t overflow */ - const size_t zero = 0; - const size_t max = ~zero; - - if ((reqSize) > max - sizeof(Block) - RCHECK) { - /* Requested allocation exceeds memory */ - return NULL; - } - } -#endif - GETCACHE(cachePtr); /* diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 7932b50..2bf39ed 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -468,7 +468,7 @@ TraceExecutionObjCmd( } } command = TclGetStringFromObj(objv[5], &commandLength); - length = (size_t) commandLength; + length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = Tcl_Alloc( TclOffset(TraceCommandInfo, command) + 1 + length); @@ -522,7 +522,7 @@ TraceExecutionObjCmd( && ((tcmdPtr->flags & (TCL_TRACE_ANY_EXEC | TCL_TRACE_RENAME | TCL_TRACE_DELETE)) == flags) && (strncmp(command, tcmdPtr->command, - (size_t) length) == 0)) { + length) == 0)) { flags |= TCL_TRACE_DELETE; if (flags & (TCL_TRACE_ENTER_DURING_EXEC | TCL_TRACE_LEAVE_DURING_EXEC)) { @@ -705,7 +705,7 @@ TraceCommandObjCmd( } command = TclGetStringFromObj(objv[5], &commandLength); - length = (size_t) commandLength; + length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { TraceCommandInfo *tcmdPtr = Tcl_Alloc( TclOffset(TraceCommandInfo, command) + 1 + length); @@ -747,7 +747,7 @@ TraceCommandObjCmd( if ((tcmdPtr->length == length) && (tcmdPtr->flags == flags) && (strncmp(command, tcmdPtr->command, - (size_t) length) == 0)) { + length) == 0)) { Tcl_UntraceCommand(interp, name, flags | TCL_TRACE_DELETE, TraceCommandProc, clientData); tcmdPtr->flags |= TCL_TRACE_DESTROYED; @@ -908,7 +908,7 @@ TraceVariableObjCmd( } } command = TclGetStringFromObj(objv[5], &commandLength); - length = (size_t) commandLength; + length = commandLength; if ((enum traceOptions) optionIndex == TRACE_ADD) { CombinedTraceVarInfo *ctvarPtr = Tcl_Alloc( TclOffset(CombinedTraceVarInfo, traceCmdInfo.command) @@ -950,7 +950,7 @@ TraceVariableObjCmd( #endif )==flags) && (strncmp(command, tvarPtr->command, - (size_t) length) == 0)) { + length) == 0)) { Tcl_UntraceVar2(interp, name, NULL, flags | TCL_TRACE_UNSETS | TCL_TRACE_RESULT_OBJECT, TraceVarProc, clientData); diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 67df8fb..f69c84d 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1517,7 +1517,7 @@ Tcl_ZlibStreamGet( Tcl_ListObjIndex(NULL, zshPtr->outData, 0, &itemObj); itemPtr = TclGetByteArrayFromObj(itemObj, &itemLen); - if (itemLen-zshPtr->outPos >= (size_t)(count-dataPos)) { + if (itemLen-zshPtr->outPos + dataPos >= count) { size_t len = count - dataPos; memcpy(dataPtr + dataPos, itemPtr + zshPtr->outPos, len); |
