diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-07-03 19:24:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-07-03 19:24:45 (GMT) |
commit | 572883ec08458425e314f1bae57a5e04b46fc887 (patch) | |
tree | f6b60451a12773d16803ee0c2830a9f92297f933 /generic | |
parent | 79f1d89388b7f8956b21b3f074ed61cf941bfef5 (diff) | |
download | tcl-572883ec08458425e314f1bae57a5e04b46fc887.zip tcl-572883ec08458425e314f1bae57a5e04b46fc887.tar.gz tcl-572883ec08458425e314f1bae57a5e04b46fc887.tar.bz2 |
More size_t API changes (*.decls files are complete now)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.decls | 52 | ||||
-rw-r--r-- | generic/tclAssembly.c | 6 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 2 | ||||
-rw-r--r-- | generic/tclCmdIL.c | 3 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 47 | ||||
-rw-r--r-- | generic/tclInt.decls | 14 | ||||
-rw-r--r-- | generic/tclInt.h | 2 | ||||
-rw-r--r-- | generic/tclOOMethod.c | 2 | ||||
-rw-r--r-- | generic/tclPlatDecls.h | 8 | ||||
-rw-r--r-- | generic/tclProc.c | 12 | ||||
-rw-r--r-- | generic/tclStringObj.c | 8 |
11 files changed, 82 insertions, 74 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index b9db05a..d69ecbc 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -618,10 +618,10 @@ declare 168 { Tcl_PathType Tcl_GetPathType(const char *path) } declare 169 { - int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr) + size_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr) } declare 170 { - int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr) + size_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr) } declare 171 { int Tcl_GetServiceMode(void) @@ -747,7 +747,7 @@ declare 205 { void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position) } declare 206 { - int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead) + size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead) } declare 207 { void Tcl_ReapDetachedProcs(void) @@ -944,7 +944,7 @@ declare 262 { void *prevClientData) } declare 263 { - int Tcl_Write(Tcl_Channel chan, const char *s, int slen) + size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen) } declare 264 { void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, @@ -1140,8 +1140,8 @@ declare 312 { size_t Tcl_NumUtfChars(const char *src, size_t length) } declare 313 { - int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, size_t charsToRead, - int appendFlag) + size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, + size_t charsToRead, int appendFlag) } declare 314 { void Tcl_RestoreResult(Tcl_Interp *interp, Tcl_SavedResult *statePtr) @@ -1185,7 +1185,7 @@ declare 326 { int Tcl_UtfCharComplete(const char *src, size_t length) } declare 327 { - int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst) + size_t Tcl_UtfBackslash(const char *src, int *readPtr, char *dst) } declare 328 { const char *Tcl_UtfFindFirst(const char *src, int ch) @@ -1225,7 +1225,7 @@ declare 338 { size_t Tcl_WriteChars(Tcl_Channel chan, const char *src, size_t srcLen) } declare 339 { - int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr) + size_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr) } declare 340 { char *Tcl_GetString(Tcl_Obj *objPtr) @@ -1297,12 +1297,13 @@ declare 359 { const char *command, size_t length) } declare 360 { - int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, size_t numBytes, - Tcl_Parse *parsePtr, int append, const char **termPtr) + int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, + size_t numBytes, Tcl_Parse *parsePtr, int append, + const char **termPtr) } declare 361 { - int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, size_t numBytes, - int nested, Tcl_Parse *parsePtr) + int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, + size_t numBytes, int nested, Tcl_Parse *parsePtr) } declare 362 { int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, size_t numBytes, @@ -1314,8 +1315,8 @@ declare 363 { const char **termPtr) } declare 364 { - int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, size_t numBytes, - Tcl_Parse *parsePtr, int append) + int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, + size_t numBytes, Tcl_Parse *parsePtr, int append) } # These 4 functions are obsolete, use Tcl_FSGetCwd, Tcl_FSChdir, # Tcl_FSAccess and Tcl_FSStat @@ -1415,10 +1416,10 @@ declare 393 { # Introduced in 8.3.2 declare 394 { - int Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead) + size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead) } declare 395 { - int Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen) + size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen) } declare 396 { Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan) @@ -2115,8 +2116,8 @@ declare 574 { void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, Tcl_Obj *objPtr) } declare 575 { - void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes, size_t length, - size_t limit, const char *ellipsis) + void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, const char *bytes, + size_t length, size_t limit, const char *ellipsis) } declare 576 { Tcl_Obj *Tcl_Format(Tcl_Interp *interp, const char *format, int objc, @@ -2161,8 +2162,8 @@ declare 584 { int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags) } declare 585 { - int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], - int flags) + int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[], int flags) } declare 586 { int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, int objc, @@ -2272,11 +2273,11 @@ declare 611 { } declare 612 { unsigned int Tcl_ZlibCRC32(unsigned int crc, const unsigned char *buf, - int len) + size_t len) } declare 613 { unsigned int Tcl_ZlibAdler32(unsigned int adler, const unsigned char *buf, - int len) + size_t len) } declare 614 { int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode, int format, @@ -2295,7 +2296,8 @@ declare 618 { int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle, Tcl_Obj *data, int flush) } declare 619 { - int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data, int count) + int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, Tcl_Obj *data, + size_t count) } declare 620 { int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle) @@ -2389,12 +2391,12 @@ declare 1 win { declare 0 macosx { int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, const char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath) + size_t maxPathLen, char *libraryPath) } declare 1 macosx { int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, - int hasResourceFile, int maxPathLen, char *libraryPath) + int hasResourceFile, size_t maxPathLen, char *libraryPath) } ############################################################################## diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 688ed2d..a3cc514 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -843,7 +843,7 @@ CompileAssembleObj( * names in the bytecode resolve */ int status; /* Status return from Tcl_AssembleCode */ const char* source; /* String representation of the source code */ - int sourceLen; /* Length of the source code in bytes */ + size_t sourceLen; /* Length of the source code in bytes */ /* @@ -1257,7 +1257,7 @@ AssembleOneLine( Tcl_Obj* operand1Obj = NULL; /* First operand to the instruction */ const char* operand1; /* String rep of the operand */ - int operand1Len; /* String length of the operand */ + size_t operand1Len; /* String length of the operand */ int opnd; /* Integer representation of an operand */ int litIndex; /* Literal pool index of a constant */ int localVar; /* LVT index of a local variable */ @@ -2301,7 +2301,7 @@ FindLocalVar( * source code. */ Tcl_Obj* varNameObj; /* Name of the variable */ const char* varNameStr; - int varNameLen; + size_t varNameLen; int localVar; /* Index of the variable in the LVT */ if (GetNextOperand(assemEnvPtr, tokenPtrPtr, &varNameObj) != TCL_OK) { diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 96fd1a6..cbfb76f 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -658,7 +658,7 @@ EncodingConverttoObjCmd( Tcl_Obj *data; /* String to convert */ Tcl_DString ds; /* Buffer to hold the byte array */ Tcl_Encoding encoding; /* Encoding to use */ - int length; /* Length of the string being converted */ + size_t length; /* Length of the string being converted */ const char *stringPtr; /* Pointer to the first byte of the string */ /* TODO - ADJUST OBJ INDICES WHEN ENSEMBLIFYING THIS */ diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 6f74b01..7811947 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2890,7 +2890,8 @@ Tcl_LsearchObjCmd( Tcl_Obj *const objv[]) /* Argument values. */ { const char *bytes, *patternBytes; - int i, match, index, result=TCL_OK, listc, length = 0, elemLen, bisect; + int i, match, index, result=TCL_OK, listc, bisect; + size_t length = 0, elemLen; int allocatedIndexVector = 0; int dataType, isIncreasing, lower, upper, start, groupSize, groupOffset; Tcl_WideInt patWide, objWide; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index e9c96e7..9a972cd 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1180,7 +1180,7 @@ Tcl_SplitObjCmd( const char *splitChars; const char *stringPtr; const char *end; - int splitCharLen, stringLen; + size_t splitCharLen, stringLen; Tcl_Obj *listPtr, *objPtr; if (objc == 2) { @@ -1486,7 +1486,8 @@ StringIsCmd( const char *string1, *end, *stop; Tcl_UniChar ch = 0; int (*chcomp)(int) = NULL; /* The UniChar comparison function. */ - int i, failat = 0, result = 1, strict = 0, index, length1, length2; + int i, failat = 0, result = 1, strict = 0, index, length3; + size_t length1, length2; Tcl_Obj *objPtr, *failVarObj = NULL; Tcl_WideInt w; @@ -1728,7 +1729,7 @@ StringIsCmd( * well-formed lists. */ - if (TCL_OK == TclListObjLength(NULL, objPtr, &length2)) { + if (TCL_OK == TclListObjLength(NULL, objPtr, &length3)) { break; } @@ -1740,7 +1741,7 @@ StringIsCmd( */ const char *elemStart, *nextElem; - int lenRemain; + size_t lenRemain; size_t elemSize; register const char *p; @@ -1878,7 +1879,8 @@ StringMapCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length1, length2, mapElemc, index; + size_t length1, length2; + int mapElemc, index; int nocase = 0, mapWithDict = 0, copySource = 0; Tcl_Obj **mapElemv, *sourceObj, *resultPtr; Tcl_UniChar *ustring1, *ustring2, *p, *end; @@ -1979,7 +1981,7 @@ StringMapCmd( } else { sourceObj = objv[objc-1]; } - ustring1 = Tcl_GetUnicodeFromObj(sourceObj, &length1); + ustring1 = TclGetUnicodeFromObj(sourceObj, &length1); if (length1 == 0) { /* * Empty input string, just stop now. @@ -2005,10 +2007,11 @@ StringMapCmd( * larger strings. */ - int mapLen, u2lc; + size_t mapLen; + int u2lc; Tcl_UniChar *mapString; - ustring2 = Tcl_GetUnicodeFromObj(mapElemv[0], &length2); + ustring2 = TclGetUnicodeFromObj(mapElemv[0], &length2); p = ustring1; if ((length2 > length1) || (length2 == 0)) { /* @@ -2017,7 +2020,7 @@ StringMapCmd( ustring1 = end; } else { - mapString = Tcl_GetUnicodeFromObj(mapElemv[1], &mapLen); + mapString = TclGetUnicodeFromObj(mapElemv[1], &mapLen); u2lc = (nocase ? Tcl_UniCharToLower(*ustring2) : 0); for (; ustring1 < end; ustring1++) { if (((*ustring1 == *ustring2) || @@ -2038,7 +2041,8 @@ StringMapCmd( } } else { Tcl_UniChar **mapStrings; - int *mapLens, *u2lc = NULL; + size_t *mapLens; + int *u2lc = 0; /* * Precompute pointers to the unicode string and length. This saves us @@ -2047,13 +2051,13 @@ StringMapCmd( * case. */ - mapStrings = TclStackAlloc(interp, mapElemc*2*sizeof(Tcl_UniChar *)); - mapLens = TclStackAlloc(interp, mapElemc * 2 * sizeof(int)); + mapStrings = TclStackAlloc(interp, mapElemc*sizeof(Tcl_UniChar *)*2); + mapLens = TclStackAlloc(interp, mapElemc * sizeof(size_t) * 2); if (nocase) { u2lc = TclStackAlloc(interp, mapElemc * sizeof(int)); } for (index = 0; index < mapElemc; index++) { - mapStrings[index] = Tcl_GetUnicodeFromObj(mapElemv[index], + mapStrings[index] = TclGetUnicodeFromObj(mapElemv[index], mapLens+index); if (nocase && ((index % 2) == 0)) { u2lc[index/2] = Tcl_UniCharToLower(*mapStrings[index]); @@ -2070,7 +2074,7 @@ StringMapCmd( if ((length2 > 0) && ((*ustring1 == *ustring2) || (nocase && (Tcl_UniCharToLower(*ustring1) == u2lc[index/2]))) && /* Restrict max compare length. */ - (end-ustring1 >= length2) && ((length2 == 1) || + ((size_t)(end-ustring1) >= length2) && ((length2 == 1) || !strCmpFn(ustring2, ustring1, length2))) { if (p != ustring1) { /* @@ -2156,11 +2160,11 @@ StringMatchCmd( } if (objc == 4) { - int length; + size_t length; const char *string = TclGetStringFromObj(objv[1], &length); if ((length > 1) && - strncmp(string, "-nocase", (size_t) length) == 0) { + strncmp(string, "-nocase", length) == 0) { nocase = TCL_MATCH_NOCASE; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2200,7 +2204,8 @@ StringRangeCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int length, first, last; + size_t length; + int first, last; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "string first last"); @@ -2222,7 +2227,7 @@ StringRangeCmd( if (first < 0) { first = 0; } - if (last >= length) { + if (last >= (int)length) { last = length; } if (last >= first) { @@ -3084,8 +3089,7 @@ StringTrimCmd( size_t triml, trimr, length1, length2; if (objc == 3) { - string2 = TclGetString(objv[2]); - length2 = objv[2]->length; + string2 = TclGetStringFromObj(objv[2], &length2); } else if (objc == 2) { string2 = tclDefaultTrimSet; length2 = strlen(tclDefaultTrimSet); @@ -3093,8 +3097,7 @@ StringTrimCmd( Tcl_WrongNumArgs(interp, 1, objv, "string ?chars?"); return TCL_ERROR; } - string1 = TclGetString(objv[1]); - length1 = objv[1]->length; + string1 = TclGetStringFromObj(objv[1], &length1); triml = TclTrim(string1, length1, string2, length2, &trimr); diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 8e091c7..5c1e375 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -48,7 +48,7 @@ declare 6 { void TclCleanupCommand(Command *cmdPtr) } declare 7 { - int TclCopyAndCollapse(int count, const char *src, char *dst) + size_t TclCopyAndCollapse(size_t count, const char *src, char *dst) } # Removed in 9.0: #declare 8 { @@ -153,8 +153,8 @@ declare 32 { # TclCmdProcType TclGetInterpProc(void) #} declare 34 { - int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr, - int endValue, int *indexPtr) + size_t TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr, + size_t endValue, size_t *indexPtr) } # Removed in 8.4b2: #declare 35 { @@ -707,12 +707,12 @@ declare 169 { } declare 170 { int TclCheckInterpTraces(Tcl_Interp *interp, const char *command, - int numChars, Command *cmdPtr, int result, int traceFlags, + size_t numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]) } declare 171 { int TclCheckExecutionTraces(Tcl_Interp *interp, const char *command, - int numChars, Command *cmdPtr, int result, int traceFlags, + size_t numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]) } declare 172 { @@ -722,8 +722,8 @@ declare 172 { # added for 8.4.2 declare 173 { - int TclUniCharMatch(const Tcl_UniChar *string, int strLen, - const Tcl_UniChar *pattern, int ptnLen, int flags) + int TclUniCharMatch(const Tcl_UniChar *string, size_t strLen, + const Tcl_UniChar *pattern, size_t ptnLen, int flags) } # added for 8.4.3 diff --git a/generic/tclInt.h b/generic/tclInt.h index 07a361e..e0089ce 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4344,7 +4344,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1); return Tcl_GetUnicodeFromObj(objPtr, NULL); } - static inline unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, int *lenPtr) { + static inline unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lenPtr) { Tcl_GetByteArrayFromObj(objPtr, NULL); *(lenPtr) = *((size_t *) (objPtr)->internalRep.twoPtrValue.ptr1); return Tcl_GetByteArrayFromObj(objPtr, NULL); diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 6d3c666..8c258f4 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1181,7 +1181,7 @@ RenderDeclarerName( #define LIMIT 60 #define ELLIPSIFY(str,len) \ - ((len) > LIMIT ? LIMIT : (len)), (str), ((len) > LIMIT ? "..." : "") + ((len) > LIMIT ? LIMIT : ((int)len)), (str), ((len) > LIMIT ? "..." : "") static void MethodErrorHandler( diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index abe984b..7218490 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -62,12 +62,12 @@ EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, size_t len, /* 0 */ EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, const char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath); + size_t maxPathLen, char *libraryPath); /* 1 */ EXTERN int Tcl_MacOSXOpenVersionedBundleResources( Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, - int hasResourceFile, int maxPathLen, + int hasResourceFile, size_t maxPathLen, char *libraryPath); #endif /* MACOSX */ @@ -80,8 +80,8 @@ typedef struct TclPlatStubs { char * (*tcl_WinTCharToUtf) (const TCHAR *str, size_t len, Tcl_DString *dsPtr); /* 1 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ - int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */ + int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 0 */ + int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, size_t maxPathLen, char *libraryPath); /* 1 */ #endif /* MACOSX */ } TclPlatStubs; diff --git a/generic/tclProc.c b/generic/tclProc.c index e07d800..162ccb5 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -414,7 +414,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { - int length; + size_t length; Tcl_Obj *sharedBodyPtr = bodyPtr; bytes = TclGetStringFromObj(bodyPtr, &length); @@ -2044,13 +2044,14 @@ MakeProcError( Tcl_Obj *procNameObj) /* Name of the procedure. Used for error * messages and trace information. */ { - int overflow, limit = 60, nameLen; + unsigned int overflow, limit = 60; + size_t nameLen; const char *procName = TclGetStringFromObj(procNameObj, &nameLen); overflow = (nameLen > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (procedure \"%.*s%s\" line %d)", - (overflow ? limit : nameLen), procName, + (int)(overflow ? limit :nameLen), procName, (overflow ? "..." : ""), Tcl_GetErrorLine(interp))); } @@ -2701,13 +2702,14 @@ MakeLambdaError( Tcl_Obj *procNameObj) /* Name of the procedure. Used for error * messages and trace information. */ { - int overflow, limit = 60, nameLen; + unsigned int overflow, limit = 60; + size_t nameLen; const char *procName = TclGetStringFromObj(procNameObj, &nameLen); overflow = (nameLen > limit); Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (lambda term \"%.*s%s\" line %d)", - (overflow ? limit : nameLen), procName, + (int)(overflow ? limit : nameLen), procName, (overflow ? "..." : ""), Tcl_GetErrorLine(interp))); } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 26634da..1e8055b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -684,7 +684,7 @@ Tcl_GetRange( if (first == (size_t)-1) { first = 0; } - if (last >= (size_t)-2) { + if (last + 2 <= first + 1) { return Tcl_NewObj(); } @@ -3070,7 +3070,7 @@ TclStringCat( /* No string rep; Take the chance we can avoid making it */ pendingPtr = objPtr; } else { - (void *)TclGetStringFromObj(objPtr, &length); /* PANIC? */ + (void)TclGetStringFromObj(objPtr, &length); /* PANIC? */ } } while (--oc && (length == 0) && (pendingPtr == NULL)); @@ -3237,7 +3237,7 @@ TclStringCat( if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %u bytes", + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } @@ -3253,7 +3253,7 @@ TclStringCat( Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %u bytes", + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } |