From cf94275cacccff81abe333bc7b58109ab4637070 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 27 Oct 2022 15:08:49 +0000 Subject: Some more int -> Tcl_Size --- generic/tk.decls | 2 +- generic/tkCanvas.c | 4 ++-- generic/tkCmds.c | 4 ++-- generic/tkDecls.h | 8 ++++---- generic/tkInt.decls | 2 +- generic/tkIntDecls.h | 4 ++-- generic/tkUtil.c | 9 +++++++-- generic/ttk/ttkTheme.c | 4 ++-- generic/ttk/ttkTheme.h | 4 ++-- 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/generic/tk.decls b/generic/tk.decls index 2382a76..284f3ff 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -799,7 +799,7 @@ declare 209 { } declare 210 { int Tk_GetScrollInfoObj(Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) + Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) } declare 211 { int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 31a3504..7c0318b 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -2090,7 +2090,7 @@ CanvasWidgetCmd( } args = TkGetStringsFromObjs(objc, objv); - type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count); + type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count); if (args != NULL) { ckfree(args); } @@ -2136,7 +2136,7 @@ CanvasWidgetCmd( } args = TkGetStringsFromObjs(objc, objv); - type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count); + type = Tk_GetScrollInfoObj(interp, objc, objv, &fraction, &count); if (args != NULL) { ckfree(args); } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index a50ee8c..b781405 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1851,7 +1851,7 @@ Tk_WinfoObjCmd( int TkGetDisplayOf( Tcl_Interp *interp, /* Interpreter for error reporting. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. If it is present, * "-displayof" should be in objv[0] and * objv[1] the name of a window. */ @@ -1865,7 +1865,7 @@ TkGetDisplayOf( const char *string; Tcl_Size length; - if (objc < 1) { + if (objc + 1 < 2) { return 0; } string = Tcl_GetStringFromObj(objv[0], &length); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index f4bb4bf..5bfbb04 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -673,9 +673,9 @@ EXTERN int Tk_GetPixelsFromObj(Tcl_Interp *interp, EXTERN int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 210 */ -EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[], double *dblPtr, - int *intPtr); +EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, + Tcl_Size objc, Tcl_Obj *const objv[], + double *dblPtr, int *intPtr); /* 211 */ EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); @@ -1146,7 +1146,7 @@ typedef struct TkStubs { int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ - int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ + int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tk_MainEx) (Tcl_Size argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */ void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */ diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 5a8fddc..a67afa4 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -145,7 +145,7 @@ declare 34 { TkDisplay *TkGetDisplay(Display *display) } declare 35 { - int TkGetDisplayOf(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], + int TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr) } declare 36 { diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index ba87749..4926470 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -140,7 +140,7 @@ EXTERN const char * TkGetDefaultScreenName(Tcl_Interp *interp, /* 34 */ EXTERN TkDisplay * TkGetDisplay(Display *display); /* 35 */ -EXTERN int TkGetDisplayOf(Tcl_Interp *interp, int objc, +EXTERN int TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 36 */ EXTERN TkWindow * TkGetFocusWin(TkWindow *winPtr); @@ -612,7 +612,7 @@ typedef struct TkIntStubs { TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */ const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */ TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */ - int (*tkGetDisplayOf) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */ + int (*tkGetDisplayOf) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */ TkWindow * (*tkGetFocusWin) (TkWindow *winPtr); /* 36 */ int (*tkGetInterpNames) (Tcl_Interp *interp, Tk_Window tkwin); /* 37 */ int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */ diff --git a/generic/tkUtil.c b/generic/tkUtil.c index ac5c325..34bf739 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -723,7 +723,7 @@ Tk_GetScrollInfo( int Tk_GetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ - int objc, /* # arguments for command. */ + Tcl_Size objc, /* # arguments for command. */ Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ @@ -731,8 +731,13 @@ Tk_GetScrollInfoObj( * scroll, if any. */ { Tcl_Size length; - const char *arg = Tcl_GetStringFromObj(objv[2], &length); + const char *arg; + if (objc + 1 < 5) { + Tcl_WrongNumArgs(interp, 2, objv, "moveto|scroll args"); + return TK_SCROLL_ERROR; + } + arg = Tcl_GetStringFromObj(objv[2], &length); #define ArgPfxEq(str) \ ((arg[0] == str[0]) && !strncmp(arg, str, length)) diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index bf72b8a..ebf600e 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -1708,8 +1708,8 @@ StyleObjCmd( MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */ - const Ttk_Ensemble *ensemble, int cmdIndex, - void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + const Ttk_Ensemble *ensemble, Tcl_Size cmdIndex, + void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) { while (cmdIndex < objc) { int index; diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 581158c..1cfa42b 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -383,8 +383,8 @@ typedef struct TtkEnsemble { } Ttk_Ensemble; MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */ - const Ttk_Ensemble *commands, int cmdIndex, - void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); + const Ttk_Ensemble *commands, Tcl_Size cmdIndex, + void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TtkEnumerateHashTable(Tcl_Interp *, Tcl_HashTable *); -- cgit v0.12