From e91354a1f438857414146b91cc7bed3ed9e22643 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Nov 2023 15:23:21 +0000 Subject: unnecessary type-cast --- generic/tkScrollbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 4c0ef99..130edc3 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -532,7 +532,7 @@ ConfigureScrollbar( int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc, - objv, (char *) scrollPtr, flags) != TCL_OK) { + objv, scrollPtr, flags) != TCL_OK) { return TCL_ERROR; } -- cgit v0.12 From e179535b0abd3e29f2e38821ed6ec4ffc554a2ce Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 28 Nov 2023 07:45:32 +0000 Subject: TIP #647 (partial, only the 100% upwards compatible part) --- doc/ConfigWidg.3 | 2 +- generic/tk.decls | 8 ++++---- generic/tkCanvas.c | 12 ++++++------ generic/tkDecls.h | 16 ++++++++-------- generic/tkImgBmap.c | 8 ++++---- generic/tkImgPhoto.c | 8 ++++---- generic/tkOldConfig.c | 10 +++++----- generic/tkScrollbar.c | 8 ++++---- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3 index e29daa8..2fa81df 100644 --- a/doc/ConfigWidg.3 +++ b/doc/ConfigWidg.3 @@ -25,7 +25,7 @@ int .sp \fBTk_FreeOptions(\fIspecs, widgRec, display, flags\fB)\fR .SH ARGUMENTS -.AS char *widgRec in/out +.AS void *widgRec in/out .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in diff --git a/generic/tk.decls b/generic/tk.decls index 1075977..bcf7a81 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -136,17 +136,17 @@ declare 26 { declare 27 { int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - char *widgRec, const char *argvName, int flags) + void *widgRec, const char *argvName, int flags) } declare 28 { int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - char *widgRec, const char *argvName, int flags) + void *widgRec, const char *argvName, int flags) } declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - Tcl_Size argc, const char **argv, char *widgRec, + Tcl_Size argc, const char **argv, void *widgRec, int flags) } declare 30 { @@ -318,7 +318,7 @@ declare 73 { } declare 74 { void Tk_FreeOptions(const Tk_ConfigSpec *specs, - char *widgRec, Display *display, int needFlags) + void *widgRec, Display *display, int needFlags) } declare 75 { void Tk_FreePixmap(Display *display, Pixmap pixmap) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 2b5568d..874ecf7 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -367,7 +367,7 @@ ItemConfigInfo( Tcl_Obj *fieldName) { return Tk_ConfigureInfo(canvasPtr->interp, canvasPtr->tkwin, - itemPtr->typePtr->configSpecs, (char *) itemPtr, + itemPtr->typePtr->configSpecs, itemPtr, (fieldName ? Tcl_GetString(fieldName) : NULL), 0); } @@ -378,7 +378,7 @@ ItemConfigValue( Tcl_Obj *fieldName) { return Tk_ConfigureValue(canvasPtr->interp, canvasPtr->tkwin, - itemPtr->typePtr->configSpecs, (char *) itemPtr, + itemPtr->typePtr->configSpecs, itemPtr, Tcl_GetString(fieldName), 0); } @@ -1164,15 +1164,15 @@ CanvasWidgetCmd( goto done; } result = Tk_ConfigureValue(interp, canvasPtr->tkwin, configSpecs, - (char *) canvasPtr, Tcl_GetString(objv[2]), 0); + canvasPtr, Tcl_GetString(objv[2]), 0); break; case CANV_CONFIGURE: if (objc == 2) { result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs, - (char *) canvasPtr, NULL, 0); + canvasPtr, NULL, 0); } else if (objc == 3) { result = Tk_ConfigureInfo(interp, canvasPtr->tkwin, configSpecs, - (char *) canvasPtr, Tcl_GetString(objv[2]), 0); + canvasPtr, Tcl_GetString(objv[2]), 0); } else { result = ConfigureCanvas(interp, canvasPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); @@ -2286,7 +2286,7 @@ DestroyCanvas( if (canvasPtr->bindingTable != NULL) { Tk_DeleteBindingTable(canvasPtr->bindingTable); } - Tk_FreeOptions(configSpecs, (char *) canvasPtr, canvasPtr->display, 0); + Tk_FreeOptions(configSpecs, canvasPtr, canvasPtr->display, 0); canvasPtr->tkwin = NULL; ckfree(canvasPtr); } diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 706d91a..a2fb17d 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -132,18 +132,18 @@ EXTERN int Tk_ClipboardClear(Tcl_Interp *interp, Tk_Window tkwin); /* 27 */ EXTERN int Tk_ConfigureInfo(Tcl_Interp *interp, Tk_Window tkwin, - const Tk_ConfigSpec *specs, char *widgRec, + const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 28 */ EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, - char *widgRec, const char *argvName, + void *widgRec, const char *argvName, int flags); /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size argc, const char **argv, - char *widgRec, int flags); + void *widgRec, int flags); /* 30 */ EXTERN void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, @@ -282,7 +282,7 @@ EXTERN void Tk_FreeGC(Display *display, GC gc); EXTERN void Tk_FreeImage(Tk_Image image); /* 74 */ EXTERN void Tk_FreeOptions(const Tk_ConfigSpec *specs, - char *widgRec, Display *display, + void *widgRec, Display *display, int needFlags); /* 75 */ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap); @@ -964,9 +964,9 @@ typedef struct TkStubs { void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ - int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */ - int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */ - int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size argc, const char **argv, char *widgRec, int flags); /* 29 */ + int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 27 */ + int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, void *widgRec, const char *argvName, int flags); /* 28 */ + int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, Tcl_Size argc, const char **argv, void *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, Tcl_Size numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ @@ -1011,7 +1011,7 @@ typedef struct TkStubs { void (*tk_FreeFont) (Tk_Font f); /* 71 */ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */ void (*tk_FreeImage) (Tk_Image image); /* 73 */ - void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */ + void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, void *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ TCL_DEPRECATED_API("function does nothing, call can be removed") void (*tk_FreeXId) (Display *display, XID xid); /* 77 */ diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 9344777..a7da3d9 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -768,14 +768,14 @@ ImgBmapCmd( return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) modelPtr, Tcl_GetString(objv[2]), 0); + modelPtr, Tcl_GetString(objv[2]), 0); case 1: /* configure */ if (objc == 2) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, NULL, 0); + configSpecs, modelPtr, NULL, 0); } else if (objc == 3) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, + configSpecs, modelPtr, Tcl_GetString(objv[2]), 0); } else { return ImgBmapConfigureModel(modelPtr, objc-2, objv+2, @@ -1017,7 +1017,7 @@ ImgBmapDelete( if (modelPtr->maskData != NULL) { ckfree(modelPtr->maskData); } - Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + Tk_FreeOptions(configSpecs, modelPtr, NULL, 0); ckfree(modelPtr); } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 757fae4..b8b3dd7 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -526,7 +526,7 @@ ImgPhotoCmd( } } else { Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) modelPtr, Tcl_GetString(objv[2]), 0); + modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } @@ -540,7 +540,7 @@ ImgPhotoCmd( Tcl_Obj *obj, *subobj; result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, NULL, 0); + configSpecs, modelPtr, NULL, 0); if (result != TCL_OK) { return result; } @@ -616,7 +616,7 @@ ImgPhotoCmd( return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, arg, 0); + configSpecs, modelPtr, arg, 0); } } else { return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2, @@ -2462,7 +2462,7 @@ ImgPhotoDelete( if (modelPtr->metadata != NULL) { Tcl_DecrRefCount(modelPtr->metadata); } - Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + Tk_FreeOptions(configSpecs, modelPtr, NULL, 0); ckfree(modelPtr); } diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index bb44763..a25861d 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -78,7 +78,7 @@ Tk_ConfigureWidget( const Tk_ConfigSpec *specs, /* Describes legal options. */ Tcl_Size argc, /* Number of elements in argv. */ const char **argv, /* Command-line options. */ - char *widgRec, /* Record whose fields are to be modified. + void *widgRec, /* Record whose fields are to be modified. * Values must be properly initialized. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be @@ -608,7 +608,7 @@ Tk_ConfigureInfo( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ - char *widgRec, /* Record whose fields contain current values + void *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* If non-NULL, indicates a single option * whose info is to be returned. Otherwise @@ -922,7 +922,7 @@ Tk_ConfigureValue( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window corresponding to widgRec. */ const Tk_ConfigSpec *specs, /* Describes legal options. */ - char *widgRec, /* Record whose fields contain current values + void *widgRec, /* Record whose fields contain current values * for options. */ const char *argvName, /* Gives the command-line name for the option * whose value is to be returned. */ @@ -990,7 +990,7 @@ Tk_ConfigureValue( void Tk_FreeOptions( const Tk_ConfigSpec *specs, /* Describes legal options. */ - char *widgRec, /* Record whose fields contain current values + void *widgRec, /* Record whose fields contain current values * for options. */ Display *display, /* X display; needed for freeing some * resources. */ @@ -1008,7 +1008,7 @@ Tk_FreeOptions( if (specPtr->offset < 0) { continue; } - ptr = widgRec + specPtr->offset; + ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_STRING: if (*((char **) ptr) != NULL) { diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 4fb8b3c..a776488 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -293,16 +293,16 @@ ScrollbarWidgetObjCmd( goto error; } result = Tk_ConfigureValue(interp, scrollPtr->tkwin, - configSpecs, (char *) scrollPtr, Tcl_GetString(objv[2]), 0); + configSpecs, scrollPtr, Tcl_GetString(objv[2]), 0); break; } case COMMAND_CONFIGURE: { if (objc == 2) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - configSpecs, (char *) scrollPtr, NULL, 0); + configSpecs, scrollPtr, NULL, 0); } else if (objc == 3) { result = Tk_ConfigureInfo(interp, scrollPtr->tkwin, - configSpecs, (char *) scrollPtr, Tcl_GetString(objv[2]), 0); + configSpecs, scrollPtr, Tcl_GetString(objv[2]), 0); } else { result = ConfigureScrollbar(interp, scrollPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); @@ -606,7 +606,7 @@ TkScrollbarEventProc( * Tk_FreeOptions handle all the standard option-related stuff. */ - Tk_FreeOptions(configSpecs, (char*) scrollPtr, scrollPtr->display, 0); + Tk_FreeOptions(configSpecs, scrollPtr, scrollPtr->display, 0); Tcl_EventuallyFree(scrollPtr, TCL_DYNAMIC); } else if (eventPtr->type == ConfigureNotify) { TkpComputeScrollbarGeometry(scrollPtr); -- cgit v0.12