diff options
Diffstat (limited to 'generic/tclOOCall.c')
| -rw-r--r-- | generic/tclOOCall.c | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index f6d675c..3bd96a2 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -137,7 +137,7 @@ static inline int IsStillValid(CallChain *callPtr, Object *oPtr, int flags, int reuseMask); static Tcl_NRPostProc ResetFilterFlags; static Tcl_NRPostProc SetFilterFlags; -static int SortMethodNames(Tcl_HashTable *namesPtr, int flags, +static size_t SortMethodNames(Tcl_HashTable *namesPtr, int flags, const char ***stringsPtr); static inline void StashCallChain(Tcl_Obj *objPtr, CallChain *callPtr); @@ -306,7 +306,7 @@ FreeMethodNameRep( int TclOOInvokeContext( - ClientData clientData, /* The method call context. */ + void *clientData, /* The method call context. */ Tcl_Interp *interp, /* Interpreter for error reporting, and many * other sorts of context handling (e.g., * commands, variables) depending on method @@ -375,7 +375,7 @@ TclOOInvokeContext( static int SetFilterFlags( - ClientData data[], + void *data[], TCL_UNUSED(Tcl_Interp *), int result) { @@ -387,7 +387,7 @@ SetFilterFlags( static int ResetFilterFlags( - ClientData data[], + void *data[], TCL_UNUSED(Tcl_Interp *), int result) { @@ -399,7 +399,7 @@ ResetFilterFlags( static int FinalizeMethodRefs( - ClientData data[], + void *data[], TCL_UNUSED(Tcl_Interp *), int result) { @@ -445,7 +445,7 @@ TclOOGetSortedMethodList( * at. Is set-like in nature and keyed by * pointer to class. */ FOREACH_HASH_DECLS; - int i, numStrings; + size_t i, numStrings; Class *mixinPtr; Tcl_Obj *namePtr; Method *mPtr; @@ -521,7 +521,7 @@ TclOOGetSortedMethodList( return numStrings; } -int +size_t TclOOGetSortedClassMethodList( Class *clsPtr, /* The class to get the method names for. */ int flags, /* Whether we just want the public method @@ -535,7 +535,7 @@ TclOOGetSortedClassMethodList( /* Used to track what classes have been looked * at. Is set-like in nature and keyed by * pointer to class. */ - int numStrings; + size_t numStrings; Tcl_InitObjHashTable(&names); Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS); @@ -580,7 +580,7 @@ TclOOGetSortedClassMethodList( * ---------------------------------------------------------------------- */ -static int +static size_t SortMethodNames( Tcl_HashTable *namesPtr, /* The table of names; unsorted, but contains * whether the names are wanted and under what @@ -686,14 +686,14 @@ AddClassMethodNames( * pointers to the classes, and the values are * immaterial. */ { - int i; + size_t i; /* * If we've already started looking at this class, stop working on it now * to prevent repeated work. */ - if (Tcl_FindHashEntry(examinedClassesPtr, (char *) clsPtr)) { + if (Tcl_FindHashEntry(examinedClassesPtr, clsPtr)) { return; } @@ -710,7 +710,7 @@ AddClassMethodNames( Method *mPtr; int isNew; - (void) Tcl_CreateHashEntry(examinedClassesPtr, (char *) clsPtr, + (void) Tcl_CreateHashEntry(examinedClassesPtr, clsPtr, &isNew); if (!isNew) { break; @@ -769,7 +769,7 @@ AddPrivateMethodNames( if (IS_PRIVATE(mPtr)) { int isNew; - hPtr = Tcl_CreateHashEntry(namesPtr, (char *) namePtr, &isNew); + hPtr = Tcl_CreateHashEntry(namesPtr, namePtr, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(IN_LIST)); } } @@ -785,7 +785,7 @@ AddStandardMethodName( if (!IS_PRIVATE(mPtr)) { int isNew; Tcl_HashEntry *hPtr = - Tcl_CreateHashEntry(namesPtr, (char *) namePtr, &isNew); + Tcl_CreateHashEntry(namesPtr, namePtr, &isNew); if (isNew) { int isWanted = (!WANT_PUBLIC(flags) || IS_PUBLIC(mPtr)) @@ -833,7 +833,7 @@ AddInstancePrivateToCallContext( int donePrivate = 0; if (oPtr->methodsPtr) { - hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, (char *) methodName); + hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, methodName); if (hPtr != NULL) { mPtr = (Method *)Tcl_GetHashValue(hPtr); if (IS_PRIVATE(mPtr)) { @@ -877,12 +877,13 @@ AddSimpleChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i, foundPrivate = 0, blockedUnexported = 0; + size_t i; + int foundPrivate = 0, blockedUnexported = 0; Tcl_HashEntry *hPtr; Method *mPtr; if (!(flags & (KNOWN_STATE | SPECIAL)) && oPtr->methodsPtr) { - hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, (char *) methodNameObj); + hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, methodNameObj); if (hPtr != NULL) { mPtr = (Method *)Tcl_GetHashValue(hPtr); @@ -913,7 +914,7 @@ AddSimpleChainToCallContext( flags | TRAVERSED_MIXIN, filterDecl); } if (oPtr->methodsPtr && !blockedUnexported) { - hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, (char *)methodNameObj); + hPtr = Tcl_FindHashEntry(oPtr->methodsPtr, methodNameObj); if (hPtr != NULL) { mPtr = (Method *)Tcl_GetHashValue(hPtr); if (!IS_PRIVATE(mPtr)) { @@ -1149,8 +1150,8 @@ TclOOGetCallContext( CallContext *contextPtr; CallChain *callPtr; struct ChainBuilder cb; - size_t count; - int i, doFilters, donePrivate = 0; + size_t i, count; + int doFilters, donePrivate = 0; Tcl_HashEntry *hPtr; Tcl_HashTable doneFilters; @@ -1205,14 +1206,14 @@ TclOOGetCallContext( if (oPtr->flags & USE_CLASS_CACHE) { if (oPtr->selfCls->classChainCache != NULL) { hPtr = Tcl_FindHashEntry(oPtr->selfCls->classChainCache, - (char *) methodNameObj); + methodNameObj); } else { hPtr = NULL; } } else { if (oPtr->chainCache != NULL) { hPtr = Tcl_FindHashEntry(oPtr->chainCache, - (char *) methodNameObj); + methodNameObj); } else { hPtr = NULL; } @@ -1342,7 +1343,7 @@ TclOOGetCallContext( Tcl_InitObjHashTable(oPtr->selfCls->classChainCache); } hPtr = Tcl_CreateHashEntry(oPtr->selfCls->classChainCache, - (char *) methodNameObj, &isNew); + methodNameObj, &isNew); } else { if (oPtr->chainCache == NULL) { oPtr->chainCache = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable)); @@ -1350,7 +1351,7 @@ TclOOGetCallContext( Tcl_InitObjHashTable(oPtr->chainCache); } hPtr = Tcl_CreateHashEntry(oPtr->chainCache, - (char *) methodNameObj, &isNew); + methodNameObj, &isNew); } } callPtr->refCount++; @@ -1436,7 +1437,7 @@ TclOOGetStereotypeCallChain( if (clsPtr->classChainCache != NULL) { hPtr = Tcl_FindHashEntry(clsPtr->classChainCache, - (char *) methodNameObj); + methodNameObj); if (hPtr != NULL && Tcl_GetHashValue(hPtr) != NULL) { const int reuseMask = (WANT_PUBLIC(flags) ? ~0 : ~PUBLIC_METHOD); @@ -1512,7 +1513,7 @@ TclOOGetStereotypeCallChain( Tcl_InitObjHashTable(clsPtr->classChainCache); } hPtr = Tcl_CreateHashEntry(clsPtr->classChainCache, - (char *) methodNameObj, &isNew); + methodNameObj, &isNew); } callPtr->refCount++; Tcl_SetHashValue(hPtr, callPtr); @@ -1545,7 +1546,8 @@ AddClassFiltersToCallContext( int flags) /* Whether we've gone along a mixin link * yet. */ { - int i, clearedFlags = + size_t i; + int clearedFlags = flags & ~(TRAVERSED_MIXIN|OBJECT_MIXIN|BUILDING_MIXINS); Class *superPtr, *mixinPtr; Tcl_Obj *filterObj; @@ -1575,8 +1577,7 @@ AddClassFiltersToCallContext( FOREACH(filterObj, clsPtr->filters) { int isNew; - (void) Tcl_CreateHashEntry(doneFilters, (char *) filterObj, - &isNew); + (void) Tcl_CreateHashEntry(doneFilters, filterObj, &isNew); if (isNew) { AddSimpleChainToCallContext(oPtr, NULL, filterObj, cbPtr, doneFilters, clearedFlags|BUILDING_MIXINS, clsPtr); @@ -1634,7 +1635,7 @@ AddPrivatesFromClassChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i; + size_t i; Class *superPtr; /* @@ -1712,7 +1713,8 @@ AddSimpleClassChainToCallContext( * NULL, either the filter was declared by the * object or this isn't a filter. */ { - int i, privateDanger = 0; + size_t i; + int privateDanger = 0; Class *superPtr; /* @@ -1738,7 +1740,7 @@ AddSimpleClassChainToCallContext( filterDecl, flags); } else { Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&classPtr->classMethods, - (char *) methodNameObj); + methodNameObj); if (classPtr->flags & HAS_PRIVATE_METHODS) { privateDanger |= 1; @@ -1825,7 +1827,7 @@ TclOORenderCallChain( */ objv = (Tcl_Obj **)TclStackAlloc(interp, callPtr->numChain * sizeof(Tcl_Obj *)); - for (i = 0 ; i < callPtr->numChain ; i++) { + for (i = 0 ; i < (size_t)callPtr->numChain ; i++) { struct MInvoke *miPtr = &callPtr->chain[i]; descObjs[0] = @@ -1953,7 +1955,7 @@ AddSimpleDefineNamespaces( * building. */ { Class *mixinPtr; - int i; + size_t i; FOREACH(mixinPtr, oPtr->mixins) { AddSimpleClassDefineNamespaces(mixinPtr, definePtr, @@ -1982,7 +1984,7 @@ AddSimpleClassDefineNamespaces( int flags) /* What sort of define chain are we * building. */ { - int i; + size_t i; Class *superPtr; /* |
