1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
Description: Patch adds explicit casts to intptr_t or uintptr_t types
to prevent casting to/from pointer from/to integers of different size.
Author: Sergei Golovan
Last-Modified: Wed, 09 Jul 2014 19:20:07 +0400
--- a/generic/bltBgexec.c
+++ b/generic/bltBgexec.c
@@ -668,7 +668,7 @@
sinkPtr->name = name;
sinkPtr->echo = FALSE;
sinkPtr->fd = -1;
- sinkPtr->file = (Tcl_File)NULL;
+ sinkPtr->file = (Tcl_File)0;
sinkPtr->byteArr = sinkPtr->staticSpace;
sinkPtr->size = DEF_BUFFER_SIZE;
sinkPtr->encoding = encoding;
@@ -726,7 +726,7 @@
Blt_Free(sinkPtr->byteArr);
}
sinkPtr->fd = -1;
- sinkPtr->file = (Tcl_File)NULL;
+ sinkPtr->file = (Tcl_File)0;
#if (TCL_MAJOR_VERSION >= 8)
if (sinkPtr->objv != NULL) {
register int i;
@@ -883,7 +883,7 @@
#else
Tcl_DeleteFileHandler(sinkPtr->fd);
#endif
- sinkPtr->file = (Tcl_File)NULL;
+ sinkPtr->file = (Tcl_File)0;
sinkPtr->fd = -1;
#if WINDEBUG
--- a/generic/bltTree.c
+++ b/generic/bltTree.c
@@ -424,7 +424,7 @@
TreeDestroyValues(nodePtr);
UnlinkNode(nodePtr);
treeObjPtr->nNodes--;
- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)nodePtr->inode);
+ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)nodePtr->inode);
assert(hPtr);
Blt_DeleteHashEntry(&treeObjPtr->nodeTable, hPtr);
nodePtr->inode = -1;
@@ -934,7 +934,7 @@
/* Generate an unique serial number for this node. */
do {
inode = treeObjPtr->nextInode++;
- hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode,
+ hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(intptr_t)inode,
&isNew);
} while (!isNew);
nodePtr = NewNode(treeObjPtr, name, inode);
@@ -1030,7 +1030,7 @@
int isNew, result;
treeObjPtr = parentPtr->treeObject;
- hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode, &isNew);
+ hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(intptr_t)inode, &isNew);
if (!isNew) {
return NULL;
}
@@ -1166,7 +1166,7 @@
TreeObject *treeObjPtr = clientPtr->treeObject;
Blt_HashEntry *hPtr;
- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)inode);
+ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)inode);
if (hPtr != NULL) {
return (Blt_TreeNode)Blt_GetHashValue(hPtr);
}
@@ -1179,7 +1179,7 @@
{
Blt_HashEntry *hPtr;
- hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)inode);
+ hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(intptr_t)inode);
if (hPtr != NULL) {
return (Node*)Blt_GetHashValue(hPtr);
}
--- a/generic/bltTreeCmd.c
+++ b/generic/bltTreeCmd.c
@@ -1641,7 +1641,7 @@
if (parentId == -1) { /* Dump marks root's parent as -1. */
node = dataPtr->root;
/* Create a mapping between the old id and the new node */
- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
+ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
&isNew);
Blt_SetHashValue(hPtr, node);
Blt_TreeRelabelNode(cmdPtr->tree, node, names[0]);
@@ -1651,7 +1651,7 @@
* This can happen when there's a id collision with an
* existing node.
*/
- hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)parentId);
+ hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)(intptr_t)parentId);
if (hPtr != NULL) {
parent = Blt_GetHashValue(hPtr);
} else {
@@ -1688,7 +1688,7 @@
if (dataPtr->flags & RESTORE_OVERWRITE &&
((node = Blt_TreeFindChild(parent, names[nNames - 1])))) {
/* Create a mapping between the old id and the new node */
- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
+ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
&isNew);
Blt_SetHashValue(hPtr, node);
}
@@ -1698,7 +1698,7 @@
node = Blt_TreeCreateNode(cmdPtr->tree, parent,
names[nNames - 1], -1);
/* Create a mapping between the old id and the new node */
- hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId,
+ hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(intptr_t)nodeId,
&isNew);
Blt_SetHashValue(hPtr, node);
} else {
@@ -2196,7 +2196,7 @@
for (node = Blt_ListFirstNode(patternList); node != NULL;
node = Blt_ListNextNode(node)) {
- type = (int)Blt_ListGetValue(node);
+ type = (intptr_t)Blt_ListGetValue(node);
pattern = (char *)Blt_ListGetKey(node);
switch (type) {
case 0:
@@ -3654,7 +3654,7 @@
for (hPtr = Blt_FirstHashEntry(tablePtr, &cursor);
hPtr != NULL; hPtr = Blt_NextHashEntry(&cursor)) {
node = Blt_GetHashValue(hPtr);
- Blt_ChainAppend(chainPtr, (ClientData)Blt_TreeNodeId(node));
+ Blt_ChainAppend(chainPtr, (ClientData)(intptr_t)Blt_TreeNodeId(node));
}
/*
* Iterate through this list to delete the nodes. By
@@ -3664,7 +3664,7 @@
for (linkPtr = Blt_ChainFirstLink(chainPtr); linkPtr != NULL;
linkPtr = nextPtr) {
nextPtr = Blt_ChainNextLink(linkPtr);
- inode = (int)Blt_ChainGetValue(linkPtr);
+ inode = (intptr_t)Blt_ChainGetValue(linkPtr);
node = Blt_TreeGetNode(cmdPtr->tree, inode);
if (node != NULL) {
DeleteNode(cmdPtr, node);
--- a/generic/bltUnixPipe.c
+++ b/generic/bltUnixPipe.c
@@ -508,7 +508,7 @@
* Reap the child process now if an error occurred during its
* startup.
*/
- Tcl_WaitPid((Tcl_Pid)pid, &status, WNOHANG);
+ Tcl_WaitPid((Tcl_Pid)(intptr_t)pid, &status, WNOHANG);
}
if (errPipeIn >= 0) {
CloseFile(errPipeIn);
--- a/generic/bltUtil.c
+++ b/generic/bltUtil.c
@@ -827,10 +827,10 @@
if (isNew) {
refCount = 0;
} else {
- refCount = (int)Blt_GetHashValue(hPtr);
+ refCount = (intptr_t)Blt_GetHashValue(hPtr);
}
refCount++;
- Blt_SetHashValue(hPtr, (ClientData)refCount);
+ Blt_SetHashValue(hPtr, (intptr_t)refCount);
return (Blt_Uid)Blt_GetHashKey(&uidTable, hPtr);
}
@@ -864,12 +864,12 @@
if (hPtr) {
int refCount;
- refCount = (int)Blt_GetHashValue(hPtr);
+ refCount = (intptr_t)Blt_GetHashValue(hPtr);
refCount--;
if (refCount == 0) {
Blt_DeleteHashEntry(&uidTable, hPtr);
} else {
- Blt_SetHashValue(hPtr, (ClientData)refCount);
+ Blt_SetHashValue(hPtr, (intptr_t)refCount);
}
} else {
fprintf(stderr, "tried to release unknown identifier \"%s\"\n", uid);
--- a/generic/bltInit.c
+++ b/generic/bltInit.c
@@ -514,7 +514,7 @@
int dostub = 0;
#endif
- flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
+ flags = (intptr_t)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
if ((flags & BLT_TCL_CMDS) == 0) {
register Tcl_AppInitProc **p;
Tcl_Namespace *nsPtr;
@@ -573,7 +573,7 @@
}
#endif
Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL,
- (ClientData)(flags | BLT_TCL_CMDS));
+ (ClientData)(intptr_t)(flags | BLT_TCL_CMDS));
}
#ifndef TCL_ONLY
if ((flags & BLT_TK_CMDS) == 0) {
@@ -609,7 +609,7 @@
}
Blt_InitEpsCanvasItem(interp);
Tcl_SetAssocData(interp, BLT_THREAD_KEY, NULL,
- (ClientData)(flags | BLT_TK_CMDS));
+ (ClientData)(intptr_t)(flags | BLT_TK_CMDS));
}
#endif
return TCL_OK;
--- a/generic/bltGrAxis.c
+++ b/generic/bltGrAxis.c
@@ -669,7 +669,7 @@
char *widgRec; /* Pointer to structure record. */
int offset; /* Offset of field in structure. */
{
- unsigned int mask = (unsigned int)clientData;
+ unsigned int mask = (uintptr_t)clientData;
Axis *axisPtr = (Axis *)widgRec;
Ticks **ticksPtrPtr = (Ticks **) (widgRec + offset);
int nTicks;
@@ -3687,7 +3687,7 @@
int margin;
/* TODO: fix bug where "$g xaxis x2" leaves x unavailable. */
- margin = (int)argv[-1];
+ margin = (intptr_t)argv[-1];
chainPtr = graphPtr->margins[margin].axes;
if (argc == 0) {
for (linkPtr = Blt_ChainFirstLink(chainPtr); linkPtr!= NULL;
@@ -4231,7 +4231,7 @@
return TCL_ERROR;
}
if (proc == UseOp) {
- argv[2] = (char *)margin; /* Hack. Slide a reference to the margin in
+ argv[2] = (char *)(intptr_t)margin; /* Hack. Slide a reference to the margin in
* the argument list. Needed only for UseOp.
*/
result = (*proc)(graphPtr, NULL, argc - 3, argv +3);
--- a/generic/bltGrBar.c
+++ b/generic/bltGrBar.c
@@ -2197,13 +2197,13 @@
if (isNew) {
count = 1;
} else {
- count = (int)Blt_GetHashValue(hPtr);
+ count = (intptr_t)Blt_GetHashValue(hPtr);
if (count == 1) {
nStacks++;
}
count++;
}
- Blt_SetHashValue(hPtr, (ClientData)count);
+ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)count);
}
}
if (nSegs == 0) {
@@ -2219,12 +2219,12 @@
infoPtr = graphPtr->freqArr;
for (hPtr = Blt_FirstHashEntry(&freqTable, &cursor); hPtr != NULL;
hPtr = Blt_NextHashEntry(&cursor)) {
- count = (int)Blt_GetHashValue(hPtr);
+ count = (intptr_t)Blt_GetHashValue(hPtr);
keyPtr = (FreqKey *)Blt_GetHashKey(&freqTable, hPtr);
if (count > 1) {
h2Ptr = Blt_CreateHashEntry(&(graphPtr->freqTable),
(char *)keyPtr, &isNew);
- count = (int)Blt_GetHashValue(hPtr);
+ count = (intptr_t)Blt_GetHashValue(hPtr);
infoPtr->freq = count;
infoPtr->axes = keyPtr->axes;
Blt_SetHashValue(h2Ptr, infoPtr);
--- a/generic/bltGrMisc.c
+++ b/generic/bltGrMisc.c
@@ -260,7 +260,7 @@
{
ColorPair *pairPtr = (ColorPair *)(widgRec + offset);
ColorPair sample;
- int allowDefault = (int)clientData;
+ int allowDefault = (intptr_t)clientData;
sample.fgColor = sample.bgColor = NULL;
if ((string != NULL) && (*string != '\0')) {
--- a/generic/bltConfig.c
+++ b/generic/bltConfig.c
@@ -442,7 +442,7 @@
char *widgRec; /* Cubicle structure record */
int offset; /* Offset of style in record */
{
- unsigned int mask = (unsigned int)clientData; /* Bit to be tested */
+ unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */
int *flagPtr = (int *)(widgRec + offset);
int bool;
@@ -478,7 +478,7 @@
int offset; /* Offset of fill in widget record */
Tcl_FreeProc **freeProcPtr; /* Not Used. */
{
- unsigned int mask = (unsigned int)clientData; /* Bit to be tested */
+ unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */
unsigned int bool = *(unsigned int *)(widgRec + offset);
return (bool & mask) ? "1" : "0";
@@ -559,7 +559,7 @@
int offset; /* Offset of pixel size in record */
{
int *valuePtr = (int *)(widgRec + offset);
- return Blt_GetPixels(interp, tkwin, string, (int)clientData, valuePtr);
+ return Blt_GetPixels(interp, tkwin, string, (intptr_t)clientData, valuePtr);
}
/*
@@ -648,7 +648,7 @@
int offset; /* Offset of pixel size in record */
{
int *valuePtr = (int *)(widgRec + offset);
- return Blt_GetInt(interp, string, (int)clientData, valuePtr);
+ return Blt_GetInt(interp, string, (intptr_t)clientData, valuePtr);
}
/*
--- a/generic/bltContainer.c
+++ b/generic/bltContainer.c
@@ -822,7 +822,7 @@
char *widgRec; /* Widget record */
int offset; /* Offset to field in structure */
{
- unsigned int flags = (int)clientData;
+ unsigned int flags = (uintptr_t)clientData;
Container *cntrPtr = (Container *)widgRec;
Window *winPtr = (Window *) (widgRec + offset);
Tk_Window tkAdopted;
--- a/generic/bltHierbox.c
+++ b/generic/bltHierbox.c
@@ -2077,7 +2077,7 @@
/* Generate a unique node serial number. */
do {
serial = hboxPtr->nextSerial++;
- hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)serial,
+ hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial,
&isNew);
} while (!isNew);
Blt_SetHashValue(hPtr, treePtr);
@@ -2372,7 +2372,7 @@
if (Tcl_GetInt(NULL, string, &serial) == TCL_OK) {
Blt_HashEntry *hPtr;
- hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)serial);
+ hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial);
if (hPtr != NULL) {
return (Tree *) Blt_GetHashValue(hPtr);
}
@@ -2406,7 +2406,7 @@
int serial;
/* Node table keys are integers. Convert them to strings. */
- serial = (int)Blt_GetHashKey(&(hboxPtr->nodeTable),
+ serial = (intptr_t)Blt_GetHashKey(&(hboxPtr->nodeTable),
nodePtr->entryPtr->hashPtr);
sprintf(string, "%d", serial);
--- a/generic/bltUnixImage.c
+++ b/generic/bltUnixImage.c
@@ -574,7 +574,7 @@
destPtr = Blt_ColorImageBits(image);
endPtr = destPtr + nPixels;
for (/* empty */; destPtr < endPtr; destPtr++) {
- hPtr = Blt_FindHashEntry(&pixelTable, (char *)destPtr->value);
+ hPtr = Blt_FindHashEntry(&pixelTable, (char *)(intptr_t)destPtr->value);
colorPtr = (XColor *)Blt_GetHashValue(hPtr);
destPtr->Red = lut[colorPtr->red >> 8];
destPtr->Green = lut[colorPtr->green >> 8];
--- a/generic/bltTable.c
+++ b/generic/bltTable.c
@@ -2034,7 +2034,7 @@
key = 0; /* Initialize key to bogus span */
for (node = Blt_ListFirstNode(list); node != NULL;
node = Blt_ListNextNode(node)) {
- key = (int)Blt_ListGetKey(node);
+ key = (intptr_t)Blt_ListGetKey(node);
if (entryPtr->row.span <= key) {
break;
}
@@ -2046,7 +2046,7 @@
* Create a new list (bucket) to hold entries of that size
* span and and link it into the list of buckets.
*/
- newNode = Blt_ListCreateNode(list, (char *)entryPtr->row.span);
+ newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->row.span);
Blt_ListSetValue(newNode, (char *)Blt_ChainCreate());
Blt_ListLinkBefore(list, newNode, node);
node = newNode;
@@ -2063,7 +2063,7 @@
key = 0;
for (node = Blt_ListFirstNode(list); node != NULL;
node = Blt_ListNextNode(node)) {
- key = (int)Blt_ListGetKey(node);
+ key = (intptr_t)Blt_ListGetKey(node);
if (entryPtr->column.span <= key) {
break;
}
@@ -2075,7 +2075,7 @@
* Create a new list (bucket) to hold entries of that size
* span and and link it into the list of buckets.
*/
- newNode = Blt_ListCreateNode(list, (char *)entryPtr->column.span);
+ newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->column.span);
Blt_ListSetValue(newNode, (char *)Blt_ChainCreate());
Blt_ListLinkBefore(list, newNode, node);
node = newNode;
--- a/generic/bltTreeView.c
+++ b/generic/bltTreeView.c
@@ -1314,10 +1314,10 @@
if (isNew) {
refCount = 1;
} else {
- refCount = (int)Blt_GetHashValue(hPtr);
+ refCount = (intptr_t)Blt_GetHashValue(hPtr);
refCount++;
}
- Blt_SetHashValue(hPtr, (ClientData)refCount);
+ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)refCount);
return Blt_GetHashKey(&tvPtr->uidTable, hPtr);
}
@@ -1343,10 +1343,10 @@
hPtr = Blt_FindHashEntry(&tvPtr->uidTable, uid);
assert(hPtr != NULL);
- refCount = (int)Blt_GetHashValue(hPtr);
+ refCount = (intptr_t)Blt_GetHashValue(hPtr);
refCount--;
if (refCount > 0) {
- Blt_SetHashValue(hPtr, (ClientData)refCount);
+ Blt_SetHashValue(hPtr, (ClientData)(intptr_t)refCount);
} else {
Blt_DeleteHashEntry(&tvPtr->uidTable, hPtr);
}
--- a/generic/bltTreeViewCmd.c
+++ b/generic/bltTreeViewCmd.c
@@ -516,7 +516,7 @@
if ((context == ITEM_ENTRY) ||
(context == ITEM_ENTRY_BUTTON) ||
- ((unsigned int)context >= (unsigned int)ITEM_STYLE)) {
+ ((uintptr_t)context >= (uintptr_t)ITEM_STYLE)) {
entryPtr = Blt_GetCurrentItem(tvPtr->bindTable);
}
}
--- a/generic/bltWinop.c
+++ b/generic/bltWinop.c
@@ -980,9 +980,9 @@
if (isNew) {
Blt_SetHashValue(hPtr, 1);
} else {
- cnt = (int)Blt_GetHashValue(hPtr);
+ cnt = (intptr_t)Blt_GetHashValue(hPtr);
cnt++;
- Blt_SetHashValue(hPtr, cnt);
+ Blt_SetHashValue(hPtr, (intptr_t)cnt);
}
srcPtr++;
}
@@ -994,7 +994,7 @@
Tcl_Obj *objPtr = Tcl_NewStringObj(Blt_GetHashKey(&hTbl, hPtr), -1);
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
if (iscnt) {
- cnt = (int)Blt_GetHashValue(hPtr);
+ cnt = (intptr_t)Blt_GetHashValue(hPtr);
sprintf(buf, "%d", cnt);
objPtr = Tcl_NewStringObj(buf, -1);
Tcl_ListObjAppendElement(interp, listPtr, objPtr);
--- a/generic/bltObjConfig.c
+++ b/generic/bltObjConfig.c
@@ -1338,7 +1338,7 @@
if (Tcl_GetBooleanFromObj(interp, objPtr, &bool) != TCL_OK) {
return TCL_ERROR;
}
- flag = (unsigned int)specPtr->customPtr;
+ flag = (uintptr_t)specPtr->customPtr;
*(int *)ptr &= ~flag;
if (bool) {
*(int *)ptr |= flag;
@@ -1639,7 +1639,7 @@
{
unsigned int flag;
- flag = (*(int *)ptr) & (unsigned int)specPtr->customPtr;
+ flag = (*(unsigned int *)ptr) & (uintptr_t)specPtr->customPtr;
return Tcl_NewBooleanObj((flag != 0));
}
|