From 4eefa7b3a6b659a083c0697a4ded7779823b495c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 8 Dec 2018 08:24:22 +0000 Subject: Eliminate USE_OLD_TAG_SEARCH: It isn't used and tested any more. Eliminate a ton of unnecessary type casts --- generic/tkBind.c | 19 ++- generic/tkBitmap.c | 6 +- generic/tkBusy.c | 2 +- generic/tkCanvas.c | 385 ++-------------------------------------------- generic/tkClipboard.c | 4 +- generic/tkCmds.c | 2 +- generic/tkCursor.c | 4 +- generic/tkGC.c | 2 +- generic/tkGeometry.c | 2 +- generic/tkGrid.c | 2 +- generic/tkImgPhInstance.c | 2 +- generic/tkPack.c | 2 +- generic/tkPlace.c | 12 +- generic/tkSelect.c | 2 +- generic/tkTest.c | 44 +++--- generic/tkText.c | 2 +- generic/tkTextDisp.c | 2 +- generic/tkWindow.c | 4 +- generic/ttk/ttkBlink.c | 2 +- generic/ttk/ttkEntry.c | 6 +- generic/ttk/ttkProgress.c | 2 +- unix/tkUnixButton.c | 2 +- unix/tkUnixEvent.c | 2 +- unix/tkUnixMenubu.c | 2 +- unix/tkUnixScale.c | 2 +- unix/tkUnixScrlbr.c | 2 +- unix/tkUnixSelect.c | 2 +- unix/tkUnixWm.c | 2 +- win/tkWinButton.c | 10 +- win/tkWinDialog.c | 2 +- win/tkWinEmbed.c | 8 +- win/tkWinMenu.c | 15 +- win/tkWinScrlbr.c | 8 +- win/tkWinTest.c | 12 +- win/tkWinWindow.c | 6 +- win/tkWinWm.c | 2 +- win/tkWinX.c | 6 +- win/ttkWinMonitor.c | 2 +- 38 files changed, 118 insertions(+), 475 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index 89839d3..469725e 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -997,7 +997,7 @@ Tk_DeleteBinding( * its pattern. */ - hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object); + hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, object); if (hPtr == NULL) { Tcl_Panic("Tk_DeleteBinding couldn't find object table entry"); } @@ -1110,7 +1110,7 @@ Tk_GetAllBindings( Tcl_HashEntry *hPtr; Tcl_Obj *resultObj; - hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object); + hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, object); if (hPtr == NULL) { return; } @@ -1154,7 +1154,7 @@ Tk_DeleteAllBindings( PatSeq *nextPtr; Tcl_HashEntry *hPtr; - hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object); + hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, object); if (hPtr == NULL) { return; } @@ -1376,14 +1376,14 @@ Tk_BindEvent( key.type = ringPtr->type; key.detail = detail; - hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key); + hPtr = Tcl_FindHashEntry(veptPtr, &key); if (hPtr != NULL) { vMatchDetailList = Tcl_GetHashValue(hPtr); } if (key.detail.clientData != 0) { key.detail.clientData = 0; - hPtr = Tcl_FindHashEntry(veptPtr, (char *) &key); + hPtr = Tcl_FindHashEntry(veptPtr, &key); if (hPtr != NULL) { vMatchNoDetailList = Tcl_GetHashValue(hPtr); } @@ -1415,7 +1415,7 @@ Tk_BindEvent( key.object = *objectPtr; key.type = ringPtr->type; key.detail = detail; - hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key); + hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, &key); if (hPtr != NULL) { matchPtr = MatchPatterns(dispPtr, bindPtr, Tcl_GetHashValue(hPtr), matchPtr, NULL, &sourcePtr); @@ -1433,7 +1433,7 @@ Tk_BindEvent( if ((detail.clientData != 0) && (matchPtr == NULL)) { key.detail.clientData = 0; - hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, (char *) &key); + hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, &key); if (hPtr != NULL) { matchPtr = MatchPatterns(dispPtr, bindPtr, Tcl_GetHashValue(hPtr), matchPtr, NULL, &sourcePtr); @@ -1806,8 +1806,7 @@ MatchPatterns( key.detail.name = (Tk_Uid) Tcl_GetHashKey(hPtr->tablePtr, hPtr); - hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, - (char *) &key); + hPtr = Tcl_FindHashEntry(&bindPtr->patternTable, &key); if (hPtr != NULL) { /* * This tag is interested in this virtual event and its @@ -4291,7 +4290,7 @@ TkKeysymToString( KeySym keysym) { #ifdef REDO_KEYSYM_LOOKUP - Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym); + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, keysym); if (hPtr != NULL) { return Tcl_GetHashValue(hPtr); diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 88f3e2b..a2730d7 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -536,7 +536,7 @@ Tk_NameOfBitmap( Tcl_Panic("Tk_NameOfBitmap received unknown bitmap argument"); } - idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap); + idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { goto unknown; } @@ -578,7 +578,7 @@ Tk_SizeOfBitmap( Tcl_Panic("Tk_SizeOfBitmap received unknown bitmap argument"); } - idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap); + idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { goto unknownBitmap; } @@ -667,7 +667,7 @@ Tk_FreeBitmap( Tcl_Panic("Tk_FreeBitmap called before Tk_GetBitmap"); } - idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, (char *) bitmap); + idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 8b8db66..97fa13d 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -687,7 +687,7 @@ GetBusy( &tkwin) != TCL_OK) { return NULL; } - hPtr = Tcl_FindHashEntry(busyTablePtr, (char *) tkwin); + hPtr = Tcl_FindHashEntry(busyTablePtr, tkwin); if (hPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find busy window \"%s\"", Tcl_GetString(windowObj))); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index fa7559c..18585d2 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -13,8 +13,6 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -/* #define USE_OLD_TAG_SEARCH 1 */ - #include "tkInt.h" #include "tkCanvas.h" #include "default.h" @@ -28,26 +26,6 @@ * See tkCanvas.h for key data structures used to implement canvases. */ -#ifdef USE_OLD_TAG_SEARCH -/* - * The structure defined below is used to keep track of a tag search in - * progress. No field should be accessed by anyone other than StartTagSearch - * and NextItem. - */ - -typedef struct TagSearch { - TkCanvas *canvasPtr; /* Canvas widget being searched. */ - Tk_Uid tag; /* Tag to search for. 0 means return all - * items. */ - Tk_Item *currentPtr; /* Pointer to last item returned. */ - Tk_Item *lastPtr; /* The item right before the currentPtr is - * tracked so if the currentPtr is deleted we - * don't have to start from the beginning. */ - int searchOver; /* Non-zero means NextItem should always - * return NULL. */ -} TagSearch; - -#else /* USE_OLD_TAG_SEARCH */ /* * The structure defined below is used to keep track of a tag search in * progress. No field should be accessed by anyone other than TagSearchScan, @@ -94,8 +72,6 @@ typedef struct TagSearch { #define SEARCH_TYPE_TAG 3 /* Looking for an item by simple tag */ #define SEARCH_TYPE_EXPR 4 /* Compound search */ -#endif /* USE_OLD_TAG_SEARCH */ - /* * Custom option for handling "-state" and "-offset" */ @@ -215,7 +191,6 @@ static Tk_ItemType *typeList = NULL; * yet. */ TCL_DECLARE_MUTEX(typeListMutex) -#ifndef USE_OLD_TAG_SEARCH /* * Uids for operands in compiled advanced tag search expressions. * Initialization is done by GetStaticUids() @@ -236,7 +211,6 @@ typedef struct { static Tcl_ThreadDataKey dataKey; static SearchUids * GetStaticUids(void); -#endif /* USE_OLD_TAG_SEARCH */ /* * Prototypes for functions defined later in this file: @@ -267,40 +241,25 @@ static void CanvasWorldChanged(ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, int flags); -static void DestroyCanvas(char *memPtr); -static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom); +static void DestroyCanvas(void *memPtr); +static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom); static void DisplayCanvas(ClientData clientData); static void DoItem(Tcl_Obj *accumObj, Tk_Item *itemPtr, Tk_Uid tag); static void EventuallyRedrawItem(TkCanvas *canvasPtr, Tk_Item *itemPtr); -#ifdef USE_OLD_TAG_SEARCH -static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, - int argc, Tcl_Obj *const *argv, - Tcl_Obj *newTagObj, int first); -#else /* USE_OLD_TAG_SEARCH */ static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, Tcl_Obj *newTagObj, int first, TagSearch **searchPtrPtr); -#endif /* USE_OLD_TAG_SEARCH */ static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, Tcl_Obj *const *argv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); static const char** TkGetStringsFromObjs(int argc, Tcl_Obj *const *objv); static void InitCanvas(void); -#ifdef USE_OLD_TAG_SEARCH -static Tk_Item * NextItem(TagSearch *searchPtr); -#endif /* USE_OLD_TAG_SEARCH */ static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr); static Tcl_Obj * ScrollFractions(int screen1, int screen2, int object1, int object2); -#ifdef USE_OLD_TAG_SEARCH -static void RelinkItems(TkCanvas *canvasPtr, - Tcl_Obj *tag, Tk_Item *prevPtr); -static Tk_Item * StartTagSearch(TkCanvas *canvasPtr, - Tcl_Obj *tag, TagSearch *searchPtr); -#else /* USE_OLD_TAG_SEARCH */ static int RelinkItems(TkCanvas *canvasPtr, Tcl_Obj *tag, Tk_Item *prevPtr, TagSearch **searchPtrPtr); static void TagSearchExprInit(TagSearchExpr **exprPtrPtr); @@ -314,7 +273,6 @@ static int TagSearchEvalExpr(TagSearchExpr *expr, Tk_Item *itemPtr); static Tk_Item * TagSearchFirst(TagSearch *searchPtr); static Tk_Item * TagSearchNext(TagSearch *searchPtr); -#endif /* USE_OLD_TAG_SEARCH */ /* * The structure below defines canvas class behavior by means of functions @@ -332,17 +290,6 @@ static const Tk_ClassProcs canvasClass = { * Macros that significantly simplify all code that finds items. */ -#ifdef USE_OLD_TAG_SEARCH -#define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \ - itemPtr = StartTagSearch(canvasPtr,(objPtr),&search) -#define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \ - for (itemPtr = StartTagSearch(canvasPtr, (objPtr), &search); \ - itemPtr != NULL; itemPtr = NextItem(&search)) -#define FIND_ITEMS(objPtr, n) \ - FindItems(interp, canvasPtr, objc, objv, (objPtr), (n)) -#define RELINK_ITEMS(objPtr, itemPtr) \ - RelinkItems(canvasPtr, (objPtr), (itemPtr)) -#else /* USE_OLD_TAG_SEARCH */ #define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \ if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \ errorExitClause; \ @@ -358,7 +305,6 @@ static const Tk_ClassProcs canvasClass = { FindItems(interp, canvasPtr, objc, objv, (objPtr), (n), &searchPtr) #define RELINK_ITEMS(objPtr, itemPtr) \ result = RelinkItems(canvasPtr, (objPtr), (itemPtr), &searchPtr) -#endif /* USE_OLD_TAG_SEARCH */ /* * ---------------------------------------------------------------------- @@ -736,9 +682,7 @@ Tk_CanvasObjCmd( canvasPtr->tsoffset.flags = 0; canvasPtr->tsoffset.xoffset = 0; canvasPtr->tsoffset.yoffset = 0; -#ifndef USE_OLD_TAG_SEARCH canvasPtr->bindTagExprs = NULL; -#endif Tcl_InitHashTable(&canvasPtr->idTable, TCL_ONE_WORD_KEYS); Tk_SetClass(canvasPtr->tkwin, "Canvas"); @@ -793,12 +737,8 @@ CanvasWidgetCmd( int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ -#ifdef USE_OLD_TAG_SEARCH - TagSearch search; -#else /* USE_OLD_TAG_SEARCH */ TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by * TagSearchDestroy */ -#endif /* USE_OLD_TAG_SEARCH */ int index; static const char *const optionStrings[] = { @@ -900,7 +840,7 @@ CanvasWidgetCmd( break; } case CANV_BIND: { - ClientData object; + void *object; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?sequence? ?command?"); @@ -914,35 +854,6 @@ CanvasWidgetCmd( */ object = NULL; -#ifdef USE_OLD_TAG_SEARCH - if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))) { - int id; - char *end; - Tcl_HashEntry *entryPtr; - - id = strtoul(Tcl_GetString(objv[2]), &end, 0); - if (*end != 0) { - goto bindByTag; - } - entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char *) id); - if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); - object = itemPtr; - } - - if (object == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "item \"%s\" doesn't exist", Tcl_GetString(objv[2]))); - Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM", - Tcl_GetString(objv[2]), NULL); - result = TCL_ERROR; - goto done; - } - } else { - bindByTag: - object = Tk_GetUid(Tcl_GetString(objv[2])); - } -#else /* USE_OLD_TAG_SEARCH */ result = TagSearchScan(canvasPtr, objv[2], &searchPtr); if (result != TCL_OK) { goto done; @@ -951,7 +862,7 @@ CanvasWidgetCmd( Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(searchPtr->id)); + INT2PTR(searchPtr->id)); if (entryPtr != NULL) { itemPtr = Tcl_GetHashValue(entryPtr); object = itemPtr; @@ -966,9 +877,8 @@ CanvasWidgetCmd( goto done; } } else { - object = (ClientData) searchPtr->expr->uid; + object = (char *)searchPtr->expr->uid; } -#endif /* USE_OLD_TAG_SEARCH */ /* * Make a binding table if the canvas doesn't already have one. @@ -988,7 +898,6 @@ CanvasWidgetCmd( object, Tcl_GetString(objv[3])); goto done; } -#ifndef USE_OLD_TAG_SEARCH if (searchPtr->type == SEARCH_TYPE_EXPR) { /* * If new tag expression, then insert in linked list. @@ -1019,7 +928,6 @@ CanvasWidgetCmd( searchPtr->expr = NULL; } } -#endif /* not USE_OLD_TAG_SEARCH */ if (argv4[0] == '+') { argv4++; append = 1; @@ -1317,7 +1225,7 @@ CanvasWidgetCmd( itemPtr->nextPtr = NULL; entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(itemPtr->id), &isNew); + INT2PTR(itemPtr->id), &isNew); Tcl_SetHashValue(entryPtr, itemPtr); itemPtr->prevPtr = canvasPtr->lastItemPtr; canvasPtr->hotPtr = itemPtr; @@ -1396,7 +1304,7 @@ CanvasWidgetCmd( ckfree(itemPtr->tagPtr); } entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(itemPtr->id)); + INT2PTR(itemPtr->id)); Tcl_DeleteHashEntry(entryPtr); if (itemPtr->nextPtr != NULL) { itemPtr->nextPtr->prevPtr = itemPtr->prevPtr; @@ -2176,9 +2084,7 @@ CanvasWidgetCmd( } done: -#ifndef USE_OLD_TAG_SEARCH TagSearchDestroy(searchPtr); -#endif /* not USE_OLD_TAG_SEARCH */ Tcl_Release(canvasPtr); return result; } @@ -2203,13 +2109,11 @@ CanvasWidgetCmd( static void DestroyCanvas( - char *memPtr) /* Info about canvas widget. */ + void *memPtr) /* Info about canvas widget. */ { - TkCanvas *canvasPtr = (TkCanvas *) memPtr; + TkCanvas *canvasPtr = memPtr; Tk_Item *itemPtr; -#ifndef USE_OLD_TAG_SEARCH TagSearchExpr *expr, *next; -#endif /* * Free up all of the items in the canvas. @@ -2234,14 +2138,12 @@ DestroyCanvas( if (canvasPtr->pixmapGC != None) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } -#ifndef USE_OLD_TAG_SEARCH expr = canvasPtr->bindTagExprs; while (expr) { next = expr->next; TagSearchExprDestroy(expr); expr = next; } -#endif /* USE_OLD_TAG_SEARCH */ Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler); if (canvasPtr->bindingTable != NULL) { Tk_DeleteBindingTable(canvasPtr->bindingTable); @@ -3586,208 +3488,6 @@ InitCanvas(void) Tcl_MutexUnlock(&typeListMutex); } -#ifdef USE_OLD_TAG_SEARCH -/* - *-------------------------------------------------------------- - * - * StartTagSearch -- - * - * This function is called to initiate an enumeration of all items in a - * given canvas that contain a given tag. - * - * Results: - * The return value is a pointer to the first item in canvasPtr that - * matches tag, or NULL if there is no such item. The information at - * *searchPtr is initialized such that successive calls to NextItem will - * return successive items that match tag. - * - * Side effects: - * SearchPtr is linked into a list of searches in progress on canvasPtr, - * so that elements can safely be deleted while the search is in - * progress. EndTagSearch must be called at the end of the search to - * unlink searchPtr from this list. - * - *-------------------------------------------------------------- - */ - -static Tk_Item * -StartTagSearch( - TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */ - Tcl_Obj *tagObj, /* Object giving tag value. */ - TagSearch *searchPtr) /* Record describing tag search; will be - * initialized here. */ -{ - int id; - Tk_Item *itemPtr, *lastPtr; - Tk_Uid *tagPtr; - Tk_Uid uid; - char *tag = Tcl_GetString(tagObj); - int count; - TkWindow *tkwin = (TkWindow *) canvasPtr->tkwin; - TkDisplay *dispPtr = tkwin->dispPtr; - - /* - * Initialize the search. - */ - - searchPtr->canvasPtr = canvasPtr; - searchPtr->searchOver = 0; - - /* - * Find the first matching item in one of several ways. If the tag is a - * number then it selects the single item with the matching identifier. - * In this case see if the item being requested is the hot item, in which - * case the search can be skipped. - */ - - if (isdigit(UCHAR(*tag))) { - char *end; - Tcl_HashEntry *entryPtr; - - dispPtr->numIdSearches++; - id = strtoul(tag, &end, 0); - if (*end == 0) { - itemPtr = canvasPtr->hotPtr; - lastPtr = canvasPtr->hotPrevPtr; - if ((itemPtr == NULL) || (itemPtr->id != id) || (lastPtr == NULL) - || (lastPtr->nextPtr != itemPtr)) { - dispPtr->numSlowSearches++; - entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, (char*) id); - if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); - lastPtr = itemPtr->prevPtr; - } else { - lastPtr = itemPtr = NULL; - } - } - searchPtr->lastPtr = lastPtr; - searchPtr->searchOver = 1; - canvasPtr->hotPtr = itemPtr; - canvasPtr->hotPrevPtr = lastPtr; - return itemPtr; - } - } - - searchPtr->tag = uid = Tk_GetUid(tag); - if (uid == Tk_GetUid("all")) { - /* - * All items match. - */ - - searchPtr->tag = NULL; - searchPtr->lastPtr = NULL; - searchPtr->currentPtr = canvasPtr->firstItemPtr; - return canvasPtr->firstItemPtr; - } - - /* - * None of the above. Search for an item with a matching tag. - */ - - for (lastPtr = NULL, itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; - lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) { - for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags; - count > 0; tagPtr++, count--) { - if (*tagPtr == uid) { - searchPtr->lastPtr = lastPtr; - searchPtr->currentPtr = itemPtr; - return itemPtr; - } - } - } - searchPtr->lastPtr = lastPtr; - searchPtr->searchOver = 1; - return NULL; -} - -/* - *-------------------------------------------------------------- - * - * NextItem -- - * - * This function returns successive items that match a given tag; it - * should be called only after StartTagSearch has been used to begin a - * search. - * - * Results: - * The return value is a pointer to the next item that matches the tag - * specified to StartTagSearch, or NULL if no such item exists. - * *SearchPtr is updated so that the next call to this function will - * return the next item. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static Tk_Item * -NextItem( - TagSearch *searchPtr) /* Record describing search in progress. */ -{ - Tk_Item *itemPtr, *lastPtr; - int count; - Tk_Uid uid; - Tk_Uid *tagPtr; - - /* - * Find next item in list (this may not actually be a suitable one to - * return), and return if there are no items left. - */ - - lastPtr = searchPtr->lastPtr; - if (lastPtr == NULL) { - itemPtr = searchPtr->canvasPtr->firstItemPtr; - } else { - itemPtr = lastPtr->nextPtr; - } - if ((itemPtr == NULL) || (searchPtr->searchOver)) { - searchPtr->searchOver = 1; - return NULL; - } - if (itemPtr != searchPtr->currentPtr) { - /* - * The structure of the list has changed. Probably the previously- - * returned item was removed from the list. In this case, don't - * advance lastPtr; just return its new successor (i.e. do nothing - * here). - */ - } else { - lastPtr = itemPtr; - itemPtr = lastPtr->nextPtr; - } - - /* - * Handle special case of "all" search by returning next item. - */ - - uid = searchPtr->tag; - if (uid == NULL) { - searchPtr->lastPtr = lastPtr; - searchPtr->currentPtr = itemPtr; - return itemPtr; - } - - /* - * Look for an item with a particular tag. - */ - - for ( ; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) { - for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags; - count > 0; tagPtr++, count--) { - if (*tagPtr == uid) { - searchPtr->lastPtr = lastPtr; - searchPtr->currentPtr = itemPtr; - return itemPtr; - } - } - } - searchPtr->lastPtr = lastPtr; - searchPtr->searchOver = 1; - return NULL; -} - -#else /* !USE_OLD_TAG_SEARCH */ /* *---------------------------------------------------------------------- * @@ -4551,7 +4251,7 @@ TagSearchFirst( if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id) || (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) { entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, - (char *) INT2PTR(searchPtr->id)); + INT2PTR(searchPtr->id)); if (entryPtr != NULL) { itemPtr = Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; @@ -4716,7 +4416,6 @@ TagSearchNext( searchPtr->searchOver = 1; return NULL; } -#endif /* USE_OLD_TAG_SEARCH */ /* *-------------------------------------------------------------- @@ -4829,14 +4528,9 @@ FindItems( int first /* For error messages: gives number of * elements of objv which are already * handled. */ -#ifndef USE_OLD_TAG_SEARCH ,TagSearch **searchPtrPtr /* From CanvasWidgetCmd local vars*/ -#endif /* not USE_OLD_TAG_SEARCH */ ) { -#ifdef USE_OLD_TAG_SEARCH - TagSearch search; -#endif /* USE_OLD_TAG_SEARCH */ Tk_Item *itemPtr; Tk_Uid uid; int index, result; @@ -5153,16 +4847,6 @@ FindArea( *-------------------------------------------------------------- */ -#ifdef USE_OLD_TAG_SEARCH -static void -RelinkItems( - TkCanvas *canvasPtr, /* Canvas to be modified. */ - Tcl_Obj *tag, /* Tag identifying items to be moved in the - * redisplay list. */ - Tk_Item *prevPtr) /* Reposition the items so that they go just - * after this item (NULL means put at - * beginning of list). */ -#else /* USE_OLD_TAG_SEARCH */ static int RelinkItems( TkCanvas *canvasPtr, /* Canvas to be modified. */ @@ -5172,12 +4856,8 @@ RelinkItems( * after this item (NULL means put at * beginning of list). */ TagSearch **searchPtrPtr) /* From CanvasWidgetCmd local vars */ -#endif /* USE_OLD_TAG_SEARCH */ { Tk_Item *itemPtr; -#ifdef USE_OLD_TAG_SEARCH - TagSearch search; -#endif /* USE_OLD_TAG_SEARCH */ Tk_Item *firstMovePtr, *lastMovePtr; int result; @@ -5229,11 +4909,7 @@ RelinkItems( */ if (firstMovePtr == NULL) { -#ifdef USE_OLD_TAG_SEARCH - return; -#else /* USE_OLD_TAG_SEARCH */ return TCL_OK; -#endif /* USE_OLD_TAG_SEARCH */ } if (prevPtr == NULL) { if (canvasPtr->firstItemPtr != NULL) { @@ -5254,9 +4930,7 @@ RelinkItems( if (canvasPtr->lastItemPtr == prevPtr) { canvasPtr->lastItemPtr = lastMovePtr; } -#ifndef USE_OLD_TAG_SEARCH return TCL_OK; -#endif /* not USE_OLD_TAG_SEARCH */ } /* @@ -5400,9 +5074,7 @@ PickCurrentItem( double coords[2]; int buttonDown; Tk_Item *prevItemPtr; -#ifndef USE_OLD_TAG_SEARCH SearchUids *searchUids = GetStaticUids(); -#endif /* * Check whether or not a button is down. If so, we'll log entry and exit @@ -5525,11 +5197,7 @@ PickCurrentItem( if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) { for (i = itemPtr->numTags-1; i >= 0; i--) { -#ifdef USE_OLD_TAG_SEARCH - if (itemPtr->tagPtr[i] == Tk_GetUid("current")) -#else /* USE_OLD_TAG_SEARCH */ if (itemPtr->tagPtr[i] == searchUids->currentUid) -#endif /* USE_OLD_TAG_SEARCH */ /* then */ { itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1]; itemPtr->numTags--; @@ -5566,11 +5234,7 @@ PickCurrentItem( if (canvasPtr->currentItemPtr != NULL) { XEvent event; -#ifdef USE_OLD_TAG_SEARCH - DoItem(NULL, canvasPtr->currentItemPtr, Tk_GetUid("current")); -#else /* USE_OLD_TAG_SEARCH */ DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid); -#endif /* USE_OLD_TAG_SEARCH */ if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT && prevItemPtr != canvasPtr->currentItemPtr)) { ItemConfigure(canvasPtr, canvasPtr->currentItemPtr, 0, NULL); @@ -5664,15 +5328,13 @@ CanvasDoEvent( * processed. */ { #define NUM_STATIC 3 - ClientData staticObjects[NUM_STATIC]; - ClientData *objectPtr; + void *staticObjects[NUM_STATIC]; + void **objectPtr; int numObjects, i; Tk_Item *itemPtr; -#ifndef USE_OLD_TAG_SEARCH TagSearchExpr *expr; int numExprs; SearchUids *searchUids = GetStaticUids(); -#endif /* not USE_OLD_TAG_SEARCH */ if (canvasPtr->bindingTable == NULL) { return; @@ -5686,16 +5348,6 @@ CanvasDoEvent( return; } -#ifdef USE_OLD_TAG_SEARCH - /* - * Set up an array with all the relevant objects for processing this - * event. The relevant objects are (a) the event's item, (b) the tags - * associated with the event's item, and (c) the tag "all". If there are a - * lot of tags then malloc an array to hold all of the objects. - */ - - numObjects = itemPtr->numTags + 2; -#else /* USE_OLD_TAG_SEARCH */ /* * Set up an array with all the relevant objects for processing this * event. The relevant objects are: @@ -5724,23 +5376,17 @@ CanvasDoEvent( } numObjects = itemPtr->numTags + numExprs + 2; -#endif /* not USE_OLD_TAG_SEARCH */ if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { - objectPtr = ckalloc(numObjects * sizeof(ClientData)); + objectPtr = ckalloc(numObjects * sizeof(void *)); } -#ifdef USE_OLD_TAG_SEARCH - objectPtr[0] = (ClientData) Tk_GetUid("all"); -#else /* USE_OLD_TAG_SEARCH */ - objectPtr[0] = (ClientData) searchUids->allUid; -#endif /* USE_OLD_TAG_SEARCH */ + objectPtr[0] = (char *)searchUids->allUid; for (i = itemPtr->numTags-1; i >= 0; i--) { - objectPtr[i+1] = (ClientData) itemPtr->tagPtr[i]; + objectPtr[i+1] = (char *)itemPtr->tagPtr[i]; } objectPtr[itemPtr->numTags+1] = itemPtr; -#ifndef USE_OLD_TAG_SEARCH /* * Copy uids of matching expressions into object array */ @@ -5753,7 +5399,6 @@ CanvasDoEvent( } expr = expr->next; } -#endif /* not USE_OLD_TAG_SEARCH */ /* * Invoke the binding system, then free up the object array if it was diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index aa6bb93..9f6822f 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -422,7 +422,7 @@ Tk_ClipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; const char *path = NULL; Atom selection; static const char *const optionStrings[] = { "append", "clear", "get", NULL }; @@ -709,7 +709,7 @@ ClipboardGetProc( * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1); + Tcl_DStringAppend(clientData, portion, -1); return TCL_OK; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 81bb335..f0c489a 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1860,7 +1860,7 @@ Tk_WmObjCmd( TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW }; - tkwin = (Tk_Window) clientData; + tkwin = clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?"); diff --git a/generic/tkCursor.c b/generic/tkCursor.c index e337b37..afdf6dd 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -428,7 +428,7 @@ Tk_NameOfCursor( sprintf(dispPtr->cursorString, "cursor id %p", cursor); return dispPtr->cursorString; } - idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor); + idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor); if (idHashPtr == NULL) { goto printid; } @@ -517,7 +517,7 @@ Tk_FreeCursor( Tcl_Panic("Tk_FreeCursor called before Tk_GetCursor"); } - idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, (char *) cursor); + idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } diff --git a/generic/tkGC.c b/generic/tkGC.c index 55e5774..4caa046 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -307,7 +307,7 @@ Tk_FreeGC( return; } - idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, (char *) gc); + idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, gc); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 2e0009a..eab3850 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -587,7 +587,7 @@ Tk_UnmaintainGeometry( if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) { Tk_UnmapWindow(slave); } - hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, (char *) master); + hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, master); if (hPtr == NULL) { return; } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index ec22016..c632793 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -2885,7 +2885,7 @@ GridStructureProc( slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, - (char *) gridPtr->tkwin)); + gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 12bdb7b..1dc8840 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -1461,7 +1461,7 @@ DisposeColorTable( ckfree(colorPtr->pixelMap); } - entry = Tcl_FindHashEntry(&imgPhotoColorHash, (char *) &colorPtr->id); + entry = Tcl_FindHashEntry(&imgPhotoColorHash, &colorPtr->id); if (entry == NULL) { Tcl_Panic("DisposeColorTable couldn't find hash entry"); } diff --git a/generic/tkPack.c b/generic/tkPack.c index f2ba642..aabfe1f 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1474,7 +1474,7 @@ PackStructureProc( if (packPtr->tkwin != NULL) { TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr; Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable, - (char *) packPtr->tkwin)); + packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { diff --git a/generic/tkPlace.c b/generic/tkPlace.c index e627794..b225e26 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -315,7 +315,7 @@ Tk_PlaceObjCmd( } UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) tkwin)); + tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, slavePtr); Tk_ManageGeometry(tkwin, NULL, NULL); @@ -455,7 +455,7 @@ FindSlave( register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin); + hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin); if (hPtr == NULL) { return NULL; } @@ -578,7 +578,7 @@ FindMaster( register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin); + hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin); if (hPtr == NULL) { return NULL; } @@ -1084,7 +1084,7 @@ MasterStructureProc( slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, - (char *) masterPtr->tkwin)); + masterPtr->tkwin)); if (masterPtr->flags & PARENT_RECONFIG_PENDING) { Tcl_CancelIdleCall(RecomputePlacement, masterPtr); } @@ -1151,7 +1151,7 @@ SlaveStructureProc( UnlinkSlave(slavePtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) slavePtr->tkwin)); + slavePtr->tkwin)); FreeSlave(slavePtr); } } @@ -1230,7 +1230,7 @@ PlaceLostSlaveProc( Tk_UnmapWindow(tkwin); UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) tkwin)); + tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, slavePtr); FreeSlave(slavePtr); diff --git a/generic/tkSelect.c b/generic/tkSelect.c index d97db45..9e9b3c9 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -190,7 +190,7 @@ Tk_CreateSelHandler( * should make a copy for this selPtr. */ - unsigned cmdInfoLen = Tk_Offset(CommandInfo, command) + 1 + + size_t cmdInfoLen = Tk_Offset(CommandInfo, command) + 1 + ((CommandInfo *)clientData)->cmdLength; selPtr->clientData = ckalloc(cmdInfoLen); diff --git a/generic/tkTest.c b/generic/tkTest.c index 8890e14..2061893 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -537,7 +537,7 @@ TestobjconfigObjCmd( CustomOptionFree, INT2PTR(1) }; - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = clientData; Tk_Window tkwin; int index, result = TCL_OK; @@ -651,7 +651,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, + tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -706,7 +706,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, + tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -759,7 +759,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, + tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -929,7 +929,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, + tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -1081,7 +1081,7 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, - (Tk_Window) clientData, Tcl_GetString(objv[2]), NULL); + clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -1158,7 +1158,7 @@ TrivialConfigObjCmd( }; Tcl_Obj *resultObjPtr; int index, mask; - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = clientData; Tk_Window tkwin = headerPtr->tkwin; Tk_SavedOptions saved; @@ -1253,7 +1253,7 @@ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { @@ -1265,8 +1265,8 @@ TrivialCmdDeletedProc( * here. */ - Tk_FreeConfigOptions((char *) clientData, - headerPtr->optionTable, (Tk_Window) NULL); + Tk_FreeConfigOptions(clientData, + headerPtr->optionTable, NULL); Tcl_EventuallyFree(clientData, TCL_DYNAMIC); } } @@ -1292,11 +1292,11 @@ TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { - Tk_FreeConfigOptions((char *) clientData, + Tk_FreeConfigOptions(clientData, headerPtr->optionTable, headerPtr->tkwin); headerPtr->optionTable = NULL; headerPtr->tkwin = NULL; @@ -1338,7 +1338,7 @@ TestfontObjCmd( Tk_Window tkwin; Tk_Font tkfont; - tkwin = (Tk_Window) clientData; + tkwin = clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); @@ -1458,7 +1458,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; int x, y, width, height; if (objc < 2) { @@ -1513,7 +1513,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1560,7 +1560,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; /* @@ -1624,7 +1624,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -1658,7 +1658,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); @@ -1697,7 +1697,7 @@ TestmakeexistObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = clientData; int i; Tk_Window tkwin; @@ -1740,7 +1740,7 @@ TestmenubarObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = clientData; Tk_Window tkwin, menubar; if (objc < 2) { @@ -1853,7 +1853,7 @@ TestpropObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; @@ -1994,7 +1994,7 @@ TestwrapperObjCmd( return TCL_ERROR; } - tkwin = (Tk_Window) clientData; + tkwin = clientData; winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; diff --git a/generic/tkText.c b/generic/tkText.c index a08878c..280eec8 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -5605,7 +5605,7 @@ static void RunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = (TkText *) clientData; + register TkText *textPtr = clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 46d2b1a..0ad9ead 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -7725,7 +7725,7 @@ TkTextCharLayoutProc( #if !TK_LAYOUT_WITH_BASE_CHUNKS ciPtr = ckalloc(Tk_Offset(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; - memcpy(ciPtr->chars, p, (unsigned) bytesThatFit); + memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ ciPtr->numBytes = bytesThatFit; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 198c2d7..23c0891 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1443,7 +1443,7 @@ Tk_DestroyWindow( } #endif Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, - (char *) winPtr->window)); + winPtr->window)); winPtr->window = None; } UnlinkWindow(winPtr); @@ -2362,7 +2362,7 @@ Tk_IdToWindow( return NULL; } - hPtr = Tcl_FindHashEntry(&dispPtr->winTable, (char *) window); + hPtr = Tcl_FindHashEntry(&dispPtr->winTable, window); if (hPtr == NULL) { return NULL; } diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 7294f8b..484e66b 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -68,7 +68,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp) static void CursorBlinkProc(ClientData clientData) { - CursorManager *cm = (CursorManager*)clientData; + CursorManager *cm = clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index e5268e7..32491dd 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -356,7 +356,7 @@ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; size_t byteCount; const char *string; const char *selStart, *selEnd; @@ -389,7 +389,7 @@ EntryFetchSelection( */ static void EntryLostSelection(ClientData clientData) { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); @@ -924,7 +924,7 @@ DeleteChars( static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index b805357..cb4b464 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -159,7 +159,7 @@ static void CheckAnimation(Progressbar *pb) if (AnimationEnabled(pb)) { if (pb->progress.timer == 0) { pb->progress.timer = Tcl_CreateTimerHandler( - pb->progress.period, AnimateProgressProc, (ClientData)pb); + pb->progress.period, AnimateProgressProc, pb); } } else { if (pb->progress.timer != 0) { diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 6a99124..975fca8 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -396,7 +396,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - register TkButton *butPtr = (TkButton *) clientData; + register TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index cc626c2..a3867a4 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -462,7 +462,7 @@ DisplayFileProc( ClientData clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { - TkDisplay *dispPtr = (TkDisplay *) clientData; + TkDisplay *dispPtr = clientData; Display *display = dispPtr->display; int numFound; diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index ad71b7b..ba78016 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -58,7 +58,7 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; + register TkMenuButton *mbPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index 8f88018..d0208b7 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -541,7 +541,7 @@ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index 2446c3f..5a7b0a1 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -97,7 +97,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - register TkScrollbar *scrollPtr = (TkScrollbar *) clientData; + register TkScrollbar *scrollPtr = clientData; register Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index e67970d..6155f54 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -766,7 +766,7 @@ SelTimeoutProc( retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, - (ClientData) retrPtr); + retrPtr); } } diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 6e75c55..1c55f40 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -6411,7 +6411,7 @@ TkWmStackorderToplevel( windows = NULL; } else { for (i = 0; i < numChildren; i++) { - hPtr = Tcl_FindHashEntry(&table, (char *) children[i]); + hPtr = Tcl_FindHashEntry(&table, children[i]); if (hPtr != NULL) { childWinPtr = Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; diff --git a/win/tkWinButton.c b/win/tkWinButton.c index e46bcb3..9cd13a7 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -315,7 +315,7 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - register TkButton *butPtr = (TkButton *) clientData; + register TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -1253,7 +1253,7 @@ ButtonProc( PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); - TkpDisplayButton((ClientData)butPtr); + TkpDisplayButton(butPtr); /* * Special note: must cancel any existing idle handler for @@ -1261,7 +1261,7 @@ ButtonProc( * cleared the REDRAW_PENDING flag. */ - Tcl_CancelIdleCall(TkpDisplayButton, (ClientData)butPtr); + Tcl_CancelIdleCall(TkpDisplayButton, butPtr); return 0; } case BN_CLICKED: { @@ -1276,14 +1276,14 @@ ButtonProc( Tcl_Interp *interp = butPtr->info.interp; if (butPtr->info.state != STATE_DISABLED) { - Tcl_Preserve((ClientData)interp); + Tcl_Preserve(interp); code = TkInvokeButton((TkButton*)butPtr); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (button invoke)"); Tcl_BackgroundException(interp, code); } - Tcl_Release((ClientData)interp); + Tcl_Release(interp); } Tcl_ServiceAll(); return 0; diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index d8eec68..5a9034d 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -3022,7 +3022,7 @@ SetTkDialog( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); char buf[32]; - sprintf(buf, "0x%p", (HWND) clientData); + sprintf(buf, "0x%p", clientData); Tcl_SetVar2(tsdPtr->debugInterp, "tk_dialog", NULL, buf, TCL_GLOBAL_ONLY); } diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 43c5e25..daffb94 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -173,7 +173,7 @@ void Tk_MapEmbeddedWindow( TkpWmSetState(winPtr, state); TkWmMapWindow(winPtr); } - Tcl_Release((ClientData)winPtr); + Tcl_Release(winPtr); } /* @@ -331,8 +331,8 @@ TkpUseWindow( * window. */ - Tcl_Preserve((ClientData) winPtr); - Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, (ClientData) winPtr); + Tcl_Preserve(winPtr); + Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, winPtr); return TCL_OK; } @@ -392,7 +392,7 @@ TkpMakeContainer( */ Tk_CreateEventHandler(tkwin, StructureNotifyMask, - ContainerEventProc, (ClientData) containerPtr); + ContainerEventProc, containerPtr); } /* diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 435c7a1..6ac14c2 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -420,7 +420,7 @@ TkpDestroyMenu( if (tsdPtr->menuHWND != NULL) { Tcl_HashEntry *hashEntryPtr = - Tcl_FindHashEntry(&tsdPtr->winMenuTable, (char *) winMenuHdl); + Tcl_FindHashEntry(&tsdPtr->winMenuTable, winMenuHdl); if (hashEntryPtr != NULL) { Tcl_DeleteHashEntry(hashEntryPtr); @@ -1043,7 +1043,7 @@ TkWinHandleMenuEvent( switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, - (char *) *pwParam); + *pwParam); if (hashEntryPtr != NULL) { menuPtr = Tcl_GetHashValue(hashEntryPtr); if ((menuPtr->menuRefPtr != NULL) @@ -1057,7 +1057,7 @@ TkWinHandleMenuEvent( case WM_INITMENU: TkMenuInit(); hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, - (char *) *pwParam); + *pwParam); if (hashEntryPtr != NULL) { tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); menuPtr = Tcl_GetHashValue(hashEntryPtr); @@ -1142,7 +1142,7 @@ TkWinHandleMenuEvent( case WM_MENUCHAR: { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, - (char *) *plParam); + *plParam); if (hashEntryPtr != NULL) { int i, len, underline; Tcl_Obj *labelPtr; @@ -1279,7 +1279,7 @@ TkWinHandleMenuEvent( menuPtr = NULL; if (*plParam != 0) { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, - (char *) *plParam); + *plParam); if (hashEntryPtr != NULL) { menuPtr = Tcl_GetHashValue(hashEntryPtr); } @@ -1404,7 +1404,7 @@ TkpSetWindowMenuBar( winMenuHdl = (HMENU) menuPtr->platformData; hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, - (char *) winMenuHdl); + winMenuHdl); Tcl_DeleteHashEntry(hashEntryPtr); DestroyMenu(winMenuHdl); winMenuHdl = CreateMenu(); @@ -2148,8 +2148,7 @@ TkpInitializeMenuBindings( */ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey", - TkWinMenuKeyObjCmd, - (ClientData) Tk_MainWindow(interp), (Tcl_CmdDeleteProc *) NULL); + TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL); (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid, "", "tk::WinMenuKey %W %N", 0); diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 1b3717e..43a33ee 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -275,7 +275,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - WinScrollbar *scrollPtr = (WinScrollbar *) clientData; + WinScrollbar *scrollPtr = clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; @@ -295,7 +295,7 @@ TkpDisplayScrollbar( DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), - (ClientData) scrollPtr); + scrollPtr); } else { UpdateScrollbar(scrollPtr); } @@ -617,7 +617,7 @@ ModalLoop( int oldMode; if (scrollPtr->hwnd) { - Tcl_Preserve((ClientData)scrollPtr); + Tcl_Preserve(scrollPtr); scrollPtr->winFlags |= IN_MODAL_LOOP; oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); TkWinResendEvent(scrollPtr->oldProc, scrollPtr->hwnd, eventPtr); @@ -626,7 +626,7 @@ ModalLoop( if (scrollPtr->hwnd && scrollPtr->winFlags & ALREADY_DEAD) { DestroyWindow(scrollPtr->hwnd); } - Tcl_Release((ClientData)scrollPtr); + Tcl_Release(scrollPtr); } } diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 4fac15c..b99c47b 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -67,15 +67,15 @@ TkplatformtestInit( */ Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd, - (ClientData) Tk_MainWindow(interp), NULL); + Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwinevent", TestwineventObjCmd, - (ClientData) Tk_MainWindow(interp), NULL); + Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testfindwindow", TestfindwindowObjCmd, - (ClientData) Tk_MainWindow(interp), NULL); + Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testgetwindowinfo", TestgetwindowinfoObjCmd, - (ClientData) Tk_MainWindow(interp), NULL); + Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwinlocale", TestwinlocaleObjCmd, - (ClientData) Tk_MainWindow(interp), NULL); + Tk_MainWindow(interp), NULL); return TCL_OK; } @@ -244,7 +244,7 @@ TestclipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 385e72b..fc72dac 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -71,7 +71,7 @@ Tk_AttachHWND( twdPtr->window.winPtr = (TkWindow *) tkwin; } else if (twdPtr->window.handle != NULL) { entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, - (char *)twdPtr->window.handle); + twdPtr->window.handle); Tcl_DeleteHashEntry(entryPtr); } @@ -115,7 +115,7 @@ Tk_HWNDToWindow( Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS); tsdPtr->initialized = 1; } - entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char *) hwnd); + entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { return (Tk_Window) Tcl_GetHashValue(entryPtr); } @@ -323,7 +323,7 @@ XDestroyWindow( TkPointerDeadWindow(winPtr); - entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, (char*)hwnd); + entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { Tcl_DeleteHashEntry(entryPtr); } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index b750566..2e3a2a1 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -6677,7 +6677,7 @@ TkWmStackorderToplevelEnumProc( /*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/ - hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd); + hPtr = Tcl_FindHashEntry(pair->table, hwnd); if (hPtr != NULL) { childWinPtr = Tcl_GetHashValue(hPtr); diff --git a/win/tkWinX.c b/win/tkWinX.c index e3b552e..e35fd3c 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -256,7 +256,7 @@ TkWinXInit( * Make sure we cleanup on finalize. */ - TkCreateExitHandler(TkWinXCleanup, (ClientData) hInstance); + TkCreateExitHandler(TkWinXCleanup, hInstance); } /* @@ -279,7 +279,7 @@ void TkWinXCleanup( ClientData clientData) { - HINSTANCE hInstance = (HINSTANCE) clientData; + HINSTANCE hInstance = clientData; /* * Clean up our own class. @@ -650,7 +650,7 @@ TkClipCleanup( dispPtr->windowAtom); Tk_DestroyWindow(dispPtr->clipWindow); - Tcl_Release((ClientData) dispPtr->clipWindow); + Tcl_Release(dispPtr->clipWindow); dispPtr->clipWindow = NULL; } } diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c index 6e46374..5d9cf0a 100644 --- a/win/ttkWinMonitor.c +++ b/win/ttkWinMonitor.c @@ -152,7 +152,7 @@ MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); - Ttk_RegisterCleanup(interp, (ClientData)hwnd, DestroyThemeMonitorWindow); + Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow); TtkWinTheme_Init(interp, hwnd); TtkXPTheme_Init(interp, hwnd); -- cgit v0.12