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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
--- ../tcl/generic/tclExtend.h Wed Jun 14 03:48:24 2000
+++ ../tcl/generic/tclExtend.h Mon Jul 18 22:39:18 2005
@@ -101,5 +101,5 @@
TclX_Eval _ANSI_ARGS_((Tcl_Interp *interp,
unsigned options,
- char *cmd));
+ const char *cmd));
EXTERN int
@@ -123,7 +123,7 @@
Tclx_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
-EXTERN char*
+EXTERN const char*
TclX_InitTclStubs _ANSI_ARGS_((Tcl_Interp *interp,
- char *version,
+ const char *version,
int exact));
@@ -203,5 +203,5 @@
TclX_KeyedListGet _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj **valuePtrPtr));
@@ -209,5 +209,5 @@
TclX_KeyedListSet _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj *valuePtr));
@@ -215,10 +215,10 @@
TclX_KeyedListDelete _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key));
+ const char *key));
EXTERN int
TclX_KeyedListGetKeys _ANSI_ARGS_((Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj **listObjPtrPtr));
--- ../tcl/generic/tclXbsearch.c Wed Mar 31 01:37:43 1999
+++ ../tcl/generic/tclXbsearch.c Mon Apr 5 13:30:43 2004
@@ -106,7 +106,8 @@
TclProcKeyCompare (searchCBPtr)
binSearchCB_t *searchCBPtr;
{
- char *cmdArgv [3], *command, *oldResult;
+ const char * cmdArgv [3];
+ char *command;
int result;
cmdArgv [0] = searchCBPtr->tclProc;
@@ -123,15 +120,9 @@
if (Tcl_GetIntFromObj (searchCBPtr->interp,
Tcl_GetObjResult (searchCBPtr->interp),
&searchCBPtr->cmpResult) != TCL_OK) {
- oldResult = Tcl_GetStringFromObj (
- Tcl_GetObjResult (searchCBPtr->interp), NULL);
- oldResult = ckstrdup (oldResult);
-
- Tcl_ResetResult (searchCBPtr->interp);
- TclX_AppendObjResult (searchCBPtr->interp, "invalid integer \"",
- oldResult, "\" returned from compare proc \"",
+ TclX_AppendObjResult (searchCBPtr->interp,
+ "\" returned from compare proc \"",
searchCBPtr->tclProc, "\"", (char *) NULL);
- ckfree (oldResult);
return TCL_ERROR;
}
Tcl_ResetResult (searchCBPtr->interp);
@@ -254,3 +254,4 @@ BinSearch (searchCBPtr)
{
- off_t middle, high, low;
+ int middle;
+ off_t high, low;
--- ../tcl/generic/tclXdup.c Wed Mar 31 01:37:43 1999
+++ ../tcl/generic/tclXdup.c Mon Jul 18 21:24:59 2005
@@ -58,5 +58,5 @@
{
Tcl_DString strValues;
- char *option, *value, **optArgv = NULL;
+ const char *option, *value, **optArgv = NULL;
int optArgc, idx;
@@ -202,5 +202,5 @@
{
Tcl_Channel newChannel;
- int bindFnum, fnum;
+ int fnum;
char *srcChannelId, *targetChannelId;
@@ -214,24 +214,14 @@
* a dup.
*/
- if (objv [1]->typePtr == Tcl_GetObjType ("int")) {
- bindFnum = TRUE;
- } else {
- srcChannelId = Tcl_GetStringFromObj (objv [1], NULL);
- if (ISDIGIT (srcChannelId [0])) {
- if (Tcl_ConvertToType (interp, objv [1],
- Tcl_GetObjType ("int")) != TCL_OK)
- goto badFnum;
- bindFnum = TRUE;
- } else {
- bindFnum = FALSE;
- }
- }
- if (bindFnum) {
- if (objc != 2)
- goto bind2ndArg;
- if (Tcl_GetIntFromObj (interp, objv [1], &fnum) != TCL_OK)
- return TCL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv [1], &fnum) == TCL_OK) {
+ if (objc != 2) {
+ TclX_AppendObjResult (interp, "the second argument, "
+ "targetChannelId, is not allowed when binding a "
+ "file number to a Tcl channel", NULL);
+ return TCL_ERROR;
+ }
newChannel = TclXOSBindOpenFile (interp, fnum);
} else {
+ srcChannelId = Tcl_GetStringFromObj (objv [1], NULL);
if (objc > 2) {
targetChannelId = Tcl_GetStringFromObj (objv [2], NULL);
@@ -250,18 +240,4 @@
Tcl_GetChannelName (newChannel), -1);
return TCL_OK;
-
- badFnum:
- Tcl_ResetResult (interp);
- TclX_AppendObjResult (interp, "invalid integer file number \"",
- Tcl_GetStringFromObj (objv [1], NULL),
- "\", expected unsigned integer or Tcl file id",
- (char *) NULL);
- return TCL_ERROR;
-
- bind2ndArg:
- TclX_AppendObjResult (interp, "the second argument, targetChannelId, ",
- "is not allow when binding a file number to ",
- "a Tcl channel", (char *) NULL);
- return TCL_ERROR;
}
--- ../tcl/generic/tclXhandles.c Wed Mar 31 01:37:44 1999
+++ ../tcl/generic/tclXhandles.c Fri Jan 10 17:09:53 2003
@@ -160,3 +160,3 @@
int numNewEntries;
- int newSize;
+ size_t newSize;
@@ -170,3 +170,3 @@
memcpy (tblHdrPtr->bodyPtr, oldbodyPtr,
- (tblHdrPtr->tableSize * tblHdrPtr->entrySize));
+ (size_t)(tblHdrPtr->tableSize * tblHdrPtr->entrySize));
LinkInNewEntries (tblHdrPtr, tblHdrPtr->tableSize, numNewEntries);
@@ -234,3 +234,3 @@
if ((strncmp (tblHdrPtr->handleBase, (char *) handle,
- tblHdrPtr->baseLength) != 0) ||
+ (size_t)tblHdrPtr->baseLength) != 0) ||
!TclX_StrToUnsigned (&handle [tblHdrPtr->baseLength], 10,
@@ -269,3 +269,3 @@
if ((strncmp (tblHdrPtr->handleBase, (char *) handle,
- tblHdrPtr->baseLength) != 0) ||
+ (size_t)tblHdrPtr->baseLength) != 0) ||
!TclX_StrToUnsigned (&handle [tblHdrPtr->baseLength], 10,
@@ -332,3 +332,3 @@
tblHdrPtr->bodyPtr =
- (ubyte_pt) ckalloc (initEntries * tblHdrPtr->entrySize);
+ (ubyte_pt) ckalloc ((size_t)initEntries * tblHdrPtr->entrySize);
LinkInNewEntries (tblHdrPtr, 0, initEntries);
--- ../tcl/generic/tclXkeylist.c Wed Mar 31 01:37:45 1999
+++ ../tcl/generic/tclXkeylist.c Mon Jul 18 22:39:43 2005
@@ -106,5 +106,5 @@
static int
FindKeyedListEntry _ANSI_ARGS_((keylIntObj_t *keylIntPtr,
- char *key,
+ const char *key,
int *keyLenPtr,
char **nextSubKeyPtr));
@@ -370,10 +370,11 @@
FindKeyedListEntry (keylIntPtr, key, keyLenPtr, nextSubKeyPtr)
keylIntObj_t *keylIntPtr;
- char *key;
+ const char *key;
int *keyLenPtr;
char **nextSubKeyPtr;
{
char *keySeparPtr;
- int keyLen, findIdx;
+ int findIdx;
+ size_t keyLen;
keySeparPtr = strchr (key, '.');
@@ -604,6 +605,5 @@
for (idx = 0; idx < keylIntPtr->numEntries; idx++) {
entryObjv [0] =
- Tcl_NewStringObj (keylIntPtr->entries [idx].key,
- strlen (keylIntPtr->entries [idx].key));
+ Tcl_NewStringObj (keylIntPtr->entries [idx].key, -1);
entryObjv [1] = keylIntPtr->entries [idx].valuePtr;
listObjv [idx] = Tcl_NewListObj (2, entryObjv);
@@ -612,5 +612,5 @@
tmpListObj = Tcl_NewListObj (keylIntPtr->numEntries, listObjv);
listStr = Tcl_GetStringFromObj (tmpListObj, &strLen);
- keylPtr->bytes = ckbinstrdup (listStr, strLen);
+ keylPtr->bytes = ckbinstrdup (listStr, (size_t)strLen);
keylPtr->length = strLen;
@@ -660,5 +660,5 @@
Tcl_Interp *interp;
Tcl_Obj *keylPtr;
- char *key;
+ const char *key;
Tcl_Obj **valuePtrPtr;
{
@@ -715,5 +715,5 @@
Tcl_Interp *interp;
Tcl_Obj *keylPtr;
- char *key;
+ const char *key;
Tcl_Obj *valuePtr;
{
@@ -744,6 +744,6 @@
}
keylIntPtr->entries [findIdx].key =
- (char *) ckalloc (keyLen + 1);
- strncpy (keylIntPtr->entries [findIdx].key, key, keyLen);
+ (char *) ckalloc ((size_t)(keyLen + 1));
+ strncpy (keylIntPtr->entries [findIdx].key, key, (size_t)keyLen);
keylIntPtr->entries [findIdx].key [keyLen] = '\0';
keylIntPtr->entries [findIdx].valuePtr = valuePtr;
@@ -783,6 +783,6 @@
findIdx = keylIntPtr->numEntries++;
keylIntPtr->entries [findIdx].key =
- (char *) ckalloc (keyLen + 1);
- strncpy (keylIntPtr->entries [findIdx].key, key, keyLen);
+ (char *) ckalloc ((size_t)(keyLen + 1));
+ strncpy (keylIntPtr->entries [findIdx].key, key, (size_t)keyLen);
keylIntPtr->entries [findIdx].key [keyLen] = '\0';
keylIntPtr->entries [findIdx].valuePtr = newKeylPtr;
@@ -814,5 +814,5 @@
Tcl_Interp *interp;
Tcl_Obj *keylPtr;
- char *key;
+ const char *key;
{
keylIntObj_t *keylIntPtr, *subKeylIntPtr;
@@ -888,5 +888,5 @@
Tcl_Interp *interp;
Tcl_Obj *keylPtr;
- char *key;
+ const char *key;
Tcl_Obj **listObjPtrPtr;
{
--- ../tcl/generic/tclXlib.c Wed Oct 24 18:57:02 2001
+++ ../tcl/generic/tclXlib.c Mon Jul 18 22:12:59 2005
@@ -68,3 +68,3 @@
EvalFilePart _ANSI_ARGS_((Tcl_Interp *interp,
- char *fileName,
+ const char *fileName,
off_t offset,
@@ -87,5 +87,5 @@
char *packageName,
- char **fileNamePtr,
+ Tcl_Obj **fileNamePtr,
off_t *offsetPtr,
- unsigned *lengthPtr));
+ long *lengthPtr));
@@ -159,3 +159,3 @@
Tcl_Interp *interp;
- char *fileName;
+ const char *fileName;
off_t offset;
@@ -167,3 +167,4 @@
Tcl_DString pathBuf, cmdBuf;
- char *oldScriptFile, *buf;
+ Tcl_Obj *oldScriptFile;
+ char *buf;
Tcl_Channel channel = NULL;
@@ -210,3 +211,3 @@
oldScriptFile = iPtr->scriptFile;
- iPtr->scriptFile = fileName;
+ iPtr->scriptFile = Tcl_NewStringObj(fileName, -1);
result = Tcl_GlobalEval (interp, cmdBuf.string);
@@ -384,5 +385,5 @@
char *packageName;
- char **fileNamePtr;
- off_t *offsetPtr;
- unsigned *lengthPtr;
+ Tcl_Obj **fileNamePtr;
+ off_t *offsetPtr;
+ long *lengthPtr;
{
@@ -414,7 +415,7 @@
goto invalidEntry;
- if (TclX_GetUnsignedFromObj (interp, pkgDataObjv [2], lengthPtr) != TCL_OK)
+ if (Tcl_GetLongFromObj (interp, pkgDataObjv [2], lengthPtr) != TCL_OK
+ || *lengthPtr < 0)
goto invalidEntry;
- *fileNamePtr = Tcl_GetStringFromObj (pkgDataObjv [0], NULL);
- *fileNamePtr = ckstrdup (*fileNamePtr);
+ *fileNamePtr = pkgDataObjv[0];
@@ -455,3 +456,3 @@
Tcl_DString command;
- char *result;
+ const char *result;
@@ -540,3 +541,3 @@
if ((Tcl_SplitList (interp, lineBuffer.string, &lineArgc,
- &lineArgv) != TCL_OK) || (lineArgc < 4))
+ (const char ***)&lineArgv) != TCL_OK) || (lineArgc < 4))
goto formatError;
@@ -884,5 +885,6 @@
{
- char *fileName;
+ Tcl_Obj *fileNameObj;
+ const char *fileName;
off_t offset;
- unsigned length;
+ long length;
int result;
@@ -894,7 +896,9 @@
if (GetPackageIndexEntry (interp, Tcl_GetStringFromObj (objv [1], NULL),
- &fileName, &offset, &length) != TCL_OK)
+ &fileNameObj, &offset, &length) != TCL_OK)
return TCL_ERROR;
+ fileName = Tcl_GetStringFromObj(fileNameObj, NULL);
+ Tcl_IncrRefCount(fileNameObj);
result = EvalFilePart (interp, fileName, offset, length);
- ckfree (fileName);
+ Tcl_DecrRefCount(fileNameObj);
--- ../tcl/generic/tclXlist.c Sat May 19 12:39:44 2001
+++ ../tcl/generic/tclXlist.c Fri Jan 10 18:04:21 2003
@@ -469,3 +469,3 @@
match = (valueLen == patternLen) &&
- (memcmp (valueStr, patternStr, valueLen) == 0);
+ (memcmp (valueStr, patternStr, (size_t) patternLen) == 0);
break;
@@ -544,3 +544,3 @@
if ((elementLen == checkLen) &&
- (memcmp (elementStr, checkStr, elementLen) == 0))
+ (memcmp (elementStr, checkStr, (size_t)elementLen) == 0))
break;
--- ../tcl/generic/tclXmath.c Wed Mar 31 01:37:45 1999
+++ ../tcl/generic/tclXmath.c Fri Jan 10 18:05:54 2003
@@ -308,3 +308,3 @@ TclX_RandomObjCmd (dummy, interp, objc,
} else {
- int seed;
+ unsigned int seed;
--- ../tcl/generic/tclXcmdloop.c Wed Mar 31 01:37:43 1999
+++ ../tcl/generic/tclXcmdloop.c Mon Jul 18 20:59:50 2005
@@ -192,5 +192,5 @@
char *prompt2;
{
- char *promptHook, *resultStr;
+ const char *promptHook, *resultStr;
int result, useResult, promptDone = FALSE;
Tcl_Channel stdoutChan, stderrChan;
--- ../tcl/generic/tclXfilecmds.c Wed Mar 31 01:37:43 1999
+++ ../tcl/generic/tclXfilecmds.c Mon Jul 18 21:27:01 2005
@@ -72,5 +72,5 @@
{
Tcl_Channel channels [2];
- char *channelNames [2];
+ const char *channelNames[2];
if (!((objc == 1) || (objc == 3)))
--- ../tcl/generic/tclXinit.c Sat Feb 5 12:22:46 2000
+++ ../tcl/generic/tclXinit.c Mon Jul 18 22:20:14 2005
@@ -167,6 +167,6 @@
#define PROC_ARGC 5
Tcl_CmdInfo cmdInfo;
- char *procArgv[PROC_ARGC+1];
- char *quick;
+ const char *procArgv[PROC_ARGC+1];
+ const char *quick;
if (DefineFindInit(interp, &cmdInfo) != TCL_OK) {
@@ -207,5 +207,5 @@
{
Tcl_DString buffer;
- char *path;
+ const char *path;
Tcl_Channel chan;
@@ -266,5 +266,5 @@
Tcl_Interp *interp;
int exitCode;
- char *message, *errorStack, *noDump, *strResult;
+ const char *message, *errorStack, *noDump, *strResult;
Tcl_Channel stdoutChan, stderrChan;
Tcl_Obj *savedResult;
@@ -453,11 +453,11 @@
*-----------------------------------------------------------------------------
*/
-char *
+const char *
TclX_InitTclStubs (interp, version, exact)
Tcl_Interp *interp;
- char *version;
+ const char *version;
int exact;
{
- char *actualVersion;
+ const char *actualVersion;
actualVersion = Tcl_InitStubs(interp, version, exact);
--- ../tcl/generic/tclXprofile.c Wed Mar 31 01:37:46 1999
+++ ../tcl/generic/tclXprofile.c Mon Jul 18 22:32:38 2005
@@ -124,5 +124,5 @@
Tcl_Interp *interp,
int argc,
- char **argv));
+ const char **argv));
static int
@@ -263,5 +263,6 @@
int idx, newEntry;
profEntry_t *scanPtr;
- char **stackArgv, *stackListPtr;
+ const char **stackArgv;
+ char *stackListPtr;
Tcl_HashEntry *hashEntryPtr;
profDataEntry_t *dataEntryPtr;
@@ -273,5 +274,5 @@
* are skipped.
*/
- stackArgv = (char **) ckalloc (sizeof (char *) * infoPtr->stackSize);
+ stackArgv = (const char **)ckalloc (sizeof (char *) * infoPtr->stackSize);
if (infoPtr->evalMode) {
for (idx= 0, scanPtr = entryPtr; scanPtr != NULL;
@@ -525,5 +526,5 @@
Tcl_Interp *interp;
int argc;
- char **argv;
+ const char **argv;
{
profInfo_t *infoPtr = (profInfo_t *) clientData;
@@ -796,5 +797,6 @@
Tcl_HashSearch searchCookie;
profDataEntry_t *dataEntryPtr;
- char *dataArgv [3], *dataListPtr;
+ const char *dataArgv[3];
+ char *dataListPtr;
char countBuf [32], realTimeBuf [32], cpuTimeBuf [32];
--- ../tcl/generic/tclXsignal.c Wed Mar 31 01:37:46 1999
+++ ../tcl/generic/tclXsignal.c Mon Jul 18 22:38:35 2005
@@ -53,5 +53,5 @@
* Pointer is used as a quick check of a valid signal number.
*/
-static char *unknownSignalIdMsg;
+static const char *unknownSignalIdMsg;
/*
@@ -237,5 +237,5 @@
* Prototypes of internal functions.
*/
-static char *
+static const char *
GetSignalName _ANSI_ARGS_((int signalNum));
@@ -346,5 +346,5 @@
*-----------------------------------------------------------------------------
*/
-static char *
+static const char *
GetSignalName (signalNum)
int signalNum;
@@ -806,5 +806,5 @@
*/
if (signalTrapCmds [signalNum] == NULL) {
- char *signalName = GetSignalName (signalNum);
+ const char *signalName = GetSignalName (signalNum);
signalsReceived [signalNum] = 0;
--- ../tcl/generic/tclXshell.c Wed Jun 14 03:48:24 2000
+++ ../tcl/generic/tclXshell.c Mon Jul 18 22:45:08 2005
@@ -144,5 +144,5 @@
goto tclError;
- tclArgv = Tcl_Merge (argc - optind, &argv [optind]);
+ tclArgv = Tcl_Merge (argc - optind, (const char **)&argv [optind]);
if (Tcl_SetVar (interp, "argv", tclArgv,
TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG) == NULL)
@@ -227,5 +227,5 @@
Tcl_Interp *interp;
{
- char *evalStr;
+ const char *evalStr;
/*
--- ../tcl/generic/tclXstring.c Fri Apr 23 06:00:07 1999
+++ ../tcl/generic/tclXstring.c Mon Jul 18 22:46:30 2005
@@ -212,5 +212,5 @@
int strLen, utfLen, first, subLen;
int isRange = (int) clientData;
- char *str, *start, *end;
+ const char *str, *start, *end;
if (objc != 4) {
--- ../doc/Keylist.3 Wed Mar 31 01:37:41 1999
+++ ../doc/Keylist.3 Mon Jul 18 23:35:57 2005
@@ -32,5 +32,5 @@
TclX_KeyedListGet (Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj **valuePtrPtr);
@@ -38,5 +38,5 @@
TclX_KeyedListSet (Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj *valuePtr);
@@ -44,10 +44,10 @@
TclX_KeyedListDelete (Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key);
+ const char *key);
int
TclX_KeyedListGetKeys (Tcl_Interp *interp,
Tcl_Obj *keylPtr,
- char *key,
+ const char *key,
Tcl_Obj **listObjPtrPtr);
|