From d409a29e57b2d4ced1bad4b0bb5bb1e2387f4120 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 Jul 2019 06:54:24 +0000 Subject: Experiment: compile Tcl with C++ compiler. WIP --- generic/tclBasic.c | 60 ++++++++++++++--------------- generic/tclCmdIL.c | 6 +-- generic/tclCmdMZ.c | 8 ++-- generic/tclCompExpr.c | 20 +++++----- generic/tclCompile.c | 6 +-- generic/tclDictObj.c | 4 +- generic/tclEvent.c | 76 ++++++++++++++++++------------------- generic/tclExecute.c | 2 +- generic/tclFileName.c | 2 +- generic/tclIOCmd.c | 2 +- generic/tclIndexObj.c | 16 ++++---- generic/tclInt.h | 2 +- generic/tclInterp.c | 2 +- generic/tclNamesp.c | 10 ++--- generic/tclOOCall.c | 4 +- generic/tclOODefineCmds.c | 6 +-- generic/tclOOMethod.c | 4 +- generic/tclParse.c | 6 +-- generic/tclProc.c | 12 +++--- generic/tclRegexp.c | 8 ++-- generic/tclScan.c | 2 +- generic/tclTest.c | 65 ++++++++++++++++---------------- generic/tclTestObj.c | 42 ++++++++++----------- generic/tclTestProcBodyObj.c | 16 ++++---- generic/tclThreadAlloc.c | 28 +++++++------- generic/tclThreadTest.c | 44 +++++++++++----------- generic/tclTrace.c | 2 +- unix/tclEpollNotfy.c | 12 +++--- unix/tclKqueueNotfy.c | 12 +++--- unix/tclLoadDl.c | 2 +- unix/tclLoadDyld.c | 14 +++---- unix/tclLoadNext.c | 2 +- unix/tclLoadOSF.c | 2 +- unix/tclLoadShl.c | 2 +- unix/tclSelectNotfy.c | 2 +- unix/tclUnixChan.c | 90 ++++++++++++++++++++++---------------------- unix/tclUnixCompat.c | 24 ++++++------ unix/tclUnixFCmd.c | 84 ++++++++++++++++++++--------------------- unix/tclUnixFile.c | 30 +++++++-------- unix/tclUnixInit.c | 2 +- unix/tclUnixPipe.c | 54 +++++++++++++------------- unix/tclUnixSock.c | 90 ++++++++++++++++++++++---------------------- unix/tclUnixTest.c | 2 +- unix/tclUnixThrd.c | 14 +++---- unix/tclUnixTime.c | 4 +- unix/tclXtNotify.c | 4 +- win/tclWinDde.c | 8 ++-- win/tclWinReg.c | 8 ++-- win/tclWinTest.c | 6 +-- 49 files changed, 461 insertions(+), 462 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 9832807..616457d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -453,24 +453,24 @@ typedef struct { const char *name; /* Name of the function. The full name is * "::tcl::mathfunc::". */ Tcl_ObjCmdProc *objCmdProc; /* Function that evaluates the function */ - ClientData clientData; /* Client data for the function */ + void *clientData; /* Client data for the function */ } BuiltinFuncDef; static const BuiltinFuncDef BuiltinFuncTable[] = { { "abs", ExprAbsFunc, NULL }, - { "acos", ExprUnaryFunc, (ClientData) acos }, - { "asin", ExprUnaryFunc, (ClientData) asin }, - { "atan", ExprUnaryFunc, (ClientData) atan }, - { "atan2", ExprBinaryFunc, (ClientData) atan2 }, + { "acos", ExprUnaryFunc, (void *) acos }, + { "asin", ExprUnaryFunc, (void *) asin }, + { "atan", ExprUnaryFunc, (void *) atan }, + { "atan2", ExprBinaryFunc, (void *) atan2 }, { "bool", ExprBoolFunc, NULL }, { "ceil", ExprCeilFunc, NULL }, - { "cos", ExprUnaryFunc, (ClientData) cos }, - { "cosh", ExprUnaryFunc, (ClientData) cosh }, + { "cos", ExprUnaryFunc, (void *) cos }, + { "cosh", ExprUnaryFunc, (void *) cosh }, { "double", ExprDoubleFunc, NULL }, { "entier", ExprIntFunc, NULL }, - { "exp", ExprUnaryFunc, (ClientData) exp }, + { "exp", ExprUnaryFunc, (void *) exp }, { "floor", ExprFloorFunc, NULL }, - { "fmod", ExprBinaryFunc, (ClientData) fmod }, - { "hypot", ExprBinaryFunc, (ClientData) hypot }, + { "fmod", ExprBinaryFunc, (void *) fmod }, + { "hypot", ExprBinaryFunc, (void *) hypot }, { "int", ExprIntFunc, NULL }, { "isfinite", ExprIsFiniteFunc, NULL }, { "isinf", ExprIsInfinityFunc, NULL }, @@ -479,19 +479,19 @@ static const BuiltinFuncDef BuiltinFuncTable[] = { { "isqrt", ExprIsqrtFunc, NULL }, { "issubnormal", ExprIsSubnormalFunc, NULL, }, { "isunordered", ExprIsUnorderedFunc, NULL, }, - { "log", ExprUnaryFunc, (ClientData) log }, - { "log10", ExprUnaryFunc, (ClientData) log10 }, + { "log", ExprUnaryFunc, (void *) log }, + { "log10", ExprUnaryFunc, (void *) log10 }, { "max", ExprMaxFunc, NULL }, { "min", ExprMinFunc, NULL }, - { "pow", ExprBinaryFunc, (ClientData) pow }, + { "pow", ExprBinaryFunc, (void *) pow }, { "rand", ExprRandFunc, NULL }, { "round", ExprRoundFunc, NULL }, - { "sin", ExprUnaryFunc, (ClientData) sin }, - { "sinh", ExprUnaryFunc, (ClientData) sinh }, + { "sin", ExprUnaryFunc, (void *) sin }, + { "sinh", ExprUnaryFunc, (void *) sinh }, { "sqrt", ExprSqrtFunc, NULL }, { "srand", ExprSrandFunc, NULL }, - { "tan", ExprUnaryFunc, (ClientData) tan }, - { "tanh", ExprUnaryFunc, (ClientData) tanh }, + { "tan", ExprUnaryFunc, (void *) tan }, + { "tanh", ExprUnaryFunc, (void *) tanh }, { "wide", ExprWideFunc, NULL }, { NULL, NULL, NULL } }; @@ -1330,7 +1330,7 @@ TclHideUnsafeCommands( Tcl_GetString(Tcl_GetObjResult(interp))); } Tcl_CreateObjCommand(interp, TclGetString(cmdName), - BadEnsembleSubcommand, (ClientData) unsafePtr, NULL); + BadEnsembleSubcommand, (void *)unsafePtr, NULL); TclDecrRefCount(cmdName); TclDecrRefCount(hideName); } else { @@ -2829,7 +2829,7 @@ TclInvokeStringCommand( { Command *cmdPtr = clientData; int i, result; - const char **argv = + const char **argv = (const char **) TclStackAlloc(interp, (objc + 1) * sizeof(char *)); for (i = 0; i < objc; i++) { @@ -2875,10 +2875,10 @@ TclInvokeObjectCommand( int argc, /* Number of arguments. */ register const char **argv) /* Argument strings. */ { - Command *cmdPtr = clientData; + Command *cmdPtr = ( Command *) clientData; Tcl_Obj *objPtr; int i, length, result; - Tcl_Obj **objv = + Tcl_Obj **objv = (Tcl_Obj **) TclStackAlloc(interp, (argc * sizeof(Tcl_Obj *))); for (i = 0; i < argc; i++) { @@ -3330,7 +3330,7 @@ Tcl_GetCommandName( return ""; } - return Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr); + return (const char *)Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr); } /* @@ -3380,7 +3380,7 @@ Tcl_GetCommandFullName( } } if (cmdPtr->hPtr != NULL) { - name = Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr); + name = (char *)Tcl_GetHashKey(cmdPtr->hPtr->tablePtr, cmdPtr->hPtr); Tcl_AppendToObj(objPtr, name, -1); } } @@ -5064,7 +5064,7 @@ TEOV_NotFound( Tcl_ListObjGetElements(NULL, currNsPtr->unknownHandlerPtr, &handlerObjc, &handlerObjv); newObjc = objc + handlerObjc; - newObjv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * newObjc); + newObjv = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * newObjc); /* * Copy command prefix from unknown handler and add on the real command's @@ -5431,12 +5431,12 @@ TclEvalEx( * state has been allocated while evaluating * the script, so that it can be freed * properly if an error occurs. */ - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); - CmdFrame *eeFramePtr = TclStackAlloc(interp, sizeof(CmdFrame)); - Tcl_Obj **stackObjArray = + Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); + CmdFrame *eeFramePtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); + Tcl_Obj **stackObjArray = (Tcl_Obj **) TclStackAlloc(interp, minObjs * sizeof(Tcl_Obj *)); - int *expandStack = TclStackAlloc(interp, minObjs * sizeof(int)); - int *linesStack = TclStackAlloc(interp, minObjs * sizeof(int)); + int *expandStack = (int *)TclStackAlloc(interp, minObjs * sizeof(int)); + int *linesStack = (int *)TclStackAlloc(interp, minObjs * sizeof(int)); /* TIP #280 Structures for tracking of command * locations. */ int *clNext = NULL; /* Pointer for the tracking of invisible @@ -6486,7 +6486,7 @@ TclNREvalObjEx( * should be pushed, as needed by alias and ensemble redirections. */ - eoFramePtr = TclStackAlloc(interp, sizeof(CmdFrame)); + eoFramePtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); eoFramePtr->nline = 0; eoFramePtr->line = NULL; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index cbb40c6..cd3cb79 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -1313,7 +1313,7 @@ TclInfoFrame( * Execution of bytecode. Talk to the BC engine to fill out the frame. */ - CmdFrame *fPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *fPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *fPtr = *framePtr; @@ -3362,7 +3362,7 @@ Tcl_LsearchObjCmd( sortInfo.indexv = &sortInfo.singleIndex; break; default: - sortInfo.indexv = + sortInfo.indexv = (int *) TclStackAlloc(interp, sizeof(int) * sortInfo.indexc); allocatedIndexVector = 1; /* Cannot use indexc field, as it * might be decreased by 1 later. */ @@ -4179,7 +4179,7 @@ Tcl_LsortObjCmd( sortInfo.indexv = &sortInfo.singleIndex; break; default: - sortInfo.indexv = + sortInfo.indexv = (int *) TclStackAlloc(interp, sizeof(int) * sortInfo.indexc); allocatedIndexVector = 1; /* Cannot use indexc field, as it * might be decreased by 1 later. */ diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index cdc1e28..58c5b5e 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2037,7 +2037,7 @@ StringMapCmd( * adapt this code... */ - mapElemv = TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc); + mapElemv = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * mapElemc); Tcl_DictObjFirst(interp, objv[objc-2], &search, mapElemv+0, mapElemv+1, &done); for (i=2 ; itokenPtr + parsePtr->numTokens; @@ -1838,7 +1838,7 @@ Tcl_ParseExpr( OpNode *opTree = NULL; /* Will point to the tree of operators. */ Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals. */ Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names. */ - Tcl_Parse *exprParsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *exprParsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions. */ if (numBytes < 0) { @@ -2156,7 +2156,7 @@ TclCompileExpr( OpNode *opTree = NULL; /* Will point to the tree of operators */ Tcl_Obj *litList = Tcl_NewObj(); /* List to hold the literals */ Tcl_Obj *funcList = Tcl_NewObj(); /* List to hold the functon names*/ - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); /* Holds the Tcl_Tokens of substitutions */ int code = ParseExpr(interp, script, numBytes, &opTree, litList, @@ -2226,7 +2226,7 @@ ExecConstantExprTree( * bytecode, so there's no need to tend to TIP 280 issues. */ - envPtr = TclStackAlloc(interp, sizeof(CompileEnv)); + envPtr = (CompileEnv *)TclStackAlloc(interp, sizeof(CompileEnv)); TclInitCompileEnv(interp, envPtr, NULL, 0, NULL, 0); CompileExprTree(interp, nodes, index, litObjvPtr, NULL, NULL, envPtr, 0 /* optimize */); @@ -2321,13 +2321,13 @@ CompileExprTree( break; } case QUESTION: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpPtr->jump); break; case COLON: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, @@ -2340,7 +2340,7 @@ CompileExprTree( break; case AND: case OR: - newJump = TclStackAlloc(interp, sizeof(JumpList)); + newJump = (JumpList *)TclStackAlloc(interp, sizeof(JumpList)); newJump->next = jumpPtr; jumpPtr = newJump; TclEmitForwardJump(envPtr, (nodePtr->lexeme == AND) @@ -2632,9 +2632,9 @@ TclSortingOpCmd( Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1)); } else { TclOpCmdClientData *occdPtr = clientData; - Tcl_Obj **litObjv = TclStackAlloc(interp, + Tcl_Obj **litObjv = (Tcl_Obj **)TclStackAlloc(interp, 2 * (objc-2) * sizeof(Tcl_Obj *)); - OpNode *nodes = TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode)); + OpNode *nodes = (OpNode *)TclStackAlloc(interp, 2 * (objc-2) * sizeof(OpNode)); unsigned char lexeme; int i, lastAnd = 1; Tcl_Obj *const *litObjPtrPtr = litObjv; @@ -2761,7 +2761,7 @@ TclVariadicOpCmd( return code; } else { Tcl_Obj *const *litObjv = objv + 1; - OpNode *nodes = TclStackAlloc(interp, (objc-1) * sizeof(OpNode)); + OpNode *nodes = (OpNode *)TclStackAlloc(interp, (objc-1) * sizeof(OpNode)); int i, lastOp = OT_LITERAL; nodes[0].lexeme = START; diff --git a/generic/tclCompile.c b/generic/tclCompile.c index c10e3ee..6faa273 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1148,7 +1148,7 @@ CleanupByteCode( (char *) codePtr); if (hePtr) { - ReleaseCmdWordData(Tcl_GetHashValue(hePtr)); + ReleaseCmdWordData((ExtCmdLoc *)Tcl_GetHashValue(hePtr)); Tcl_DeleteHashEntry(hePtr); } } @@ -1554,7 +1554,7 @@ TclInitCompileEnv( * ...) which may make change the type as well. */ - CmdFrame *ctxPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *ctxPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); int pc = 0; *ctxPtr = *invoker; @@ -2452,7 +2452,7 @@ TclCompileTokens( if (numCL >= maxNumCL) { maxNumCL *= 2; - clPosition = ckrealloc(clPosition, + clPosition = (int *)ckrealloc(clPosition, maxNumCL * sizeof(int)); } clPosition[numCL] = clPos; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index f3b0981..7862a0f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2499,7 +2499,7 @@ DictForNRCmd( Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "for", NULL); return TCL_ERROR; } - searchPtr = TclStackAlloc(interp, sizeof(Tcl_DictSearch)); + searchPtr = (Tcl_DictSearch *)TclStackAlloc(interp, sizeof(Tcl_DictSearch)); if (Tcl_DictObjFirst(interp, objv[2], searchPtr, &keyObj, &valueObj, &done) != TCL_OK) { TclStackFree(interp, searchPtr); @@ -2693,7 +2693,7 @@ DictMapNRCmd( Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "dict", "map", NULL); return TCL_ERROR; } - storagePtr = TclStackAlloc(interp, sizeof(DictMapStorage)); + storagePtr = (DictMapStorage *)TclStackAlloc(interp, sizeof(DictMapStorage)); if (Tcl_DictObjFirst(interp, objv[2], &storagePtr->search, &keyObj, &valueObj, &done) != TCL_OK) { TclStackFree(interp, storagePtr); diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 734f114..eedecf2 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -55,7 +55,7 @@ typedef struct { typedef struct ExitHandler { Tcl_ExitProc *proc; /* Function to call when process exits. */ - ClientData clientData; /* One word of information to pass to proc. */ + void *clientData; /* One word of information to pass to proc. */ struct ExitHandler *nextPtr;/* Next in list of all exit handlers for this * application, or NULL for end of list. */ } ExitHandler; @@ -103,19 +103,19 @@ static Tcl_ThreadDataKey dataKey; #if TCL_THREADS typedef struct { Tcl_ThreadCreateProc *proc; /* Main() function of the thread */ - ClientData clientData; /* The one argument to Main() */ + void *clientData; /* The one argument to Main() */ } ThreadClientData; -static Tcl_ThreadCreateType NewThreadProc(ClientData clientData); +static Tcl_ThreadCreateType NewThreadProc(void *clientData); #endif /* TCL_THREADS */ /* * Prototypes for functions referenced only in this file: */ -static void BgErrorDeleteProc(ClientData clientData, +static void BgErrorDeleteProc(void *clientData, Tcl_Interp *interp); -static void HandleBgErrors(ClientData clientData); -static char * VwaitVarProc(ClientData clientData, +static void HandleBgErrors(void *clientData); +static char * VwaitVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void InvokeExitHandlers(void); @@ -163,7 +163,7 @@ Tcl_BackgroundException( return; } - errPtr = ckalloc(sizeof(BgError)); + errPtr = (BgError*)ckalloc(sizeof(BgError)); errPtr->errorMsg = Tcl_GetObjResult(interp); Tcl_IncrRefCount(errPtr->errorMsg); errPtr->returnOpts = Tcl_GetReturnOptions(interp, code); @@ -171,7 +171,7 @@ Tcl_BackgroundException( errPtr->nextPtr = NULL; (void) TclGetBgErrorHandler(interp); - assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (assocPtr->firstBgPtr == NULL) { assocPtr->firstBgPtr = errPtr; Tcl_DoWhenIdle(HandleBgErrors, assocPtr); @@ -201,9 +201,9 @@ Tcl_BackgroundException( static void HandleBgErrors( - ClientData clientData) /* Pointer to ErrAssocData structure. */ + void *clientData) /* Pointer to ErrAssocData structure. */ { - ErrAssocData *assocPtr = clientData; + ErrAssocData *assocPtr = (ErrAssocData *)clientData; Tcl_Interp *interp = assocPtr->interp; BgError *errPtr; @@ -230,7 +230,7 @@ HandleBgErrors( errPtr = assocPtr->firstBgPtr; Tcl_ListObjGetElements(NULL, copyObj, &prefixObjc, &prefixObjv); - tempObjv = ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *)); + tempObjv = (Tcl_Obj**)ckalloc((prefixObjc+2) * sizeof(Tcl_Obj *)); memcpy(tempObjv, prefixObjv, prefixObjc*sizeof(Tcl_Obj *)); tempObjv[prefixObjc] = errPtr->errorMsg; tempObjv[prefixObjc+1] = errPtr->returnOpts; @@ -311,7 +311,7 @@ HandleBgErrors( int TclDefaultBgErrorHandlerObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -518,7 +518,7 @@ TclSetBgErrorHandler( Tcl_Interp *interp, Tcl_Obj *cmdPrefix) { - ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (cmdPrefix == NULL) { Tcl_Panic("TclSetBgErrorHandler: NULL cmdPrefix argument"); @@ -528,7 +528,7 @@ TclSetBgErrorHandler( * First access: initialize. */ - assocPtr = ckalloc(sizeof(ErrAssocData)); + assocPtr = (ErrAssocData*)ckalloc(sizeof(ErrAssocData)); assocPtr->interp = interp; assocPtr->cmdPrefix = NULL; assocPtr->firstBgPtr = NULL; @@ -563,14 +563,14 @@ Tcl_Obj * TclGetBgErrorHandler( Tcl_Interp *interp) { - ErrAssocData *assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + ErrAssocData *assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); if (assocPtr == NULL) { Tcl_Obj *bgerrorObj; TclNewLiteralStringObj(bgerrorObj, "::tcl::Bgerror"); TclSetBgErrorHandler(interp, bgerrorObj); - assocPtr = Tcl_GetAssocData(interp, "tclBgError", NULL); + assocPtr = (ErrAssocData *)Tcl_GetAssocData(interp, "tclBgError", NULL); } return assocPtr->cmdPrefix; } @@ -596,10 +596,10 @@ TclGetBgErrorHandler( static void BgErrorDeleteProc( - ClientData clientData, /* Pointer to ErrAssocData structure. */ + void *clientData, /* Pointer to ErrAssocData structure. */ Tcl_Interp *interp) /* Interpreter being deleted. */ { - ErrAssocData *assocPtr = clientData; + ErrAssocData *assocPtr = (ErrAssocData *)clientData; BgError *errPtr; while (assocPtr->firstBgPtr != NULL) { @@ -635,9 +635,9 @@ BgErrorDeleteProc( void Tcl_CreateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { - ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler)); + ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -668,9 +668,9 @@ Tcl_CreateExitHandler( void TclCreateLateExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { - ExitHandler *exitPtr = ckalloc(sizeof(ExitHandler)); + ExitHandler *exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -701,7 +701,7 @@ TclCreateLateExitHandler( void Tcl_DeleteExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; @@ -744,7 +744,7 @@ Tcl_DeleteExitHandler( void TclDeleteLateExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; @@ -787,12 +787,12 @@ TclDeleteLateExitHandler( void Tcl_CreateThreadExitHandler( Tcl_ExitProc *proc, /* Function to invoke. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler*)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; exitPtr->nextPtr = tsdPtr->firstExitPtr; @@ -820,7 +820,7 @@ Tcl_CreateThreadExitHandler( void Tcl_DeleteThreadExitHandler( Tcl_ExitProc *proc, /* Function that was previously registered. */ - ClientData clientData) /* Arbitrary value to pass to proc. */ + void *clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -1296,7 +1296,7 @@ FinalizeThread( * initialized already. */ - tsdPtr = TclThreadDataKeyGet(&dataKey); + tsdPtr = (ThreadSpecificData*)TclThreadDataKeyGet(&dataKey); if (tsdPtr != NULL) { tsdPtr->inExit = 1; @@ -1371,7 +1371,7 @@ TclInExit(void) int TclInThreadExit(void) { - ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); + ThreadSpecificData *tsdPtr = (ThreadSpecificData *)TclThreadDataKeyGet(&dataKey); if (tsdPtr == NULL) { return 0; @@ -1399,7 +1399,7 @@ TclInThreadExit(void) /* ARGSUSED */ int Tcl_VwaitObjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1463,13 +1463,13 @@ Tcl_VwaitObjCmd( /* ARGSUSED */ static char * VwaitVarProc( - ClientData clientData, /* Pointer to integer to set to 1. */ + void *clientData, /* Pointer to integer to set to 1. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; *donePtr = 1; Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -1497,7 +1497,7 @@ VwaitVarProc( /* ARGSUSED */ int Tcl_UpdateObjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1565,10 +1565,10 @@ Tcl_UpdateObjCmd( static Tcl_ThreadCreateType NewThreadProc( - ClientData clientData) + void *clientData) { - ThreadClientData *cdPtr = clientData; - ClientData threadClientData; + ThreadClientData *cdPtr = (ThreadClientData *)clientData; + void *threadClientData; Tcl_ThreadCreateProc *threadProc; threadProc = cdPtr->proc; @@ -1604,13 +1604,13 @@ int Tcl_CreateThread( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ - ClientData clientData, /* The one argument to Main() */ + void *clientData, /* The one argument to Main() */ int stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { #if TCL_THREADS - ThreadClientData *cdPtr = ckalloc(sizeof(ThreadClientData)); + ThreadClientData *cdPtr = (ThreadClientData *)ckalloc(sizeof(ThreadClientData)); int result; cdPtr->proc = proc; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 520c2ee..f47f8ea 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1695,7 +1695,7 @@ TclCompileObj( eclPtr = Tcl_GetHashValue(hePtr); redo = 0; - ctxCopyPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + ctxCopyPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *ctxCopyPtr = *invoker; if (invoker->type == TCL_LOCATION_BC) { diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 98ee37c..3ed16a4 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1449,7 +1449,7 @@ Tcl_GlobObjCmd( if (length <= 0) { goto skipTypes; } - globTypes = TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); + globTypes = (Tcl_GlobTypeData *)TclStackAlloc(interp, sizeof(Tcl_GlobTypeData)); globTypes->type = 0; globTypes->perm = 0; globTypes->macType = NULL; diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 271fc57..5bf5949 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -952,7 +952,7 @@ Tcl_ExecObjCmd( */ argc = objc - skip; - argv = TclStackAlloc(interp, (argc + 1) * sizeof(char *)); + argv = (const char **)TclStackAlloc(interp, (argc + 1) * sizeof(char *)); /* * Copy the string conversions of each (post option) object into the diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 919db92..c7114ae 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -126,7 +126,7 @@ Tcl_GetIndexFromObj( const Tcl_ObjIntRep *irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { - IndexRep *indexRep = irPtr->twoPtrValue.ptr1; + IndexRep *indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; /* * Here's hoping we don't get hit by unfortunate packing constraints @@ -200,7 +200,7 @@ GetIndexFromObjList( * Build a string table from the list. */ - tablePtr = ckalloc((objc + 1) * sizeof(char *)); + tablePtr = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (t = 0; t < objc; t++) { if (objv[t] == objPtr) { /* @@ -284,7 +284,7 @@ Tcl_GetIndexFromObjStruct( if (!(flags & INDEX_TEMP_TABLE)) { irPtr = TclFetchIntRep(objPtr, &indexType); if (irPtr) { - indexRep = irPtr->twoPtrValue.ptr1; + indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1; if (indexRep->tablePtr==tablePtr && indexRep->offset==offset) { *indexPtr = indexRep->index; return TCL_OK; @@ -308,7 +308,7 @@ Tcl_GetIndexFromObjStruct( * - Several abbreviations (never allowed, but overridden by exact match) */ - for (entryPtr = tablePtr, idx = 0; *entryPtr != NULL; + for (entryPtr = (const char* const*)tablePtr, idx = 0; *entryPtr != NULL; entryPtr = NEXT_ENTRY(entryPtr, offset), idx++) { for (p1 = key, p2 = *entryPtr; *p1 == *p2; p1++, p2++) { if (*p1 == '\0') { @@ -352,7 +352,7 @@ Tcl_GetIndexFromObjStruct( } else { Tcl_ObjIntRep ir; - indexRep = ckalloc(sizeof(IndexRep)); + indexRep = (IndexRep*)ckalloc(sizeof(IndexRep)); ir.twoPtrValue.ptr1 = indexRep; Tcl_StoreIntRep(objPtr, &indexType, &ir); } @@ -978,7 +978,7 @@ Tcl_WrongNumArgs( len = TclScanElement(elementStr, elemLen, &flags); if (MAY_QUOTE_WORD && len != elemLen) { - char *quotedElementStr = TclStackAlloc(interp, len + 1); + char *quotedElementStr = (char *)TclStackAlloc(interp, len + 1); len = TclConvertElement(elementStr, elemLen, quotedElementStr, flags); @@ -1029,7 +1029,7 @@ Tcl_WrongNumArgs( len = TclScanElement(elementStr, elemLen, &flags); if (MAY_QUOTE_WORD && len != elemLen) { - char *quotedElementStr = TclStackAlloc(interp, len + 1); + char *quotedElementStr = (char *)TclStackAlloc(interp, len + 1); len = TclConvertElement(elementStr, elemLen, quotedElementStr, flags); @@ -1319,7 +1319,7 @@ Tcl_ParseArgsObjv( } leftovers[nrem] = NULL; *objcPtr = nrem++; - *remObjv = ckrealloc(leftovers, nrem * sizeof(Tcl_Obj *)); + *remObjv = (Tcl_Obj **)ckrealloc(leftovers, nrem * sizeof(Tcl_Obj *)); return TCL_OK; /* diff --git a/generic/tclInt.h b/generic/tclInt.h index 27d7e6d..972996a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4350,7 +4350,7 @@ MODULE_SCOPE void TclpFreeAllocCache(void *); (objPtr) = TclThreadAllocObj(); \ } else { \ (objPtr) = cachePtr->firstObjPtr; \ - cachePtr->firstObjPtr = (objPtr)->internalRep.twoPtrValue.ptr1; \ + cachePtr->firstObjPtr = (Tcl_Obj *)(objPtr)->internalRep.twoPtrValue.ptr1; \ --cachePtr->numObjects; \ } \ } while (0) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 92c6159..e76e41e 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -1188,7 +1188,7 @@ Tcl_CreateAlias( int i; int result; - objv = TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc); + objv = (Tcl_Obj **)TclStackAlloc(slaveInterp, sizeof(Tcl_Obj *) * argc); for (i = 0; i < argc; i++) { objv[i] = Tcl_NewStringObj(argv[i], -1); Tcl_IncrRefCount(objv[i]); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index bbe357d..cde572f 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -1146,7 +1146,7 @@ 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; @@ -1218,7 +1218,7 @@ TclTeardownNamespace( #ifndef BREAK_NAMESPACE_COMPAT while (nsPtr->childTable.numEntries > 0) { int length = nsPtr->childTable.numEntries; - Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr, + Namespace **children = (Namespace **)TclStackAlloc((Tcl_Interp *) iPtr, sizeof(Namespace *) * length); i = 0; @@ -1239,7 +1239,7 @@ TclTeardownNamespace( if (nsPtr->childTablePtr != NULL) { while (nsPtr->childTablePtr->numEntries > 0) { int length = nsPtr->childTablePtr->numEntries; - Namespace **children = TclStackAlloc((Tcl_Interp *) iPtr, + Namespace **children = (Namespace **)TclStackAlloc((Tcl_Interp *) iPtr, sizeof(Namespace *) * length); i = 0; @@ -2764,7 +2764,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 *)); /* @@ -4063,7 +4063,7 @@ NamespacePathCmd( goto badNamespace; } if (nsObjc != 0) { - namespaceList = TclStackAlloc(interp, + namespaceList = (Tcl_Namespace **)TclStackAlloc(interp, sizeof(Tcl_Namespace *) * nsObjc); for (i=0 ; ifPtr->interp, sizeof(CallContext)); + contextPtr = (CallContext *)TclStackAlloc(oPtr->fPtr->interp, sizeof(CallContext)); contextPtr->oPtr = oPtr; /* @@ -1819,7 +1819,7 @@ TclOORenderCallChain( * method (or "object" if it is declared on the instance). */ - objv = TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); for (i = 0 ; i < callPtr->numChain ; i++) { struct MInvoke *miPtr = &callPtr->chain[i]; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 6a00018..9ffdc27 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -738,7 +738,7 @@ TclOOUnknownDefinition( * Got one match, and only one match! */ - Tcl_Obj **newObjv = + Tcl_Obj **newObjv = (Tcl_Obj **) TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1)); int result; @@ -2461,7 +2461,7 @@ ClassMixinSet( return TCL_ERROR; } - mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc); + mixins = (Class **)TclStackAlloc(interp, sizeof(Class *) * mixinc); for (i = 0; i < mixinc; i++) { mixins[i] = GetClassInOuterContext(interp, mixinv[i], @@ -2908,7 +2908,7 @@ ObjMixinSet( return TCL_ERROR; } - mixins = TclStackAlloc(interp, sizeof(Class *) * mixinc); + mixins = (Class **)TclStackAlloc(interp, sizeof(Class *) * mixinc); for (i = 0; i < mixinc; i++) { mixins[i] = GetClassInOuterContext(interp, mixinv[i], diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 32dd3c7..ed06a5c 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -692,7 +692,7 @@ InvokeProcedureMethod( * Allocate the special frame data. */ - fdPtr = TclStackAlloc(interp, sizeof(PMFrameData)); + fdPtr = (PMFrameData *)TclStackAlloc(interp, sizeof(PMFrameData)); /* * Create a call frame for this method. @@ -1620,7 +1620,7 @@ InitEnsembleRewrite( * array of rewritten arguments. */ { unsigned len = rewriteLength + objc - toRewrite; - Tcl_Obj **argObjs = TclStackAlloc(interp, sizeof(Tcl_Obj *) * len); + Tcl_Obj **argObjs = (Tcl_Obj **)TclStackAlloc(interp, sizeof(Tcl_Obj *) * len); memcpy(argObjs, rewriteObjs, rewriteLength * sizeof(Tcl_Obj *)); memcpy(argObjs + rewriteLength, objv + toRewrite, diff --git a/generic/tclParse.c b/generic/tclParse.c index 164905a..e4614a3 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1131,7 +1131,7 @@ ParseTokens( src++; numBytes--; - nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse)); + nestedPtr = (Tcl_Parse *)TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse)); while (1) { const char *curEnd; @@ -1519,7 +1519,7 @@ Tcl_ParseVar( { register Tcl_Obj *objPtr; int code; - Tcl_Parse *parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse)); + Tcl_Parse *parsePtr = (Tcl_Parse *)TclStackAlloc(interp, sizeof(Tcl_Parse)); if (Tcl_ParseVarName(interp, start, -1, parsePtr, 0) != TCL_OK) { TclStackFree(interp, parsePtr); @@ -2000,7 +2000,7 @@ TclSubstParse( Tcl_Token *tokenPtr; const char *lastTerm = parsePtr->term; - Tcl_Parse *nestedPtr = + Tcl_Parse *nestedPtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse)); while (TCL_OK == diff --git a/generic/tclProc.c b/generic/tclProc.c index afa00ee..8235902 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -232,7 +232,7 @@ Tcl_ProcObjCmd( */ if (iPtr->cmdFramePtr) { - CmdFrame *contextPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *contextPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *contextPtr = *iPtr->cmdFramePtr; if (contextPtr->type == TCL_LOCATION_BC) { @@ -1048,8 +1048,8 @@ ProcWrongNumArgs( */ numArgs = framePtr->procPtr->numArgs; - desiredObjs = TclStackAlloc(interp, - (int) sizeof(Tcl_Obj *) * (numArgs+1)); + desiredObjs = (Tcl_Obj **)TclStackAlloc(interp, + sizeof(Tcl_Obj *) * (numArgs+1)); if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1); @@ -1400,7 +1400,7 @@ InitArgsAndLocals( * parameters. */ - varPtr = TclStackAlloc(interp, (int)(localCt * sizeof(Var))); + varPtr = (Var *)TclStackAlloc(interp, localCt * sizeof(Var)); framePtr->compiledLocals = varPtr; framePtr->numCompiledLocals = localCt; @@ -2475,7 +2475,7 @@ SetLambdaFromAny( */ if (iPtr->cmdFramePtr) { - CmdFrame *contextPtr = TclStackAlloc(interp, sizeof(CmdFrame)); + CmdFrame *contextPtr = (CmdFrame *)TclStackAlloc(interp, sizeof(CmdFrame)); *contextPtr = *iPtr->cmdFramePtr; if (contextPtr->type == TCL_LOCATION_BC) { @@ -2663,7 +2663,7 @@ TclNRApplyObjCmd( return TCL_ERROR; } - extraPtr = TclStackAlloc(interp, sizeof(ApplyExtraData)); + extraPtr = (ApplyExtraData *)TclStackAlloc(interp, sizeof(ApplyExtraData)); memset(&extraPtr->cmd, 0, sizeof(Command)); procPtr->cmdPtr = &extraPtr->cmd; extraPtr->cmd.nsPtr = (Namespace *) nsPtr; diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index d3f7428..533a73d 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -122,7 +122,7 @@ const Tcl_ObjType tclRegexpType = { do { \ const Tcl_ObjIntRep *irPtr; \ irPtr = TclFetchIntRep((objPtr), &tclRegexpType); \ - (rePtr) = irPtr ? irPtr->twoPtrValue.ptr1 : NULL; \ + (rePtr) = irPtr ? (TclRegexp *)irPtr->twoPtrValue.ptr1 : NULL; \ } while (0) @@ -916,7 +916,7 @@ CompileRegexp( * This is a new expression, so compile it and add it to the cache. */ - regexpPtr = ckalloc(sizeof(TclRegexp)); + regexpPtr = (TclRegexp*)ckalloc(sizeof(TclRegexp)); regexpPtr->objPtr = NULL; regexpPtr->string = NULL; regexpPtr->details.rm_extend.rm_so = -1; @@ -971,7 +971,7 @@ CompileRegexp( */ regexpPtr->matches = - ckalloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1)); + (regmatch_t*)ckalloc(sizeof(regmatch_t) * (regexpPtr->re.re_nsub + 1)); /* * Initialize the refcount to one initially, since it is in the cache. @@ -997,7 +997,7 @@ CompileRegexp( tsdPtr->patLengths[i+1] = tsdPtr->patLengths[i]; tsdPtr->regexps[i+1] = tsdPtr->regexps[i]; } - tsdPtr->patterns[0] = ckalloc(length + 1); + tsdPtr->patterns[0] = (char *)ckalloc(length + 1); memcpy(tsdPtr->patterns[0], string, length + 1); tsdPtr->patLengths[0] = length; tsdPtr->regexps[0] = regexpPtr; diff --git a/generic/tclScan.c b/generic/tclScan.c index 74ec2da..2986860 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -260,7 +260,7 @@ ValidateFormat( char *end; Tcl_UniChar ch = 0; int objIndex, xpgSize, nspace = numVars; - int *nassign = TclStackAlloc(interp, nspace * sizeof(int)); + int *nassign = (int *)TclStackAlloc(interp, nspace * sizeof(int)); char buf[TCL_UTF_MAX + 1] = ""; Tcl_Obj *errorMsg; /* Place to build an error messages. Note that * these are messy operations because we do diff --git a/generic/tclTest.c b/generic/tclTest.c index 4eb8519..166334a 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -41,7 +41,6 @@ /* * Declare external functions used in Windows tests. */ - DLLEXPORT int Tcltest_Init(Tcl_Interp *interp); DLLEXPORT int Tcltest_SafeInit(Tcl_Interp *interp); @@ -228,7 +227,7 @@ static int TestasyncCmd(void *dummy, static int TestbytestringObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestpurebytesobjObjCmd(ClientData clientData, +static int TestpurebytesobjObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int TeststringbytesObjCmd(void *clientData, @@ -851,8 +850,8 @@ TestasyncCmd( if (argc != 3) { goto wrongNumArgs; } - asyncPtr = ckalloc(sizeof(TestAsyncHandler)); - asyncPtr->command = ckalloc(strlen(argv[2]) + 1); + asyncPtr = (TestAsyncHandler *)ckalloc(sizeof(TestAsyncHandler)); + asyncPtr->command = (char *)ckalloc(strlen(argv[2]) + 1); strcpy(asyncPtr->command, argv[2]); Tcl_MutexLock(&asyncTestMutex); asyncPtr->id = nextId; @@ -1625,9 +1624,9 @@ TestdelCmd( return TCL_ERROR; } - dPtr = ckalloc(sizeof(DelCmd)); + dPtr = (DelCmd*)ckalloc(sizeof(DelCmd)); dPtr->interp = interp; - dPtr->deleteCmd = ckalloc(strlen(argv[3]) + 1); + dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1); strcpy(dPtr->deleteCmd, argv[3]); Tcl_CreateCommand(slave, argv[2], DelCmdProc, dPtr, @@ -1654,7 +1653,7 @@ static void DelDeleteProc( void *clientData) /* String command to evaluate. */ { - DelCmd *dPtr = clientData; + DelCmd *dPtr = (DelCmd *) clientData; Tcl_EvalEx(dPtr->interp, dPtr->deleteCmd, -1, 0); Tcl_ResetResult(dPtr->interp); @@ -1859,7 +1858,7 @@ TestdstringCmd( } else if (strcmp(argv[2], "staticlarge") == 0) { Tcl_AppendResult(interp, "first0 first1 first2 first3 first4 first5 first6 first7 first8 first9\nsecond0 second1 second2 second3 second4 second5 second6 second7 second8 second9\nthird0 third1 third2 third3 third4 third5 third6 third7 third8 third9\nfourth0 fourth1 fourth2 fourth3 fourth4 fourth5 fourth6 fourth7 fourth8 fourth9\nfifth0 fifth1 fifth2 fifth3 fifth4 fifth5 fifth6 fifth7 fifth8 fifth9\nsixth0 sixth1 sixth2 sixth3 sixth4 sixth5 sixth6 sixth7 sixth8 sixth9\nseventh0 seventh1 seventh2 seventh3 seventh4 seventh5 seventh6 seventh7 seventh8 seventh9\n", NULL); } else if (strcmp(argv[2], "free") == 0) { - char *s = ckalloc(100); + char *s = (char *)ckalloc(100); strcpy(s, "This is a malloc-ed string"); Tcl_SetResult(interp, s, TCL_DYNAMIC); } else if (strcmp(argv[2], "special") == 0) { @@ -1911,9 +1910,9 @@ TestdstringCmd( * Tcl_DStringGetResult handles freeProc's other than free. */ -static void SpecialFree(blockPtr) - char *blockPtr; /* Block to free. */ -{ +static void SpecialFree( + char *blockPtr /* Block to free. */ +) { ckfree(blockPtr - 16); } @@ -1965,15 +1964,15 @@ TestencodingObjCmd( if (objc != 5) { return TCL_ERROR; } - encodingPtr = ckalloc(sizeof(TclEncoding)); + encodingPtr = (TclEncoding*)ckalloc(sizeof(TclEncoding)); encodingPtr->interp = interp; string = Tcl_GetStringFromObj(objv[3], &length); - encodingPtr->toUtfCmd = ckalloc(length + 1); + encodingPtr->toUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->toUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[4], &length); - encodingPtr->fromUtfCmd = ckalloc(length + 1); + encodingPtr->fromUtfCmd = (char *)ckalloc(length + 1); memcpy(encodingPtr->fromUtfCmd, string, length + 1); string = Tcl_GetStringFromObj(objv[2], &length); @@ -2071,7 +2070,7 @@ static void EncodingFreeProc( void *clientData) /* ClientData associated with type. */ { - TclEncoding *encodingPtr = clientData; + TclEncoding *encodingPtr = (TclEncoding *)clientData; ckfree(encodingPtr->toUtfCmd); ckfree(encodingPtr->fromUtfCmd); @@ -2230,7 +2229,7 @@ TesteventObjCmd( "position specifier", TCL_EXACT, &posIndex) != TCL_OK) { return TCL_ERROR; } - ev = ckalloc(sizeof(TestEvent)); + ev = (TestEvent *)ckalloc(sizeof(TestEvent)); ev->header.proc = TesteventProc; ev->header.nextPtr = NULL; ev->interp = interp; @@ -3088,7 +3087,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } } @@ -3195,7 +3194,7 @@ TestlinkCmd( if (strcmp(argv[5], "-") == 0) { stringVar = NULL; } else { - stringVar = ckalloc(strlen(argv[5]) + 1); + stringVar = (char *)ckalloc(strlen(argv[5]) + 1); strcpy(stringVar, argv[5]); } Tcl_UpdateLinkedVar(interp, "string"); @@ -3304,7 +3303,7 @@ TestlinkCmd( static int TestlinkarrayCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -4253,7 +4252,7 @@ TestsetassocdataCmd( return TCL_ERROR; } - buf = ckalloc(strlen(argv[2]) + 1); + buf = (char *)ckalloc(strlen(argv[2]) + 1); strcpy(buf, argv[2]); /* @@ -4833,7 +4832,7 @@ GetTimesObjCmd( fprintf(stderr, "alloc & free 100000 6 word items\n"); Tcl_GetTime(&start); for (i = 0; i < 100000; i++) { - objPtr = ckalloc(sizeof(Tcl_Obj)); + objPtr = (Tcl_Obj *)ckalloc(sizeof(Tcl_Obj)); ckfree(objPtr); } Tcl_GetTime(&stop); @@ -4842,10 +4841,10 @@ GetTimesObjCmd( /* alloc 5000 times */ fprintf(stderr, "alloc 5000 6 word items\n"); - objv = ckalloc(5000 * sizeof(Tcl_Obj *)); + objv = (Tcl_Obj **)ckalloc(5000 * sizeof(Tcl_Obj *)); Tcl_GetTime(&start); for (i = 0; i < 5000; i++) { - objv[i] = ckalloc(sizeof(Tcl_Obj)); + objv[i] = (Tcl_Obj *)ckalloc(sizeof(Tcl_Obj)); } Tcl_GetTime(&stop); timePer = (stop.sec - start.sec)*1000000 + (stop.usec - start.usec); @@ -5087,7 +5086,7 @@ TeststringbytesObjCmd( static int TestpurebytesobjObjCmd( - ClientData unused, /* Not used. */ + void *unused, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ @@ -5107,7 +5106,7 @@ TestpurebytesobjObjCmd( if (objc == 2) { const char *s = Tcl_GetString(objv[1]); objPtr->length = objv[1]->length; - objPtr->bytes = ckalloc(objPtr->length + 1); + objPtr->bytes = (char *)ckalloc(objPtr->length + 1); memcpy(objPtr->bytes, s, objPtr->length); objPtr->bytes[objPtr->length] = 0; } @@ -5300,7 +5299,7 @@ TestsaveresultCmd( Tcl_AppendResult(interp, "append result", NULL); break; case RESULT_FREE: { - char *buf = ckalloc(200); + char *buf = (char *)ckalloc(200); strcpy(buf, "free result"); Tcl_SetResult(interp, buf, TCL_DYNAMIC); @@ -5622,7 +5621,7 @@ TestChannelCmd( /* Remember the channel in the pool of detached channels */ - det = ckalloc(sizeof(TestChannel)); + det = (TestChannel *)ckalloc(sizeof(TestChannel)); det->chan = chan; det->nextPtr = firstDetached; firstDetached = det; @@ -5814,7 +5813,7 @@ TestChannelCmd( for (hPtr = Tcl_FirstHashEntry(hTblPtr, &hSearch); hPtr != NULL; hPtr = Tcl_NextHashEntry(&hSearch)) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } return TCL_OK; } @@ -5855,7 +5854,7 @@ TestChannelCmd( chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; if (statePtr->flags & TCL_READABLE) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } } return TCL_OK; @@ -5912,7 +5911,7 @@ TestChannelCmd( chanPtr = (Channel *) Tcl_GetHashValue(hPtr); statePtr = chanPtr->state; if (statePtr->flags & TCL_WRITABLE) { - Tcl_AppendElement(interp, Tcl_GetHashKey(hTblPtr, hPtr)); + Tcl_AppendElement(interp, (char *)Tcl_GetHashKey(hTblPtr, hPtr)); } } return TCL_OK; @@ -6020,7 +6019,7 @@ TestChannelEventCmd( return TCL_ERROR; } - esPtr = ckalloc(sizeof(EventScriptRecord)); + esPtr = (EventScriptRecord *)ckalloc(sizeof(EventScriptRecord)); esPtr->nextPtr = statePtr->scriptRecordPtr; statePtr->scriptRecordPtr = esPtr; @@ -6446,7 +6445,7 @@ TestReportFreeInternalRep( } } -static ClientData +static void * TestReportDupInternalRep( void *clientData) { @@ -7766,7 +7765,7 @@ InterpCompiledVarResolver( Tcl_ResolvedVarInfo **rPtr) { if (*name == 'T') { - MyResolvedVarInfo *resVarInfo = ckalloc(sizeof(MyResolvedVarInfo)); + MyResolvedVarInfo *resVarInfo = (MyResolvedVarInfo *)ckalloc(sizeof(MyResolvedVarInfo)); resVarInfo->vInfo.fetchProc = MyCompiledVarFetch; resVarInfo->vInfo.deleteProc = MyCompiledVarFree; diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index c9e4a6f..b427c9e 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -30,28 +30,28 @@ static int CheckIfVarUnset(Tcl_Interp *interp, Tcl_Obj **varPtr, int varIndex); static int GetVariableIndex(Tcl_Interp *interp, const char *string, int *indexPtr); static void SetVarToObj(Tcl_Obj **varPtr, int varIndex, Tcl_Obj *objPtr); -static int TestbignumobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestbignumobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestbooleanobjCmd(ClientData dummy, +static int TestbooleanobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestdoubleobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestdoubleobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestindexobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestindexobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestintobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestintobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestlistobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestlistobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TestobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TeststringobjCmd(ClientData dummy, Tcl_Interp *interp, +static int TeststringobjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #define VARPTR_KEY "TCLOBJTEST_VARPTR" #define NUMBER_OF_OBJECT_VARS 20 -static void VarPtrDeleteProc(ClientData clientData, Tcl_Interp *interp) +static void VarPtrDeleteProc(void *clientData, Tcl_Interp *interp) { register int i; Tcl_Obj **varPtr = (Tcl_Obj **) clientData; @@ -146,7 +146,7 @@ TclObjTest_Init( static int TestbignumobjCmd( - ClientData clientData, /* unused */ + void *clientData, /* unused */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Argument count */ Tcl_Obj *const objv[]) /* Argument vector */ @@ -345,7 +345,7 @@ TestbignumobjCmd( static int TestbooleanobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -445,7 +445,7 @@ TestbooleanobjCmd( static int TestdoubleobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -563,7 +563,7 @@ TestdoubleobjCmd( static int TestindexobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -594,7 +594,7 @@ TestindexobjCmd( } Tcl_GetIndexFromObj(NULL, objv[1], tablePtr, "token", 0, &index); - indexRep = objv[1]->internalRep.twoPtrValue.ptr1; + indexRep = (struct IndexRep *)objv[1]->internalRep.twoPtrValue.ptr1; indexRep->index = index2; result = Tcl_GetIndexFromObj(NULL, objv[1], tablePtr, "token", 0, &index); @@ -616,7 +616,7 @@ TestindexobjCmd( return TCL_ERROR; } - argv = ckalloc((objc-3) * sizeof(char *)); + argv = (const char **)ckalloc((objc-3) * sizeof(char *)); for (i = 4; i < objc; i++) { argv[i-4] = Tcl_GetString(objv[i]); } @@ -652,7 +652,7 @@ TestindexobjCmd( static int TestintobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -856,7 +856,7 @@ TestintobjCmd( static int TestlistobjCmd( - ClientData clientData, /* Not used */ + void *clientData, /* Not used */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -953,7 +953,7 @@ TestlistobjCmd( static int TestobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1165,7 +1165,7 @@ TestobjCmd( static int TeststringobjCmd( - ClientData clientData, /* Not used. */ + void *clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1283,7 +1283,7 @@ TeststringobjCmd( if (varPtr[varIndex] != NULL) { Tcl_ConvertToType(NULL, varPtr[varIndex], Tcl_GetObjType("string")); - strPtr = varPtr[varIndex]->internalRep.twoPtrValue.ptr1; + strPtr = (String *)varPtr[varIndex]->internalRep.twoPtrValue.ptr1; length = (int) strPtr->allocated; } else { length = -1; @@ -1337,7 +1337,7 @@ TeststringobjCmd( if (varPtr[varIndex] != NULL) { Tcl_ConvertToType(NULL, varPtr[varIndex], Tcl_GetObjType("string")); - strPtr = varPtr[varIndex]->internalRep.twoPtrValue.ptr1; + strPtr = (String *)varPtr[varIndex]->internalRep.twoPtrValue.ptr1; length = strPtr->maxChars; } else { length = -1; diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 913b253..59379de 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -45,13 +45,13 @@ typedef struct CmdTable { * Declarations for functions defined in this file. */ -static int ProcBodyTestProcObjCmd(ClientData dummy, +static int ProcBodyTestProcObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ProcBodyTestCheckObjCmd(ClientData dummy, +static int ProcBodyTestCheckObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ProcBodyTestInitInternal(Tcl_Interp *interp, int isSafe); static int RegisterCommand(Tcl_Interp* interp, - const char *namespace, const CmdTable *cmdTablePtr); + const char *namesp, const CmdTable *cmdTablePtr); /* * List of commands to create when the package is loaded; must go after the @@ -139,7 +139,7 @@ static int RegisterCommand( Tcl_Interp* interp, /* the Tcl interpreter for which the operation * is performed */ - const char *namespace, /* the namespace in which the command is + const char *namesp, /* the namespace in which the command is * registered */ const CmdTable *cmdTablePtr)/* the command to register */ { @@ -147,13 +147,13 @@ RegisterCommand( if (cmdTablePtr->exportIt) { sprintf(buf, "namespace eval %s { namespace export %s }", - namespace, cmdTablePtr->cmdName); + namesp, cmdTablePtr->cmdName); if (Tcl_EvalEx(interp, buf, -1, 0) != TCL_OK) { return TCL_ERROR; } } - sprintf(buf, "%s::%s", namespace, cmdTablePtr->cmdName); + sprintf(buf, "%s::%s", namesp, cmdTablePtr->cmdName); Tcl_CreateObjCommand(interp, buf, cmdTablePtr->proc, 0, 0); return TCL_OK; } @@ -228,7 +228,7 @@ ProcBodyTestInitInternal( static int ProcBodyTestProcObjCmd( - ClientData dummy, /* context; not used */ + void *dummy, /* context; not used */ Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ @@ -327,7 +327,7 @@ ProcBodyTestProcObjCmd( static int ProcBodyTestCheckObjCmd( - ClientData dummy, /* context; not used */ + void *dummy, /* context; not used */ Tcl_Interp *interp, /* the current interpreter */ int objc, /* argument count */ Tcl_Obj *const objv[]) /* arguments */ diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 3f1abc2..5849672 100644 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -162,7 +162,7 @@ static __thread Cache *tcachePtr; #else # define GETCACHE(cachePtr) \ do { \ - (cachePtr) = TclpGetAllocCache(); \ + (cachePtr) = (Cache*)TclpGetAllocCache(); \ if ((cachePtr) == NULL) { \ (cachePtr) = GetCache(); \ } \ @@ -209,9 +209,9 @@ GetCache(void) * Get this thread's cache, allocating if necessary. */ - cachePtr = TclpGetAllocCache(); + cachePtr = (Cache*)TclpGetAllocCache(); if (cachePtr == NULL) { - cachePtr = TclpSysAlloc(sizeof(Cache), 0); + cachePtr = (Cache*)TclpSysAlloc(sizeof(Cache), 0); if (cachePtr == NULL) { Tcl_Panic("alloc: could not allocate new cache"); } @@ -246,7 +246,7 @@ void TclFreeAllocCache( void *arg) { - Cache *cachePtr = arg; + Cache *cachePtr = (Cache*)arg; Cache **nextPtrPtr; register unsigned int bucket; @@ -337,7 +337,7 @@ TclpAlloc( #endif if (size > MAXALLOC) { bucket = NBUCKETS; - blockPtr = TclpSysAlloc(size, 0); + blockPtr = (Block *)TclpSysAlloc(size, 0); if (blockPtr != NULL) { cachePtr->totalAssigned += reqSize; } @@ -491,7 +491,7 @@ TclpRealloc( } else if (size > MAXALLOC) { cachePtr->totalAssigned -= blockPtr->blockReqSize; cachePtr->totalAssigned += reqSize; - blockPtr = TclpSysRealloc(blockPtr, size); + blockPtr = (Block*)TclpSysRealloc(blockPtr, size); if (blockPtr == NULL) { return NULL; } @@ -510,7 +510,7 @@ TclpRealloc( memcpy(newPtr, ptr, reqSize); TclpFree(ptr); } - return newPtr; + return (char *)newPtr; } /* @@ -563,7 +563,7 @@ TclThreadAllocObj(void) Tcl_Obj *newObjsPtr; cachePtr->numObjects = numMove = NOBJALLOC; - newObjsPtr = TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0); + newObjsPtr = (Tcl_Obj *)TclpSysAlloc(sizeof(Tcl_Obj) * numMove, 0); if (newObjsPtr == NULL) { Tcl_Panic("alloc: could not allocate %d new objects", numMove); } @@ -582,7 +582,7 @@ TclThreadAllocObj(void) */ objPtr = cachePtr->firstObjPtr; - cachePtr->firstObjPtr = objPtr->internalRep.twoPtrValue.ptr1; + cachePtr->firstObjPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; cachePtr->numObjects--; return objPtr; } @@ -721,9 +721,9 @@ MoveObjs( */ while (--numMove) { - objPtr = objPtr->internalRep.twoPtrValue.ptr1; + objPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; } - fromPtr->firstObjPtr = objPtr->internalRep.twoPtrValue.ptr1; + fromPtr->firstObjPtr = (Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1; /* * Move all objects as a block - they are already linked to each other, we @@ -766,7 +766,7 @@ PutObjs( } else { do { lastPtr = firstPtr; - firstPtr = firstPtr->internalRep.twoPtrValue.ptr1; + firstPtr = (Tcl_Obj *)firstPtr->internalRep.twoPtrValue.ptr1; } while (--keep > 0); lastPtr->internalRep.twoPtrValue.ptr1 = NULL; } @@ -1032,7 +1032,7 @@ GetBlocks( if (blockPtr == NULL) { size = MAXALLOC; - blockPtr = TclpSysAlloc(size, 0); + blockPtr = (Block*)TclpSysAlloc(size, 0); if (blockPtr == NULL) { return 0; } @@ -1147,7 +1147,7 @@ TclFinalizeThreadAlloc(void) void TclFinalizeThreadAllocThread(void) { - Cache *cachePtr = TclpGetAllocCache(); + Cache *cachePtr = (Cache *)TclpGetAllocCache(); if (cachePtr != NULL) { TclpFreeAllocCache(cachePtr); } diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index e9b1107..48aa445 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -119,7 +119,7 @@ static char *errorProcString; TCL_DECLARE_MUTEX(threadMutex) -static int ThreadObjCmd(ClientData clientData, +static int ThreadObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ThreadCreate(Tcl_Interp *interp, const char *script, @@ -130,15 +130,15 @@ static int ThreadSend(Tcl_Interp *interp, Tcl_ThreadId id, static int ThreadCancel(Tcl_Interp *interp, Tcl_ThreadId id, const char *result, int flags); -static Tcl_ThreadCreateType NewTestThread(ClientData clientData); +static Tcl_ThreadCreateType NewTestThread(void *clientData); static void ListRemove(ThreadSpecificData *tsdPtr); static void ListUpdateInner(ThreadSpecificData *tsdPtr); static int ThreadEventProc(Tcl_Event *evPtr, int mask); static void ThreadErrorProc(Tcl_Interp *interp); -static void ThreadFreeProc(ClientData clientData); +static void ThreadFreeProc(void *clientData); static int ThreadDeleteEvent(Tcl_Event *eventPtr, - ClientData clientData); -static void ThreadExitProc(ClientData clientData); + void *clientData); +static void ThreadExitProc(void *clientData); extern int Tcltest_Init(Tcl_Interp *interp); /* @@ -206,7 +206,7 @@ TclThread_Init( /* ARGSUSED */ static int ThreadObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -435,7 +435,7 @@ ThreadObjCmd( ckfree(errorProcString); } proc = Tcl_GetString(objv[2]); - errorProcString = ckalloc(strlen(proc) + 1); + errorProcString = (char *)ckalloc(strlen(proc) + 1); strcpy(errorProcString, proc); Tcl_MutexUnlock(&threadMutex); return TCL_OK; @@ -556,9 +556,9 @@ ThreadCreate( Tcl_ThreadCreateType NewTestThread( - ClientData clientData) + void *clientData) { - ThreadCtrl *ctrlPtr = clientData; + ThreadCtrl *ctrlPtr = (ThreadCtrl *)clientData; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int result; char *threadEvalScript; @@ -595,7 +595,7 @@ NewTestThread( * eval'ing, for the case that we exit during evaluation */ - threadEvalScript = ckalloc(strlen(ctrlPtr->script) + 1); + threadEvalScript = (char *)ckalloc(strlen(ctrlPtr->script) + 1); strcpy(threadEvalScript, ctrlPtr->script); Tcl_CreateThreadExitHandler(ThreadExitProc, threadEvalScript); @@ -840,13 +840,13 @@ ThreadSend( * Create the event for its event queue. */ - threadEventPtr = ckalloc(sizeof(ThreadEvent)); - threadEventPtr->script = ckalloc(strlen(script) + 1); + threadEventPtr = (ThreadEvent*)ckalloc(sizeof(ThreadEvent)); + threadEventPtr->script = (char *)ckalloc(strlen(script) + 1); strcpy(threadEventPtr->script, script); if (!wait) { resultPtr = threadEventPtr->resultPtr = NULL; } else { - resultPtr = ckalloc(sizeof(ThreadEventResult)); + resultPtr = (ThreadEventResult *)ckalloc(sizeof(ThreadEventResult)); threadEventPtr->resultPtr = resultPtr; /* @@ -1042,14 +1042,14 @@ ThreadEventProc( if (resultPtr) { Tcl_MutexLock(&threadMutex); resultPtr->code = code; - resultPtr->result = ckalloc(strlen(result) + 1); + resultPtr->result = (char *)ckalloc(strlen(result) + 1); strcpy(resultPtr->result, result); if (errorCode != NULL) { - resultPtr->errorCode = ckalloc(strlen(errorCode) + 1); + resultPtr->errorCode = (char *)ckalloc(strlen(errorCode) + 1); strcpy(resultPtr->errorCode, errorCode); } if (errorInfo != NULL) { - resultPtr->errorInfo = ckalloc(strlen(errorInfo) + 1); + resultPtr->errorInfo = (char *)ckalloc(strlen(errorInfo) + 1); strcpy(resultPtr->errorInfo, errorInfo); } Tcl_ConditionNotify(&resultPtr->done); @@ -1073,7 +1073,7 @@ ThreadEventProc( * None. * * Side effects: - * Clears up mem specified in ClientData + * Clears up mem specified in clientData * *------------------------------------------------------------------------ */ @@ -1081,7 +1081,7 @@ ThreadEventProc( /* ARGSUSED */ static void ThreadFreeProc( - ClientData clientData) + void *clientData) { if (clientData) { ckfree(clientData); @@ -1109,7 +1109,7 @@ ThreadFreeProc( static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ - ClientData clientData) /* dummy */ + void *clientData) /* dummy */ { if (eventPtr->proc == ThreadEventProc) { ckfree(((ThreadEvent *) eventPtr)->script); @@ -1144,9 +1144,9 @@ ThreadDeleteEvent( /* ARGSUSED */ static void ThreadExitProc( - ClientData clientData) + void *clientData) { - char *threadEvalScript = clientData; + char *threadEvalScript = (char *)clientData; ThreadEventResult *resultPtr, *nextPtr; Tcl_ThreadId self = Tcl_GetCurrentThread(); ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -1199,7 +1199,7 @@ ThreadExitProc( const char *msg = "target thread died"; - resultPtr->result = ckalloc(strlen(msg) + 1); + resultPtr->result = (char *)ckalloc(strlen(msg) + 1); strcpy(resultPtr->result, msg); resultPtr->code = TCL_ERROR; Tcl_ConditionNotify(&resultPtr->done); diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 1a6d459..36983f2 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -1689,7 +1689,7 @@ CallTraceFunction( * Copy the command characters into a new string. */ - commandCopy = TclStackAlloc(interp, numChars + 1); + commandCopy = (char *)TclStackAlloc(interp, numChars + 1); memcpy(commandCopy, command, numChars); commandCopy[numChars] = '\0'; diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 4961ef5..c540c4e 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -238,7 +238,7 @@ PlatformEventsControl( newEvent.events |= EPOLLOUT; } if (isNew) { - newPedPtr = ckalloc(sizeof(*newPedPtr)); + newPedPtr = (struct PlatformEventData *)ckalloc(sizeof(struct PlatformEventData)); newPedPtr->filePtr = filePtr; newPedPtr->tsdPtr = tsdPtr; filePtr->pedPtr = newPedPtr; @@ -370,7 +370,7 @@ PlatformEventsInit(void) if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } - filePtr = ckalloc(sizeof(*filePtr)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); #ifdef HAVE_EVENTFD tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); if (tsdPtr->triggerEventFd <= 0) { @@ -391,7 +391,7 @@ PlatformEventsInit(void) PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1); if (!tsdPtr->readyEvents) { tsdPtr->maxReadyEvents = 512; - tsdPtr->readyEvents = ckalloc( + tsdPtr->readyEvents = (struct epoll_event *)ckalloc( tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0])); } LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr); @@ -550,7 +550,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; @@ -733,7 +733,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; @@ -810,7 +810,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 99d794e..e2ff4f4 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -222,7 +222,7 @@ PlatformEventsControl( struct stat fdStat; if (isNew) { - newPedPtr = ckalloc(sizeof(*newPedPtr)); + newPedPtr = (struct PlatformEventData *)ckalloc(sizeof(struct PlatformEventData)); newPedPtr->filePtr = filePtr; newPedPtr->tsdPtr = tsdPtr; filePtr->pedPtr = newPedPtr; @@ -409,13 +409,13 @@ PlatformEventsInit(void) } else if (fcntl(tsdPtr->eventsFd, F_SETFD, FD_CLOEXEC) == -1) { Tcl_Panic("fcntl: %s", strerror(errno)); } - filePtr = ckalloc(sizeof(*filePtr)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = tsdPtr->triggerPipe[0]; filePtr->mask = TCL_READABLE; PlatformEventsControl(filePtr, tsdPtr, EV_ADD, 1); if (!tsdPtr->readyEvents) { tsdPtr->maxReadyEvents = 512; - tsdPtr->readyEvents = ckalloc( + tsdPtr->readyEvents = (struct kevent *)ckalloc( tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0])); } LIST_INIT(&tsdPtr->firstReadyFileHandlerPtr); @@ -580,7 +580,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; @@ -768,7 +768,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; @@ -828,7 +828,7 @@ Tcl_WaitForEvent( */ if (filePtr->readyMask == 0) { - FileHandlerEvent *fileEvPtr = + FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index aec071c..6339044 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -131,7 +131,7 @@ TclpDlopen( } return TCL_ERROR; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = handle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index e998bf9..9ae8d85 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -258,7 +258,7 @@ TclpDlopen( module = NSLinkModule(dyldObjFileImage, nativePath, nsflags); NSDestroyObjectFileImage(dyldObjFileImage); if (module) { - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = NULL; } else { @@ -278,13 +278,13 @@ TclpDlopen( || dyldLibHeader || modulePtr #endif /* TCL_DYLD_USE_NSMODULE */ ) { - dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle)); + dyldLoadHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldLoadHandle)); dyldLoadHandle->dlHandle = dlHandle; #if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) dyldLoadHandle->dyldLibHeader = dyldLibHeader; dyldLoadHandle->modulePtr = modulePtr; #endif /* TCL_DYLD_USE_NSMODULE || TCL_LOAD_FROM_MEMORY */ - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(*newHandle)); newHandle->clientData = dyldLoadHandle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; @@ -381,7 +381,7 @@ FindSymbol( modulePtr = modulePtr->nextPtr; } if (modulePtr == NULL) { - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = dyldLoadHandle->modulePtr; dyldLoadHandle->modulePtr = modulePtr; @@ -693,14 +693,14 @@ TclpLoadMemory( * Stash the module reference within the load handle we create and return. */ - modulePtr = ckalloc(sizeof(Tcl_DyldModuleHandle)); + modulePtr = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldModuleHandle)); modulePtr->module = module; modulePtr->nextPtr = NULL; - dyldLoadHandle = ckalloc(sizeof(Tcl_DyldLoadHandle)); + dyldLoadHandle = (Tcl_DyldModuleHandle *)ckalloc(sizeof(Tcl_DyldLoadHandle)); dyldLoadHandle->dlHandle = NULL; dyldLoadHandle->dyldLibHeader = NULL; dyldLoadHandle->modulePtr = modulePtr; - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = dyldLoadHandle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadNext.c b/unix/tclLoadNext.c index eb0affa..8c62784 100644 --- a/unix/tclLoadNext.c +++ b/unix/tclLoadNext.c @@ -101,7 +101,7 @@ TclpDlopen( } NXCloseMemory(errorStream, NX_FREEBUFFER); - newHandle = ckalloc(sizeof(Tcl_LoadHandle)); + newHandle = (Tcl_LoadHandle) ckalloc(sizeof(*newHandle)); newHandle->clientData = INT2PTR(1); newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadOSF.c b/unix/tclLoadOSF.c index 377ed28..bbcaa66 100644 --- a/unix/tclLoadOSF.c +++ b/unix/tclLoadOSF.c @@ -128,7 +128,7 @@ TclpDlopen( } else { pkg++; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = pkg; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = &UnloadFile; diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c index 4be3d7b..a92ddf5 100644 --- a/unix/tclLoadShl.c +++ b/unix/tclLoadShl.c @@ -97,7 +97,7 @@ TclpDlopen( fileName, Tcl_PosixError(interp))); return TCL_ERROR; } - newHandle = ckalloc(sizeof(*newHandle)); + newHandle = (Tcl_LoadHandle)ckalloc(sizeof(*newHandle)); newHandle->clientData = handle; newHandle->findSymbolProcPtr = &FindSymbol; newHandle->unloadFileProcPtr = *unloadProcPtr = &UnloadFile; diff --git a/unix/tclSelectNotfy.c b/unix/tclSelectNotfy.c index a0dea57..38d6afd 100644 --- a/unix/tclSelectNotfy.c +++ b/unix/tclSelectNotfy.c @@ -464,7 +464,7 @@ Tcl_CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index be49c95..2c12bac 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -119,27 +119,27 @@ typedef struct { * Static routines for this file: */ -static int FileBlockModeProc(ClientData instanceData, int mode); -static int FileCloseProc(ClientData instanceData, +static int FileBlockModeProc(void *instanceData, int mode); +static int FileCloseProc(void *instanceData, Tcl_Interp *interp); -static int FileGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int FileInputProc(ClientData instanceData, char *buf, +static int FileGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int FileInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int FileOutputProc(ClientData instanceData, +static int FileOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static int FileSeekProc(ClientData instanceData, long offset, +static int FileSeekProc(void *instanceData, long offset, int mode, int *errorCode); -static int FileTruncateProc(ClientData instanceData, +static int FileTruncateProc(void *instanceData, Tcl_WideInt length); -static Tcl_WideInt FileWideSeekProc(ClientData instanceData, +static Tcl_WideInt FileWideSeekProc(void *instanceData, Tcl_WideInt offset, int mode, int *errorCode); -static void FileWatchProc(ClientData instanceData, int mask); +static void FileWatchProc(void *instanceData, int mask); #ifdef SUPPORTS_TTY -static int TtyCloseProc(ClientData instanceData, +static int TtyCloseProc(void *instanceData, Tcl_Interp *interp); static void TtyGetAttributes(int fd, TtyAttrs *ttyPtr); -static int TtyGetOptionProc(ClientData instanceData, +static int TtyGetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); static int TtyGetBaud(speed_t speed); @@ -149,7 +149,7 @@ static void TtyModemStatusStr(int status, Tcl_DString *dsPtr); static int TtyParseMode(Tcl_Interp *interp, const char *mode, TtyAttrs *ttyPtr); static void TtySetAttributes(int fd, TtyAttrs *ttyPtr); -static int TtySetOptionProc(ClientData instanceData, +static int TtySetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, const char *value); #endif /* SUPPORTS_TTY */ @@ -225,11 +225,11 @@ static const Tcl_ChannelType ttyChannelType = { /* ARGSUSED */ static int FileBlockModeProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ int mode) /* The mode to set. Can be TCL_MODE_BLOCKING * or TCL_MODE_NONBLOCKING. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; if (TclUnixSetBlockingMode(fsPtr->fd, mode) < 0) { return errno; @@ -258,13 +258,13 @@ FileBlockModeProc( static int FileInputProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int bytesRead; /* How many bytes were actually read from the * input device? */ @@ -305,12 +305,12 @@ FileInputProc( static int FileOutputProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int written; *errorCodePtr = 0; @@ -352,10 +352,10 @@ FileOutputProc( static int FileCloseProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp) /* For error reporting - unused. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int errorCode = 0; Tcl_DeleteFileHandler(fsPtr->fd); @@ -377,10 +377,10 @@ FileCloseProc( #ifdef SUPPORTS_TTY static int TtyCloseProc( - ClientData instanceData, + void *instanceData, Tcl_Interp *interp) { - TtyState *ttyPtr = instanceData; + TtyState *ttyPtr = (TtyState*)instanceData; /* * If we've been asked by the user to drain or flush, do so now. @@ -435,13 +435,13 @@ TtyCloseProc( static int FileSeekProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_SET or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; Tcl_WideInt oldLoc, newLoc; /* @@ -496,13 +496,13 @@ FileSeekProc( static Tcl_WideInt FileWideSeekProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_WideInt offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? Can be * one of SEEK_START, SEEK_CUR or SEEK_END. */ int *errorCodePtr) /* To store error code. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; Tcl_WideInt newLoc; newLoc = TclOSseek(fsPtr->fd, (Tcl_SeekOffset) offset, mode); @@ -530,12 +530,12 @@ FileWideSeekProc( static void FileWatchProc( - ClientData instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; /* * Make sure we only register for events that are valid on this file. Note @@ -572,11 +572,11 @@ FileWatchProc( static int FileGetHandleProc( - ClientData instanceData, /* The file state. */ + void *instanceData, /* The file state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; if (direction & fsPtr->validMask) { *handlePtr = INT2PTR(fsPtr->fd); @@ -639,12 +639,12 @@ TtyModemStatusStr( static int TtySetOptionProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Which option to set? */ const char *value) /* New value for option. */ { - TtyState *fsPtr = instanceData; + TtyState *fsPtr = (TtyState *)instanceData; unsigned int len, vlen; TtyAttrs tty; int argc; @@ -978,12 +978,12 @@ TtySetOptionProc( static int TtyGetOptionProc( - ClientData instanceData, /* File state. */ + void *instanceData, /* File state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Option to get. */ Tcl_DString *dsPtr) /* Where to store value(s). */ { - TtyState *fsPtr = instanceData; + TtyState *fsPtr = (TtyState *)instanceData; unsigned int len; char buf[3*TCL_INTEGER_SPACE + 16]; int valid = 0; /* Flag if valid option parsed. */ @@ -1652,7 +1652,7 @@ TclpOpenFileChannel( return NULL; } - native = Tcl_FSGetNativePath(pathPtr); + native = (const char *)Tcl_FSGetNativePath(pathPtr); if (native == NULL) { if (interp != (Tcl_Interp *) NULL) { Tcl_AppendResult(interp, "couldn't open \"", @@ -1712,7 +1712,7 @@ TclpOpenFileChannel( sprintf(channelName, "file%d", fd); } - fsPtr = ckalloc(sizeof(TtyState)); + fsPtr = (TtyState *)ckalloc(sizeof(TtyState)); fsPtr->fileState.validMask = channelPermissions | TCL_EXCEPTION; fsPtr->fileState.fd = fd; #ifdef SUPPORTS_TTY @@ -1763,7 +1763,7 @@ TclpOpenFileChannel( Tcl_Channel Tcl_MakeFileChannel( - ClientData handle, /* OS level handle. */ + void *handle, /* OS level handle. */ int mode) /* ORed combination of TCL_READABLE and * TCL_WRITABLE to indicate file mode. */ { @@ -1790,13 +1790,13 @@ Tcl_MakeFileChannel( && (sockaddrLen > 0) && (sockaddr.sa_family == AF_INET || sockaddr.sa_family == AF_INET6)) { - return TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); + return (Tcl_Channel)TclpMakeTcpClientChannelMode(INT2PTR(fd), mode); } else { channelTypePtr = &fileChannelType; sprintf(channelName, "file%d", fd); } - fsPtr = ckalloc(sizeof(TtyState)); + fsPtr = (TtyState *)ckalloc(sizeof(TtyState)); fsPtr->fileState.fd = fd; fsPtr->fileState.validMask = mode | TCL_EXCEPTION; fsPtr->fileState.channel = Tcl_CreateChannel(channelTypePtr, channelName, @@ -1932,12 +1932,12 @@ Tcl_GetOpenFile( * "forWriting". Ignored, we always check that * the channel is open for the requested * mode. */ - ClientData *filePtr) /* Store pointer to FILE structure here. */ + void **filePtr) /* Store pointer to FILE structure here. */ { Tcl_Channel chan; int chanMode, fd; const Tcl_ChannelType *chanTypePtr; - ClientData data; + void *data; FILE *f; chan = Tcl_GetChannel(interp, chanID, &chanMode); @@ -2022,10 +2022,10 @@ Tcl_GetOpenFile( static int FileTruncateProc( - ClientData instanceData, + void *instanceData, Tcl_WideInt length) { - FileState *fsPtr = instanceData; + FileState *fsPtr = (FileState *)instanceData; int result; #ifdef HAVE_TYPE_OFF64_T diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index aa25c6b..7da0f45 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -201,7 +201,7 @@ TclpGetPwNam( if (tsdPtr->pbuflen < 1) { tsdPtr->pbuflen = 1024; } - tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen); Tcl_CreateThreadExitHandler(FreePwBuf, NULL); } while (1) { @@ -214,7 +214,7 @@ TclpGetPwNam( return NULL; } tsdPtr->pbuflen *= 2; - tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); } return (pwPtr != NULL ? &tsdPtr->pwd : NULL); @@ -281,7 +281,7 @@ TclpGetPwUid( if (tsdPtr->pbuflen < 1) { tsdPtr->pbuflen = 1024; } - tsdPtr->pbuf = ckalloc(tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckalloc(tsdPtr->pbuflen); Tcl_CreateThreadExitHandler(FreePwBuf, NULL); } while (1) { @@ -294,7 +294,7 @@ TclpGetPwUid( return NULL; } tsdPtr->pbuflen *= 2; - tsdPtr->pbuf = ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); + tsdPtr->pbuf = (char *)ckrealloc(tsdPtr->pbuf, tsdPtr->pbuflen); } return (pwPtr != NULL ? &tsdPtr->pwd : NULL); @@ -384,7 +384,7 @@ TclpGetGrNam( if (tsdPtr->gbuflen < 1) { tsdPtr->gbuflen = 1024; } - tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen); + tsdPtr->gbuf = (char*)ckalloc(tsdPtr->gbuflen); Tcl_CreateThreadExitHandler(FreeGrBuf, NULL); } while (1) { @@ -397,7 +397,7 @@ TclpGetGrNam( return NULL; } tsdPtr->gbuflen *= 2; - tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); + tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); } return (grPtr != NULL ? &tsdPtr->grp : NULL); @@ -464,7 +464,7 @@ TclpGetGrGid( if (tsdPtr->gbuflen < 1) { tsdPtr->gbuflen = 1024; } - tsdPtr->gbuf = ckalloc(tsdPtr->gbuflen); + tsdPtr->gbuf = (char*)ckalloc(tsdPtr->gbuflen); Tcl_CreateThreadExitHandler(FreeGrBuf, NULL); } while (1) { @@ -477,7 +477,7 @@ TclpGetGrGid( return NULL; } tsdPtr->gbuflen *= 2; - tsdPtr->gbuf = ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); + tsdPtr->gbuf = (char *)ckrealloc(tsdPtr->gbuf, tsdPtr->gbuflen); } return (grPtr != NULL ? &tsdPtr->grp : NULL); @@ -887,7 +887,7 @@ CopyArray( int buflen) /* Size of buffer. */ { int i, j, len = 0; - char *p, **new; + char *p, **pp; if (src == NULL) { return 0; @@ -903,7 +903,7 @@ CopyArray( return -1; } - new = (char **) buf; + pp = (char **) buf; p = buf + len; for (j = 0; j < i; j++) { @@ -914,10 +914,10 @@ CopyArray( return -1; } memcpy(p, src[j], sz); - new[j] = p; + pp[j] = p; p = buf + len; } - new[j] = NULL; + pp[j] = NULL; return len; } diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 3e1a5c2..17822f5 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -331,8 +331,8 @@ TclpObjRenameFile( Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr) { - return DoRenameFile(Tcl_FSGetNativePath(srcPathPtr), - Tcl_FSGetNativePath(destPathPtr)); + return DoRenameFile((const char *)Tcl_FSGetNativePath(srcPathPtr), + (const char *)Tcl_FSGetNativePath(destPathPtr)); } static int @@ -447,14 +447,14 @@ TclpObjCopyFile( Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr) { - const char *src = Tcl_FSGetNativePath(srcPathPtr); + const char *src = (const char *)Tcl_FSGetNativePath(srcPathPtr); Tcl_StatBuf srcStatBuf; if (TclOSlstat(src, &srcStatBuf) != 0) { /* INTL: Native. */ return TCL_ERROR; } - return DoCopyFile(src, Tcl_FSGetNativePath(destPathPtr), &srcStatBuf); + return DoCopyFile(src, (const char *)Tcl_FSGetNativePath(destPathPtr), &srcStatBuf); } static int @@ -610,7 +610,7 @@ TclUnixCopyFile( if (blockSize <= 0) { blockSize = DEFAULT_COPY_BLOCK_SIZE; } - buffer = ckalloc(blockSize); + buffer = (char *)ckalloc(blockSize); while (1) { nread = (size_t) read(srcFd, buffer, blockSize); if ((nread == (size_t) -1) || (nread == 0)) { @@ -709,7 +709,7 @@ int TclpObjCreateDirectory( Tcl_Obj *pathPtr) { - return DoCreateDirectory(Tcl_FSGetNativePath(pathPtr)); + return DoCreateDirectory((const char *)Tcl_FSGetNativePath(pathPtr)); } static int @@ -1528,7 +1528,7 @@ SetGroupAttribute( gid = groupPtr->gr_gid; } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chown(native, (uid_t) -1, (gid_t) gid); /* INTL: Native. */ if (result != 0) { @@ -1594,7 +1594,7 @@ SetOwnerAttribute( uid = pwPtr->pw_uid; } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chown(native, (uid_t) uid, (gid_t) -1); /* INTL: Native. */ if (result != 0) { @@ -1688,7 +1688,7 @@ SetPermissionsAttribute( } } - native = Tcl_FSGetNativePath(fileName); + native = (const char *)Tcl_FSGetNativePath(fileName); result = chmod(native, newMode); /* INTL: Native. */ if (result != 0) { if (interp != NULL) { @@ -2173,7 +2173,7 @@ TclUnixOpenTemporaryFile( Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj) { - Tcl_DString template, tmp; + Tcl_DString templ, tmp; const char *string; int fd; @@ -2183,46 +2183,46 @@ TclUnixOpenTemporaryFile( if (dirObj) { string = TclGetString(dirObj); - Tcl_UtfToExternalDString(NULL, string, dirObj->length, &template); + Tcl_UtfToExternalDString(NULL, string, dirObj->length, &templ); } else { - Tcl_DStringInit(&template); - Tcl_DStringAppend(&template, DefaultTempDir(), -1); /* INTL: native */ + Tcl_DStringInit(&templ); + Tcl_DStringAppend(&templ, DefaultTempDir(), -1); /* INTL: native */ } - TclDStringAppendLiteral(&template, "/"); + TclDStringAppendLiteral(&templ, "/"); if (basenameObj) { string = TclGetString(basenameObj); Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); + TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); } else { - TclDStringAppendLiteral(&template, "tcl"); + TclDStringAppendLiteral(&templ, "tcl"); } - TclDStringAppendLiteral(&template, "_XXXXXX"); + TclDStringAppendLiteral(&templ, "_XXXXXX"); #ifdef HAVE_MKSTEMPS if (extensionObj) { string = TclGetString(extensionObj); Tcl_UtfToExternalDString(NULL, string, extensionObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); - fd = mkstemps(Tcl_DStringValue(&template), Tcl_DStringLength(&tmp)); + TclDStringAppendDString(&templ, &tmp); + fd = mkstemps(Tcl_DStringValue(&templ), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); } else #endif { - fd = mkstemp(Tcl_DStringValue(&template)); + fd = mkstemp(Tcl_DStringValue(&templ)); } if (fd == -1) { - Tcl_DStringFree(&template); + Tcl_DStringFree(&templ); return -1; } if (resultingNameObj) { - Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&template), - Tcl_DStringLength(&template), &tmp); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&templ), + Tcl_DStringLength(&templ), &tmp); Tcl_SetStringObj(resultingNameObj, Tcl_DStringValue(&tmp), Tcl_DStringLength(&tmp)); Tcl_DStringFree(&tmp); @@ -2233,10 +2233,10 @@ TclUnixOpenTemporaryFile( * this! */ - unlink(Tcl_DStringValue(&template)); + unlink(Tcl_DStringValue(&templ)); errno = 0; } - Tcl_DStringFree(&template); + Tcl_DStringFree(&templ); return fd; } @@ -2296,7 +2296,7 @@ TclpCreateTemporaryDirectory( Tcl_Obj *dirObj, Tcl_Obj *basenameObj) { - Tcl_DString template, tmp; + Tcl_DString templ, tmp; const char *string; #define DEFAULT_TEMP_DIR_PREFIX "tcl" @@ -2308,37 +2308,37 @@ TclpCreateTemporaryDirectory( if (dirObj) { string = TclGetString(dirObj); - Tcl_UtfToExternalDString(NULL, string, dirObj->length, &template); + Tcl_UtfToExternalDString(NULL, string, dirObj->length, &templ); } else { - Tcl_DStringInit(&template); - Tcl_DStringAppend(&template, DefaultTempDir(), -1); /* INTL: native */ + Tcl_DStringInit(&templ); + Tcl_DStringAppend(&templ, DefaultTempDir(), -1); /* INTL: native */ } - if (Tcl_DStringValue(&template)[Tcl_DStringLength(&template) - 1] != '/') { - TclDStringAppendLiteral(&template, "/"); + if (Tcl_DStringValue(&templ)[Tcl_DStringLength(&templ) - 1] != '/') { + TclDStringAppendLiteral(&templ, "/"); } if (basenameObj) { string = TclGetString(basenameObj); if (basenameObj->length) { Tcl_UtfToExternalDString(NULL, string, basenameObj->length, &tmp); - TclDStringAppendDString(&template, &tmp); + TclDStringAppendDString(&templ, &tmp); Tcl_DStringFree(&tmp); } else { - TclDStringAppendLiteral(&template, DEFAULT_TEMP_DIR_PREFIX); + TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX); } } else { - TclDStringAppendLiteral(&template, DEFAULT_TEMP_DIR_PREFIX); + TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX); } - TclDStringAppendLiteral(&template, "_XXXXXX"); + TclDStringAppendLiteral(&templ, "_XXXXXX"); /* * Make the temporary directory. */ - if (mkdtemp(Tcl_DStringValue(&template)) == NULL) { - Tcl_DStringFree(&template); + if (mkdtemp(Tcl_DStringValue(&templ)) == NULL) { + Tcl_DStringFree(&templ); return NULL; } @@ -2346,9 +2346,9 @@ TclpCreateTemporaryDirectory( * The template has been updated. Tell the caller what it was. */ - Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&template), - Tcl_DStringLength(&template), &tmp); - Tcl_DStringFree(&template); + Tcl_ExternalToUtfDString(NULL, Tcl_DStringValue(&templ), + Tcl_DStringLength(&templ), &tmp); + Tcl_DStringFree(&templ); return TclDStringToObj(&tmp); } @@ -2370,11 +2370,11 @@ winPathFromObj( Tcl_Obj *fileName) { int size; - const char *native = Tcl_FSGetNativePath(fileName); + const char *native = (const char *)Tcl_FSGetNativePath(fileName); WCHAR *winPath; size = cygwin_conv_path(1, native, NULL, 0); - winPath = ckalloc(size); + winPath = (WCHAR *)ckalloc(size); cygwin_conv_path(1, native, winPath, size); return winPath; diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index bf033d2..2f6baf6 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -249,9 +249,9 @@ TclpMatchInDirectory( Tcl_Obj *tailPtr; const char *nativeTail; - native = Tcl_FSGetNativePath(pathPtr); + native = (const char *)Tcl_FSGetNativePath(pathPtr); tailPtr = TclPathPart(interp, pathPtr, TCL_PATH_TAIL); - nativeTail = Tcl_FSGetNativePath(tailPtr); + nativeTail = (const char *)Tcl_FSGetNativePath(tailPtr); matchResult = NativeMatchType(interp, native, nativeTail, types); if (matchResult == 1) { Tcl_ListObjAppendElement(interp, resultPtr, pathPtr); @@ -622,7 +622,7 @@ TclpObjAccess( Tcl_Obj *pathPtr, /* Path of file to access */ int mode) /* Permission setting. */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -650,7 +650,7 @@ int TclpObjChdir( Tcl_Obj *pathPtr) /* Path to new working directory */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -679,7 +679,7 @@ TclpObjLstat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - return TclOSlstat(Tcl_FSGetNativePath(pathPtr), bufPtr); + return TclOSlstat((const char *)Tcl_FSGetNativePath(pathPtr), bufPtr); } /* @@ -720,7 +720,7 @@ TclpGetNativeCwd( #endif /* USEGETWD */ if ((clientData == NULL) || strcmp(buffer, (const char *) clientData)) { - char *newCd = ckalloc(strlen(buffer) + 1); + char *newCd = (char*)ckalloc(strlen(buffer) + 1); strcpy(newCd, buffer); return newCd; @@ -847,7 +847,7 @@ TclpObjStat( Tcl_Obj *pathPtr, /* Path of file to stat */ Tcl_StatBuf *bufPtr) /* Filled with results of stat call. */ { - const char *path = Tcl_FSGetNativePath(pathPtr); + const char *path = (const char *)Tcl_FSGetNativePath(pathPtr); if (path == NULL) { return -1; @@ -864,7 +864,7 @@ TclpObjLink( int linkAction) { if (toPtr != NULL) { - const char *src = Tcl_FSGetNativePath(pathPtr); + const char *src = (const char *)Tcl_FSGetNativePath(pathPtr); const char *target = NULL; if (src == NULL) { @@ -910,7 +910,7 @@ TclpObjLink( Tcl_DecrRefCount(absPtr); Tcl_DecrRefCount(dirPtr); } else { - target = Tcl_FSGetNativePath(toPtr); + target = (const char*)Tcl_FSGetNativePath(toPtr); if (target == NULL) { return NULL; } @@ -982,7 +982,7 @@ TclpObjLink( } Tcl_DecrRefCount(transPtr); - length = readlink(Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); + length = readlink((const char *)Tcl_FSGetNativePath(pathPtr), link, sizeof(link)); if (length < 0) { return NULL; } @@ -1116,7 +1116,7 @@ TclNativeCreateNativeRep( return NULL; } Tcl_DecrRefCount(validPathPtr); - nativePathPtr = ckalloc(len); + nativePathPtr = (char *)ckalloc(len); memcpy(nativePathPtr, Tcl_DStringValue(&ds), len); Tcl_DStringFree(&ds); @@ -1157,7 +1157,7 @@ TclNativeDupInternalRep( len = (strlen((const char*) clientData) + 1) * sizeof(char); - copy = ckalloc(len); + copy = (char *)ckalloc(len); memcpy(copy, clientData, len); return copy; } @@ -1183,7 +1183,7 @@ TclpUtime( Tcl_Obj *pathPtr, /* File to modify */ struct utimbuf *tval) /* New modification date structure */ { - return utime(Tcl_FSGetNativePath(pathPtr), tval); + return utime((const char *)Tcl_FSGetNativePath(pathPtr), tval); } #ifdef __CYGWIN__ @@ -1194,7 +1194,7 @@ TclOSstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = stat(name, &buf); statBuf->st_mode = buf.st_mode; @@ -1217,7 +1217,7 @@ TclOSlstat( void *cygstat) { struct stat buf; - Tcl_StatBuf *statBuf = cygstat; + Tcl_StatBuf *statBuf = (Tcl_StatBuf *)cygstat; int result = lstat(name, &buf); statBuf->st_mode = buf.st_mode; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index b6b66da..7406991 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -539,7 +539,7 @@ TclpInitLibraryPath( *encodingPtr = Tcl_GetEncoding(NULL, NULL); str = TclGetString(pathPtr); *lengthPtr = pathPtr->length; - *valuePtr = ckalloc(*lengthPtr + 1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); memcpy(*valuePtr, str, *lengthPtr + 1); Tcl_DecrRefCount(pathPtr); } diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 93faec8..bb01597 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -48,16 +48,16 @@ typedef struct { * Declarations for local functions defined in this file: */ -static int PipeBlockModeProc(ClientData instanceData, int mode); -static int PipeClose2Proc(ClientData instanceData, +static int PipeBlockModeProc(void *instanceData, int mode); +static int PipeClose2Proc(void *instanceData, Tcl_Interp *interp, int flags); -static int PipeGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int PipeInputProc(ClientData instanceData, char *buf, +static int PipeGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int PipeInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int PipeOutputProc(ClientData instanceData, +static int PipeOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void PipeWatchProc(ClientData instanceData, int mask); +static void PipeWatchProc(void *instanceData, int mask); static void RestoreSignals(void); static int SetupStdFile(TclFile file, int type); @@ -107,7 +107,7 @@ TclpMakeFile( Tcl_Channel channel, /* Channel to get file from. */ int direction) /* Either TCL_READABLE or TCL_WRITABLE. */ { - ClientData data; + void *data; if (Tcl_GetChannelHandle(channel, direction, &data) != TCL_OK) { return NULL; @@ -432,8 +432,8 @@ TclpCreateProcess( * deallocated later */ - dsArray = TclStackAlloc(interp, argc * sizeof(Tcl_DString)); - newArgv = TclStackAlloc(interp, (argc+1) * sizeof(char *)); + dsArray = (Tcl_DString *)TclStackAlloc(interp, argc * sizeof(Tcl_DString)); + newArgv = (char **)TclStackAlloc(interp, (argc+1) * sizeof(char *)); newArgv[argc] = NULL; for (i = 0; i < argc; i++) { newArgv[i] = Tcl_UtfToExternalDString(NULL, argv[i], -1, &dsArray[i]); @@ -744,7 +744,7 @@ TclpCreateCommandChannel( { char channelName[16 + TCL_INTEGER_SPACE]; int channelId; - PipeState *statePtr = ckalloc(sizeof(PipeState)); + PipeState *statePtr = (PipeState *)ckalloc(sizeof(PipeState)); int mode; statePtr->inFile = readFile; @@ -869,7 +869,7 @@ TclGetAndDetachPids( return; } - pipePtr = Tcl_GetChannelInstanceData(chan); + pipePtr = (PipeState *)Tcl_GetChannelInstanceData(chan); TclNewObj(pidsObj); for (i = 0; i < pipePtr->numPids; i++) { Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewWideIntObj( @@ -903,12 +903,12 @@ TclGetAndDetachPids( /* ARGSUSED */ static int PipeBlockModeProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ int mode) /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; if (psPtr->inFile && TclUnixSetBlockingMode(GetFd(psPtr->inFile), mode) < 0) { @@ -943,11 +943,11 @@ PipeBlockModeProc( static int PipeClose2Proc( - ClientData instanceData, /* The pipe to close. */ + void *instanceData, /* The pipe to close. */ Tcl_Interp *interp, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { - PipeState *pipePtr = instanceData; + PipeState *pipePtr = (PipeState *)instanceData; Tcl_Channel errChan; int errorCode, result; @@ -1038,13 +1038,13 @@ PipeClose2Proc( static int PipeInputProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ char *buf, /* Where to store data read. */ int toRead, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int bytesRead; /* How many bytes were actually read from the * input device? */ @@ -1089,12 +1089,12 @@ PipeInputProc( static int PipeOutputProc( - ClientData instanceData, /* Pipe state. */ + void *instanceData, /* Pipe state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int written; *errorCodePtr = 0; @@ -1134,12 +1134,12 @@ PipeOutputProc( static void PipeWatchProc( - ClientData instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; int newmask; if (psPtr->inFile) { @@ -1182,11 +1182,11 @@ PipeWatchProc( static int PipeGetHandleProc( - ClientData instanceData, /* The pipe state. */ + void *instanceData, /* The pipe state. */ int direction, /* TCL_READABLE or TCL_WRITABLE */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - PipeState *psPtr = instanceData; + PipeState *psPtr = (PipeState *)instanceData; if (direction == TCL_READABLE && psPtr->inFile) { *handlePtr = INT2PTR(GetFd(psPtr->inFile)); @@ -1252,7 +1252,7 @@ Tcl_WaitPid( /* ARGSUSED */ int Tcl_PidObjCmd( - ClientData dummy, /* Not used. */ + void *dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ @@ -1286,7 +1286,7 @@ Tcl_PidObjCmd( * Extract the process IDs from the pipe structure. */ - pipePtr = Tcl_GetChannelInstanceData(chan); + pipePtr = (PipeState *)Tcl_GetChannelInstanceData(chan); resultPtr = Tcl_NewObj(); for (i = 0; i < pipePtr->numPids; i++) { Tcl_ListObjAppendElement(NULL, resultPtr, diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 62e4756..c061a78 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -66,7 +66,7 @@ struct TcpState { Tcl_TcpAcceptProc *acceptProc; /* Proc to call on accept. */ - ClientData acceptProcData; /* The data for the accept proc. */ + void *acceptProcData; /* The data for the accept proc. */ /* * Only needed for client sockets @@ -130,24 +130,24 @@ struct TcpState { */ static int TcpConnect(Tcl_Interp *interp, TcpState *state); -static void TcpAccept(ClientData data, int mask); -static int TcpBlockModeProc(ClientData data, int mode); -static int TcpCloseProc(ClientData instanceData, +static void TcpAccept(void *data, int mask); +static int TcpBlockModeProc(void *data, int mode); +static int TcpCloseProc(void *instanceData, Tcl_Interp *interp); -static int TcpClose2Proc(ClientData instanceData, +static int TcpClose2Proc(void *instanceData, Tcl_Interp *interp, int flags); -static int TcpGetHandleProc(ClientData instanceData, - int direction, ClientData *handlePtr); -static int TcpGetOptionProc(ClientData instanceData, +static int TcpGetHandleProc(void *instanceData, + int direction, void **handlePtr); +static int TcpGetOptionProc(void *instanceData, Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); -static int TcpInputProc(ClientData instanceData, char *buf, +static int TcpInputProc(void *instanceData, char *buf, int toRead, int *errorCode); -static int TcpOutputProc(ClientData instanceData, +static int TcpOutputProc(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void TcpWatchProc(ClientData instanceData, int mask); +static void TcpWatchProc(void *instanceData, int mask); static int WaitForConnect(TcpState *statePtr, int *errorCodePtr); -static void WrapNotify(ClientData clientData, int mask); +static void WrapNotify(void *clientData, int mask); /* * This structure describes the channel type structure for TCP socket @@ -239,7 +239,7 @@ InitializeHostName( char *dot = strchr(u.nodename, '.'); if (dot != NULL) { - char *node = ckalloc(dot - u.nodename + 1); + char *node = (char *)ckalloc(dot - u.nodename + 1); memcpy(node, u.nodename, dot - u.nodename); node[dot - u.nodename] = '\0'; @@ -283,11 +283,11 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); if (native) { *lengthPtr = strlen(native); - *valuePtr = ckalloc(*lengthPtr + 1); + *valuePtr = (char *)ckalloc(*lengthPtr + 1); memcpy(*valuePtr, native, *lengthPtr + 1); } else { *lengthPtr = 0; - *valuePtr = ckalloc(1); + *valuePtr = (char *)ckalloc(1); *valuePtr[0] = '\0'; } } @@ -381,12 +381,12 @@ TclpFinalizeSockets(void) /* ARGSUSED */ static int TcpBlockModeProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ int mode) /* The mode to set. Can be one of * TCL_MODE_BLOCKING or * TCL_MODE_NONBLOCKING. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (mode == TCL_MODE_BLOCKING) { CLEAR_BITS(statePtr->flags, TCP_NONBLOCKING); @@ -527,13 +527,13 @@ WaitForConnect( /* ARGSUSED */ static int TcpInputProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ char *buf, /* Where to store data read. */ int bufSize, /* How much space is available in the * buffer? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int bytesRead; *errorCodePtr = 0; @@ -578,12 +578,12 @@ TcpInputProc( static int TcpOutputProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCodePtr) /* Where to store error code. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int written; *errorCodePtr = 0; @@ -620,10 +620,10 @@ TcpOutputProc( /* ARGSUSED */ static int TcpCloseProc( - ClientData instanceData, /* The socket to close. */ + void *instanceData, /* The socket to close. */ Tcl_Interp *interp) /* For error reporting - unused. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; @@ -681,11 +681,11 @@ TcpCloseProc( static int TcpClose2Proc( - ClientData instanceData, /* The socket to close. */ + void *instanceData, /* The socket to close. */ Tcl_Interp *interp, /* For error reporting. */ int flags) /* Flags that indicate which side to close. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; int sd; @@ -842,7 +842,7 @@ TcpHostPortList( static int TcpGetOptionProc( - ClientData instanceData, /* Socket state. */ + void *instanceData, /* Socket state. */ Tcl_Interp *interp, /* For error reporting - can be NULL. */ const char *optionName, /* Name of the option to retrieve the value * for, or NULL to get all options and their @@ -850,7 +850,7 @@ TcpGetOptionProc( Tcl_DString *dsPtr) /* Where to store the computed value; * initialized by caller. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; size_t len = 0; WaitForConnect(statePtr, NULL); @@ -1008,7 +1008,7 @@ TcpGetOptionProc( static void WrapNotify( - ClientData clientData, + void *clientData, int mask) { TcpState *statePtr = (TcpState *) clientData; @@ -1037,12 +1037,12 @@ WrapNotify( static void TcpWatchProc( - ClientData instanceData, /* The socket state. */ + void *instanceData, /* The socket state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; if (statePtr->acceptProc != NULL) { /* @@ -1111,11 +1111,11 @@ TcpWatchProc( /* ARGSUSED */ static int TcpGetHandleProc( - ClientData instanceData, /* The socket state. */ + void *instanceData, /* The socket state. */ int direction, /* Not used. */ - ClientData *handlePtr) /* Where to store the handle. */ + void **handlePtr) /* Where to store the handle. */ { - TcpState *statePtr = instanceData; + TcpState *statePtr = (TcpState *)instanceData; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1135,12 +1135,12 @@ TcpGetHandleProc( static void TcpAsyncCallback( - ClientData clientData, /* The socket state. */ + void *clientData, /* The socket state. */ int mask) /* Events of interest; an OR-ed combination of * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { - TcpConnect(NULL, clientData); + TcpConnect(NULL, (TcpState *)clientData); } /* @@ -1182,6 +1182,7 @@ TcpConnect( int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); int ret = -1, error = EHOSTUNREACH; int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); + static const int reuseaddr = 1; if (async_callback) { goto reenter; @@ -1192,7 +1193,6 @@ TcpConnect( for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { - int reuseaddr = 1; /* * No need to try combinations of local and remote addresses of @@ -1399,7 +1399,7 @@ Tcl_OpenTcpClient( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->flags = async ? TCP_ASYNC_CONNECT : 0; statePtr->cachedBlocking = TCL_MODE_BLOCKING; @@ -1446,7 +1446,7 @@ Tcl_OpenTcpClient( Tcl_Channel Tcl_MakeTcpClientChannel( - ClientData sock) /* The socket to wrap up into a channel. */ + void *sock) /* The socket to wrap up into a channel. */ { return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, TCL_READABLE | TCL_WRITABLE); @@ -1478,7 +1478,7 @@ TclpMakeTcpClientChannelMode( TcpState *statePtr; char channelName[SOCK_CHAN_LENGTH]; - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->fds.fd = PTR2INT(sock); statePtr->flags = 0; @@ -1521,7 +1521,7 @@ Tcl_OpenTcpServerEx( Tcl_TcpAcceptProc *acceptProc, /* Callback for accepting connections from new * clients. */ - ClientData acceptProcData) /* Data for the callback. */ + void *acceptProcData) /* Data for the callback. */ { int status = 0, sock = -1, optvalue, port, chosenport; struct addrinfo *addrlist = NULL, *addrPtr; /* socket address */ @@ -1701,14 +1701,14 @@ Tcl_OpenTcpServerEx( * Allocate a new TcpState for this socket. */ - statePtr = ckalloc(sizeof(TcpState)); + statePtr = (TcpState *)ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->acceptProc = acceptProc; statePtr->acceptProcData = acceptProcData; sprintf(channelName, SOCK_TEMPLATE, (long) statePtr); newfds = &statePtr->fds; } else { - newfds = ckalloc(sizeof(TcpFdList)); + newfds = (TcpFdList *)ckalloc(sizeof(TcpFdList)); memset(newfds, (int) 0, sizeof(TcpFdList)); fds->next = newfds; } @@ -1769,10 +1769,10 @@ Tcl_OpenTcpServerEx( /* ARGSUSED */ static void TcpAccept( - ClientData data, /* Callback token. */ + void *data, /* Callback token. */ int mask) /* Not used. */ { - TcpFdList *fds = data; /* Client data of server socket. */ + TcpFdList *fds = (TcpFdList *)data; /* Client data of server socket. */ int newsock; /* The new client socket */ TcpState *newSockState; /* State for new socket. */ address addr; /* The remote address */ @@ -1793,7 +1793,7 @@ TcpAccept( (void) fcntl(newsock, F_SETFD, FD_CLOEXEC); - newSockState = ckalloc(sizeof(TcpState)); + newSockState = (TcpState *)ckalloc(sizeof(TcpState)); memset(newSockState, 0, sizeof(TcpState)); newSockState->flags = 0; newSockState->fds.fd = newsock; diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index e59a0e3..eb91ba1 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -331,7 +331,7 @@ TestFileHandlerProc( int mask) /* Indicates which events happened: * TCL_READABLE or TCL_WRITABLE. */ { - Pipe *pipePtr = clientData; + Pipe *pipePtr = (Pipe *)clientData; if (mask & TCL_READABLE) { pipePtr->readCount++; diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 60340b0..30e19ca 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -577,7 +577,7 @@ Tcl_MutexLock( * Double inside master lock check to avoid a race condition. */ - pmutexPtr = ckalloc(sizeof(PMutex)); + pmutexPtr = (PMutex *)ckalloc(sizeof(PMutex)); PMutexInit(pmutexPtr); *mutexPtr = (Tcl_Mutex) pmutexPtr; TclRememberMutex(mutexPtr); @@ -687,7 +687,7 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - pcondPtr = ckalloc(sizeof(pthread_cond_t)); + pcondPtr = (pthread_cond_t *)ckalloc(sizeof(pthread_cond_t)); pthread_cond_init(pcondPtr, NULL); *condPtr = (Tcl_Condition) pcondPtr; TclRememberCondition(condPtr); @@ -846,7 +846,7 @@ TclpNewAllocMutex(void) AllocMutex *lockPtr; register PMutex *plockPtr; - lockPtr = malloc(sizeof(AllocMutex)); + lockPtr = (AllocMutex *)malloc(sizeof(AllocMutex)); if (lockPtr == NULL) { Tcl_Panic("could not allocate lock"); } @@ -917,7 +917,7 @@ TclpThreadCreateKey(void) { pthread_key_t *ptkeyPtr; - ptkeyPtr = TclpSysAlloc(sizeof(pthread_key_t), 0); + ptkeyPtr = (pthread_key_t *)TclpSysAlloc(sizeof(pthread_key_t), 0); if (NULL == ptkeyPtr) { Tcl_Panic("unable to allocate thread key!"); } @@ -933,7 +933,7 @@ void TclpThreadDeleteKey( void *keyPtr) { - pthread_key_t *ptkeyPtr = keyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t *)keyPtr; if (pthread_key_delete(*ptkeyPtr)) { Tcl_Panic("unable to delete key!"); @@ -947,7 +947,7 @@ TclpThreadSetMasterTSD( void *tsdKeyPtr, void *ptr) { - pthread_key_t *ptkeyPtr = tsdKeyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t *)tsdKeyPtr; if (pthread_setspecific(*ptkeyPtr, ptr)) { Tcl_Panic("unable to set master TSD value"); @@ -958,7 +958,7 @@ void * TclpThreadGetMasterTSD( void *tsdKeyPtr) { - pthread_key_t *ptkeyPtr = tsdKeyPtr; + pthread_key_t *ptkeyPtr = (pthread_key_t*)tsdKeyPtr; return pthread_getspecific(*ptkeyPtr); } diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 1d8b351..0bdadc7 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -59,7 +59,7 @@ static void NativeGetTime(Tcl_Time *timebuf, Tcl_GetTimeProc *tclGetTimeProcPtr = NativeGetTime; Tcl_ScaleTimeProc *tclScaleTimeProcPtr = NativeScaleTime; -ClientData tclTimeClientData = NULL; +void *tclTimeClientData = NULL; /* *---------------------------------------------------------------------- @@ -579,7 +579,7 @@ SetTZIfNecessary(void) } else { ckfree(lastTZ); } - lastTZ = ckalloc(strlen(newTZ) + 1); + lastTZ = (char *)ckalloc(strlen(newTZ) + 1); strcpy(lastTZ, newTZ); } Tcl_MutexUnlock(&tmMutex); diff --git a/unix/tclXtNotify.c b/unix/tclXtNotify.c index 26db9f2..490b739 100644 --- a/unix/tclXtNotify.c +++ b/unix/tclXtNotify.c @@ -359,7 +359,7 @@ CreateFileHandler( } } if (filePtr == NULL) { - filePtr = ckalloc(sizeof(FileHandler)); + filePtr = (FileHandler *)ckalloc(sizeof(FileHandler)); filePtr->fd = fd; filePtr->read = 0; filePtr->write = 0; @@ -525,7 +525,7 @@ FileProc( */ filePtr->readyMask |= mask; - fileEvPtr = ckalloc(sizeof(FileHandlerEvent)); + fileEvPtr = (FileHandlerEvent *)ckalloc(sizeof(FileHandlerEvent)); fileEvPtr->header.proc = FileHandlerEventProc; fileEvPtr->fd = filePtr->fd; Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 27ddfc8..06e7878 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -1472,7 +1472,7 @@ DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, (void *) serviceName, + ddeService = DdeCreateStringHandle(ddeInstance, serviceName, CP_WINUNICODE); } @@ -1485,7 +1485,7 @@ DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, (void *) topicName, + ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, CP_WINUNICODE); } } @@ -1592,7 +1592,7 @@ DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1669,7 +1669,7 @@ DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, (void *) itemString, + ddeItem = DdeCreateStringHandle(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(dataString, (DWORD) length, diff --git a/win/tclWinReg.c b/win/tclWinReg.c index f93a553..5f131d3 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -215,7 +215,7 @@ Registry_Unload( * Delete the originally registered command. */ - cmd = Tcl_GetAssocData(interp, REGISTRY_ASSOC_KEY, NULL); + cmd = (Tcl_Command)Tcl_GetAssocData(interp, REGISTRY_ASSOC_KEY, NULL); if (cmd != NULL) { Tcl_DeleteCommandFromToken(interp, cmd); } @@ -244,7 +244,7 @@ static void DeleteCmd( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_SetAssocData(interp, REGISTRY_ASSOC_KEY, NULL, NULL); } @@ -1168,7 +1168,7 @@ RecursiveDeleteKey( HKEY hKey; REGSAM saveMode = mode; static int checkExProc = 0; - static FARPROC regDeleteKeyExProc = NULL; + static LSTATUS (* regDeleteKeyExProc) (HKEY, LPCWSTR, REGSAM, DWORD) = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) NULL; /* * Do not allow NULL or empty key name. @@ -1208,7 +1208,7 @@ RecursiveDeleteKey( checkExProc = 1; handle = GetModuleHandle(TEXT("ADVAPI32")); - regDeleteKeyExProc = (FARPROC) + regDeleteKeyExProc = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress(handle, "RegDeleteKeyExW"); } if (mode && regDeleteKeyExProc) { diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 40be3d5..1cff8e9 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -465,7 +465,7 @@ TestplatformChmod( goto done; } - secDesc = ckalloc(secDescLen); + secDesc = (BYTE *)ckalloc(secDescLen); if (!GetFileSecurityA(nativePath, infoBits, (PSECURITY_DESCRIPTOR) secDesc, secDescLen, &secDescLen2) || (secDescLen < secDescLen2)) { @@ -477,7 +477,7 @@ TestplatformChmod( * Get the World SID. */ - userSid = ckalloc(GetSidLengthRequired((UCHAR) 1)); + userSid = (SID *)ckalloc(GetSidLengthRequired((UCHAR) 1)); InitializeSid(userSid, &userSidAuthority, (BYTE) 1); *(GetSidSubAuthority(userSid, 0)) = SECURITY_WORLD_RID; @@ -503,7 +503,7 @@ TestplatformChmod( newAclSize = ACLSize.AclBytesInUse + sizeof(ACCESS_DENIED_ACE) + GetLengthSid(userSid) - sizeof(DWORD); - newAcl = ckalloc(newAclSize); + newAcl = (PACL) ckalloc(newAclSize); /* * Initialize the new ACL. -- cgit v0.12 From 8c60b1157a27a535111861c5a83b64d502ec1948 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 3 Sep 2019 20:32:33 +0000 Subject: Mark more unused parameters --- generic/tclEvent.c | 7 ++++--- generic/tclObj.c | 17 ++++++++++++++++- generic/tclPathObj.c | 9 ++++++--- generic/tclPkg.c | 18 +++++++++++++++--- generic/tclScan.c | 1 + generic/tclStringObj.c | 7 ++++++- generic/tclTestProcBodyObj.c | 2 ++ generic/tclThreadTest.c | 6 +++++- generic/tclTrace.c | 2 ++ generic/tclUtil.c | 6 +++--- generic/tclVar.c | 8 +++++++- generic/tclZlib.c | 3 ++- macosx/tclMacOSXBundle.c | 3 ++- macosx/tclMacOSXNotify.c | 6 +++++- unix/tclLoadDyld.c | 6 +++++- unix/tclUnixInit.c | 4 ++++ unix/tclUnixSock.c | 11 +++++++++-- unix/tclUnixTest.c | 37 ++++++++++++++++++++++++++++--------- unix/tclUnixTime.c | 5 ++++- 19 files changed, 126 insertions(+), 32 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 7c499b5..91bc995 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1467,17 +1467,18 @@ Tcl_VwaitObjCmd( static char * VwaitVarProc( void *clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *interp, /* Interpreter containing variable. */ + Tcl_Interp *dummy, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { int *donePtr = (int *)clientData; + (void)dummy; (void)flags; + (void)name1; + (void)name2; *donePtr = 1; - Tcl_UntraceVar(interp, name1, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VwaitVarProc, clientData); return NULL; } diff --git a/generic/tclObj.c b/generic/tclObj.c index cbba762..edbf50b 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -786,8 +786,9 @@ TclContinuationsGet( static void TclThreadFinalizeContLines( - ClientData clientData) + ClientData dummy) { + (void)dummy; /* * Release the hashtable tracking invisible continuation lines. */ @@ -1024,6 +1025,8 @@ TclDbDumpActiveObjects( } } } +#else + (void)outFile; #endif } @@ -1200,6 +1203,9 @@ Tcl_DbNewObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewObj(); } #endif /* TCL_MEM_DEBUG */ @@ -2038,6 +2044,9 @@ Tcl_DbNewBooleanObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewBooleanObj(boolValue); } #endif /* TCL_MEM_DEBUG */ @@ -2425,6 +2434,9 @@ Tcl_DbNewDoubleObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewDoubleObj(dblValue); } #endif /* TCL_MEM_DEBUG */ @@ -2909,6 +2921,9 @@ Tcl_DbNewLongObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewWideIntObj(longValue); } #endif /* TCL_MEM_DEBUG */ diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 9e62c7c..41fb0c6 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1402,13 +1402,14 @@ AppendPath( Tcl_Obj * TclFSMakePathRelative( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ Tcl_Obj *pathPtr, /* The path we have. */ Tcl_Obj *cwdPtr) /* Make it relative to this. */ { int cwdLen, len; const char *tempStr; Tcl_ObjIntRep *irPtr = TclFetchIntRep(pathPtr, &fsPathType); + (void)dummy; if (irPtr) { FsPath *fsPathPtr = PATHOBJ(pathPtr); @@ -1473,10 +1474,11 @@ TclFSMakePathRelative( static int MakePathFromNormalized( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Not used. */ Tcl_Obj *pathPtr) /* The object to convert. */ { FsPath *fsPathPtr; + (void)dummy; if (TclHasIntRep(pathPtr, &fsPathType)) { return TCL_OK; @@ -2548,8 +2550,9 @@ UpdateStringOfFsPath( int TclNativePathInFilesystem( Tcl_Obj *pathPtr, - ClientData *clientDataPtr) + ClientData *dummy) { + (void)dummy; /* * A special case is required to handle the empty path "". This is a valid * path (i.e. the user should be able to do 'file exists ""' without diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 98c9cf3..0a32f48 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -226,11 +226,12 @@ Tcl_PkgProvideEx( static void PkgFilesCleanupProc( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *dummy) { PkgFiles *pkgFiles = (PkgFiles *) clientData; Tcl_HashSearch search; Tcl_HashEntry *entry; + (void)dummy; while (pkgFiles->names) { PkgName *name = pkgFiles->names; @@ -466,6 +467,7 @@ PkgRequireCore( Tcl_Obj **reqv = (Tcl_Obj **)data[2]; int code = CheckAllRequirements(interp, reqc, reqv); Require *reqPtr; + (void)result; if (code != TCL_OK) { return code; @@ -498,6 +500,7 @@ PkgRequireCoreStep1( int reqc = PTR2INT(data[1]); Tcl_Obj **const reqv = (Tcl_Obj **)data[2]; const char *name = reqPtr->name /* Name of desired package. */; + (void)result; /* * If we've got the package in the DB already, go on to actually loading @@ -592,6 +595,7 @@ PkgRequireCoreFinal( char *pkgVersionI; void *clientDataPtr = reqPtr->clientDataPtr; const char *name = reqPtr->name; /* Name of desired package. */ + (void)result; if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -635,9 +639,11 @@ PkgRequireCoreFinal( static int PkgRequireCoreCleanup( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { + (void)dummy; + ckfree(data[0]); return result; } @@ -658,6 +664,7 @@ SelectPackage( const char *name = reqPtr->name; Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; + (void)result; /* * Check whether we're already attempting to load some version of this @@ -1057,6 +1064,8 @@ Tcl_PackageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)dummy; + return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv); } @@ -1089,6 +1098,7 @@ TclNRPackageObjCmd( const char *argv2, *argv3, *argv4; char *iva = NULL, *ivb = NULL; Tcl_Obj *objvListPtr, **newObjvPtr; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1536,9 +1546,11 @@ TclNRPackageObjCmd( static int TclNRPackageObjCmdCleanup( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { + (void)dummy; + TclDecrRefCount((Tcl_Obj *) data[0]); TclDecrRefCount((Tcl_Obj *) data[1]); return result; diff --git a/generic/tclScan.c b/generic/tclScan.c index b6d4132..78fd3be 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -584,6 +584,7 @@ Tcl_ScanObjCmd( char buf[513]; /* Temporary buffer to hold scanned number * strings before they are passed to * strtoul. */ + (void)dummy; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c4f4f87..5bdf496 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -347,6 +347,9 @@ Tcl_DbNewStringObj( int line) /* Line number in the source file; used for * debugging. */ { + (void)file; + (void)line; + return Tcl_NewStringObj(bytes, length); } #endif /* TCL_MEM_DEBUG */ @@ -4166,9 +4169,11 @@ DupStringInternalRep( static int SetStringFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Not used. */ Tcl_Obj *objPtr) /* The object to convert. */ { + (void)dummy; + if (!TclHasIntRep(objPtr, &tclStringType)) { String *stringPtr = stringAlloc(0); diff --git a/generic/tclTestProcBodyObj.c b/generic/tclTestProcBodyObj.c index 59379de..b6ac741 100644 --- a/generic/tclTestProcBodyObj.c +++ b/generic/tclTestProcBodyObj.c @@ -240,6 +240,7 @@ ProcBodyTestProcObjCmd( Tcl_Obj *bodyObjPtr; Tcl_Obj *myobjv[5]; int result; + (void)dummy; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "newName argsList bodyName"); @@ -333,6 +334,7 @@ ProcBodyTestCheckObjCmd( Tcl_Obj *const objv[]) /* arguments */ { const char *version; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c index 48aa445..7fc748e 100644 --- a/generic/tclThreadTest.c +++ b/generic/tclThreadTest.c @@ -223,6 +223,7 @@ ThreadObjCmd( THREAD_ID, THREAD_JOIN, THREAD_NAMES, THREAD_SEND, THREAD_WAIT, THREAD_ERRORPROC }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1018,6 +1019,7 @@ ThreadEventProc( Tcl_Interp *interp = tsdPtr->interp; int code; const char *result, *errorCode, *errorInfo; + (void)mask; if (interp == NULL) { code = TCL_ERROR; @@ -1109,8 +1111,10 @@ ThreadFreeProc( static int ThreadDeleteEvent( Tcl_Event *eventPtr, /* Really ThreadEvent */ - void *clientData) /* dummy */ + void *dummy) /* dummy */ { + (void)dummy; + if (eventPtr->proc == ThreadEventProc) { ckfree(((ThreadEvent *) eventPtr)->script); return 1; diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 3dac23f..4725e97 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -210,6 +210,7 @@ Tcl_TraceObjCmd( TRACE_OLD_VARIABLE, TRACE_OLD_VDELETE, TRACE_OLD_VINFO #endif }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1050,6 +1051,7 @@ Tcl_CommandTraceInfo( { Command *cmdPtr; CommandTrace *tracePtr; + (void)flags; cmdPtr = (Command *) Tcl_FindCommand(interp, cmdName, NULL, TCL_LEAVE_ERR_MSG); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index f1133e3..b4f0e79 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2479,6 +2479,7 @@ TclByteArrayMatch( { const unsigned char *stringEnd, *patternEnd; unsigned char p; + (void)flags; stringEnd = string + strLen; patternEnd = pattern + ptnLen; @@ -3263,9 +3264,7 @@ Tcl_DStringEndSublist( void Tcl_PrintDouble( - Tcl_Interp *interp, /* Interpreter whose tcl_precision variable - * used to be used to control printing. It's - * ignored now. */ + Tcl_Interp *dummy, /* Not used. */ double value, /* Value to print as string. */ char *dst) /* Where to store converted value; must have * at least TCL_DOUBLE_SPACE characters. */ @@ -3276,6 +3275,7 @@ Tcl_PrintDouble( char *digits; char *end; int *precisionPtr = (int *)Tcl_GetThreadData(&precisionKey, sizeof(int)); + (void)dummy; /* * Handle NaN. diff --git a/generic/tclVar.c b/generic/tclVar.c index 6526e25..bcb12ca 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1534,6 +1534,7 @@ Tcl_SetObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_Obj *varValueObj; + (void)dummy; if (objc == 2) { varValueObj = Tcl_ObjGetVar2(interp, objv[1], NULL,TCL_LEAVE_ERR_MSG); @@ -2830,6 +2831,7 @@ Tcl_UnsetObjCmd( { int i, flags = TCL_LEAVE_ERR_MSG; const char *name; + (void)dummy; if (objc == 1) { /* @@ -2900,6 +2902,7 @@ Tcl_AppendObjCmd( Tcl_Obj *varValuePtr = NULL; /* Initialized to avoid compiler warning. */ int i; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -2966,6 +2969,7 @@ Tcl_LappendObjCmd( int numElems, createdNewObj; Var *varPtr, *arrayPtr; int result; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "varName ?value ...?"); @@ -3182,6 +3186,7 @@ ArrayForNRCmd( ArraySearch *searchPtr = NULL; Var *varPtr; int isArray, numVars; + (void)dummy; /* * array for {k v} a body @@ -3404,7 +3409,7 @@ ArrayPopulateSearch( static int ArrayStartSearchCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -3412,6 +3417,7 @@ ArrayStartSearchCmd( Var *varPtr; int isArray; ArraySearch *searchPtr; + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName"); diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 09195a2..71f0ad5 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1920,7 +1920,7 @@ Tcl_ZlibAdler32( static int ZlibCmd( - void *notUsed, + void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1939,6 +1939,7 @@ ZlibCmd( CMD_ADLER, CMD_COMPRESS, CMD_CRC, CMD_DECOMPRESS, CMD_DEFLATE, CMD_GUNZIP, CMD_GZIP, CMD_INFLATE, CMD_PUSH, CMD_STREAM }; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command arg ?...?"); diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 915f290..81d8d04 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -197,7 +197,7 @@ Tcl_MacOSXOpenBundleResources( int Tcl_MacOSXOpenVersionedBundleResources( - Tcl_Interp *interp, + Tcl_Interp *dummy, const char *bundleName, const char *bundleVersion, int hasResourceFile, @@ -208,6 +208,7 @@ Tcl_MacOSXOpenVersionedBundleResources( CFBundleRef bundleRef, versionedBundleRef = NULL; CFStringRef bundleNameRef; CFURLRef libURL; + (void)dummy; libraryPath[0] = '\0'; diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 945ea4b..1523400 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -945,6 +945,8 @@ TimerWakeUp( CFRunLoopTimerRef timer, void *info) { + (void)timer; + (void)info; } /* @@ -1453,6 +1455,7 @@ UpdateWaitingListAndServiceEvents( void *info) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *)info; + (void)observer; if (tsdPtr->sleeping) { return; @@ -1827,13 +1830,14 @@ TclUnixWaitForFile( static TCL_NORETURN void NotifierThreadProc( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { ThreadSpecificData *tsdPtr; fd_set readableMask, writableMask, exceptionalMask; int i, numFdBits = 0, polling; struct timeval poll = {0., 0.}, *timePtr; char buf[2]; + (void)dummy; /* * Look for file events and report them to interested threads. diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 14e05b2..9d4e99c 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -491,6 +491,9 @@ TclGuessPackageName( Tcl_DString *bufPtr) /* Initialized empty dstring. Append package * name to this if possible. */ { + (void)fileName; + (void)bufPtr; + return 0; } @@ -513,10 +516,11 @@ TclGuessPackageName( #ifdef TCL_LOAD_FROM_MEMORY MODULE_SCOPE void * TclpLoadMemoryGetBuffer( - Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Interp *dummy, /* Used for error reporting. */ int size) /* Size of desired buffer. */ { void *buffer = NULL; + (void)dummy; /* * NSCreateObjectFileImageFromMemory is available but always fails diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 341a70b..a3a64a9 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -1062,6 +1062,10 @@ MacOSXGetLibraryPath( foundInFramework = Tcl_MacOSXOpenVersionedBundleResources(interp, "com.tcltk.tcllibrary", TCL_FRAMEWORK_VERSION, 0, maxPathLen, tclLibPath); +#else + (void)interp; + (void)maxPathLen; + (void)tclLibPath; #endif return foundInFramework; diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index c061a78..993ee95 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -334,8 +334,10 @@ Tcl_GetHostName(void) int TclpHasSockets( - Tcl_Interp *interp) /* Not used. */ + Tcl_Interp *dummy) /* Not used. */ { + (void)dummy; + return TCL_OK; } @@ -621,11 +623,12 @@ TcpOutputProc( static int TcpCloseProc( void *instanceData, /* The socket to close. */ - Tcl_Interp *interp) /* For error reporting - unused. */ + Tcl_Interp *dummy) /* For error reporting - unused. */ { TcpState *statePtr = (TcpState *)instanceData; int errorCode = 0; TcpFdList *fds; + (void)dummy; /* * Delete a file handler that may be active for this socket if this is a @@ -1116,6 +1119,7 @@ TcpGetHandleProc( void **handlePtr) /* Where to store the handle. */ { TcpState *statePtr = (TcpState *)instanceData; + (void)direction; *handlePtr = INT2PTR(statePtr->fds.fd); return TCL_OK; @@ -1140,6 +1144,8 @@ TcpAsyncCallback( * TCL_READABLE, TCL_WRITABLE and * TCL_EXCEPTION. */ { + (void)mask; + TcpConnect(NULL, (TcpState *)clientData); } @@ -1779,6 +1785,7 @@ TcpAccept( socklen_t len; /* For accept interface */ char channelName[SOCK_CHAN_LENGTH]; char host[NI_MAXHOST], port[NI_MAXSERV]; + (void)mask; len = sizeof(addr); newsock = accept(fds->fd, &addr.sa, &len); diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index eb91ba1..7b0719e 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -138,7 +138,7 @@ TclplatformtestInit( static int TestfilehandlerCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -148,6 +148,7 @@ TestfilehandlerCmd( static int initialized = 0; char buffer[4000]; TclFile file; + (void)dummy; /* * NOTE: When we make this code work on Windows also, the following @@ -360,7 +361,7 @@ TestFileHandlerProc( static int TestfilewaitCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -369,6 +370,7 @@ TestfilewaitCmd( Tcl_Channel channel; int fd; ClientData data; + (void)dummy; if (argc != 4) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -429,12 +431,13 @@ TestfilewaitCmd( static int TestfindexecutableCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { Tcl_Obj *saveName; + (void)dummy; if (argc != 2) { Tcl_AppendResult(interp, "wrong # arguments: should be \"", argv[0], @@ -472,12 +475,13 @@ TestfindexecutableCmd( static int TestgetopenfileCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { ClientData filePtr; + (void)dummy; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -515,11 +519,13 @@ TestgetopenfileCmd( static int TestsetencpathObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { + (void)dummy; + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; @@ -548,12 +554,13 @@ TestsetencpathObjCmd( static int TestforkObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); @@ -593,11 +600,13 @@ TestforkObjCmd( static int TestgetencpathObjCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const *objv) /* Argument strings. */ { + (void)dummy; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; @@ -627,7 +636,7 @@ TestgetencpathObjCmd( static int TestalarmCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ @@ -635,6 +644,7 @@ TestalarmCmd( #ifdef SA_RESTART unsigned int sec; struct sigaction action; + (void)dummy; if (argc > 1) { Tcl_GetInt(interp, argv[1], (int *)&sec); @@ -658,6 +668,8 @@ TestalarmCmd( (void) alarm(sec); return TCL_OK; #else + (void)dummy; + Tcl_AppendResult(interp, "warning: sigaction SA_RESTART not support on this platform", NULL); @@ -685,6 +697,8 @@ static void AlarmHandler( int signum) { + (void)signum; + gotsig = "1"; } @@ -706,11 +720,15 @@ AlarmHandler( static int TestgotsigCmd( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char **argv) /* Argument strings. */ { + (void)dummy; + (void)argc; + (void)argv; + Tcl_AppendResult(interp, gotsig, NULL); gotsig = "0"; return TCL_OK; @@ -743,6 +761,7 @@ TestchmodCmd( Tcl_Obj *const *objv) /* Argument strings. */ { int i, mode; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?"); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index fb0b5e1..fb649d2 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -511,6 +511,8 @@ NativeScaleTime( Tcl_Time *timePtr, ClientData clientData) { + (void)timePtr; + (void)clientData; /* Native scale is 1:1. Nothing is done */ } @@ -534,9 +536,10 @@ NativeScaleTime( static void NativeGetTime( Tcl_Time *timePtr, - ClientData clientData) + ClientData dummy) { struct timeval tv; + (void)dummy; (void) gettimeofday(&tv, NULL); timePtr->sec = tv.tv_sec; -- cgit v0.12 From 650605595407701981f6662028e353accea5d38c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 20:51:06 +0000 Subject: (experiment) Allow C++ symbols to be found in loaded extensions --- unix/tclLoadDl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 412c73f..73a44f2 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -188,6 +188,23 @@ FindSymbol( proc = dlsym(handle, native); /* INTL: Native. */ Tcl_DStringFree(&newName); } +#ifdef __cplusplus + if (proc == NULL) { + char buf[32]; + sprintf(buf, "%d", Tcl_DStringLength(&ds)); + Tcl_DStringInit(&newName); + TclDStringAppendLiteral(&newName, "__Z"); + Tcl_DStringAppend(&newName, buf, -1); + Tcl_DStringAppend(&newName, Tcl_DStringValue(&ds), -1); + TclDStringAppendLiteral(&newName, "P10Tcl_Interp"); + native = Tcl_DStringValue(&newName); + proc = dlsym(handle, native + 1); /* INTL: Native. */ + if (proc == NULL) { + proc = dlsym(handle, native); /* INTL: Native. */ + } + Tcl_DStringFree(&newName); + } +#endif Tcl_DStringFree(&ds); if (proc == NULL) { const char *errorStr = dlerror(); -- cgit v0.12 From ed985943f3df9f3ed7b6cc8130c0e67cece08dfd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 21:19:59 +0000 Subject: Handle "Unload" as well --- unix/tclLoadDl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index 73a44f2..0fef500 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -202,6 +202,14 @@ FindSymbol( if (proc == NULL) { proc = dlsym(handle, native); /* INTL: Native. */ } + if (proc == NULL) { + TclDStringAppendLiteral(&newName, "i"); + native = Tcl_DStringValue(&newName); + proc = dlsym(handle, native + 1); /* INTL: Native. */ + } + if (proc == NULL) { + proc = dlsym(handle, native); /* INTL: Native. */ + } Tcl_DStringFree(&newName); } #endif -- cgit v0.12 From 2cd19c4e6bde78b2754deda187fec816a7c8283f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 22:08:23 +0000 Subject: Bring back Tcl_UntraceVar --- generic/tclEvent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 91bc995..d5a3776 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1475,10 +1475,10 @@ VwaitVarProc( int *donePtr = (int *)clientData; (void)dummy; (void)flags; - (void)name1; - (void)name2; *donePtr = 1; + Tcl_UntraceVar2(interp, name1, name2, TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + VwaitVarProc, clientData); return NULL; } -- cgit v0.12 From 2d7fb3bc20951567f5cd26584fb146ea5c271cc2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Sep 2019 22:11:48 +0000 Subject: interp is not dummy any-more --- generic/tclEvent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index d5a3776..56d5ce5 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1467,13 +1467,12 @@ Tcl_VwaitObjCmd( static char * VwaitVarProc( void *clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *dummy, /* Interpreter containing variable. */ + Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { int *donePtr = (int *)clientData; - (void)dummy; (void)flags; *donePtr = 1; -- cgit v0.12 From 0ff016021c022c1f60500a200461fee9721b97e1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 18 Sep 2019 09:33:43 +0000 Subject: Make less dependent on UNICODE definition --- generic/tclTest.c | 3 +-- generic/tclTestObj.c | 2 +- win/tclWinDde.c | 76 +++++++++++++++++++++++++++------------------------- win/tclWinReg.c | 43 +++++++++++++++-------------- 4 files changed, 64 insertions(+), 60 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index 008a521..91ceaa6 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -3523,8 +3523,6 @@ TestlocaleCmd( { int index; const char *locale; - (void)dummy; - static const char *const optionStrings[] = { "ctype", "numeric", "time", "collate", "monetary", "all", NULL @@ -3533,6 +3531,7 @@ TestlocaleCmd( LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_ALL }; + (void)dummy; /* * LC_CTYPE, etc. correspond to the indices for the strings. diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 6dce6a3..a54a06f 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -574,7 +574,6 @@ TestindexobjCmd( int allowAbbrev, index, index2, setError, i, result; const char **argv; static const char *const tablePtr[] = {"a", "b", "check", NULL}; - (void)dummy; /* * Keep this structure declaration in sync with tclIndexObj.c @@ -585,6 +584,7 @@ TestindexobjCmd( int index; /* Selected index into table. */ }; struct IndexRep *indexRep; + (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "check") == 0)) { diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 3fe855f..1eded82 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -11,8 +11,6 @@ */ #undef STATIC_BUILD -#undef TCL_UTF_MAX -#define TCL_UTF_MAX 3 #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif @@ -83,8 +81,8 @@ static int ddeIsServer = 0; #define TCL_DDE_VERSION "1.4.1" #define TCL_DDE_PACKAGE_NAME "dde" -#define TCL_DDE_SERVICE_NAME TEXT("TclEval") -#define TCL_DDE_EXECUTE_RESULT TEXT("$TCLEVAL$EXECUTE$RESULT") +#define TCL_DDE_SERVICE_NAME L"TclEval" +#define TCL_DDE_EXECUTE_RESULT L"$TCLEVAL$EXECUTE$RESULT" #define DDE_FLAG_ASYNC 1 #define DDE_FLAG_BINARY 2 @@ -120,8 +118,13 @@ static int DdeObjCmd(void *clientData, Tcl_Obj *const objv[]); #if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +# if TCL_UTF_MAX > 3 +# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf(a,(b)*sizeof(WCHAR),c) +# define Tcl_UtfToWCharDString(a,b,c) Tcl_WinUtfToTChar(a,b,c) +# else # define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# endif #endif static unsigned char * @@ -261,7 +264,7 @@ Initialize(void) if ((ddeServiceGlobal == 0) && (nameFound != 0)) { ddeIsServer = 1; Tcl_CreateExitHandler(DdeExitProc, NULL); - ddeServiceGlobal = DdeCreateStringHandle(ddeInstance, + ddeServiceGlobal = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); DdeNameService(ddeInstance, ddeServiceGlobal, 0L, DNS_REGISTER); } else { @@ -347,7 +350,7 @@ DdeSetServerName( * current interp, but it doesn't have a name. */ - return TEXT(""); + return L""; } /* @@ -369,7 +372,7 @@ DdeSetServerName( } if (r != TCL_OK) { Tcl_DStringInit(&dString); - OutputDebugString(Tcl_UtfToWCharDString(Tcl_GetString(Tcl_GetObjResult(interp)), -1, &dString)); + OutputDebugStringW(Tcl_UtfToWCharDString(Tcl_GetString(Tcl_GetObjResult(interp)), -1, &dString)); Tcl_DStringFree(&dString); return NULL; } @@ -388,13 +391,13 @@ DdeSetServerName( if (suffix > 1) { if (suffix == 2) { Tcl_DStringAppend(&dString, (char *)name, wcslen(name) * sizeof(WCHAR)); - Tcl_DStringAppend(&dString, (char *)TEXT(" #"), 2 * sizeof(WCHAR)); + Tcl_DStringAppend(&dString, (char *)L" #", 2 * sizeof(WCHAR)); offset = Tcl_DStringLength(&dString); Tcl_DStringSetLength(&dString, offset + sizeof(WCHAR) * TCL_INTEGER_SPACE); actualName = (WCHAR *) Tcl_DStringValue(&dString); } _snwprintf((WCHAR *) (Tcl_DStringValue(&dString) + offset), - TCL_INTEGER_SPACE, TEXT("%d"), suffix); + TCL_INTEGER_SPACE, L"%d", suffix); } /* @@ -503,8 +506,7 @@ DdeGetRegistrationPtr( static void DeleteProc( - void *clientData) /* The interp we are deleting passed as - * ClientData. */ + void *clientData) /* The interp we are deleting. */ { RegisteredInterp *riPtr = (RegisteredInterp *) clientData; RegisteredInterp *searchPtr, *prevPtr; @@ -663,11 +665,11 @@ DdeServerProc( * sure we have a valid topic. */ - len = DdeQueryString(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, CP_WINUNICODE); for (riPtr = tsdPtr->interpListPtr; riPtr != NULL; @@ -688,11 +690,11 @@ DdeServerProc( * result to return in an XTYP_REQUEST. */ - len = DdeQueryString(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeTopic, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeTopic, utilString, (DWORD) len + 1, CP_WINUNICODE); for (riPtr = tsdPtr->interpListPtr; riPtr != NULL; riPtr = riPtr->nextPtr) { @@ -756,12 +758,12 @@ DdeServerProc( Tcl_DString dsBuf; char *returnString; - len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); Tcl_DStringInit(&dString); Tcl_DStringInit(&dsBuf); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINUNICODE); if (_wcsicmp(utilString, TCL_DDE_EXECUTE_RESULT) == 0) { returnString = @@ -836,10 +838,10 @@ DdeServerProc( Tcl_DStringInit(&dString); Tcl_DStringInit(&ds2); - len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); + len = DdeQueryStringW(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); Tcl_DStringSetLength(&dString, (len + 1) * sizeof(WCHAR) - 1); utilString = (WCHAR *) Tcl_DStringValue(&dString); - DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, + DdeQueryStringW(ddeInstance, ddeItem, utilString, (DWORD) len + 1, CP_WINUNICODE); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(utilString, wcslen(utilString), &ds); @@ -954,9 +956,9 @@ DdeServerProc( len = dlen; for (i = 0, riPtr = tsdPtr->interpListPtr; i < numItems; i++, riPtr = riPtr->nextPtr) { - returnPtr[i].hszSvc = DdeCreateStringHandle(ddeInstance, + returnPtr[i].hszSvc = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); - returnPtr[i].hszTopic = DdeCreateStringHandle(ddeInstance, + returnPtr[i].hszTopic = DdeCreateStringHandleW(ddeInstance, riPtr->name, CP_WINUNICODE); } returnPtr[i].hszSvc = NULL; @@ -1022,8 +1024,8 @@ MakeDdeConnection( HSZ ddeTopic, ddeService; HCONV ddeConv; - ddeService = DdeCreateStringHandle(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); - ddeTopic = DdeCreateStringHandle(ddeInstance, name, CP_WINUNICODE); + ddeService = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); + ddeTopic = DdeCreateStringHandleW(ddeInstance, name, CP_WINUNICODE); ddeConv = DdeConnect(ddeInstance, ddeService, ddeTopic, NULL); DdeFreeStringHandle(ddeInstance, ddeService); @@ -1071,9 +1073,9 @@ static int DdeCreateClient( DdeEnumServices *es) { - WNDCLASSEX wc; - static const WCHAR *szDdeClientClassName = TEXT("TclEval client class"); - static const WCHAR *szDdeClientWindowName = TEXT("TclEval client window"); + WNDCLASSEXW wc; + static const WCHAR *szDdeClientClassName = L"TclEval client class"; + static const WCHAR *szDdeClientWindowName = L"TclEval client window"; memset(&wc, 0, sizeof(wc)); wc.cbSize = sizeof(wc); @@ -1085,8 +1087,8 @@ DdeCreateClient( * Register and create the callback window. */ - RegisterClassEx(&wc); - es->hwnd = CreateWindowEx(0, szDdeClientClassName, szDdeClientWindowName, + RegisterClassExW(&wc); + es->hwnd = CreateWindowExW(0, szDdeClientClassName, szDdeClientWindowName, WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL, (LPVOID)es); return TCL_OK; } @@ -1142,12 +1144,12 @@ DdeServicesOnAck( Tcl_Obj *matchPtr = Tcl_NewListObj(0, NULL); Tcl_Obj *resultPtr = Tcl_GetObjResult(es->interp); - GlobalGetAtomName(service, sz, 255); + GlobalGetAtomNameW(service, sz, 255); Tcl_DStringInit(&dString); Tcl_WCharToUtfDString(sz, wcslen(sz), &dString); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(Tcl_DStringValue(&dString), -1)); Tcl_DStringFree(&dString); - GlobalGetAtomName(topic, sz, 255); + GlobalGetAtomNameW(topic, sz, 255); Tcl_DStringInit(&dString); Tcl_WCharToUtfDString(sz, wcslen(sz), &dString); Tcl_ListObjAppendElement(NULL, matchPtr, Tcl_NewStringObj(Tcl_DStringValue(&dString), -1)); @@ -1206,8 +1208,8 @@ DdeGetServicesList( es.interp = interp; es.result = TCL_OK; es.service = (serviceName == NULL) - ? (ATOM)0 : GlobalAddAtom(serviceName); - es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtom(topicName); + ? (ATOM)0 : GlobalAddAtomW(serviceName); + es.topic = (topicName == NULL) ? (ATOM)0 : GlobalAddAtomW(topicName); Tcl_ResetResult(interp); /* our list is to be appended to result. */ DdeCreateClient(&es); @@ -1500,7 +1502,7 @@ DdeObjCmd( if (length == 0) { serviceName = NULL; } else if ((index != DDE_SERVERNAME) && (index != DDE_EVAL)) { - ddeService = DdeCreateStringHandle(ddeInstance, serviceName, + ddeService = DdeCreateStringHandleW(ddeInstance, serviceName, CP_WINUNICODE); } @@ -1514,7 +1516,7 @@ DdeObjCmd( if (length == 0) { topicName = NULL; } else { - ddeTopic = DdeCreateStringHandle(ddeInstance, topicName, + ddeTopic = DdeCreateStringHandleW(ddeInstance, topicName, CP_WINUNICODE); } } @@ -1624,7 +1626,7 @@ DdeObjCmd( result = TCL_ERROR; } else { Tcl_Obj *returnObjPtr; - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandleW(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(NULL, 0, hConv, ddeItem, @@ -1704,7 +1706,7 @@ DdeObjCmd( SetDdeError(interp); result = TCL_ERROR; } else { - ddeItem = DdeCreateStringHandle(ddeInstance, itemString, + ddeItem = DdeCreateStringHandleW(ddeInstance, itemString, CP_WINUNICODE); if (ddeItem != NULL) { ddeData = DdeClientTransaction(dataString, (DWORD) length, @@ -1873,7 +1875,7 @@ DdeObjCmd( 0xFFFFFFFF, hConv, 0, CF_UNICODETEXT, XTYP_EXECUTE, 30000, NULL); if (ddeData != 0) { - ddeCookie = DdeCreateStringHandle(ddeInstance, + ddeCookie = DdeCreateStringHandleW(ddeInstance, TCL_DDE_EXECUTE_RESULT, CP_WINUNICODE); ddeData = DdeClientTransaction(NULL, 0, hConv, ddeCookie, CF_UNICODETEXT, XTYP_REQUEST, 30000, NULL); diff --git a/win/tclWinReg.c b/win/tclWinReg.c index f89d120..b715209 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -13,8 +13,6 @@ */ #undef STATIC_BUILD -#undef TCL_UTF_MAX -#define TCL_UTF_MAX 3 #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif @@ -127,8 +125,13 @@ static int SetValue(Tcl_Interp *interp, Tcl_Obj *keyNameObj, Tcl_Obj *typeObj, REGSAM mode); #if (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7) +# if TCL_UTF_MAX > 3 +# define Tcl_WCharToUtfDString(a,b,c) Tcl_WinTCharToUtf(a,(b)*sizeof(WCHAR),c) +# define Tcl_UtfToWCharDString(a,b,c) Tcl_WinUtfToTChar(a,b,c) +# else # define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# endif #endif static unsigned char * @@ -542,7 +545,7 @@ DeleteValue( valueName = Tcl_GetString(valueNameObj); Tcl_DStringInit(&ds); Tcl_UtfToWCharDString(valueName, valueNameObj->length, &ds); - result = RegDeleteValue(key, (const WCHAR *)Tcl_DStringValue(&ds)); + result = RegDeleteValueW(key, (const WCHAR *)Tcl_DStringValue(&ds)); Tcl_DStringFree(&ds); if (result != ERROR_SUCCESS) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -616,7 +619,7 @@ GetKeyNames( resultPtr = Tcl_NewObj(); for (index = 0;; ++index) { bufSize = MAX_KEY_LENGTH; - result = RegEnumKeyEx(key, index, buffer, &bufSize, + result = RegEnumKeyExW(key, index, buffer, &bufSize, NULL, NULL, NULL, NULL); if (result != ERROR_SUCCESS) { if (result == ERROR_NO_MORE_ITEMS) { @@ -699,7 +702,7 @@ GetType( valueName = Tcl_GetString(valueNameObj); Tcl_DStringInit(&ds); nativeValue = Tcl_UtfToWCharDString(valueName, valueNameObj->length, &ds); - result = RegQueryValueEx(key, nativeValue, NULL, &type, + result = RegQueryValueExW(key, nativeValue, NULL, &type, NULL, NULL); Tcl_DStringFree(&ds); RegCloseKey(key); @@ -782,7 +785,7 @@ GetValue( Tcl_DStringInit(&buf); nativeValue = Tcl_UtfToWCharDString(valueName, valueNameObj->length, &buf); - result = RegQueryValueEx(key, nativeValue, NULL, &type, + result = RegQueryValueExW(key, nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); while (result == ERROR_MORE_DATA) { /* @@ -793,7 +796,7 @@ GetValue( length = Tcl_DStringLength(&data) * (2 / sizeof(WCHAR)); Tcl_DStringSetLength(&data, (int) length * sizeof(WCHAR)); - result = RegQueryValueEx(key, nativeValue, + result = RegQueryValueExW(key, nativeValue, NULL, &type, (BYTE *) Tcl_DStringValue(&data), &length); } Tcl_DStringFree(&buf); @@ -919,7 +922,7 @@ GetValueNames( */ size = MAX_KEY_LENGTH; - while (RegEnumValue(key,index, (WCHAR *)Tcl_DStringValue(&buffer), + while (RegEnumValueW(key,index, (WCHAR *)Tcl_DStringValue(&buffer), &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { Tcl_DStringInit(&ds); @@ -1031,7 +1034,7 @@ OpenSubKey( if (hostName) { Tcl_DStringInit(&buf); hostName = (char *) Tcl_UtfToWCharDString(hostName, -1, &buf); - result = RegConnectRegistry((WCHAR *)hostName, rootKey, + result = RegConnectRegistryW((WCHAR *)hostName, rootKey, &rootKey); Tcl_DStringFree(&buf); if (result != ERROR_SUCCESS) { @@ -1051,7 +1054,7 @@ OpenSubKey( if (flags & REG_CREATE) { DWORD create; - result = RegCreateKeyEx(rootKey, (WCHAR *)keyName, 0, NULL, + result = RegCreateKeyExW(rootKey, (WCHAR *)keyName, 0, NULL, REG_OPTION_NON_VOLATILE, mode, NULL, keyPtr, &create); } else if (rootKey == HKEY_PERFORMANCE_DATA) { /* @@ -1062,7 +1065,7 @@ OpenSubKey( *keyPtr = HKEY_PERFORMANCE_DATA; result = ERROR_SUCCESS; } else { - result = RegOpenKeyEx(rootKey, (WCHAR *)keyName, 0, mode, + result = RegOpenKeyExW(rootKey, (WCHAR *)keyName, 0, mode, keyPtr); } if (keyName) { @@ -1202,7 +1205,7 @@ RecursiveDeleteKey( } mode |= KEY_ENUMERATE_SUB_KEYS | DELETE | KEY_QUERY_VALUE; - result = RegOpenKeyEx(startKey, keyName, 0, mode, &hKey); + result = RegOpenKeyExW(startKey, keyName, 0, mode, &hKey); if (result != ERROR_SUCCESS) { return result; } @@ -1217,7 +1220,7 @@ RecursiveDeleteKey( */ size = MAX_KEY_LENGTH; - result = RegEnumKeyEx(hKey, 0, (WCHAR *)Tcl_DStringValue(&subkey), + result = RegEnumKeyExW(hKey, 0, (WCHAR *)Tcl_DStringValue(&subkey), &size, NULL, NULL, NULL, NULL); if (result == ERROR_NO_MORE_ITEMS) { /* @@ -1230,14 +1233,14 @@ RecursiveDeleteKey( HMODULE handle; checkExProc = 1; - handle = GetModuleHandle(TEXT("ADVAPI32")); + handle = GetModuleHandleW(L"ADVAPI32"); regDeleteKeyExProc = (LSTATUS (*) (HKEY, LPCWSTR, REGSAM, DWORD)) GetProcAddress(handle, "RegDeleteKeyExW"); } if (mode && regDeleteKeyExProc) { result = regDeleteKeyExProc(startKey, keyName, mode, 0); } else { - result = RegDeleteKey(startKey, keyName); + result = RegDeleteKeyW(startKey, keyName); } break; } else if (result == ERROR_SUCCESS) { @@ -1311,7 +1314,7 @@ SetValue( } value = ConvertDWORD((DWORD) type, (DWORD) value); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) &value, sizeof(DWORD)); } else if (type == REG_MULTI_SZ) { Tcl_DString data, buf; @@ -1346,7 +1349,7 @@ SetValue( Tcl_DStringInit(&buf); Tcl_UtfToWCharDString(Tcl_DStringValue(&data), Tcl_DStringLength(&data)+1, &buf); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) Tcl_DStringValue(&buf), (DWORD) Tcl_DStringLength(&buf)); Tcl_DStringFree(&data); @@ -1364,7 +1367,7 @@ SetValue( Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf)+1); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, (BYTE *) data, (DWORD) Tcl_DStringLength(&buf) + 1); Tcl_DStringFree(&buf); } else { @@ -1376,7 +1379,7 @@ SetValue( */ data = (BYTE *) getByteArrayFromObj(dataObj, &bytelength); - result = RegSetValueEx(key, (WCHAR *) valueName, 0, + result = RegSetValueExW(key, (WCHAR *) valueName, 0, (DWORD) type, data, (DWORD) bytelength); } @@ -1490,7 +1493,7 @@ AppendSystemError( if (Tcl_IsShared(resultPtr)) { resultPtr = Tcl_DuplicateObj(resultPtr); } - length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM + length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *) tMsgPtrPtr, 0, NULL); -- cgit v0.12 From 865ea5e678412f23106c8374c3113169e35439f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Sep 2019 13:53:39 +0000 Subject: More Win32 API impovals. --- generic/tclZipfs.c | 7 ++++++- win/tclWinConsole.c | 4 ++-- win/tclWinDde.c | 16 ++++++++-------- win/tclWinFile.c | 2 +- win/tclWinPipe.c | 2 +- win/tclWinReg.c | 2 +- win/tclWinSock.c | 16 ++++++++-------- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e0d08a7..2467588 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1161,7 +1161,7 @@ ZipFSOpenArchive( ZIPFS_POSIX_ERROR(interp, "invalid file size"); goto error; } - zf->mountHandle = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, + zf->mountHandle = CreateFileMappingW((HANDLE) handle, 0, PAGE_READONLY, 0, zf->length, 0); if (zf->mountHandle == INVALID_HANDLE_VALUE) { ZIPFS_POSIX_ERROR(interp, "file mapping failed"); @@ -4926,7 +4926,12 @@ TclZipfs_AppHook( { char *archive; +#ifdef _WIN32 + (void)argvPtr; + Tcl_FindExecutable(NULL); +#else Tcl_FindExecutable((*argvPtr)[0]); +#endif archive = (char *) Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index e7b87a7..dbec52b 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -229,7 +229,7 @@ ReadConsoleBytes( * will run and take whatever action it deems appropriate. */ do { - result = ReadConsole(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, + result = ReadConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); } while (result && ntchars == 0 && GetLastError() == ERROR_OPERATION_ABORTED); if (nbytesread != NULL) { @@ -248,7 +248,7 @@ WriteConsoleBytes( DWORD ntchars; BOOL result; - result = WriteConsole(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, + result = WriteConsoleW(hConsole, lpBuffer, nbytes / sizeof(WCHAR), &ntchars, NULL); if (nbyteswritten != NULL) { *nbyteswritten = ntchars * sizeof(WCHAR); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 1eded82..6fa9cc2 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -251,7 +251,7 @@ Initialize(void) if (ddeInstance == 0) { Tcl_MutexLock(&ddeMutex); if (ddeInstance == 0) { - if (DdeInitialize(&ddeInstance, (PFNCALLBACK) DdeServerProc, + if (DdeInitializeW(&ddeInstance, (PFNCALLBACK) DdeServerProc, CBF_SKIP_REGISTRATIONS | CBF_SKIP_UNREGISTRATIONS | CBF_FAIL_POKES, 0) != DMLERR_NO_ERROR) { ddeInstance = 0; @@ -1107,16 +1107,16 @@ DdeClientWindowProc( (DdeEnumServices *) lpcs->lpCreateParams; #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) es); + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) es); #else - SetWindowLong(hwnd, GWL_USERDATA, (LONG) es); + SetWindowLongW(hwnd, GWL_USERDATA, (LONG) es); #endif return (LRESULT) 0L; } case WM_DDE_ACK: return DdeServicesOnAck(hwnd, wParam, lParam); default: - return DefWindowProc(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -1134,9 +1134,9 @@ DdeServicesOnAck( Tcl_DString dString; #ifdef _WIN64 - es = (DdeEnumServices *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + es = (DdeEnumServices *) GetWindowLongPtrW(hwnd, GWLP_USERDATA); #else - es = (DdeEnumServices *) GetWindowLong(hwnd, GWL_USERDATA); + es = (DdeEnumServices *) GetWindowLongW(hwnd, GWL_USERDATA); #endif if (((es->service == (ATOM)0) || (es->service == service)) @@ -1179,7 +1179,7 @@ DdeServicesOnAck( * Tell the server we are no longer interested. */ - PostMessage(hwndRemote, WM_DDE_TERMINATE, (WPARAM)hwnd, 0L); + PostMessageW(hwndRemote, WM_DDE_TERMINATE, (WPARAM)hwnd, 0L); return 0L; } @@ -1191,7 +1191,7 @@ DdeEnumWindowsCallback( DWORD_PTR dwResult = 0; DdeEnumServices *es = (DdeEnumServices *) lParam; - SendMessageTimeout(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, + SendMessageTimeoutW(hwndTarget, WM_DDE_INITIATE, (WPARAM)es->hwnd, MAKELONG(es->service, es->topic), SMTO_ABORTIFHUNG, 1000, &dwResult); return TRUE; diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 3259ff7..0682d74 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -2207,7 +2207,7 @@ NativeDev( p = strchr(p + 1, '\\'); if (p == NULL) { /* - * Add terminating backslash to fullpath or GetVolumeInformation() + * Add terminating backslash to fullpath or GetVolumeInformationW() * won't work. */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index ed4bc22..26f0b3e 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1207,7 +1207,7 @@ HasConsole(void) { HANDLE handle; - handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, + handle = CreateFileW(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle != INVALID_HANDLE_VALUE) { diff --git a/win/tclWinReg.c b/win/tclWinReg.c index b715209..068e5d7 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -1449,7 +1449,7 @@ BroadcastValue( * Use the ignore the result. */ - result = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, + result = SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, (WPARAM) 0, (LPARAM) wstr, SMTO_ABORTIFHUNG, (UINT) timeout, &sendResult); Tcl_DStringFree(&ds); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 7a5c282..bb6c690 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -310,7 +310,7 @@ static ProcessGlobalValue hostName = */ #define SendSelectMessage(tsdPtr, message, payload) \ - SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \ + SendMessageW((tsdPtr)->hwnd, SOCKET_SELECT, \ (WPARAM) (message), (LPARAM) (payload)) @@ -501,7 +501,7 @@ TclpFinalizeSockets(void) if (tsdPtr->socketThread != NULL) { if (tsdPtr->hwnd != NULL) { - PostMessage(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0); + PostMessageW(tsdPtr->hwnd, SOCKET_TERMINATE, 0, 0); /* * Wait for the thread to exit. This ensures that we are @@ -2534,11 +2534,11 @@ InitSockets(void) tsdPtr->socketList = NULL; tsdPtr->hwnd = NULL; tsdPtr->threadId = Tcl_GetCurrentThread(); - tsdPtr->readyEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + tsdPtr->readyEvent = CreateEventW(NULL, FALSE, FALSE, NULL); if (tsdPtr->readyEvent == NULL) { goto initFailure; } - tsdPtr->socketListLock = CreateEvent(NULL, FALSE, TRUE, NULL); + tsdPtr->socketListLock = CreateEventW(NULL, FALSE, TRUE, NULL); if (tsdPtr->socketListLock == NULL) { goto initFailure; } @@ -3205,7 +3205,7 @@ SocketThread( /* * Process all messages on the socket window until WM_QUIT. This threads * exits only when instructed to do so by the call to - * PostMessage(SOCKET_TERMINATE) in TclpFinalizeSockets(). + * PostMessageW(SOCKET_TERMINATE) in TclpFinalizeSockets(). */ while (GetMessageW(&msg, NULL, 0, 0) > 0) { @@ -3256,7 +3256,7 @@ SocketProc( #ifdef _WIN64 GetWindowLongPtrW(hwnd, GWLP_USERDATA); #else - GetWindowLong(hwnd, GWL_USERDATA); + GetWindowLongW(hwnd, GWL_USERDATA); #endif switch (message) { @@ -3271,10 +3271,10 @@ SocketProc( */ #ifdef _WIN64 - SetWindowLongPtr(hwnd, GWLP_USERDATA, + SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) ((LPCREATESTRUCT)lParam)->lpCreateParams); #else - SetWindowLong(hwnd, GWL_USERDATA, + SetWindowLongW(hwnd, GWL_USERDATA, (LONG) ((LPCREATESTRUCT)lParam)->lpCreateParams); #endif break; -- cgit v0.12 From 9348f2301275b473b59425310f3ac4beb7e545c0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Nov 2019 12:34:27 +0000 Subject: Fix tclScan.c, not generating a string representation any more with unsigned wideints --- generic/tcl.h | 2 +- generic/tclScan.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 5822d86..6453ed7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -361,7 +361,7 @@ typedef long LONG; */ #if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) -# if defined(_MSC_VER) || (defined(_WIN32) && !defined(__cplusplus)) +# if defined(_MSC_VER) || defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 # define TCL_LL_MODIFIER "I64" # if defined(_WIN64) diff --git a/generic/tclScan.c b/generic/tclScan.c index 67138e6..24b4374 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -934,8 +934,9 @@ Tcl_ScanObjCmd( } } if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) { - sprintf(buf, "%" TCL_LL_MODIFIER "u", wideValue); - Tcl_SetStringObj(objPtr, buf, -1); + mp_int big; + TclBNInitBignumFromWideUInt(&big, (Tcl_WideUInt)wideValue); + Tcl_SetBignumObj(objPtr, &big); } else { TclSetIntObj(objPtr, wideValue); } -- cgit v0.12 From 368faf4c43d67c935838001b500d1d8f8eea8f22 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2019 13:11:09 +0000 Subject: Update win/tcl.m4, for use with C++ --- win/configure | 15 ++++++++++++--- win/tcl.m4 | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/win/configure b/win/configure index 71bbdeb..5a7fbea 100755 --- a/win/configure +++ b/win/configure @@ -3973,14 +3973,14 @@ $as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -4214,10 +4214,19 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith -Wunused-parameter" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith -Wunused-parameter" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" diff --git a/win/tcl.m4 b/win/tcl.m4 index 37f3bab..59dd673 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -541,14 +541,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" + CC="x86_64-w64-mingw32-${CC}" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" RANLIB="x86_64-w64-mingw32-ranlib" RC="x86_64-w64-mingw32-windres" ;; *) - CC="i686-w64-mingw32-gcc" + CC="i686-w64-mingw32-${CC}" LD="i686-w64-mingw32-ld" AR="i686-w64-mingw32-ar" RANLIB="i686-w64-mingw32-ranlib" @@ -685,10 +685,19 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith -Wunused-parameter" + CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith -Wunused-parameter" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= + case "${CC}" in + *++) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + ;; + esac + # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" -- cgit v0.12 From bb09dba8c07eb42beccc0249f53dc2ca25bb01ed Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 20 Dec 2019 16:11:54 +0000 Subject: Fix 2 unused arguments with USE_DTRACE --- generic/tclBasic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f58cec0..2169b9d 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8828,10 +8828,12 @@ DTraceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)dummy; + (void)interp; + if (TCL_DTRACE_TCL_PROBE_ENABLED()) { char *a[10]; int i = 0; - (void)dummy; while (i++ < 10) { a[i-1] = i < objc ? TclGetString(objv[i]) : NULL; -- cgit v0.12