Skip to content

Commit 51d6aed

Browse files
author
jan.nijtmans
committed
Merge 9.0. Fix some -Wconversion warnings, see [03cff7a777]
3 parents c0b81d1 + a8fc23a + 33fd941 commit 51d6aed

File tree

10 files changed

+87
-69
lines changed

10 files changed

+87
-69
lines changed

generic/tclBasic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ cmdWrapperProc(
27342734
if (objc < 0) {
27352735
objc = -1;
27362736
}
2737-
return info->proc(info->clientData, interp, objc, objv);
2737+
return info->proc(info->clientData, interp, (int)objc, objv);
27382738
}
27392739

27402740
static void
@@ -5671,7 +5671,7 @@ void
56715671
TclAdvanceContinuations(
56725672
Tcl_Size *line,
56735673
Tcl_Size **clNextPtrPtr,
5674-
int loc)
5674+
Tcl_Size loc)
56755675
{
56765676
/*
56775677
* Track the invisible continuation lines embedded in a script, if any.
@@ -7715,7 +7715,7 @@ ExprRandFunc(
77157715
* take into consideration the thread this interp is running in.
77167716
*/
77177717

7718-
iPtr->randSeed = TclpGetClicks() + PTR2UINT(Tcl_GetCurrentThread()) * 4093U;
7718+
iPtr->randSeed = (long)TclpGetClicks() + (long)PTR2UINT(Tcl_GetCurrentThread()) * 4093U;
77197719

77207720
/*
77217721
* Make sure 1 <= randSeed <= (2^31) - 2. See below.

generic/tclDictObj.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,9 @@ UpdateStringOfDict(
546546
dst = Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1);
547547
TclOOM(dst, bytesNeeded);
548548
for (i=0,cPtr=dict->entryChainHead; i<numElems; i+=2,cPtr=cPtr->nextPtr) {
549-
flagPtr[i] |= ( i ? TCL_DONT_QUOTE_HASH : 0 );
549+
if (i) {
550+
flagPtr[i] |= TCL_DONT_QUOTE_HASH;
551+
}
550552
keyPtr = (Tcl_Obj *)Tcl_GetHashKey(&dict->table, &cPtr->entry);
551553
elem = TclGetStringFromObj(keyPtr, &length);
552554
dst += TclConvertElement(elem, length, dst, flagPtr[i]);
@@ -1967,8 +1969,8 @@ DictMergeCmd(
19671969
Tcl_Obj *const *objv)
19681970
{
19691971
Tcl_Obj *targetObj, *keyObj = NULL, *valueObj = NULL;
1970-
int allocatedDict = 0;
1971-
int i, done;
1972+
int done, allocatedDict = 0;
1973+
int i;
19721974
Tcl_DictSearch search;
19731975

19741976
if (objc == 1) {
@@ -2493,7 +2495,8 @@ DictLappendCmd(
24932495
Tcl_Obj *const *objv)
24942496
{
24952497
Tcl_Obj *dictPtr, *valuePtr, *resultPtr;
2496-
int i, allocatedDict = 0, allocatedValue = 0;
2498+
int allocatedDict = 0, allocatedValue = 0;
2499+
int i;
24972500

24982501
if (objc < 3) {
24992502
Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?");
@@ -3855,10 +3858,10 @@ TclDictWithFinish(
38553858
* parameter is >= 0 */
38563859
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
38573860
* in the array part1. */
3858-
int index, /* Index into the local variable table of the
3861+
Tcl_Size index, /* Index into the local variable table of the
38593862
* variable, or -1. Only used when part1Ptr is
38603863
* NULL. */
3861-
int pathc, /* The number of elements in the path into the
3864+
Tcl_Size pathc, /* The number of elements in the path into the
38623865
* dictionary. */
38633866
Tcl_Obj *const pathv[], /* The elements of the path to the subdict. */
38643867
Tcl_Obj *keysPtr) /* List of keys to be synchronized. This is

generic/tclInt.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ typedef struct Interp {
21682168
* invoking context of the bytecode compiler.
21692169
* NULL when the byte code compiler is not
21702170
* active. */
2171-
int invokeWord; /* Index of the word in the command which
2171+
Tcl_Size invokeWord; /* Index of the word in the command which
21722172
* is getting compiled. */
21732173
Tcl_HashTable *linePBodyPtr;/* This table remembers for each statically
21742174
* defined procedure the location information
@@ -3229,7 +3229,7 @@ struct Tcl_LoadHandle_ {
32293229
*/
32303230

32313231
MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, Tcl_Size **next,
3232-
int loc);
3232+
Tcl_Size loc);
32333233
MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start,
32343234
const char *end);
32353235
MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr,
@@ -3260,7 +3260,7 @@ MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan);
32603260
MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan);
32613261
MODULE_SCOPE int TclChannelGetBlockingMode(Tcl_Channel chan);
32623262
MODULE_SCOPE int TclCheckArrayTraces(Tcl_Interp *interp, Var *varPtr,
3263-
Var *arrayPtr, Tcl_Obj *name, int index);
3263+
Var *arrayPtr, Tcl_Obj *name, Tcl_Size index);
32643264
MODULE_SCOPE int TclCheckEmptyString(Tcl_Obj *objPtr);
32653265
MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp,
32663266
Tcl_Channel chan);
@@ -3440,7 +3440,7 @@ MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name,
34403440
const EnsembleImplMap map[]);
34413441
MODULE_SCOPE Tcl_Size TclMaxListLength(const char *bytes, Tcl_Size numBytes,
34423442
const char **endPtr);
3443-
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc,
3443+
MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, Tcl_Size objc,
34443444
Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr,
34453445
int *codePtr, int *levelPtr);
34463446
MODULE_SCOPE Tcl_Obj * TclNoErrorStack(Tcl_Interp *interp, Tcl_Obj *options);
@@ -3449,13 +3449,13 @@ MODULE_SCOPE void TclNsDecrRefCount(Namespace *nsPtr);
34493449
MODULE_SCOPE int TclNamespaceDeleted(Namespace *nsPtr);
34503450
MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
34513451
Tcl_Obj *part2Ptr, const char *operation,
3452-
const char *reason, int index);
3452+
const char *reason, Tcl_Size index);
34533453
MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp,
34543454
Tcl_Size objc, Tcl_Obj *const objv[],
34553455
Tcl_Namespace *nsPtr, int flags);
34563456
MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp,
34573457
Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags);
3458-
MODULE_SCOPE int TclParseBackslash(const char *src,
3458+
MODULE_SCOPE Tcl_Size TclParseBackslash(const char *src,
34593459
Tcl_Size numBytes, Tcl_Size *readPtr, char *dst);
34603460
MODULE_SCOPE int TclParseNumber(Tcl_Interp *interp, Tcl_Obj *objPtr,
34613461
const char *expected, const char *bytes,
@@ -3690,7 +3690,7 @@ MODULE_SCOPE Tcl_ObjCmdProc TclDefaultBgErrorHandlerObjCmd;
36903690
MODULE_SCOPE Tcl_Command TclInitDictCmd(Tcl_Interp *interp);
36913691
MODULE_SCOPE int TclDictWithFinish(Tcl_Interp *interp, Var *varPtr,
36923692
Var *arrayPtr, Tcl_Obj *part1Ptr,
3693-
Tcl_Obj *part2Ptr, int index, int pathc,
3693+
Tcl_Obj *part2Ptr, Tcl_Size index, Tcl_Size pathc,
36943694
Tcl_Obj *const pathv[], Tcl_Obj *keysPtr);
36953695
MODULE_SCOPE Tcl_Obj * TclDictWithInit(Tcl_Interp *interp, Tcl_Obj *dictPtr,
36963696
Tcl_Size pathc, Tcl_Obj *const pathv[]);
@@ -3981,25 +3981,25 @@ MODULE_SCOPE Var * TclLookupArrayElement(Tcl_Interp *interp,
39813981
Tcl_Obj *arrayNamePtr, Tcl_Obj *elNamePtr,
39823982
int flags, const char *msg,
39833983
int createPart1, int createPart2,
3984-
Var *arrayPtr, int index);
3984+
Var *arrayPtr, Tcl_Size index);
39853985
MODULE_SCOPE Tcl_Obj * TclPtrGetVarIdx(Tcl_Interp *interp,
39863986
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
3987-
Tcl_Obj *part2Ptr, int flags, int index);
3987+
Tcl_Obj *part2Ptr, int flags, Tcl_Size index);
39883988
MODULE_SCOPE Tcl_Obj * TclPtrSetVarIdx(Tcl_Interp *interp,
39893989
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
39903990
Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr,
3991-
int flags, int index);
3991+
int flags, Tcl_Size index);
39923992
MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVarIdx(Tcl_Interp *interp,
39933993
Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr,
39943994
Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr,
3995-
int flags, int index);
3995+
int flags, Tcl_Size index);
39963996
MODULE_SCOPE int TclPtrObjMakeUpvarIdx(Tcl_Interp *interp,
39973997
Var *otherPtr, Tcl_Obj *myNamePtr, int myFlags,
39983998
int index);
39993999
MODULE_SCOPE int TclPtrUnsetVarIdx(Tcl_Interp *interp, Var *varPtr,
40004000
Var *arrayPtr, Tcl_Obj *part1Ptr,
40014001
Tcl_Obj *part2Ptr, int flags,
4002-
int index);
4002+
Tcl_Size index);
40034003
MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr);
40044004
MODULE_SCOPE void TclFindArrayPtrElements(Var *arrayPtr,
40054005
Tcl_HashTable *tablePtr);
@@ -4010,7 +4010,7 @@ MODULE_SCOPE void TclFindArrayPtrElements(Var *arrayPtr,
40104010

40114011
MODULE_SCOPE int TclObjCallVarTraces(Interp *iPtr, Var *arrayPtr,
40124012
Var *varPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr,
4013-
int flags, int leaveErrMsg, int index);
4013+
int flags, int leaveErrMsg, Tcl_Size index);
40144014

40154015
/*
40164016
* So tclObj.c and tclDictObj.c can share these implementations.
@@ -4496,7 +4496,7 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
44964496
do { \
44974497
Tcl_Obj *bignumObj = (objPtr); \
44984498
int bignumPayload = \
4499-
PTR2INT(bignumObj->internalRep.twoPtrValue.ptr2); \
4499+
(int)PTR2INT(bignumObj->internalRep.twoPtrValue.ptr2); \
45004500
if (bignumPayload == -1) { \
45014501
(bignum) = *((mp_int *) bignumObj->internalRep.twoPtrValue.ptr1); \
45024502
} else { \

generic/tclParse.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static Tcl_Size ParseWhiteSpace(const char *src, Tcl_Size numBytes,
129129
int *incompletePtr, char *typePtr);
130130
static Tcl_Size ParseAllWhiteSpace(const char *src, Tcl_Size numBytes,
131131
int *incompletePtr);
132-
static int ParseHex(const char *src, Tcl_Size numBytes,
132+
static Tcl_Size ParseHex(const char *src, Tcl_Size numBytes,
133133
int *resultPtr);
134134

135135
/*
@@ -724,7 +724,7 @@ TclParseAllWhiteSpace(
724724
*----------------------------------------------------------------------
725725
*/
726726

727-
int
727+
Tcl_Size
728728
ParseHex(
729729
const char *src, /* First character to parse. */
730730
Tcl_Size numBytes, /* Max number of byes to scan */
@@ -779,7 +779,7 @@ ParseHex(
779779
*----------------------------------------------------------------------
780780
*/
781781

782-
int
782+
Tcl_Size
783783
TclParseBackslash(
784784
const char *src, /* Points to the backslash character of a
785785
* backslash sequence. */
@@ -1329,7 +1329,7 @@ Tcl_ParseVarName(
13291329
{
13301330
Tcl_Token *tokenPtr;
13311331
const char *src;
1332-
int varIndex;
1332+
Tcl_Size varIndex;
13331333
unsigned array;
13341334

13351335
if (numBytes < 0 && start) {
@@ -2166,7 +2166,7 @@ TclSubstTokens(
21662166
for (; count>0 && code==TCL_OK ; count--, tokenPtr++) {
21672167
Tcl_Obj *appendObj = NULL;
21682168
const char *append = NULL;
2169-
int appendByteLength = 0;
2169+
Tcl_Size appendByteLength = 0;
21702170
char utfCharBytes[4] = "";
21712171

21722172
switch (tokenPtr->type) {

generic/tclResult.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ TclProcessReturn(
807807
int
808808
TclMergeReturnOptions(
809809
Tcl_Interp *interp, /* Current interpreter. */
810-
int objc, /* Number of arguments. */
810+
Tcl_Size objc, /* Number of arguments. */
811811
Tcl_Obj *const objv[], /* Argument objects. */
812812
Tcl_Obj **optionsPtrPtr, /* If not NULL, points to space for a (Tcl_Obj
813813
* *) where the pointer to the merged return

generic/tclTrace.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,10 +1995,10 @@ traceWrapperProc(
19951995
Tcl_Obj *const objv[])
19961996
{
19971997
TraceWrapperInfo *info = (TraceWrapperInfo *)clientData;
1998-
if (objc > INT_MAX) {
1998+
if (objc > INT_MAX || objc < 0) {
19991999
objc = -1; /* Signal Tcl_CmdObjTraceProc that objc is out of range */
20002000
}
2001-
return info->proc(info->clientData, interp, (int)level, command, commandInfo, objc, objv);
2001+
return info->proc(info->clientData, interp, (int)level, command, commandInfo, (int)objc, objv);
20022002
}
20032003

20042004
static void
@@ -2187,8 +2187,8 @@ StringTraceProc(
21872187
* either command or argv.
21882188
*/
21892189

2190-
data->proc(data->clientData, interp, level, (char *) command,
2191-
cmdPtr->proc, cmdPtr->clientData, objc, argv);
2190+
data->proc(data->clientData, interp, (int)level, (char *) command,
2191+
cmdPtr->proc, cmdPtr->clientData, (int)objc, argv);
21922192
TclStackFree(interp, (void *) argv);
21932193

21942194
return TCL_OK;
@@ -2393,7 +2393,7 @@ TclCheckArrayTraces(
23932393
Var *varPtr,
23942394
Var *arrayPtr,
23952395
Tcl_Obj *name,
2396-
int index)
2396+
Tcl_Size index)
23972397
{
23982398
int code = TCL_OK;
23992399

@@ -2446,7 +2446,7 @@ TclObjCallVarTraces(
24462446
int leaveErrMsg, /* If true, and one of the traces indicates an
24472447
* error, then leave an error message and
24482448
* stack trace information in *iPTr. */
2449-
int index) /* Index into the local variable table of the
2449+
Tcl_Size index) /* Index into the local variable table of the
24502450
* variable, or -1. Only used when part1Ptr is
24512451
* NULL. */
24522452
{
@@ -2528,7 +2528,7 @@ TclCallVarTraces(
25282528
} while (*p != '\0');
25292529
p--;
25302530
if (*p == ')') {
2531-
int offset = (openParen - part1);
2531+
Tcl_Size offset = (openParen - part1);
25322532
char *newPart1;
25332533

25342534
Tcl_DStringInit(&nameCopy);

0 commit comments

Comments
 (0)