diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-02-28 12:46:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-02-28 12:46:42 (GMT) |
commit | 4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f (patch) | |
tree | d5db4ca8a1fecbd63d9e72730fad2f404367daff /generic/tclOO.c | |
parent | 63994a73e3f641451b26f48f697b6a069863751c (diff) | |
parent | 52e543c5691a60c3ef802fecf1ae08e7efcf19b7 (diff) | |
download | tcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.zip tcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.tar.gz tcl-4af90e27e5e22978b56d6cb5d0d1ecd90af0f48f.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index 5ffe294..14a3343 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -299,8 +299,8 @@ InitFoundation( { static Tcl_ThreadDataKey tsdKey; ThreadLocalData *tsdPtr = - Tcl_GetThreadData(&tsdKey, sizeof(ThreadLocalData)); - Foundation *fPtr = Tcl_Alloc(sizeof(Foundation)); + (ThreadLocalData *)Tcl_GetThreadData(&tsdKey, sizeof(ThreadLocalData)); + Foundation *fPtr = (Foundation *)Tcl_Alloc(sizeof(Foundation)); Tcl_Obj *namePtr; Tcl_DString buffer; Command *cmdPtr; @@ -533,7 +533,7 @@ static void DeletedDefineNamespace( ClientData clientData) { - Foundation *fPtr = clientData; + Foundation *fPtr = (Foundation *)clientData; fPtr->defineNs = NULL; } @@ -542,7 +542,7 @@ static void DeletedObjdefNamespace( ClientData clientData) { - Foundation *fPtr = clientData; + Foundation *fPtr = (Foundation *)clientData; fPtr->objdefNs = NULL; } @@ -551,7 +551,7 @@ static void DeletedHelpersNamespace( ClientData clientData) { - Foundation *fPtr = clientData; + Foundation *fPtr = (Foundation *)clientData; fPtr->helpersNs = NULL; } @@ -569,12 +569,13 @@ DeletedHelpersNamespace( static void KillFoundation( - ClientData clientData, /* Pointer to the OO system foundation + ClientData dummy, /* Pointer to the OO system foundation * structure. */ Tcl_Interp *interp) /* The interpreter containing the OO system * foundation. */ { Foundation *fPtr = GetFoundation(interp); + (void)dummy; TclDecrRefCount(fPtr->unknownMethodNameObj); TclDecrRefCount(fPtr->constructorName); @@ -624,7 +625,7 @@ AllocObject( CommandTrace *tracePtr; size_t creationEpoch; - oPtr = Tcl_Alloc(sizeof(Object)); + oPtr = (Object *)Tcl_Alloc(sizeof(Object)); memset(oPtr, 0, sizeof(Object)); /* @@ -735,7 +736,7 @@ AllocObject( cmdPtr = (Command *) oPtr->command; cmdPtr->nreProc = PublicNRObjectCmd; - cmdPtr->tracePtr = tracePtr = Tcl_Alloc(sizeof(CommandTrace)); + cmdPtr->tracePtr = tracePtr = (CommandTrace *)Tcl_Alloc(sizeof(CommandTrace)); tracePtr->traceProc = ObjectRenamedTrace; tracePtr->clientData = oPtr; tracePtr->flags = TCL_TRACE_RENAME|TCL_TRACE_DELETE; @@ -789,7 +790,7 @@ MyDeleted( ClientData clientData) /* Reference to the object whose [my] has been * squelched. */ { - Object *oPtr = clientData; + Object *oPtr = (Object *)clientData; oPtr->myCommand = NULL; } @@ -798,7 +799,7 @@ static void MyClassDeleted( ClientData clientData) { - Object *oPtr = clientData; + Object *oPtr = (Object *)clientData; oPtr->myclassCommand = NULL; } @@ -823,7 +824,10 @@ ObjectRenamedTrace( const char *newName, /* What it's getting renamed to. (unused) */ int flags) /* Why was the object deleted? */ { - Object *oPtr = clientData; + Object *oPtr = (Object *)clientData; + (void)interp; + (void)oldName; + (void)newName; /* * If this is a rename and not a delete of the object, we just flush the @@ -1110,7 +1114,7 @@ ObjectNamespaceDeleted( ClientData clientData) /* Pointer to the class whose namespace is * being deleted. */ { - Object *oPtr = clientData; + Object *oPtr = (Object *)clientData; Foundation *fPtr = oPtr->fPtr; FOREACH_HASH_DECLS; Class *mixinPtr; @@ -1394,9 +1398,9 @@ TclOOAddToInstances( if (clsPtr->instances.num >= clsPtr->instances.size) { clsPtr->instances.size += ALLOC_CHUNK; if (clsPtr->instances.size == ALLOC_CHUNK) { - clsPtr->instances.list = Tcl_Alloc(sizeof(Object *) * ALLOC_CHUNK); + clsPtr->instances.list = (Object **)Tcl_Alloc(sizeof(Object *) * ALLOC_CHUNK); } else { - clsPtr->instances.list = Tcl_Realloc(clsPtr->instances.list, + clsPtr->instances.list = (Object **)Tcl_Realloc(clsPtr->instances.list, sizeof(Object *) * clsPtr->instances.size); } } @@ -1493,9 +1497,9 @@ TclOOAddToSubclasses( if (superPtr->subclasses.num >= superPtr->subclasses.size) { superPtr->subclasses.size += ALLOC_CHUNK; if (superPtr->subclasses.size == ALLOC_CHUNK) { - superPtr->subclasses.list = Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK); + superPtr->subclasses.list = (Class **)Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK); } else { - superPtr->subclasses.list = Tcl_Realloc(superPtr->subclasses.list, + superPtr->subclasses.list = (Class **)Tcl_Realloc(superPtr->subclasses.list, sizeof(Class *) * superPtr->subclasses.size); } } @@ -1558,9 +1562,9 @@ TclOOAddToMixinSubs( if (superPtr->mixinSubs.num >= superPtr->mixinSubs.size) { superPtr->mixinSubs.size += ALLOC_CHUNK; if (superPtr->mixinSubs.size == ALLOC_CHUNK) { - superPtr->mixinSubs.list = Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK); + superPtr->mixinSubs.list = (Class **)Tcl_Alloc(sizeof(Class *) * ALLOC_CHUNK); } else { - superPtr->mixinSubs.list = Tcl_Realloc(superPtr->mixinSubs.list, + superPtr->mixinSubs.list = (Class **)Tcl_Realloc(superPtr->mixinSubs.list, sizeof(Class *) * superPtr->mixinSubs.size); } } @@ -1606,7 +1610,7 @@ TclOOAllocClass( * representation. */ { Foundation *fPtr = GetFoundation(interp); - Class *clsPtr = Tcl_Alloc(sizeof(Class)); + Class *clsPtr = (Class *)Tcl_Alloc(sizeof(Class)); memset(clsPtr, 0, sizeof(Class)); clsPtr->thisPtr = useThisObj; @@ -1623,7 +1627,7 @@ TclOOAllocClass( */ clsPtr->superclasses.num = 1; - clsPtr->superclasses.list = Tcl_Alloc(sizeof(Class *)); + clsPtr->superclasses.list = (Class **)Tcl_Alloc(sizeof(Class *)); clsPtr->superclasses.list[0] = fPtr->objectCls; AddRef(fPtr->objectCls->thisPtr); @@ -1851,10 +1855,10 @@ FinalizeAlloc( Tcl_Interp *interp, int result) { - CallContext *contextPtr = data[0]; - Object *oPtr = data[1]; - Tcl_InterpState state = data[2]; - Tcl_Object *objectPtr = data[3]; + CallContext *contextPtr = (CallContext *)data[0]; + Object *oPtr = (Object *)data[1]; + Tcl_InterpState state = (Tcl_InterpState)data[2]; + Tcl_Object *objectPtr = (Tcl_Object *)data[3]; /* * Ensure an error if the object was deleted in the constructor. Don't @@ -2074,11 +2078,11 @@ Tcl_CopyObjectInstance( TclOODecrRefCount(superPtr->thisPtr); } if (cls2Ptr->superclasses.num) { - cls2Ptr->superclasses.list = Tcl_Realloc(cls2Ptr->superclasses.list, + cls2Ptr->superclasses.list = (Class **)Tcl_Realloc(cls2Ptr->superclasses.list, sizeof(Class *) * clsPtr->superclasses.num); } else { cls2Ptr->superclasses.list = - Tcl_Alloc(sizeof(Class *) * clsPtr->superclasses.num); + (Class **)Tcl_Alloc(sizeof(Class *) * clsPtr->superclasses.num); } memcpy(cls2Ptr->superclasses.list, clsPtr->superclasses.list, sizeof(Class *) * clsPtr->superclasses.num); @@ -2372,7 +2376,7 @@ Tcl_ClassSetMetadata( if (metadata == NULL) { return; } - clsPtr->metadataPtr = Tcl_Alloc(sizeof(Tcl_HashTable)); + clsPtr->metadataPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(clsPtr->metadataPtr, TCL_ONE_WORD_KEYS); } @@ -2452,7 +2456,7 @@ Tcl_ObjectSetMetadata( if (metadata == NULL) { return; } - oPtr->metadataPtr = Tcl_Alloc(sizeof(Tcl_HashTable)); + oPtr->metadataPtr = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(oPtr->metadataPtr, TCL_ONE_WORD_KEYS); } @@ -2511,7 +2515,7 @@ PublicNRObjectCmd( int objc, Tcl_Obj *const *objv) { - return TclOOObjectCmdCore(clientData, interp, objc, objv, PUBLIC_METHOD, + return TclOOObjectCmdCore((Object *)clientData, interp, objc, objv, PUBLIC_METHOD, NULL); } @@ -2532,7 +2536,7 @@ PrivateNRObjectCmd( int objc, Tcl_Obj *const *objv) { - return TclOOObjectCmdCore(clientData, interp, objc, objv, 0, NULL); + return TclOOObjectCmdCore((Object *)clientData, interp, objc, objv, 0, NULL); } int @@ -2593,7 +2597,7 @@ MyClassNRObjCmd( int objc, Tcl_Obj *const *objv) { - Object *oPtr = clientData; + Object *oPtr = (Object *)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "methodName ?arg ...?"); @@ -2652,7 +2656,7 @@ TclOOObjectCmdCore( */ if (framePtr->isProcCallFrame & FRAME_IS_METHOD) { - CallContext *callerContextPtr = framePtr->clientData; + CallContext *callerContextPtr = (CallContext *)framePtr->clientData; Method *callerMethodPtr = callerContextPtr->callPtr->chain[callerContextPtr->index].mPtr; @@ -2761,15 +2765,16 @@ TclOOObjectCmdCore( static int FinalizeObjectCall( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { + (void)dummy; /* * Dispose of the call chain, which drops the lock on the object's * structure. */ - TclOODeleteContext(data[0]); + TclOODeleteContext((CallContext *)data[0]); return result; } @@ -2922,10 +2927,11 @@ TclNRObjectContextInvokeNext( static int FinalizeNext( ClientData data[], - Tcl_Interp *interp, + Tcl_Interp *dummy, int result) { - CallContext *contextPtr = data[0]; + CallContext *contextPtr = (CallContext *)data[0]; + (void)dummy; /* * Restore the call chain context index as we've finished the inner invoke @@ -2966,7 +2972,7 @@ Tcl_GetObjectFromObj( goto notAnObject; } } - return cmdPtr->objClientData; + return (Tcl_Object)cmdPtr->objClientData; notAnObject: Tcl_SetObjResult(interp, Tcl_ObjPrintf( |