From 48507f96a5df51bf8c2c599ccb132ccb2ea2bf12 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 16 Feb 2024 08:30:40 +0000 Subject: Fix warning in tkEntry.c. More typecast cleanup --- generic/tkEntry.c | 4 ++-- unix/tkUnixSysTray.c | 58 ++++++++++++++++++++++++++-------------------------- win/tkWinDialog.c | 4 ++-- win/tkWinGDI.c | 24 +++++++++++----------- win/tkWinX.c | 2 +- win/ttkWinXPTheme.c | 8 ++++---- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 79e1d5f..3d7d056 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1051,7 +1051,7 @@ DestroyEntry( * Tk_FreeOptions handle all the standard option-related stuff. */ - ckfree(entryPtr->string); + ckfree((char *)entryPtr->string); if (entryPtr->textVarName != NULL) { Tcl_UntraceVar2(entryPtr->interp, entryPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -3273,7 +3273,7 @@ EntryTextVarProc( entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, probe); - if (probe == (void *)entryPtr) { + if (probe == entryPtr) { break; } } while (probe); diff --git a/unix/tkUnixSysTray.c b/unix/tkUnixSysTray.c index 8372b6e..1a6989f 100644 --- a/unix/tkUnixSysTray.c +++ b/unix/tkUnixSysTray.c @@ -198,9 +198,9 @@ typedef struct { * Forward declarations for procedures defined in this file. */ -static int TrayIconCreateCmd(ClientData cd, Tcl_Interp *interp, +static int TrayIconCreateCmd(void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TrayIconObjectCmd(ClientData cd, Tcl_Interp *interp, +static int TrayIconObjectCmd(void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int TrayIconConfigureMethod(DockIcon *icon, Tcl_Interp* interp, int objc, Tcl_Obj *const objv[], @@ -210,7 +210,7 @@ static int PostBalloon(DockIcon* icon, const char * utf8msg, static void CancelBalloon(DockIcon* icon, int msgid); static int QueryTrayOrientation(DockIcon* icon); -static void TrayIconDeleteProc(ClientData cd ); +static void TrayIconDeleteProc(void *cd ); static Atom DockSelectionAtomFor(Tk_Window tkwin); static void DockToManager(DockIcon *icon); static void CreateTrayIconWindow(DockIcon *icon); @@ -220,14 +220,14 @@ static void TrayIconForceImageChange(DockIcon* icon); static void TrayIconUpdate(DockIcon* icon, int mask); static void EventuallyRedrawIcon(DockIcon* icon); -static void DisplayIcon(ClientData cd); +static void DisplayIcon(void *cd); static void RetargetEvent(DockIcon *icon, XEvent *ev); -static void TrayIconEvent(ClientData cd, XEvent* ev); -static void UserIconEvent(ClientData cd, XEvent* ev); -static void TrayIconWrapperEvent(ClientData cd, XEvent* ev); -static int IconGenericHandler(ClientData cd, XEvent *ev); +static void TrayIconEvent(void *cd, XEvent* ev); +static void UserIconEvent(void *cd, XEvent* ev); +static void TrayIconWrapperEvent(void *cd, XEvent* ev); +static int IconGenericHandler(void *cd, XEvent *ev); int Tktray_Init (Tcl_Interp* interp ); @@ -249,7 +249,7 @@ int Tktray_Init (Tcl_Interp* interp ); static int TrayIconObjectCmd( - ClientData cd, + void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -611,7 +611,7 @@ CreateTrayIconWindow( Tk_CreateEventHandler(icon->drawingWin,ExposureMask|StructureNotifyMask| ButtonPressMask|ButtonReleaseMask| EnterWindowMask|LeaveWindowMask|PointerMotionMask, - TrayIconEvent,(ClientData)icon); + TrayIconEvent, icon); if(icon->bestVisual) { Tk_SetWindowVisual(icon->drawingWin,icon->bestVisual, 32,icon->bestColormap); @@ -627,7 +627,7 @@ CreateTrayIconWindow( attr.override_redirect = True; Tk_ChangeWindowAttributes(wrapper,CWOverrideRedirect,&attr); - Tk_CreateEventHandler(wrapper,StructureNotifyMask,TrayIconWrapperEvent,(ClientData)icon); + Tk_CreateEventHandler(wrapper,StructureNotifyMask,TrayIconWrapperEvent, icon); if (!icon->bestVisual) { Tk_SetWindowBackgroundPixmap(wrapper, ParentRelative); } else { @@ -744,7 +744,7 @@ TrayIconRequestSize( static void TrayIconImageChanged( - ClientData cd, + void *cd, int x, int y, int w, @@ -829,7 +829,7 @@ TrayIconForceImageChange( if (icon->image) { int w,h; Tk_SizeOfImage(icon->image,&w,&h); - TrayIconImageChanged((ClientData)icon,0,0,w,h,w,h); + TrayIconImageChanged(icon, 0, 0, w, h, w, h); } } @@ -856,7 +856,7 @@ EventuallyRedrawIcon( if (icon->drawingWin && icon->myManager) { /* don't redraw invisible icon */ if (!(icon->flags & ICON_FLAG_REDRAW_PENDING)) { /* don't schedule multiple redraw ops */ icon->flags |= ICON_FLAG_REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayIcon,(ClientData)icon); + Tcl_DoWhenIdle(DisplayIcon, icon); } } } @@ -879,7 +879,7 @@ EventuallyRedrawIcon( static void DisplayIcon( - ClientData cd) + void *cd) { DockIcon *icon = (DockIcon*)cd; int w = icon->imageWidth, h = icon->imageHeight; @@ -910,7 +910,7 @@ DisplayIcon( Tcl_InterpState saved = Tcl_SaveInterpState(icon->interp, TCL_OK); icon->imageVisualInstance = Tk_GetImage(icon->interp,icon->drawingWin, - icon->imageString, IgnoreImageChange,(ClientData)NULL); + icon->imageString, IgnoreImageChange, NULL); Tcl_RestoreInterpState(icon->interp,saved); } if (icon->photo && !icon->offscreenImage) { @@ -1072,7 +1072,7 @@ RetargetEvent( static void TrayIconWrapperEvent( - ClientData cd, + void *cd, XEvent* ev) { /* Some embedders, like Docker, add icon windows to save set @@ -1125,7 +1125,7 @@ TrayIconWrapperEvent( static void TrayIconEvent( - ClientData cd, + void *cd, XEvent* ev) { DockIcon *icon = (DockIcon*)cd; @@ -1147,7 +1147,7 @@ TrayIconEvent( if (icon->myManager) { Tk_SendVirtualEvent(icon->tkwin,Tk_GetUid("IconDestroy"), NULL); } - Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon); + Tcl_CancelIdleCall(DisplayIcon, icon); icon->flags &= ~ICON_FLAG_REDRAW_PENDING; icon->drawingWin = NULL; icon->requestedWidth = 0; /* trigger re-request on recreation */ @@ -1196,7 +1196,7 @@ TrayIconEvent( static void UserIconEvent( - ClientData cd, + void *cd, XEvent* ev) { DockIcon *icon = (DockIcon*)cd; @@ -1204,10 +1204,10 @@ UserIconEvent( switch (ev->type) { case DestroyNotify: - Tk_DeleteGenericHandler(IconGenericHandler, (ClientData)icon); + Tk_DeleteGenericHandler(IconGenericHandler, icon); if(icon->drawingWin) { icon->visible = 0; - Tcl_CancelIdleCall(DisplayIcon,(ClientData)icon); + Tcl_CancelIdleCall(DisplayIcon, icon); icon->flags &= ~ICON_FLAG_REDRAW_PENDING; Tk_DestroyWindow(icon->drawingWin); } @@ -1365,7 +1365,7 @@ CancelBalloon( static int IconGenericHandler( - ClientData cd, + void *cd, XEvent *ev) { DockIcon *icon = (DockIcon*)cd; @@ -1522,7 +1522,7 @@ TrayIconConfigureMethod( if (mask & ICON_CONF_IMAGE) { if (icon->imageString) { newImage = Tk_GetImage(interp, icon->tkwin, icon->imageString, - TrayIconImageChanged, (ClientData)icon); + TrayIconImageChanged, icon); if (!newImage) { Tk_RestoreSavedOptions(&saved); return TCL_ERROR; /* msg by Tk_GetImage */ @@ -1563,7 +1563,7 @@ TrayIconConfigureMethod( static void TrayIconDeleteProc( - ClientData cd ) + void *cd ) { DockIcon *icon = (DockIcon *)cd; Tk_DestroyWindow(icon->tkwin); @@ -1587,7 +1587,7 @@ TrayIconDeleteProc( static int TrayIconCreateCmd( - ClientData cd, + void *cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -1627,7 +1627,7 @@ TrayIconCreateCmd( /* Early tracking of DestroyNotify is essential */ Tk_CreateEventHandler(icon->tkwin,StructureNotifyMask, - UserIconEvent,(ClientData)icon); + UserIconEvent, icon); /* Now try setting options */ icon->options = Tk_CreateOptionTable(interp,IconOptionSpec); @@ -1652,7 +1652,7 @@ TrayIconCreateCmd( XSelectInput(Tk_Display(icon->tkwin),icon->trayManager, StructureNotifyMask); } - Tk_CreateGenericHandler(IconGenericHandler, (ClientData)icon); + Tk_CreateGenericHandler(IconGenericHandler, icon); if (objc>3) { if (TrayIconConfigureMethod(icon, interp, objc-2, objv+2, @@ -1662,7 +1662,7 @@ TrayIconCreateCmd( } icon->widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]), - TrayIconObjectCmd, (ClientData)icon, TrayIconDeleteProc); + TrayIconObjectCmd, icon, TrayIconDeleteProc); /* Sometimes a command just can't be created... */ if (!icon->widgetCmd) { diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 4aef6ce..1502720 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -2166,9 +2166,9 @@ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr) DWORD dw; for (dw = 0; dw < count; ++dw) { if (dlgFilterPtr[dw].pszName != NULL) - ckfree(dlgFilterPtr[dw].pszName); + ckfree((char *)dlgFilterPtr[dw].pszName); if (dlgFilterPtr[dw].pszSpec != NULL) - ckfree(dlgFilterPtr[dw].pszSpec); + ckfree((char *)dlgFilterPtr[dw].pszSpec); } ckfree(dlgFilterPtr); } diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c index 33cfc5a..b47b1de 100644 --- a/win/tkWinGDI.c +++ b/win/tkWinGDI.c @@ -597,26 +597,26 @@ static int Bezierize( outPointList = (double *)attemptckalloc(2 * sizeof(double) * nbpoints); if (outPointList == 0) { /* TODO: unreachable */ - ckfree((void *) inPointList); + ckfree((char *)inPointList); return 0; } nbpoints = TkMakeBezierCurve(NULL, inPointList, npoly, nStep, NULL, outPointList); - ckfree((void *) inPointList); + ckfree((char *)inPointList); bpoints = (POINT *)attemptckalloc(sizeof(POINT)*nbpoints); if (bpoints == 0) { /* TODO: unreachable */ - ckfree((void *) outPointList); + ckfree((char *)outPointList); return 0; } for (n=0; ninfo->flags & HEAP_ELEMENT) { - ckfree(elementData->info->statemap); - ckfree(elementData->info->className); - ckfree(elementData->info->elementName); - ckfree(elementData->info); + ckfree((char *)elementData->info->statemap); + ckfree((char *)elementData->info->className); + ckfree((char *)elementData->info->elementName); + ckfree((char *)elementData->info); } ckfree(clientData); } -- cgit v0.12 From 2d5bd258efa4930673224605e1bd76b0badcef46 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 16 Feb 2024 08:31:29 +0000 Subject: Unneeded type-cast --- generic/ttk/ttkImage.c | 2 +- generic/ttk/ttkProgress.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 634ba63..56b15f2 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -25,7 +25,7 @@ struct TtkImageSpec { Ttk_StateSpec *states; /* array[mapCount] of states ... */ Tk_Image *images; /* ... per-state images to use */ Tk_ImageChangedProc *imageChanged; - ClientData imageChangedClientData; + void *imageChangedClientData; }; /* NullImageChanged -- diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index cfffc42..07664ce 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -74,7 +74,7 @@ static const Tk_OptionSpec ProgressbarOptionSpecs[] = 0, ProgressbarModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE, - 0, (void *)ttkOrientStrings, STYLE_CHANGED }, + 0, ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_INT, "-phase", "phase", "Phase", "0", offsetof(Progressbar,progress.phaseObj), TCL_INDEX_NONE, 0, 0, 0 }, -- cgit v0.12