From 1961633531b70d5a6e627f86153f4d15e722ea8b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Dec 2018 19:38:33 +0000 Subject: If compiled with -DTCL_NO_DEPRECATED, remove Tcl_NewIntObj/Tcl_NewLongObj/Tcl_DbNewLongObj from stub table, as they will be gone in 9.0 (converted to a macro) Use Tcl_WideInt's directly in more places, diminishing the possibility of inadvent overflow. --- generic/tcl.h | 2 +- generic/tclAssembly.c | 4 ++-- generic/tclBasic.c | 2 +- generic/tclBinary.c | 8 ++++---- generic/tclClock.c | 24 ++++++++++++------------ generic/tclCmdAH.c | 24 ++++++++++++------------ generic/tclCmdIL.c | 42 +++++++++++++++++++++--------------------- generic/tclCmdMZ.c | 34 +++++++++++++++++----------------- generic/tclDecls.h | 6 +++--- generic/tclInt.h | 2 +- generic/tclInterp.c | 24 ++++++++++++------------ generic/tclObj.c | 16 +++++++++++----- generic/tclScan.c | 10 +++++----- generic/tclStringObj.c | 12 ++++++------ generic/tclStubInit.c | 3 +++ generic/tclTest.c | 26 +++++++++++++------------- generic/tclTestObj.c | 12 ++++++------ generic/tclUtil.c | 8 ++++---- generic/tclZlib.c | 18 +++++++++--------- tools/tsdPerf.c | 8 ++++---- unix/tclLoadAix.c | 4 ++-- unix/tclUnixFCmd.c | 8 ++++---- unix/tclUnixPipe.c | 6 +++--- unix/tclUnixTest.c | 4 ++-- win/tclWinTest.c | 8 ++++---- 25 files changed, 162 insertions(+), 153 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 64ad440..1c55f7e 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2519,7 +2519,7 @@ EXTERN int TclZipfs_AppHook(int *argc, char ***argv); Tcl_DbNewBignumObj(val, __FILE__, __LINE__) # undef Tcl_NewBooleanObj # define Tcl_NewBooleanObj(val) \ - Tcl_DbNewLongObj((val)!=0, __FILE__, __LINE__) + Tcl_DbNewWideIntObj((val)!=0, __FILE__, __LINE__) # undef Tcl_NewByteArrayObj # define Tcl_NewByteArrayObj(bytes, len) \ Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 5ac9a55..85bc8b9 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -803,7 +803,7 @@ TclNRAssembleObjCmd( Tcl_AddErrorInfo(interp, "\n (\""); Tcl_AppendObjToErrorInfo(interp, objv[0]); Tcl_AddErrorInfo(interp, "\" body, line "); - backtrace = Tcl_NewIntObj(Tcl_GetErrorLine(interp)); + backtrace = Tcl_NewWideIntObj(Tcl_GetErrorLine(interp)); Tcl_AppendObjToErrorInfo(interp, backtrace); Tcl_AddErrorInfo(interp, ")"); return TCL_ERROR; @@ -4263,7 +4263,7 @@ AddBasicBlockRangeToErrorInfo( Tcl_Obj* lineNo; /* Line number in the source */ Tcl_AddErrorInfo(interp, "\n in assembly code between lines "); - lineNo = Tcl_NewIntObj(bbPtr->startLine); + lineNo = Tcl_NewWideIntObj(bbPtr->startLine); Tcl_IncrRefCount(lineNo); Tcl_AppendObjToErrorInfo(interp, lineNo); Tcl_AddErrorInfo(interp, " and "); diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fd0d8c8..0fc4f9c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7021,7 +7021,7 @@ Tcl_ExprString( * An empty string. Just set the interpreter's result to 0. */ - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } else { Tcl_Obj *resultPtr, *exprObj = Tcl_NewStringObj(expr, -1); diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 4e17979..acd26bf 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1708,7 +1708,7 @@ BinaryScanCmd( */ done: - Tcl_SetObjResult(interp, Tcl_NewLongObj(arg - 3)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(arg - 3)); DeleteScanNumberCache(numberCachePtr); return TCL_OK; @@ -2275,7 +2275,7 @@ ScanNumber( returnNumericObject: if (*numberCachePtrPtr == NULL) { - return Tcl_NewLongObj(value); + return Tcl_NewWideIntObj(value); } else { register Tcl_HashTable *tablePtr = *numberCachePtrPtr; register Tcl_HashEntry *hPtr; @@ -2286,7 +2286,7 @@ ScanNumber( return Tcl_GetHashValue(hPtr); } if (tablePtr->numEntries <= BINARY_SCAN_MAX_CACHE) { - register Tcl_Obj *objPtr = Tcl_NewLongObj(value); + register Tcl_Obj *objPtr = Tcl_NewWideIntObj(value); Tcl_IncrRefCount(objPtr); Tcl_SetHashValue(hPtr, objPtr); @@ -2304,7 +2304,7 @@ ScanNumber( DeleteScanNumberCache(tablePtr); *numberCachePtrPtr = NULL; - return Tcl_NewLongObj(value); + return Tcl_NewWideIntObj(value); } /* diff --git a/generic/tclClock.c b/generic/tclClock.c index 7f4f592..1ec3e28 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -488,27 +488,27 @@ ClockGetdatefieldsObjCmd( Tcl_DictObjPut(NULL, dict, literals[LIT_TZNAME], fields.tzName); Tcl_DecrRefCount(fields.tzName); Tcl_DictObjPut(NULL, dict, literals[LIT_TZOFFSET], - Tcl_NewIntObj(fields.tzOffset)); + Tcl_NewWideIntObj(fields.tzOffset)); Tcl_DictObjPut(NULL, dict, literals[LIT_JULIANDAY], - Tcl_NewIntObj(fields.julianDay)); + Tcl_NewWideIntObj(fields.julianDay)); Tcl_DictObjPut(NULL, dict, literals[LIT_GREGORIAN], - Tcl_NewIntObj(fields.gregorian)); + Tcl_NewWideIntObj(fields.gregorian)); Tcl_DictObjPut(NULL, dict, literals[LIT_ERA], literals[fields.era ? LIT_BCE : LIT_CE]); Tcl_DictObjPut(NULL, dict, literals[LIT_YEAR], - Tcl_NewIntObj(fields.year)); + Tcl_NewWideIntObj(fields.year)); Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFYEAR], - Tcl_NewIntObj(fields.dayOfYear)); + Tcl_NewWideIntObj(fields.dayOfYear)); Tcl_DictObjPut(NULL, dict, literals[LIT_MONTH], - Tcl_NewIntObj(fields.month)); + Tcl_NewWideIntObj(fields.month)); Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFMONTH], - Tcl_NewIntObj(fields.dayOfMonth)); + Tcl_NewWideIntObj(fields.dayOfMonth)); Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601YEAR], - Tcl_NewIntObj(fields.iso8601Year)); + Tcl_NewWideIntObj(fields.iso8601Year)); Tcl_DictObjPut(NULL, dict, literals[LIT_ISO8601WEEK], - Tcl_NewIntObj(fields.iso8601Week)); + Tcl_NewWideIntObj(fields.iso8601Week)); Tcl_DictObjPut(NULL, dict, literals[LIT_DAYOFWEEK], - Tcl_NewIntObj(fields.dayOfWeek)); + Tcl_NewWideIntObj(fields.dayOfWeek)); Tcl_SetObjResult(interp, dict); return TCL_OK; @@ -628,7 +628,7 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( copied = 1; } status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY], - Tcl_NewIntObj(fields.julianDay)); + Tcl_NewWideIntObj(fields.julianDay)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); } @@ -712,7 +712,7 @@ ClockGetjuliandayfromerayearweekdayObjCmd( copied = 1; } status = Tcl_DictObjPut(interp, dict, literals[LIT_JULIANDAY], - Tcl_NewIntObj(fields.julianDay)); + Tcl_NewWideIntObj(fields.julianDay)); if (status == TCL_OK) { Tcl_SetObjResult(interp, dict); } diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 626066d..331f791 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -382,7 +382,7 @@ CatchObjCmdCallback( } Tcl_ResetResult(interp); - Tcl_SetObjResult(interp, Tcl_NewIntObj(result)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result)); return TCL_OK; } @@ -1179,7 +1179,7 @@ FileAttrAccessTimeCmd( } } - Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_atime)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((long) buf.st_atime)); return TCL_OK; } @@ -1259,7 +1259,7 @@ FileAttrModifyTimeCmd( } } - Tcl_SetObjResult(interp, Tcl_NewLongObj((long) buf.st_mtime)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((long) buf.st_mtime)); return TCL_OK; } @@ -2278,23 +2278,23 @@ StoreStatData( * cast might fail when there isn't a real arithmetic 'long long' type... */ - STORE_ARY("dev", Tcl_NewLongObj((long)statPtr->st_dev)); + STORE_ARY("dev", Tcl_NewWideIntObj((long)statPtr->st_dev)); STORE_ARY("ino", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_ino)); - STORE_ARY("nlink", Tcl_NewLongObj((long)statPtr->st_nlink)); - STORE_ARY("uid", Tcl_NewLongObj((long)statPtr->st_uid)); - STORE_ARY("gid", Tcl_NewLongObj((long)statPtr->st_gid)); + STORE_ARY("nlink", Tcl_NewWideIntObj((long)statPtr->st_nlink)); + STORE_ARY("uid", Tcl_NewWideIntObj((long)statPtr->st_uid)); + STORE_ARY("gid", Tcl_NewWideIntObj((long)statPtr->st_gid)); STORE_ARY("size", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_size)); #ifdef HAVE_STRUCT_STAT_ST_BLOCKS STORE_ARY("blocks", Tcl_NewWideIntObj((Tcl_WideInt)statPtr->st_blocks)); #endif #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - STORE_ARY("blksize", Tcl_NewLongObj((long)statPtr->st_blksize)); + STORE_ARY("blksize", Tcl_NewWideIntObj((long)statPtr->st_blksize)); #endif - STORE_ARY("atime", Tcl_NewLongObj((long)statPtr->st_atime)); - STORE_ARY("mtime", Tcl_NewLongObj((long)statPtr->st_mtime)); - STORE_ARY("ctime", Tcl_NewLongObj((long)statPtr->st_ctime)); + STORE_ARY("atime", Tcl_NewWideIntObj((long)statPtr->st_atime)); + STORE_ARY("mtime", Tcl_NewWideIntObj((long)statPtr->st_mtime)); + STORE_ARY("ctime", Tcl_NewWideIntObj((long)statPtr->st_ctime)); mode = (unsigned short) statPtr->st_mode; - STORE_ARY("mode", Tcl_NewIntObj(mode)); + STORE_ARY("mode", Tcl_NewWideIntObj(mode)); STORE_ARY("type", Tcl_NewStringObj(GetTypeFromMode(mode), -1)); #undef STORE_ARY diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 3bd49da..dd11bac 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -404,7 +404,7 @@ Tcl_IncrObjCmd( if (objc == 3) { incrPtr = objv[2]; } else { - incrPtr = Tcl_NewIntObj(1); + incrPtr = Tcl_NewWideIntObj(1); } Tcl_IncrRefCount(incrPtr); newValuePtr = TclIncrObjVar2(interp, objv[1], NULL, @@ -606,7 +606,7 @@ InfoCmdCountCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(iPtr->cmdCount)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iPtr->cmdCount)); return TCL_OK; } @@ -988,7 +988,7 @@ InfoDefaultCmd( if (valueObjPtr == NULL) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(1)); } else { Tcl_Obj *nullObjPtr = Tcl_NewObj(); @@ -997,7 +997,7 @@ InfoDefaultCmd( if (valueObjPtr == NULL) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } return TCL_OK; } @@ -1171,7 +1171,7 @@ InfoFrameCmd( * Just "info frame". */ - Tcl_SetObjResult(interp, Tcl_NewIntObj(topLevel)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(topLevel)); goto done; } @@ -1293,9 +1293,9 @@ TclInfoFrame( ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1)); if (framePtr->line) { - ADD_PAIR("line", Tcl_NewIntObj(framePtr->line[0])); + ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0])); } else { - ADD_PAIR("line", Tcl_NewIntObj(1)); + ADD_PAIR("line", Tcl_NewWideIntObj(1)); } ADD_PAIR("cmd", TclGetSourceFromFrame(framePtr, 0, NULL)); break; @@ -1332,7 +1332,7 @@ TclInfoFrame( ADD_PAIR("type", Tcl_NewStringObj(typeString[fPtr->type], -1)); if (fPtr->line) { - ADD_PAIR("line", Tcl_NewIntObj(fPtr->line[0])); + ADD_PAIR("line", Tcl_NewWideIntObj(fPtr->line[0])); } if (fPtr->type == TCL_LOCATION_SOURCE) { @@ -1359,7 +1359,7 @@ TclInfoFrame( */ ADD_PAIR("type", Tcl_NewStringObj(typeString[framePtr->type], -1)); - ADD_PAIR("line", Tcl_NewIntObj(framePtr->line[0])); + ADD_PAIR("line", Tcl_NewWideIntObj(framePtr->line[0])); ADD_PAIR("file", framePtr->data.eval.path); /* @@ -1430,7 +1430,7 @@ TclInfoFrame( int c = framePtr->framePtr->level; int t = iPtr->varFramePtr->level; - ADD_PAIR("level", Tcl_NewIntObj(t - c)); + ADD_PAIR("level", Tcl_NewWideIntObj(t - c)); break; } } @@ -1585,7 +1585,7 @@ InfoLevelCmd( Interp *iPtr = (Interp *) interp; if (objc == 1) { /* Just "info level" */ - Tcl_SetObjResult(interp, Tcl_NewIntObj(iPtr->varFramePtr->level)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(iPtr->varFramePtr->level)); return TCL_OK; } @@ -2554,7 +2554,7 @@ Tcl_LlengthObjCmd( * length. */ - Tcl_SetObjResult(interp, Tcl_NewIntObj(listLen)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listLen)); return TCL_OK; } @@ -3390,7 +3390,7 @@ Tcl_LsearchObjCmd( if (allMatches || inlineReturn) { Tcl_ResetResult(interp); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-1)); } goto done; } @@ -3679,14 +3679,14 @@ Tcl_LsearchObjCmd( } else if (returnSubindices) { int j; - itemPtr = Tcl_NewIntObj(i+groupOffset); + itemPtr = Tcl_NewWideIntObj(i+groupOffset); for (j=0 ; jpayload.index; for (j = 0; j < groupSize; j++) { if (indices) { - objPtr = Tcl_NewIntObj(idx + j - groupOffset); + objPtr = Tcl_NewWideIntObj(idx + j - groupOffset); newArray[i++] = objPtr; Tcl_IncrRefCount(objPtr); } else { @@ -4289,7 +4289,7 @@ Tcl_LsortObjCmd( } } else if (indices) { for (i=0; elementPtr != NULL ; elementPtr = elementPtr->nextPtr) { - objPtr = Tcl_NewIntObj(elementPtr->payload.index); + objPtr = Tcl_NewWideIntObj(elementPtr->payload.index); newArray[i++] = objPtr; Tcl_IncrRefCount(objPtr); } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d21a521..786e52c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -335,7 +335,7 @@ Tcl_RegexpObjCmd( */ if (!doinline) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } return TCL_OK; } @@ -388,8 +388,8 @@ Tcl_RegexpObjCmd( end = -1; } - objs[0] = Tcl_NewLongObj(start); - objs[1] = Tcl_NewLongObj(end); + objs[0] = Tcl_NewWideIntObj(start); + objs[1] = Tcl_NewWideIntObj(end); newPtr = Tcl_NewListObj(2, objs); } else { @@ -457,7 +457,7 @@ Tcl_RegexpObjCmd( if (doinline) { Tcl_SetObjResult(interp, resultPtr); } else { - Tcl_SetObjResult(interp, Tcl_NewIntObj(all ? all-1 : 1)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(all ? all-1 : 1)); } return TCL_OK; } @@ -959,7 +959,7 @@ Tcl_RegsubObjCmd( * holding the number of matches. */ - Tcl_SetObjResult(interp, Tcl_NewIntObj(numMatches)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(numMatches)); } } else { /* @@ -1336,7 +1336,7 @@ StringFirstCmd( return TCL_ERROR; } } - Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringFirst(objv[1], + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringFirst(objv[1], objv[2], start))); return TCL_OK; } @@ -1381,7 +1381,7 @@ StringLastCmd( return TCL_ERROR; } } - Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringLast(objv[1], + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclStringLast(objv[1], objv[2], last))); return TCL_OK; } @@ -1873,7 +1873,7 @@ StringIsCmd( str_is_done: if ((result == 0) && (failVarObj != NULL) && - Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewIntObj(failat), + Tcl_ObjSetVar2(interp, failVarObj, NULL, Tcl_NewWideIntObj(failat), TCL_LEAVE_ERR_MSG) == NULL) { return TCL_ERROR; } @@ -2496,7 +2496,7 @@ StringStartCmd( cur += 1; } } - Tcl_SetObjResult(interp, Tcl_NewIntObj(cur)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(cur)); return TCL_OK; } @@ -2558,7 +2558,7 @@ StringEndCmd( } else { cur = numChars; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(cur)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(cur)); return TCL_OK; } @@ -2677,7 +2677,7 @@ StringCmpCmd( objv += objc-2; match = TclStringCmp(objv[0], objv[1], 0, nocase, reqlength); - Tcl_SetObjResult(interp, Tcl_NewIntObj(match)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(match)); return TCL_OK; } @@ -2803,7 +2803,7 @@ StringBytesCmd( } (void) TclGetStringFromObj(objv[1], &length); - Tcl_SetObjResult(interp, Tcl_NewIntObj(length)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(length)); return TCL_OK; } @@ -2837,7 +2837,7 @@ StringLenCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_GetCharLength(objv[1]))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_GetCharLength(objv[1]))); return TCL_OK; } @@ -3726,10 +3726,10 @@ TclNRSwitchObjCmd( Tcl_Obj *rangeObjAry[2]; if (info.matches[j].end > 0) { - rangeObjAry[0] = Tcl_NewLongObj(info.matches[j].start); - rangeObjAry[1] = Tcl_NewLongObj(info.matches[j].end-1); + rangeObjAry[0] = Tcl_NewWideIntObj(info.matches[j].start); + rangeObjAry[1] = Tcl_NewWideIntObj(info.matches[j].end-1); } else { - rangeObjAry[0] = rangeObjAry[1] = Tcl_NewIntObj(-1); + rangeObjAry[0] = rangeObjAry[1] = Tcl_NewWideIntObj(-1); } /* @@ -4049,7 +4049,7 @@ Tcl_TimeObjCmd( * Use int obj since we know time is not fractional. [Bug 1202178] */ - objs[0] = Tcl_NewIntObj((count <= 0) ? 0 : (int) totalMicroSec); + objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt) totalMicroSec); } else { objs[0] = Tcl_NewDoubleObj(totalMicroSec/count); } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index ad8fbbc..d323b73 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3942,13 +3942,13 @@ extern const TclStubs *tclStubsPtr; sizeof(char *), msg, flags, indexPtr) #undef Tcl_NewBooleanObj #define Tcl_NewBooleanObj(boolValue) \ - Tcl_NewLongObj((boolValue)!=0) + Tcl_NewWideIntObj((boolValue)!=0) #undef Tcl_DbNewBooleanObj #define Tcl_DbNewBooleanObj(boolValue, file, line) \ - Tcl_DbNewLongObj((boolValue)!=0, file, line) + Tcl_DbNewWideIntObj((boolValue)!=0, file, line) #undef Tcl_SetBooleanObj #define Tcl_SetBooleanObj(objPtr, boolValue) \ - Tcl_SetLongObj(objPtr, (boolValue)!=0) + Tcl_SetWideIntObj(objPtr, (boolValue)!=0) #undef Tcl_SetVar #define Tcl_SetVar(interp, varName, newValue, flags) \ Tcl_SetVar2(interp, varName, NULL, newValue, flags) diff --git a/generic/tclInt.h b/generic/tclInt.h index 9fc064e..3a9b2ee 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2527,7 +2527,7 @@ typedef struct List { #define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? (*(wideIntPtr) = (Tcl_WideInt) \ + ? (*(wideIntPtr) = \ ((objPtr)->internalRep.wideValue), TCL_OK) : \ Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index b1cc0c8..1863ea5 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1188,7 +1188,7 @@ Tcl_CreateAlias( int i; int result; - objv = TclStackAlloc(slaveInterp, (unsigned) sizeof(Tcl_Obj *) * argc); + objv = TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc); for (i = 0; i < argc; i++) { objv[i] = Tcl_NewStringObj(argv[i], -1); Tcl_IncrRefCount(objv[i]); @@ -3007,7 +3007,7 @@ SlaveRecursionLimit( return TCL_OK; } else { limit = Tcl_SetRecursionLimit(slaveInterp, 0); - Tcl_SetObjResult(interp, Tcl_NewIntObj(limit)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limit)); return TCL_OK; } } @@ -4516,12 +4516,12 @@ SlaveCommandLimitCmd( Tcl_NewStringObj(options[0], -1), empty); } Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1), - Tcl_NewIntObj(Tcl_LimitGetGranularity(slaveInterp, + Tcl_NewWideIntObj(Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_COMMANDS))); if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_COMMANDS)) { Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1), - Tcl_NewIntObj(Tcl_LimitGetCommands(slaveInterp))); + Tcl_NewWideIntObj(Tcl_LimitGetCommands(slaveInterp))); } else { Tcl_Obj *empty; @@ -4549,13 +4549,13 @@ SlaveCommandLimitCmd( } break; case OPT_GRAN: - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_COMMANDS))); break; case OPT_VAL: if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_COMMANDS)) { Tcl_SetObjResult(interp, - Tcl_NewIntObj(Tcl_LimitGetCommands(slaveInterp))); + Tcl_NewWideIntObj(Tcl_LimitGetCommands(slaveInterp))); } break; } @@ -4703,7 +4703,7 @@ SlaveTimeLimitCmd( Tcl_NewStringObj(options[0], -1), empty); } Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[1], -1), - Tcl_NewIntObj(Tcl_LimitGetGranularity(slaveInterp, + Tcl_NewWideIntObj(Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_TIME))); if (Tcl_LimitTypeEnabled(slaveInterp, TCL_LIMIT_TIME)) { @@ -4711,9 +4711,9 @@ SlaveTimeLimitCmd( Tcl_LimitGetTime(slaveInterp, &limitMoment); Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[2], -1), - Tcl_NewLongObj(limitMoment.usec/1000)); + Tcl_NewWideIntObj(limitMoment.usec/1000)); Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[3], -1), - Tcl_NewLongObj(limitMoment.sec)); + Tcl_NewWideIntObj(limitMoment.sec)); } else { Tcl_Obj *empty; @@ -4743,7 +4743,7 @@ SlaveTimeLimitCmd( } break; case OPT_GRAN: - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tcl_LimitGetGranularity(slaveInterp, TCL_LIMIT_TIME))); break; case OPT_MILLI: @@ -4752,7 +4752,7 @@ SlaveTimeLimitCmd( Tcl_LimitGetTime(slaveInterp, &limitMoment); Tcl_SetObjResult(interp, - Tcl_NewLongObj(limitMoment.usec/1000)); + Tcl_NewWideIntObj(limitMoment.usec/1000)); } break; case OPT_SEC: @@ -4760,7 +4760,7 @@ SlaveTimeLimitCmd( Tcl_Time limitMoment; Tcl_LimitGetTime(slaveInterp, &limitMoment); - Tcl_SetObjResult(interp, Tcl_NewLongObj(limitMoment.sec)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(limitMoment.sec)); } break; } diff --git a/generic/tclObj.c b/generic/tclObj.c index 9edb75f..72c45c6 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -178,7 +178,7 @@ static Tcl_ThreadDataKey pendingObjDataKey; #define PACK_BIGNUM(bignum, objPtr) \ if ((bignum).used > 0x7fff) { \ - mp_int *temp = (void *) ckalloc((unsigned) sizeof(mp_int)); \ + mp_int *temp = (void *) ckalloc(sizeof(mp_int)); \ *temp = bignum; \ (objPtr)->internalRep.twoPtrValue.ptr1 = temp; \ (objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(-1); \ @@ -1980,7 +1980,7 @@ Tcl_Obj * Tcl_NewBooleanObj( register int boolValue) /* Boolean used to initialize new object. */ { - return Tcl_DbNewLongObj(boolValue!=0, "unknown", 0); + return Tcl_DbNewWideIntObj(boolValue!=0, "unknown", 0); } #else /* if not TCL_MEM_DEBUG */ @@ -2623,6 +2623,7 @@ UpdateStringOfDouble( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_NewIntObj #ifdef TCL_MEM_DEBUG @@ -2630,7 +2631,7 @@ Tcl_Obj * Tcl_NewIntObj( register int intValue) /* Int used to initialize the new object. */ { - return Tcl_DbNewLongObj((long)intValue, "unknown", 0); + return Tcl_DbNewWideIntObj((long)intValue, "unknown", 0); } #else /* if not TCL_MEM_DEBUG */ @@ -2645,6 +2646,7 @@ Tcl_NewIntObj( return objPtr; } #endif /* if TCL_MEM_DEBUG */ +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -2830,6 +2832,7 @@ UpdateStringOfOldInt( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_NewLongObj #ifdef TCL_MEM_DEBUG @@ -2838,7 +2841,7 @@ Tcl_NewLongObj( register long longValue) /* Long integer used to initialize the * new object. */ { - return Tcl_DbNewLongObj(longValue, "unknown", 0); + return Tcl_DbNewWideIntObj(longValue, "unknown", 0); } #else /* if not TCL_MEM_DEBUG */ @@ -2854,6 +2857,7 @@ Tcl_NewLongObj( return objPtr; } #endif /* if TCL_MEM_DEBUG */ +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -2887,6 +2891,7 @@ Tcl_NewLongObj( *---------------------------------------------------------------------- */ +#ifndef TCL_NO_DEPRECATED #undef Tcl_DbNewLongObj #ifdef TCL_MEM_DEBUG @@ -2921,9 +2926,10 @@ Tcl_DbNewLongObj( int line) /* Line number in the source file; used for * debugging. */ { - return Tcl_NewLongObj(longValue); + return Tcl_NewWideIntObj(longValue); } #endif /* TCL_MEM_DEBUG */ +#endif /* TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclScan.c b/generic/tclScan.c index ae9f505..447b7ba 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -719,7 +719,7 @@ Tcl_ScanObjCmd( switch (ch) { case 'n': if (!(flags & SCAN_SUPPRESS)) { - objPtr = Tcl_NewIntObj(string - baseString); + objPtr = Tcl_NewWideIntObj(string - baseString); Tcl_IncrRefCount(objPtr); CLANG_ASSERT(objs); objs[objIndex++] = objPtr; @@ -889,7 +889,7 @@ Tcl_ScanObjCmd( #endif string += offset; if (!(flags & SCAN_SUPPRESS)) { - objPtr = Tcl_NewIntObj(i); + objPtr = Tcl_NewWideIntObj(i); Tcl_IncrRefCount(objPtr); CLANG_ASSERT(objs); objs[objIndex++] = objPtr; @@ -900,7 +900,7 @@ Tcl_ScanObjCmd( /* * Scan an unsigned or signed integer. */ - objPtr = Tcl_NewLongObj(0); + objPtr = Tcl_NewWideIntObj(0); Tcl_IncrRefCount(objPtr); if (width == 0) { width = ~0; @@ -1081,7 +1081,7 @@ Tcl_ScanObjCmd( if (code == TCL_OK) { if (underflow && (nconversions == 0)) { if (numVars) { - objPtr = Tcl_NewIntObj(-1); + objPtr = Tcl_NewWideIntObj(-1); } else { if (objPtr) { Tcl_SetListObj(objPtr, 0, NULL); @@ -1090,7 +1090,7 @@ Tcl_ScanObjCmd( } } } else if (numVars) { - objPtr = Tcl_NewIntObj(result); + objPtr = Tcl_NewWideIntObj(result); } Tcl_SetObjResult(interp, objPtr); } diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index f7d287b..4e6cdc5 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2171,7 +2171,7 @@ Tcl_AppendFormatToObj( const char *bytes; if (useShort) { - pure = Tcl_NewIntObj((int) s); + pure = Tcl_NewWideIntObj(s); #ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { pure = Tcl_NewWideIntObj(w); @@ -2179,7 +2179,7 @@ Tcl_AppendFormatToObj( } else if (useBig) { pure = Tcl_NewBignumObj(&big); } else { - pure = Tcl_NewLongObj(l); + pure = Tcl_NewWideIntObj(l); } Tcl_IncrRefCount(pure); bytes = TclGetStringFromObj(pure, &length); @@ -2635,11 +2635,11 @@ AppendPrintfToObjVA( switch (size) { case -1: case 0: - Tcl_ListObjAppendElement(NULL, list, Tcl_NewLongObj( - (long) va_arg(argList, int))); + Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj( + va_arg(argList, int))); break; case 1: - Tcl_ListObjAppendElement(NULL, list, Tcl_NewLongObj( + Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj( va_arg(argList, long))); break; case 2: @@ -2670,7 +2670,7 @@ AppendPrintfToObjVA( break; case '*': lastNum = (int) va_arg(argList, int); - Tcl_ListObjAppendElement(NULL, list, Tcl_NewIntObj(lastNum)); + Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj(lastNum)); p++; break; case '0': case '1': case '2': case '3': case '4': diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index feabc3b..682ed6d 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -97,6 +97,9 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define Tcl_ListMathFuncs 0 # define Tcl_SetIntObj 0 # define Tcl_SetLongObj 0 +# define Tcl_NewIntObj 0 +# define Tcl_NewLongObj 0 +# define Tcl_DbNewLongObj 0 #else #define TclSetStartupScriptPath setStartupScriptPath diff --git a/generic/tclTest.c b/generic/tclTest.c index 0e298ee..f97ba6d 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1958,11 +1958,11 @@ TestencodingObjCmd( string = Tcl_GetStringFromObj(objv[3], &length); encodingPtr->toUtfCmd = ckalloc(length + 1); - memcpy(encodingPtr->toUtfCmd, string, (unsigned) length + 1); + memcpy(encodingPtr->toUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[4], &length); encodingPtr->fromUtfCmd = ckalloc(length + 1); - memcpy(encodingPtr->fromUtfCmd, string, (unsigned) (length + 1)); + memcpy(encodingPtr->fromUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[2], &length); @@ -2014,7 +2014,7 @@ EncodingToUtfProc( if (len > dstLen) { len = dstLen; } - memcpy(dst, Tcl_GetStringResult(encodingPtr->interp), (unsigned) len); + memcpy(dst, Tcl_GetStringResult(encodingPtr->interp), len); Tcl_ResetResult(encodingPtr->interp); *srcReadPtr = srcLen; @@ -2046,7 +2046,7 @@ EncodingFromUtfProc( if (len > dstLen) { len = dstLen; } - memcpy(dst, Tcl_GetStringResult(encodingPtr->interp), (unsigned) len); + memcpy(dst, Tcl_GetStringResult(encodingPtr->interp), len); Tcl_ResetResult(encodingPtr->interp); *srcReadPtr = srcLen; @@ -3032,10 +3032,10 @@ TestlinkCmd( Tcl_AppendElement(interp, buffer); TclFormatInt(buffer, (int) uintVar); Tcl_AppendElement(interp, buffer); - tmp = Tcl_NewLongObj(longVar); + tmp = Tcl_NewWideIntObj(longVar); Tcl_AppendElement(interp, Tcl_GetString(tmp)); Tcl_DecrRefCount(tmp); - tmp = Tcl_NewLongObj((long)ulongVar); + tmp = Tcl_NewWideIntObj((long)ulongVar); Tcl_AppendElement(interp, Tcl_GetString(tmp)); Tcl_DecrRefCount(tmp); Tcl_PrintDouble(NULL, (double)floatVar, buffer); @@ -3942,8 +3942,8 @@ TestregexpObjCmd( end--; } - objs[0] = Tcl_NewLongObj(start); - objs[1] = Tcl_NewLongObj(end); + objs[0] = Tcl_NewWideIntObj(start); + objs[1] = Tcl_NewWideIntObj(end); newPtr = Tcl_NewListObj(2, objs); } else { @@ -5817,7 +5817,7 @@ TestChannelEventCmd( cmd = argv[2]; len = strlen(cmd); - if ((cmd[0] == 'a') && (strncmp(cmd, "add", (unsigned) len) == 0)) { + if ((cmd[0] == 'a') && (strncmp(cmd, "add", len) == 0)) { if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " channelName add eventSpec script\"", NULL); @@ -5851,7 +5851,7 @@ TestChannelEventCmd( return TCL_OK; } - if ((cmd[0] == 'd') && (strncmp(cmd, "delete", (unsigned) len) == 0)) { + if ((cmd[0] == 'd') && (strncmp(cmd, "delete", len) == 0)) { if (argc != 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " channelName delete index\"", NULL); @@ -5897,7 +5897,7 @@ TestChannelEventCmd( return TCL_OK; } - if ((cmd[0] == 'l') && (strncmp(cmd, "list", (unsigned) len) == 0)) { + if ((cmd[0] == 'l') && (strncmp(cmd, "list", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " channelName list\"", NULL); @@ -5920,7 +5920,7 @@ TestChannelEventCmd( return TCL_OK; } - if ((cmd[0] == 'r') && (strncmp(cmd, "removeall", (unsigned) len) == 0)) { + if ((cmd[0] == 'r') && (strncmp(cmd, "removeall", len) == 0)) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " channelName removeall\"", NULL); @@ -5939,7 +5939,7 @@ TestChannelEventCmd( return TCL_OK; } - if ((cmd[0] == 's') && (strncmp(cmd, "set", (unsigned) len) == 0)) { + if ((cmd[0] == 's') && (strncmp(cmd, "set", len) == 0)) { if (argc != 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " channelName delete index event\"", NULL); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 547792a..67b1997 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -723,9 +723,9 @@ TestintobjCmd( } intValue = i; if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) { - Tcl_SetLongObj(varPtr[varIndex], intValue); + Tcl_SetWideIntObj(varPtr[varIndex], intValue); } else { - SetVarToObj(varPtr, varIndex, Tcl_NewLongObj(intValue)); + SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(intValue)); } Tcl_SetObjResult(interp, varPtr[varIndex]); } else if (strcmp(subCmd, "setmaxlong") == 0) { @@ -734,9 +734,9 @@ TestintobjCmd( goto wrongNumArgs; } if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) { - Tcl_SetLongObj(varPtr[varIndex], maxLong); + Tcl_SetWideIntObj(varPtr[varIndex], maxLong); } else { - SetVarToObj(varPtr, varIndex, Tcl_NewLongObj(maxLong)); + SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(maxLong)); } } else if (strcmp(subCmd, "ismaxlong") == 0) { if (objc != 3) { @@ -782,9 +782,9 @@ TestintobjCmd( Tcl_AppendToObj(Tcl_GetObjResult(interp), "1", -1); #else if ((varPtr[varIndex] != NULL) && !Tcl_IsShared(varPtr[varIndex])) { - Tcl_SetLongObj(varPtr[varIndex], LONG_MAX); + Tcl_SetWideIntObj(varPtr[varIndex], LONG_MAX); } else { - SetVarToObj(varPtr, varIndex, Tcl_NewLongObj(LONG_MAX)); + SetVarToObj(varPtr, varIndex, Tcl_NewWideIntObj(LONG_MAX)); } if (Tcl_GetIntFromObj(interp, varPtr[varIndex], &i) != TCL_OK) { Tcl_ResetResult(interp); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index a56a99a..4c16c1f 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2016,7 +2016,7 @@ Tcl_Concat( * All element bytes + (argc - 1) spaces + 1 terminating NULL. */ - result = ckalloc((unsigned) (bytesNeeded + argc)); + result = ckalloc(bytesNeeded + argc); for (p = result, i = 0; i < argc; i++) { int triml, trimr, elemLength; @@ -3104,7 +3104,7 @@ Tcl_DStringGetResult( dsPtr->spaceAvl = dsPtr->length+1; } else { dsPtr->string = ckalloc(dsPtr->length+1); - memcpy(dsPtr->string, iPtr->result, (unsigned) dsPtr->length+1); + memcpy(dsPtr->string, iPtr->result, dsPtr->length+1); iPtr->freeProc(iPtr->result); } dsPtr->spaceAvl = dsPtr->length+1; @@ -3117,7 +3117,7 @@ Tcl_DStringGetResult( dsPtr->string = ckalloc(dsPtr->length+1); dsPtr->spaceAvl = dsPtr->length + 1; } - memcpy(dsPtr->string, iPtr->result, (unsigned) dsPtr->length+1); + memcpy(dsPtr->string, iPtr->result, dsPtr->length+1); } iPtr->result = iPtr->resultSpace; @@ -3470,7 +3470,7 @@ TclPrecTraceProc( if (flags & TCL_TRACE_READS) { - Tcl_SetVar2Ex(interp, name1, name2, Tcl_NewIntObj(*precisionPtr), + Tcl_SetVar2Ex(interp, name1, name2, Tcl_NewWideIntObj(*precisionPtr), flags & TCL_GLOBAL_ONLY); return NULL; } diff --git a/generic/tclZlib.c b/generic/tclZlib.c index cc86de7..32268af 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -565,10 +565,10 @@ ExtractHeader( SetValue(dictObj, "filename", TclDStringToObj(&tmp)); } if (headerPtr->os != 255) { - SetValue(dictObj, "os", Tcl_NewIntObj(headerPtr->os)); + SetValue(dictObj, "os", Tcl_NewWideIntObj(headerPtr->os)); } if (headerPtr->time != 0 /* magic - no time */) { - SetValue(dictObj, "time", Tcl_NewLongObj((long) headerPtr->time)); + SetValue(dictObj, "time", Tcl_NewWideIntObj(headerPtr->time)); } if (headerPtr->text != Z_UNKNOWN) { SetValue(dictObj, "type", @@ -593,7 +593,7 @@ SetInflateDictionary( int length; unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length); - return inflateSetDictionary(strm, bytes, (unsigned) length); + return inflateSetDictionary(strm, bytes, length); } return Z_OK; } @@ -607,7 +607,7 @@ SetDeflateDictionary( int length; unsigned char *bytes = Tcl_GetByteArrayFromObj(compDictObj, &length); - return deflateSetDictionary(strm, bytes, (unsigned) length); + return deflateSetDictionary(strm, bytes, length); } return Z_OK; } @@ -623,7 +623,7 @@ Deflate( int e; strm->next_out = (Bytef *) bufferPtr; - strm->avail_out = (unsigned) bufferSize; + strm->avail_out = bufferSize; e = deflate(strm, flush); if (writtenPtr != NULL) { *writtenPtr = bufferSize - strm->avail_out; @@ -1858,7 +1858,7 @@ Tcl_ZlibInflate( if (headerPtr != NULL) { ExtractHeader(&header, gzipHeaderDictObj); SetValue(gzipHeaderDictObj, "size", - Tcl_NewLongObj((long) stream.total_out)); + Tcl_NewWideIntObj(stream.total_out)); ckfree(nameBuf); ckfree(commentBuf); } @@ -1894,7 +1894,7 @@ Tcl_ZlibCRC32( int len) { /* Nothing much to do, just wrap the crc32(). */ - return crc32(crc, (Bytef *) buf, (unsigned) len); + return crc32(crc, (Bytef *) buf, len); } unsigned int @@ -1903,7 +1903,7 @@ Tcl_ZlibAdler32( const unsigned char *buf, int len) { - return adler32(adler, (Bytef *) buf, (unsigned) len); + return adler32(adler, (Bytef *) buf, len); } /* @@ -2617,7 +2617,7 @@ ZlibStreamCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_ZlibStreamEof(zstream))); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tcl_ZlibStreamEof(zstream))); return TCL_OK; case zs_checksum: /* $strm checksum */ if (objc != 2) { diff --git a/tools/tsdPerf.c b/tools/tsdPerf.c index a75e962..7a599e0 100644 --- a/tools/tsdPerf.c +++ b/tools/tsdPerf.c @@ -5,21 +5,21 @@ extern DLLEXPORT Tcl_PackageInitProc Tsdperf_Init; static Tcl_ThreadDataKey key; typedef struct { - int value; + Tcl_WideInt value; } TsdPerf; static int tsdPerfSetObjCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) { TsdPerf *perf = Tcl_GetThreadData(&key, sizeof(TsdPerf)); - int i; + Tcl_WideInt i; if (2 != objc) { Tcl_WrongNumArgs(interp, 1, objv, "value"); return TCL_ERROR; } - if (TCL_OK != Tcl_GetIntFromObj(interp, objv[1], &i)) { + if (TCL_OK != Tcl_GetWideIntFromObj(interp, objv[1], &i)) { return TCL_ERROR; } @@ -33,7 +33,7 @@ tsdPerfGetObjCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const TsdPerf *perf = Tcl_GetThreadData(&key, sizeof(TsdPerf)); - Tcl_SetObjResult(interp, Tcl_NewIntObj(perf->value)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(perf->value)); return TCL_OK; } diff --git a/unix/tclLoadAix.c b/unix/tclLoadAix.c index 88e6b50..e5d9729 100644 --- a/unix/tclLoadAix.c +++ b/unix/tclLoadAix.c @@ -134,7 +134,7 @@ dlopen( return NULL; } - mp->name = malloc((unsigned) (strlen(path) + 1)); + mp->name = malloc(strlen(path) + 1); strcpy(mp->name, path); /* @@ -541,7 +541,7 @@ readExports( tmpsym[SYMNMLEN] = '\0'; symname = tmpsym; } - ep->name = malloc((unsigned) (strlen(symname) + 1)); + ep->name = malloc(strlen(symname) + 1); strcpy(ep->name, symname); ep->addr = (void *)((unsigned long) mp->entry + ls->l_value - shdata.s_vaddr); diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 548e96b..7205085 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -1369,7 +1369,7 @@ GetGroupAttribute( groupPtr = TclpGetGrGid(statBuf.st_gid); if (groupPtr == NULL) { - *attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_gid); + *attributePtrPtr = Tcl_NewWideIntObj(statBuf.st_gid); } else { Tcl_DString ds; const char *utf; @@ -1423,7 +1423,7 @@ GetOwnerAttribute( pwPtr = TclpGetPwUid(statBuf.st_uid); if (pwPtr == NULL) { - *attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_uid); + *attributePtrPtr = Tcl_NewWideIntObj(statBuf.st_uid); } else { Tcl_DString ds; @@ -2340,8 +2340,8 @@ GetUnixFileAttributes( return TCL_ERROR; } - *attributePtrPtr = Tcl_NewIntObj( - (fileAttributes & attributeArray[objIndex]) != 0); + *attributePtrPtr = Tcl_NewBooleanObj( + fileAttributes & attributeArray[objIndex]); return TCL_OK; } diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index be7b4eb..93faec8 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -872,7 +872,7 @@ TclGetAndDetachPids( pipePtr = Tcl_GetChannelInstanceData(chan); TclNewObj(pidsObj); for (i = 0; i < pipePtr->numPids; i++) { - Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewIntObj( + Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewWideIntObj( PTR2INT(pipePtr->pidPtr[i]))); Tcl_DetachPids(1, &pipePtr->pidPtr[i]); } @@ -1268,7 +1268,7 @@ Tcl_PidObjCmd( } if (objc == 1) { - Tcl_SetObjResult(interp, Tcl_NewLongObj((long) getpid())); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(getpid())); } else { /* * Get the channel and make sure that it refers to a pipe. @@ -1290,7 +1290,7 @@ Tcl_PidObjCmd( resultPtr = Tcl_NewObj(); for (i = 0; i < pipePtr->numPids; i++) { Tcl_ListObjAppendElement(NULL, resultPtr, - Tcl_NewIntObj(PTR2INT(TclpGetPid(pipePtr->pidPtr[i])))); + Tcl_NewWideIntObj(PTR2INT(TclpGetPid(pipePtr->pidPtr[i])))); } Tcl_SetObjResult(interp, resultPtr); } diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index ceb64d9..e59a0e3 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -570,7 +570,7 @@ TestforkObjCmd( if (pid==0) { Tcl_InitNotifier(); } - Tcl_SetObjResult(interp, Tcl_NewIntObj(pid)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pid)); return TCL_OK; } @@ -761,7 +761,7 @@ TestchmodCmd( if (translated == NULL) { return TCL_ERROR; } - if (chmod(translated, (unsigned) mode) != 0) { + if (chmod(translated, mode) != 0) { Tcl_AppendResult(interp, translated, ": ", Tcl_PosixError(interp), NULL); return TCL_ERROR; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index b2fe6c0..42a0d07 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -276,11 +276,11 @@ TestwinclockCmd( result = Tcl_NewObj(); Tcl_ListObjAppendElement(interp, result, - Tcl_NewIntObj((int) (t2.QuadPart / 10000000))); + Tcl_NewWideIntObj(t2.QuadPart / 10000000)); Tcl_ListObjAppendElement(interp, result, - Tcl_NewIntObj((int) ((t2.QuadPart / 10) % 1000000))); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.sec)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.usec)); + Tcl_NewWideIntObj((t2.QuadPart / 10) % 1000000)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(tclTime.sec)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(tclTime.usec)); Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p1.QuadPart)); Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p2.QuadPart)); -- cgit v0.12