summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-01-23 19:18:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-01-23 19:18:39 (GMT)
commit46dcc60e4182a6b1bfae4b7bf93d03430e5e8ce6 (patch)
tree83cf0393ceaf7105011bcd8070b2d366de86a48e /generic
parentc08798d0f4d72da0623ce1f4dbe93f8a542e18b4 (diff)
downloadtcl-46dcc60e4182a6b1bfae4b7bf93d03430e5e8ce6.zip
tcl-46dcc60e4182a6b1bfae4b7bf93d03430e5e8ce6.tar.gz
tcl-46dcc60e4182a6b1bfae4b7bf93d03430e5e8ce6.tar.bz2
Better error-message for previous commit. Some more code-cleanup, backported from 8.7
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCmdAH.c84
-rw-r--r--generic/tclInterp.c107
-rw-r--r--generic/tclNamesp.c162
3 files changed, 153 insertions, 200 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index b3269f4..0bf5b8e 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -46,24 +46,12 @@ struct ForeachState {
static int CheckAccess(Tcl_Interp *interp, Tcl_Obj *pathPtr,
int mode);
-static int BadEncodingSubcommand(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int EncodingConvertfromObjCmd(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int EncodingConverttoObjCmd(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int EncodingDirsObjCmd(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int EncodingNamesObjCmd(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int EncodingSystemObjCmd(ClientData dummy,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc BadEncodingSubcommand;
+static Tcl_ObjCmdProc EncodingConvertfromObjCmd;
+static Tcl_ObjCmdProc EncodingConverttoObjCmd;
+static Tcl_ObjCmdProc EncodingDirsObjCmd;
+static Tcl_ObjCmdProc EncodingNamesObjCmd;
+static Tcl_ObjCmdProc EncodingSystemObjCmd;
static inline int ForeachAssignments(Tcl_Interp *interp,
struct ForeachState *statePtr);
static inline void ForeachCleanup(Tcl_Interp *interp,
@@ -132,7 +120,6 @@ static Tcl_ObjCmdProc PathTypeCmd;
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_BreakObjCmd(
ClientData dummy, /* Not used. */
@@ -164,8 +151,6 @@ Tcl_BreakObjCmd(
*
*----------------------------------------------------------------------
*/
-
- /* ARGSUSED */
int
Tcl_CaseObjCmd(
ClientData dummy, /* Not used. */
@@ -300,7 +285,6 @@ Tcl_CaseObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_CatchObjCmd(
ClientData dummy, /* Not used. */
@@ -353,8 +337,8 @@ CatchObjCmdCallback(
{
Interp *iPtr = (Interp *) interp;
int objc = PTR2INT(data[0]);
- Tcl_Obj *varNamePtr = data[1];
- Tcl_Obj *optionVarNamePtr = data[2];
+ Tcl_Obj *varNamePtr = (Tcl_Obj *)data[1];
+ Tcl_Obj *optionVarNamePtr = (Tcl_Obj *)data[2];
int rewind = iPtr->execEnvPtr->rewind;
/*
@@ -406,7 +390,6 @@ CatchObjCmdCallback(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_CdObjCmd(
ClientData dummy, /* Not used. */
@@ -462,7 +445,6 @@ Tcl_CdObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ConcatObjCmd(
ClientData dummy, /* Not used. */
@@ -497,7 +479,6 @@ Tcl_ConcatObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ContinueObjCmd(
ClientData dummy, /* Not used. */
@@ -834,10 +815,11 @@ EncodingDirsObjCmd(
*/
int
-EncodingNamesObjCmd(ClientData dummy, /* Unused */
- Tcl_Interp* interp, /* Tcl interpreter */
- int objc, /* Number of command line args */
- Tcl_Obj* const objv[]) /* Vector of command line args */
+EncodingNamesObjCmd(
+ ClientData dummy, /* Unused */
+ Tcl_Interp* interp, /* Tcl interpreter */
+ int objc, /* Number of command line args */
+ Tcl_Obj* const objv[]) /* Vector of command line args */
{
if (objc > 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -864,10 +846,11 @@ EncodingNamesObjCmd(ClientData dummy, /* Unused */
*/
int
-EncodingSystemObjCmd(ClientData dummy, /* Unused */
- Tcl_Interp* interp, /* Tcl interpreter */
- int objc, /* Number of command line args */
- Tcl_Obj* const objv[]) /* Vector of command line args */
+EncodingSystemObjCmd(
+ ClientData dummy, /* Unused */
+ Tcl_Interp* interp, /* Tcl interpreter */
+ int objc, /* Number of command line args */
+ Tcl_Obj* const objv[]) /* Vector of command line args */
{
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?encoding?");
@@ -899,7 +882,6 @@ EncodingSystemObjCmd(ClientData dummy, /* Unused */
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ErrorObjCmd(
ClientData dummy, /* Not used. */
@@ -949,7 +931,6 @@ Tcl_ErrorObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
EvalCmdErrMsg(
ClientData data[],
@@ -1032,7 +1013,6 @@ TclNREvalObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ExitObjCmd(
ClientData dummy, /* Not used. */
@@ -1053,7 +1033,6 @@ Tcl_ExitObjCmd(
return TCL_ERROR;
}
Tcl_Exit(value);
- /*NOTREACHED*/
return TCL_OK; /* Better not ever reach this! */
}
@@ -1081,7 +1060,6 @@ Tcl_ExitObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ExprObjCmd(
ClientData dummy, /* Not used. */
@@ -1125,8 +1103,8 @@ ExprCallback(
Tcl_Interp *interp,
int result)
{
- Tcl_Obj *resultPtr = data[0];
- Tcl_Obj *objPtr = data[1];
+ Tcl_Obj *resultPtr = (Tcl_Obj *)data[0];
+ Tcl_Obj *objPtr = (Tcl_Obj *)data[1];
if (objPtr != NULL) {
Tcl_DecrRefCount(objPtr);
@@ -2319,7 +2297,7 @@ FilesystemSeparatorCmd(
return TCL_ERROR;
}
if (objc == 1) {
- const char *separator = NULL; /* lint */
+ const char *separator = NULL;
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
@@ -2622,7 +2600,6 @@ GetTypeFromMode(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ForObjCmd(
ClientData dummy, /* Not used. */
@@ -2670,7 +2647,7 @@ ForSetupCallback(
Tcl_Interp *interp,
int result)
{
- ForIterData *iterPtr = data[0];
+ ForIterData *iterPtr = (ForIterData *)data[0];
if (result != TCL_OK) {
if (result == TCL_ERROR) {
@@ -2689,7 +2666,7 @@ TclNRForIterCallback(
Tcl_Interp *interp,
int result)
{
- ForIterData *iterPtr = data[0];
+ ForIterData *iterPtr = (ForIterData *)data[0];
Tcl_Obj *boolObj;
switch (result) {
@@ -2725,8 +2702,8 @@ ForCondCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
- ForIterData *iterPtr = data[0];
- Tcl_Obj *boolObj = data[1];
+ ForIterData *iterPtr = (ForIterData *)data[0];
+ Tcl_Obj *boolObj = (Tcl_Obj *)data[1];
int value;
if (result != TCL_OK) {
@@ -2763,7 +2740,7 @@ ForNextCallback(
int result)
{
Interp *iPtr = (Interp *) interp;
- ForIterData *iterPtr = data[0];
+ ForIterData *iterPtr = (ForIterData *)data[0];
Tcl_Obj *next = iterPtr->next;
if ((result == TCL_OK) || (result == TCL_CONTINUE)) {
@@ -2787,7 +2764,7 @@ ForPostNextCallback(
Tcl_Interp *interp,
int result)
{
- ForIterData *iterPtr = data[0];
+ ForIterData *iterPtr = (ForIterData *)data[0];
if ((result != TCL_BREAK) && (result != TCL_OK)) {
if (result == TCL_ERROR) {
@@ -2817,7 +2794,6 @@ ForPostNextCallback(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_ForeachObjCmd(
ClientData dummy, /* Not used. */
@@ -2892,7 +2868,7 @@ EachloopCmd(
* allocation for better performance.
*/
- statePtr = TclStackAlloc(interp,
+ statePtr = (struct ForeachState *)TclStackAlloc(interp,
sizeof(struct ForeachState) + 3 * numLists * sizeof(int)
+ 2 * numLists * (sizeof(Tcl_Obj **) + sizeof(Tcl_Obj *)));
memset(statePtr, 0,
@@ -2993,7 +2969,7 @@ ForeachLoopStep(
Tcl_Interp *interp,
int result)
{
- struct ForeachState *statePtr = data[0];
+ struct ForeachState *statePtr = (struct ForeachState *)data[0];
/*
* Process the result code from this run of the [foreach] body. Note that
@@ -3070,7 +3046,6 @@ ForeachAssignments(
for (i=0 ; i<statePtr->numLists ; i++) {
for (v=0 ; v<statePtr->varcList[i] ; v++) {
k = statePtr->index[i]++;
-
if (k < statePtr->argcList[i]) {
valuePtr = statePtr->argvList[i][k];
} else {
@@ -3135,7 +3110,6 @@ ForeachCleanup(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tcl_FormatObjCmd(
ClientData dummy, /* Not used. */
diff --git a/generic/tclInterp.c b/generic/tclInterp.c
index 613a86a..2633a18 100644
--- a/generic/tclInterp.c
+++ b/generic/tclInterp.c
@@ -225,15 +225,12 @@ static int AliasList(Tcl_Interp *interp, Tcl_Interp *childInterp);
static int AliasObjCmd(ClientData dummy,
Tcl_Interp *currentInterp, int objc,
Tcl_Obj *const objv[]);
-static int AliasNRCmd(ClientData dummy,
- Tcl_Interp *currentInterp, int objc,
- Tcl_Obj *const objv[]);
-static void AliasObjCmdDeleteProc(ClientData clientData);
+static Tcl_ObjCmdProc AliasNRCmd;
+static Tcl_CmdDeleteProc AliasObjCmdDeleteProc;
static Tcl_Interp * GetInterp(Tcl_Interp *interp, Tcl_Obj *pathPtr);
static Tcl_Interp * GetInterp2(Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
-static void InterpInfoDeleteProc(ClientData clientData,
- Tcl_Interp *interp);
+static Tcl_InterpDeleteProc InterpInfoDeleteProc;
static int ChildBgerror(Tcl_Interp *interp,
Tcl_Interp *childInterp, int objc,
Tcl_Obj *const objv[]);
@@ -259,7 +256,7 @@ static int ChildMarkTrusted(Tcl_Interp *interp,
Tcl_Interp *childInterp);
static int ChildObjCmd(ClientData dummy, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-static void ChildObjCmdDeleteProc(ClientData clientData);
+static Tcl_CmdDeleteProc ChildObjCmdDeleteProc;
static int ChildRecursionLimit(Tcl_Interp *interp,
Tcl_Interp *childInterp, int objc,
Tcl_Obj *const objv[]);
@@ -309,7 +306,7 @@ TclSetPreInitScript(
{
const char *prevString = tclPreInitScript;
tclPreInitScript = string;
- return(prevString);
+ return prevString;
}
/*
@@ -473,7 +470,7 @@ TclInterpInit(
Parent *parentPtr;
Child *childPtr;
- interpInfoPtr = ckalloc(sizeof(InterpInfo));
+ interpInfoPtr = (InterpInfo *)ckalloc(sizeof(InterpInfo));
((Interp *) interp)->interpInfo = interpInfoPtr;
parentPtr = &interpInfoPtr->parent;
@@ -589,7 +586,7 @@ InterpInfoDeleteProc(
*
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
+
int
Tcl_InterpObjCmd(
ClientData clientData, /* Unused. */
@@ -618,7 +615,7 @@ NRInterpCmd(
"slaves", "share", "target", "transfer",
NULL
};
- enum option {
+ enum interpOptionEnum {
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_CANCEL,
OPT_CHILDREN, OPT_CREATE, OPT_DEBUG, OPT_DELETE,
OPT_EVAL, OPT_EXISTS, OPT_EXPOSE,
@@ -635,7 +632,7 @@ NRInterpCmd(
&index) != TCL_OK) {
return TCL_ERROR;
}
- switch ((enum option) index) {
+ switch ((enum interpOptionEnum)index) {
case OPT_ALIAS: {
Tcl_Interp *parentInterp;
@@ -688,7 +685,7 @@ NRInterpCmd(
static const char *const cancelOptions[] = {
"-unwind", "--", NULL
};
- enum option {
+ enum optionCancelEnum {
OPT_UNWIND, OPT_LAST
};
@@ -703,7 +700,7 @@ NRInterpCmd(
return TCL_ERROR;
}
- switch ((enum option) index) {
+ switch ((enum optionCancelEnum) index) {
case OPT_UNWIND:
/*
* The evaluation stack in the target interp is to be unwound.
@@ -1024,7 +1021,7 @@ NRInterpCmd(
TclNewObj(resultPtr);
hPtr = Tcl_FirstHashEntry(&iiPtr->parent.childTable, &hashSearch);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
- string = Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
+ string = (char *)Tcl_GetHashKey(&iiPtr->parent.childTable, hPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
Tcl_NewStringObj(string, -1));
}
@@ -1095,7 +1092,7 @@ NRInterpCmd(
NULL);
return TCL_ERROR;
}
- aliasPtr = Tcl_GetHashValue(hPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
if (Tcl_GetInterpPath(interp, aliasPtr->targetInterp) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"target interpreter for alias \"%s\" in path \"%s\" is "
@@ -1178,7 +1175,7 @@ Tcl_CreateAlias(
int i;
int result;
- objv = TclStackAlloc(childInterp, (unsigned) sizeof(Tcl_Obj *) * argc);
+ objv = (Tcl_Obj **)TclStackAlloc(childInterp, sizeof(Tcl_Obj *) * argc);
for (i = 0; i < argc; i++) {
objv[i] = Tcl_NewStringObj(argv[i], -1);
Tcl_IncrRefCount(objv[i]);
@@ -1284,7 +1281,7 @@ Tcl_GetAlias(
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ALIAS", aliasName, NULL);
return TCL_ERROR;
}
- aliasPtr = Tcl_GetHashValue(hPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
objc = aliasPtr->objc;
objv = &aliasPtr->objPtr;
@@ -1346,7 +1343,7 @@ Tcl_GetAliasObj(
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ALIAS", aliasName, NULL);
return TCL_ERROR;
}
- aliasPtr = Tcl_GetHashValue(hPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
objc = aliasPtr->objc;
objv = &aliasPtr->objPtr;
@@ -1414,7 +1411,7 @@ TclPreventAliasLoop(
* chain then we have a loop.
*/
- aliasPtr = cmdPtr->objClientData;
+ aliasPtr = (Alias *)cmdPtr->objClientData;
nextAliasPtr = aliasPtr;
while (1) {
Tcl_Obj *cmdNamePtr;
@@ -1462,10 +1459,8 @@ TclPreventAliasLoop(
if (aliasCmdPtr->objProc != AliasObjCmd) {
return TCL_OK;
}
- nextAliasPtr = aliasCmdPtr->objClientData;
+ nextAliasPtr = (Alias *)aliasCmdPtr->objClientData;
}
-
- /* NOTREACHED */
}
/*
@@ -1505,7 +1500,7 @@ AliasCreate(
Tcl_Obj **prefv;
int isNew, i;
- aliasPtr = ckalloc(sizeof(Alias) + objc * sizeof(Tcl_Obj *));
+ aliasPtr = (Alias *)ckalloc(sizeof(Alias) + objc * sizeof(Tcl_Obj *));
aliasPtr->token = namePtr;
Tcl_IncrRefCount(aliasPtr->token);
aliasPtr->targetInterp = parentInterp;
@@ -1613,7 +1608,7 @@ AliasCreate(
* interp alias {} foo {} zop # Now recreate "foo"...
*/
- targetPtr = ckalloc(sizeof(Target));
+ targetPtr = (Target *)ckalloc(sizeof(Target));
targetPtr->childCmd = aliasPtr->childCmd;
targetPtr->childInterp = childInterp;
@@ -1674,7 +1669,7 @@ AliasDelete(
TclGetString(namePtr), NULL);
return TCL_ERROR;
}
- aliasPtr = Tcl_GetHashValue(hPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
Tcl_DeleteCommandFromToken(childInterp, aliasPtr->childCmd);
return TCL_OK;
}
@@ -1719,7 +1714,7 @@ AliasDescribe(
if (hPtr == NULL) {
return TCL_OK;
}
- aliasPtr = Tcl_GetHashValue(hPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(hPtr);
prefixPtr = Tcl_NewListObj(aliasPtr->objc, &aliasPtr->objPtr);
Tcl_SetObjResult(interp, prefixPtr);
return TCL_OK;
@@ -1757,7 +1752,7 @@ AliasList(
entryPtr = Tcl_FirstHashEntry(&childPtr->aliasTable, &hashSearch);
for ( ; entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&hashSearch)) {
- aliasPtr = Tcl_GetHashValue(entryPtr);
+ aliasPtr = (Alias *)Tcl_GetHashValue(entryPtr);
Tcl_ListObjAppendElement(NULL, resultPtr, aliasPtr->token);
}
Tcl_SetObjResult(interp, resultPtr);
@@ -1793,7 +1788,7 @@ AliasNRCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument vector. */
{
- Alias *aliasPtr = clientData;
+ Alias *aliasPtr = (Alias *)clientData;
int prefc, cmdc, i;
Tcl_Obj **prefv, **cmdv;
Tcl_Obj *listPtr;
@@ -1842,7 +1837,7 @@ AliasObjCmd(
Tcl_Obj *const objv[]) /* Argument vector. */
{
#define ALIAS_CMDV_PREALLOC 10
- Alias *aliasPtr = clientData;
+ Alias *aliasPtr = (Alias *)clientData;
Tcl_Interp *targetInterp = aliasPtr->targetInterp;
int result, prefc, cmdc, i;
Tcl_Obj **prefv, **cmdv;
@@ -1861,7 +1856,7 @@ AliasObjCmd(
if (cmdc <= ALIAS_CMDV_PREALLOC) {
cmdv = cmdArr;
} else {
- cmdv = TclStackAlloc(interp, cmdc * sizeof(Tcl_Obj *));
+ cmdv = (Tcl_Obj **)TclStackAlloc(interp, cmdc * sizeof(Tcl_Obj *));
}
memcpy(cmdv, prefv, prefc * sizeof(Tcl_Obj *));
@@ -1947,7 +1942,7 @@ static void
AliasObjCmdDeleteProc(
ClientData clientData) /* The alias record for this alias. */
{
- Alias *aliasPtr = clientData;
+ Alias *aliasPtr = (Alias *)clientData;
Target *targetPtr;
int i;
Tcl_Obj **objv;
@@ -2123,7 +2118,7 @@ TclSetChildCancelFlags(
hPtr = Tcl_FirstHashEntry(&parentPtr->childTable, &hashSearch);
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&hashSearch)) {
- childPtr = Tcl_GetHashValue(hPtr);
+ childPtr = (Child *)Tcl_GetHashValue(hPtr);
iPtr = (Interp *) childPtr->childInterp;
if (iPtr == NULL) {
@@ -2188,7 +2183,7 @@ Tcl_GetInterpPath(
return TCL_ERROR;
}
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- Tcl_NewStringObj(Tcl_GetHashKey(&iiPtr->parent.childTable,
+ Tcl_NewStringObj((const char *)Tcl_GetHashKey(&iiPtr->parent.childTable,
iiPtr->child.childEntryPtr), -1));
return TCL_OK;
}
@@ -2236,7 +2231,7 @@ GetInterp(
searchInterp = NULL;
break;
}
- childPtr = Tcl_GetHashValue(hPtr);
+ childPtr = (Child *)Tcl_GetHashValue(hPtr);
searchInterp = childPtr->childInterp;
if (searchInterp == NULL) {
break;
@@ -2462,7 +2457,7 @@ NRChildCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tcl_Interp *childInterp = clientData;
+ Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
int index;
static const char *const options[] = {
"alias", "aliases", "bgerror", "debug",
@@ -2470,7 +2465,7 @@ NRChildCmd(
"issafe", "invokehidden", "limit", "marktrusted",
"recursionlimit", NULL
};
- enum options {
+ enum childCmdOptionsEnum {
OPT_ALIAS, OPT_ALIASES, OPT_BGERROR, OPT_DEBUG,
OPT_EVAL, OPT_EXPOSE, OPT_HIDE, OPT_HIDDEN,
OPT_ISSAFE, OPT_INVOKEHIDDEN, OPT_LIMIT, OPT_MARKTRUSTED,
@@ -2490,7 +2485,7 @@ NRChildCmd(
return TCL_ERROR;
}
- switch ((enum options) index) {
+ switch ((enum childCmdOptionsEnum) index) {
case OPT_ALIAS:
if (objc > 2) {
if (objc == 3) {
@@ -2666,7 +2661,7 @@ ChildObjCmdDeleteProc(
ClientData clientData) /* The ChildRecord for the command. */
{
Child *childPtr; /* Interim storage for Child record. */
- Tcl_Interp *childInterp = clientData;
+ Tcl_Interp *childInterp = (Tcl_Interp *)clientData;
/* And for a child interp. */
childPtr = &((InterpInfo *) ((Interp *) childInterp)->interpInfo)->child;
@@ -2995,7 +2990,7 @@ ChildHidden(
Tcl_Interp *interp, /* Interp for data return. */
Tcl_Interp *childInterp) /* Interp whose hidden commands to query. */
{
- Tcl_Obj *listObjPtr; /* Local object pointer. */
+ Tcl_Obj *listObjPtr; /* Local object pointer. */
Tcl_HashTable *hTblPtr; /* For local searches. */
Tcl_HashEntry *hPtr; /* For local searches. */
Tcl_HashSearch hSearch; /* For local searches. */
@@ -3007,7 +3002,7 @@ ChildHidden(
hPtr != NULL;
hPtr = Tcl_NextHashEntry(&hSearch)) {
Tcl_ListObjAppendElement(NULL, listObjPtr,
- Tcl_NewStringObj(Tcl_GetHashKey(hTblPtr, hPtr), -1));
+ Tcl_NewStringObj((const char *)Tcl_GetHashKey(hTblPtr, hPtr), -1));
}
}
Tcl_SetObjResult(interp, listObjPtr);
@@ -3530,7 +3525,7 @@ Tcl_LimitAddHandler(
* Allocate a handler record.
*/
- handlerPtr = ckalloc(sizeof(LimitHandler));
+ handlerPtr = (LimitHandler *)ckalloc(sizeof(LimitHandler));
handlerPtr->flags = 0;
handlerPtr->handlerProc = handlerProc;
handlerPtr->clientData = clientData;
@@ -3987,8 +3982,8 @@ static void
TimeLimitCallback(
ClientData clientData)
{
- Tcl_Interp *interp = clientData;
- Interp *iPtr = clientData;
+ Tcl_Interp *interp = (Tcl_Interp *)clientData;
+ Interp *iPtr = (Interp *)clientData;
int code;
Tcl_Preserve(interp);
@@ -4131,7 +4126,7 @@ static void
DeleteScriptLimitCallback(
ClientData clientData)
{
- ScriptLimitCallback *limitCBPtr = clientData;
+ ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
Tcl_DecrRefCount(limitCBPtr->scriptObj);
if (limitCBPtr->entryPtr != NULL) {
@@ -4163,7 +4158,7 @@ CallScriptLimitCallback(
ClientData clientData,
Tcl_Interp *interp) /* Interpreter which failed the limit */
{
- ScriptLimitCallback *limitCBPtr = clientData;
+ ScriptLimitCallback *limitCBPtr = (ScriptLimitCallback *)clientData;
int code;
if (Tcl_InterpDeleted(limitCBPtr->interp)) {
@@ -4231,13 +4226,13 @@ SetScriptLimitCallback(
hashPtr = Tcl_CreateHashEntry(&iPtr->limit.callbacks, &key,
&isNew);
if (!isNew) {
- limitCBPtr = Tcl_GetHashValue(hashPtr);
+ limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hashPtr);
limitCBPtr->entryPtr = NULL;
Tcl_LimitRemoveHandler(targetInterp, type, CallScriptLimitCallback,
limitCBPtr);
}
- limitCBPtr = ckalloc(sizeof(ScriptLimitCallback));
+ limitCBPtr = (ScriptLimitCallback *)ckalloc(sizeof(ScriptLimitCallback));
limitCBPtr->interp = interp;
limitCBPtr->scriptObj = scriptObj;
limitCBPtr->entryPtr = hashPtr;
@@ -4426,7 +4421,7 @@ ChildCommandLimitCmd(
key.type = TCL_LIMIT_COMMANDS;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
- limitCBPtr = Tcl_GetHashValue(hPtr);
+ limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
limitCBPtr->scriptObj);
@@ -4468,7 +4463,7 @@ ChildCommandLimitCmd(
key.type = TCL_LIMIT_COMMANDS;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
- limitCBPtr = Tcl_GetHashValue(hPtr);
+ limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_SetObjResult(interp, limitCBPtr->scriptObj);
}
@@ -4502,7 +4497,7 @@ ChildCommandLimitCmd(
switch ((enum Options) index) {
case OPT_CMD:
scriptObj = objv[i+1];
- (void) Tcl_GetStringFromObj(objv[i+1], &scriptLen);
+ (void) Tcl_GetStringFromObj(scriptObj, &scriptLen);
break;
case OPT_GRAN:
granObj = objv[i+1];
@@ -4614,7 +4609,7 @@ ChildTimeLimitCmd(
key.type = TCL_LIMIT_TIME;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
- limitCBPtr = Tcl_GetHashValue(hPtr);
+ limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_DictObjPut(NULL, dictPtr, Tcl_NewStringObj(options[0], -1),
limitCBPtr->scriptObj);
@@ -4662,7 +4657,7 @@ ChildTimeLimitCmd(
key.type = TCL_LIMIT_TIME;
hPtr = Tcl_FindHashEntry(&iPtr->limit.callbacks, (char *) &key);
if (hPtr != NULL) {
- limitCBPtr = Tcl_GetHashValue(hPtr);
+ limitCBPtr = (ScriptLimitCallback *)Tcl_GetHashValue(hPtr);
if (limitCBPtr != NULL && limitCBPtr->scriptObj != NULL) {
Tcl_SetObjResult(interp, limitCBPtr->scriptObj);
}
@@ -4754,9 +4749,15 @@ ChildTimeLimitCmd(
if (TclGetWideIntFromObj(interp, objv[i+1], &sec) != TCL_OK) {
return TCL_ERROR;
}
+ if (sec > LONG_MAX) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "seconds must be between 0 and %ld", LONG_MAX));
+ goto badValue;
+ }
if (sec < 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"seconds must be at least 0", -1));
+ badValue:
Tcl_SetErrorCode(interp, "TCL", "OPERATION", "INTERP",
"BADVALUE", NULL);
return TCL_ERROR;
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index eccca78..7290bd1 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -31,7 +31,7 @@
* limited to a single interpreter.
*/
-typedef struct ThreadSpecificData {
+typedef struct {
long numNsCreated; /* Count of the number of namespaces created
* within the thread. This value is used as a
* unique id for each namespace. Cannot be
@@ -89,51 +89,30 @@ static char * EstablishErrorInfoTraces(ClientData clientData,
static void FreeNsNameInternalRep(Tcl_Obj *objPtr);
static int GetNamespaceFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr);
-static int InvokeImportedCmd(ClientData clientData,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
static int InvokeImportedNRCmd(ClientData clientData,
Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceChildrenCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceCodeCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceCurrentCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceDeleteCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceEvalCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NRNamespaceEvalCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceExistsCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceExportCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceForgetCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc InvokeImportedCmd;
+static Tcl_ObjCmdProc NamespaceChildrenCmd;
+static Tcl_ObjCmdProc NamespaceCodeCmd;
+static Tcl_ObjCmdProc NamespaceCurrentCmd;
+static Tcl_ObjCmdProc NamespaceDeleteCmd;
+static Tcl_ObjCmdProc NamespaceEvalCmd;
+static Tcl_ObjCmdProc NRNamespaceEvalCmd;
+static Tcl_ObjCmdProc NamespaceExistsCmd;
+static Tcl_ObjCmdProc NamespaceExportCmd;
+static Tcl_ObjCmdProc NamespaceForgetCmd;
static void NamespaceFree(Namespace *nsPtr);
-static int NamespaceImportCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceInscopeCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NRNamespaceInscopeCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceOriginCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceParentCmd(ClientData dummy,Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespacePathCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceQualifiersCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceTailCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceUpvarCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int NamespaceUnknownCmd(ClientData dummy,
- Tcl_Interp *interp,int objc,Tcl_Obj *const objv[]);
-static int NamespaceWhichCmd(ClientData dummy, Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc NamespaceImportCmd;
+static Tcl_ObjCmdProc NamespaceInscopeCmd;
+static Tcl_ObjCmdProc NRNamespaceInscopeCmd;
+static Tcl_ObjCmdProc NamespaceOriginCmd;
+static Tcl_ObjCmdProc NamespaceParentCmd;
+static Tcl_ObjCmdProc NamespacePathCmd;
+static Tcl_ObjCmdProc NamespaceQualifiersCmd;
+static Tcl_ObjCmdProc NamespaceTailCmd;
+static Tcl_ObjCmdProc NamespaceUpvarCmd;
+static Tcl_ObjCmdProc NamespaceUnknownCmd;
+static Tcl_ObjCmdProc NamespaceWhichCmd;
static int SetNsNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UnlinkNsPath(Namespace *nsPtr);
@@ -320,7 +299,6 @@ Tcl_PushCallFrame(
if (nsPtr->flags & NS_DEAD) {
Tcl_Panic("Trying to push call frame for dead namespace");
- /*NOTREACHED*/
}
}
@@ -465,7 +443,7 @@ TclPushStackFrame(
* treated as references to namespace
* variables. */
{
- *framePtrPtr = TclStackAlloc(interp, sizeof(CallFrame));
+ *framePtrPtr = (Tcl_CallFrame *)TclStackAlloc(interp, sizeof(CallFrame));
return Tcl_PushCallFrame(interp, *framePtrPtr, namespacePtr,
isProcCallFrame);
}
@@ -770,9 +748,9 @@ Tcl_CreateNamespace(
*/
doCreate:
- nsPtr = ckalloc(sizeof(Namespace));
+ nsPtr = (Namespace *)ckalloc(sizeof(Namespace));
nameLen = strlen(simpleName) + 1;
- nsPtr->name = ckalloc(nameLen);
+ nsPtr->name = (char *)ckalloc(nameLen);
memcpy(nsPtr->name, simpleName, nameLen);
nsPtr->fullName = NULL; /* Set below. */
nsPtr->clientData = clientData;
@@ -860,7 +838,7 @@ Tcl_CreateNamespace(
name = Tcl_DStringValue(namePtr);
nameLen = Tcl_DStringLength(namePtr);
- nsPtr->fullName = ckalloc(nameLen + 1);
+ nsPtr->fullName = (char *)ckalloc(nameLen + 1);
memcpy(nsPtr->fullName, name, nameLen + 1);
Tcl_DStringFree(&buffer1);
@@ -952,7 +930,7 @@ Tcl_DeleteNamespace(
for (entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
entryPtr != NULL;) {
- cmdPtr = Tcl_GetHashValue(entryPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
if (cmdPtr->nreProc == TclNRInterpCoroutine) {
Tcl_DeleteCommandFromToken((Tcl_Interp *) iPtr,
(Tcl_Command) cmdPtr);
@@ -1131,14 +1109,14 @@ TclTeardownNamespace(
while (nsPtr->cmdTable.numEntries > 0) {
int length = nsPtr->cmdTable.numEntries;
- Command **cmds = TclStackAlloc((Tcl_Interp *) iPtr,
+ Command **cmds = (Command **)TclStackAlloc((Tcl_Interp *) iPtr,
sizeof(Command *) * length);
i = 0;
for (entryPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
entryPtr != NULL;
entryPtr = Tcl_NextHashEntry(&search)) {
- cmds[i] = Tcl_GetHashValue(entryPtr);
+ cmds[i] = (Command *)Tcl_GetHashValue(entryPtr);
cmds[i]->refCount++;
i++;
}
@@ -1445,7 +1423,7 @@ Tcl_Export(
if (neededElems > nsPtr->maxExportPatterns) {
nsPtr->maxExportPatterns = nsPtr->maxExportPatterns ?
2 * nsPtr->maxExportPatterns : INIT_EXPORT_PATTERNS;
- nsPtr->exportArrayPtr = ckrealloc(nsPtr->exportArrayPtr,
+ nsPtr->exportArrayPtr = (char **)ckrealloc(nsPtr->exportArrayPtr,
sizeof(char *) * nsPtr->maxExportPatterns);
}
@@ -1454,7 +1432,7 @@ Tcl_Export(
*/
len = strlen(pattern);
- patternCpy = ckalloc(len + 1);
+ patternCpy = (char *)ckalloc(len + 1);
memcpy(patternCpy, pattern, len + 1);
nsPtr->exportArrayPtr[nsPtr->numExportPatterns] = patternCpy;
@@ -1665,7 +1643,7 @@ Tcl_Import(
}
for (hPtr = Tcl_FirstHashEntry(&importNsPtr->cmdTable, &search);
(hPtr != NULL); hPtr = Tcl_NextHashEntry(&search)) {
- char *cmdName = Tcl_GetHashKey(&importNsPtr->cmdTable, hPtr);
+ char *cmdName = (char *)Tcl_GetHashKey(&importNsPtr->cmdTable, hPtr);
if (Tcl_StringMatch(cmdName, simplePattern) &&
DoImport(interp, nsPtr, hPtr, cmdName, pattern, importNsPtr,
@@ -1752,13 +1730,13 @@ DoImport(
* namespace would create a cycle of imported command references.
*/
- cmdPtr = Tcl_GetHashValue(hPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(hPtr);
if (found != NULL && cmdPtr->deleteProc == DeleteImportedCmd) {
- Command *overwrite = Tcl_GetHashValue(found);
+ Command *overwrite = (Command *)Tcl_GetHashValue(found);
Command *linkCmd = cmdPtr;
while (linkCmd->deleteProc == DeleteImportedCmd) {
- dataPtr = linkCmd->objClientData;
+ dataPtr = (ImportedCmdData *)linkCmd->objClientData;
linkCmd = dataPtr->realCmdPtr;
if (overwrite == linkCmd) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1772,7 +1750,7 @@ DoImport(
}
}
- dataPtr = ckalloc(sizeof(ImportedCmdData));
+ dataPtr = (ImportedCmdData *)ckalloc(sizeof(ImportedCmdData));
importedCmd = Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
InvokeImportedCmd, InvokeImportedNRCmd, dataPtr,
DeleteImportedCmd);
@@ -1786,15 +1764,15 @@ DoImport(
* and add it to the import ref list in the "real" command.
*/
- refPtr = ckalloc(sizeof(ImportRef));
+ refPtr = (ImportRef *)ckalloc(sizeof(ImportRef));
refPtr->importedCmdPtr = (Command *) importedCmd;
refPtr->nextPtr = cmdPtr->importRefPtr;
cmdPtr->importRefPtr = refPtr;
} else {
- Command *overwrite = Tcl_GetHashValue(found);
+ Command *overwrite = (Command *)Tcl_GetHashValue(found);
if (overwrite->deleteProc == DeleteImportedCmd) {
- ImportedCmdData *dataPtr = overwrite->objClientData;
+ ImportedCmdData *dataPtr = (ImportedCmdData *)overwrite->objClientData;
if (dataPtr->realCmdPtr == Tcl_GetHashValue(hPtr)) {
/*
@@ -1888,7 +1866,7 @@ Tcl_ForgetImport(
if (TclMatchIsTrivial(simplePattern)) {
hPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simplePattern);
if (hPtr != NULL) {
- Command *cmdPtr = Tcl_GetHashValue(hPtr);
+ Command *cmdPtr = (Command *)Tcl_GetHashValue(hPtr);
if (cmdPtr && (cmdPtr->deleteProc == DeleteImportedCmd)) {
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
@@ -1898,12 +1876,12 @@ Tcl_ForgetImport(
}
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
(hPtr != NULL); hPtr = Tcl_NextHashEntry(&search)) {
- Command *cmdPtr = Tcl_GetHashValue(hPtr);
+ Command *cmdPtr = (Command *)Tcl_GetHashValue(hPtr);
if (cmdPtr->deleteProc != DeleteImportedCmd) {
continue;
}
- cmdName = Tcl_GetHashKey(&nsPtr->cmdTable, hPtr);
+ cmdName = (char *)Tcl_GetHashKey(&nsPtr->cmdTable, hPtr);
if (Tcl_StringMatch(cmdName, simplePattern)) {
Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr);
}
@@ -1918,7 +1896,7 @@ Tcl_ForgetImport(
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search); (hPtr != NULL);
hPtr = Tcl_NextHashEntry(&search)) {
Tcl_CmdInfo info;
- Tcl_Command token = Tcl_GetHashValue(hPtr);
+ Tcl_Command token = (Tcl_Command)Tcl_GetHashValue(hPtr);
Tcl_Command origin = TclGetOriginalCommand(token);
if (Tcl_GetCommandInfoFromToken(origin, &info) == 0) {
@@ -1931,7 +1909,7 @@ Tcl_ForgetImport(
*/
Command *cmdPtr = (Command *) token;
- ImportedCmdData *dataPtr = cmdPtr->objClientData;
+ ImportedCmdData *dataPtr = (ImportedCmdData *)cmdPtr->objClientData;
Tcl_Command firstToken = (Tcl_Command) dataPtr->realCmdPtr;
if (firstToken == origin) {
@@ -1986,7 +1964,7 @@ TclGetOriginalCommand(
}
while (cmdPtr->deleteProc == DeleteImportedCmd) {
- dataPtr = cmdPtr->objClientData;
+ dataPtr = (ImportedCmdData *)cmdPtr->objClientData;
cmdPtr = dataPtr->realCmdPtr;
}
return (Tcl_Command) cmdPtr;
@@ -2019,7 +1997,7 @@ InvokeImportedNRCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- ImportedCmdData *dataPtr = clientData;
+ ImportedCmdData *dataPtr = (ImportedCmdData *)clientData;
Command *realCmdPtr = dataPtr->realCmdPtr;
TclSkipTailcall(interp);
@@ -2064,7 +2042,7 @@ DeleteImportedCmd(
ClientData clientData) /* Points to the imported command's
* ImportedCmdData structure. */
{
- ImportedCmdData *dataPtr = clientData;
+ ImportedCmdData *dataPtr = (ImportedCmdData *)clientData;
Command *realCmdPtr = dataPtr->realCmdPtr;
Command *selfPtr = dataPtr->selfPtr;
ImportRef *refPtr, *prevPtr;
@@ -2340,7 +2318,7 @@ TclGetNamespaceForQualName(
}
#endif
if (entryPtr != NULL) {
- nsPtr = Tcl_GetHashValue(entryPtr);
+ nsPtr = (Namespace *)Tcl_GetHashValue(entryPtr);
} else if (flags & TCL_CREATE_NS_IF_UNKNOWN) {
Tcl_CallFrame *framePtr;
@@ -2375,7 +2353,7 @@ TclGetNamespaceForQualName(
}
#endif
if (entryPtr != NULL) {
- altNsPtr = Tcl_GetHashValue(entryPtr);
+ altNsPtr = (Namespace *)Tcl_GetHashValue(entryPtr);
} else {
altNsPtr = NULL;
}
@@ -2625,7 +2603,7 @@ Tcl_FindCommand(
|| !(realNsPtr->flags & NS_DYING)) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
- cmdPtr = Tcl_GetHashValue(entryPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
}
}
}
@@ -2646,7 +2624,7 @@ Tcl_FindCommand(
&& !(realNsPtr->flags & NS_DYING)) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
- cmdPtr = Tcl_GetHashValue(entryPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
}
}
}
@@ -2664,7 +2642,7 @@ Tcl_FindCommand(
&& !(realNsPtr->flags & NS_DYING)) {
entryPtr = Tcl_FindHashEntry(&realNsPtr->cmdTable, simpleName);
if (entryPtr != NULL) {
- cmdPtr = Tcl_GetHashValue(entryPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
}
}
}
@@ -2686,7 +2664,7 @@ Tcl_FindCommand(
entryPtr = Tcl_FindHashEntry(&nsPtr[search]->cmdTable,
simpleName);
if (entryPtr != NULL) {
- cmdPtr = Tcl_GetHashValue(entryPtr);
+ cmdPtr = (Command *)Tcl_GetHashValue(entryPtr);
}
}
}
@@ -2750,7 +2728,7 @@ TclResetShadowedCmdRefs(
int found, i;
int trailFront = -1;
int trailSize = 5; /* Formerly NUM_TRAIL_ELEMS. */
- Namespace **trailPtr = TclStackAlloc(interp,
+ Namespace **trailPtr = (Namespace **)TclStackAlloc(interp,
trailSize * sizeof(Namespace *));
/*
@@ -2770,7 +2748,7 @@ TclResetShadowedCmdRefs(
* cmdName.
*/
- cmdName = Tcl_GetHashKey(newCmdPtr->hPtr->tablePtr, newCmdPtr->hPtr);
+ cmdName = (char *)Tcl_GetHashKey(newCmdPtr->hPtr->tablePtr, newCmdPtr->hPtr);
for (nsPtr=newCmdPtr->nsPtr ; (nsPtr!=NULL) && (nsPtr!=globalNsPtr) ;
nsPtr=nsPtr->parentPtr) {
/*
@@ -2799,7 +2777,7 @@ TclResetShadowedCmdRefs(
}
#endif
if (hPtr != NULL) {
- shadowNsPtr = Tcl_GetHashValue(hPtr);
+ shadowNsPtr = (Namespace *)Tcl_GetHashValue(hPtr);
} else {
found = 0;
break;
@@ -2840,7 +2818,7 @@ TclResetShadowedCmdRefs(
if (trailFront == trailSize) {
int newSize = 2 * trailSize;
- trailPtr = TclStackRealloc(interp, trailPtr,
+ trailPtr = (Namespace **)TclStackRealloc(interp, trailPtr,
newSize * sizeof(Namespace *));
trailSize = newSize;
}
@@ -3065,7 +3043,7 @@ NamespaceChildrenCmd(
entryPtr = Tcl_FirstHashEntry(nsPtr->childTablePtr, &search);
#endif
while (entryPtr != NULL) {
- childNsPtr = Tcl_GetHashValue(entryPtr);
+ childNsPtr = (Namespace *)Tcl_GetHashValue(entryPtr);
if ((pattern == NULL)
|| Tcl_StringMatch(childNsPtr->fullName, pattern)) {
elemPtr = Tcl_NewStringObj(childNsPtr->fullName, -1);
@@ -3428,13 +3406,13 @@ NsEval_Callback(
Tcl_Interp *interp,
int result)
{
- Tcl_Namespace *namespacePtr = data[0];
+ Tcl_Namespace *namespacePtr = (Tcl_Namespace *)data[0];
if (result == TCL_ERROR) {
int length = strlen(namespacePtr->fullName);
int limit = 200;
int overflow = (length > limit);
- char *cmd = data[1];
+ char *cmd = (char *)data[1];
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (in namespace %s \"%.*s%s\" script line %d)",
@@ -3550,7 +3528,7 @@ NamespaceExportCmd(
Tcl_Obj *listPtr;
TclNewObj(listPtr);
- (void) Tcl_AppendExportList(interp, NULL, listPtr);
+ (void)Tcl_AppendExportList(interp, NULL, listPtr);
Tcl_SetObjResult(interp, listPtr);
return TCL_OK;
}
@@ -3716,11 +3694,11 @@ NamespaceImportCmd(
TclNewObj(listPtr);
for (hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Command *cmdPtr = Tcl_GetHashValue(hPtr);
+ Command *cmdPtr = (Command *)Tcl_GetHashValue(hPtr);
if (cmdPtr->deleteProc == DeleteImportedCmd) {
Tcl_ListObjAppendElement(NULL, listPtr, Tcl_NewStringObj(
- Tcl_GetHashKey(&nsPtr->cmdTable, hPtr) ,-1));
+ (char *)Tcl_GetHashKey(&nsPtr->cmdTable, hPtr) ,-1));
}
}
Tcl_SetObjResult(interp, listPtr);
@@ -4048,7 +4026,7 @@ NamespacePathCmd(
goto badNamespace;
}
if (nsObjc != 0) {
- namespaceList = TclStackAlloc(interp,
+ namespaceList = (Tcl_Namespace **)TclStackAlloc(interp,
sizeof(Tcl_Namespace *) * nsObjc);
for (i=0 ; i<nsObjc ; i++) {
@@ -4101,7 +4079,7 @@ TclSetNsPath(
{
if (pathLength != 0) {
NamespacePathEntry *tmpPathArray =
- ckalloc(sizeof(NamespacePathEntry) * pathLength);
+ (NamespacePathEntry *)ckalloc(sizeof(NamespacePathEntry) * pathLength);
int i;
for (i=0 ; i<pathLength ; i++) {
@@ -4699,7 +4677,7 @@ FreeNsNameInternalRep(
Tcl_Obj *objPtr) /* nsName object with internal representation
* to free. */
{
- ResolvedNsName *resNamePtr = objPtr->internalRep.twoPtrValue.ptr1;
+ ResolvedNsName *resNamePtr = (ResolvedNsName *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* Decrement the reference count of the namespace. If there are no more
@@ -4812,12 +4790,12 @@ SetNsNameFromAny(
}
nsPtr->refCount++;
- resNamePtr = ckalloc(sizeof(ResolvedNsName));
+ resNamePtr = (ResolvedNsName *)ckalloc(sizeof(ResolvedNsName));
resNamePtr->nsPtr = nsPtr;
if ((name[0] == ':') && (name[1] == ':')) {
resNamePtr->refNsPtr = NULL;
} else {
- resNamePtr->refNsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
+ resNamePtr->refNsPtr = (Namespace *)Tcl_GetCurrentNamespace(interp);
}
resNamePtr->refCount = 1;
TclFreeIntRep(objPtr);
@@ -4874,7 +4852,7 @@ TclGetNamespaceChildTable(
return &nPtr->childTable;
#else
if (nPtr->childTablePtr == NULL) {
- nPtr->childTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ nPtr->childTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(nPtr->childTablePtr, TCL_STRING_KEYS);
}
return nPtr->childTablePtr;
@@ -4963,7 +4941,7 @@ TclLogCommandInfo(
} else {
Tcl_HashEntry *hPtr
= Tcl_FindHashEntry(&iPtr->varTraces, (char *) varPtr);
- VarTrace *tracePtr = Tcl_GetHashValue(hPtr);
+ VarTrace *tracePtr = (VarTrace *)Tcl_GetHashValue(hPtr);
if (tracePtr->traceProc != EstablishErrorInfoTraces) {
/*