diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-12 21:20:21 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-03-12 21:20:21 (GMT) |
commit | 1a1118fa21d731504dac09ed2e6d6238601f5c84 (patch) | |
tree | 582b351a98fe27e820ca3d6d0281519c1a11dbcf /generic/tkCanvUtil.c | |
parent | d72c843661bf5789ff40389b8b71707d92437397 (diff) | |
download | tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.zip tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.tar.gz tk-1a1118fa21d731504dac09ed2e6d6238601f5c84.tar.bz2 |
More -1 -> TCL_INDEX_NONE. More TCL_UNUSED(
Diffstat (limited to 'generic/tkCanvUtil.c')
-rw-r--r-- | generic/tkCanvUtil.c | 86 |
1 files changed, 32 insertions, 54 deletions
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index b4c9852..beff519 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -46,7 +46,7 @@ static const Tk_SmoothMethod tkRawSmoothMethod = { * Function forward-declarations. */ -static void SmoothMethodCleanupProc(ClientData clientData, +static void SmoothMethodCleanupProc(void *clientData, Tcl_Interp *interp); static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp); static int DashConvert(char *l, const char *p, int n, @@ -235,14 +235,12 @@ Tk_CanvasWindowCoords( int Tk_CanvasGetCoord( - Tcl_Interp *dummy, /* Interpreter for error reporting. */ + TCL_UNUSED(Tcl_Interp *), /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ const char *string, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { - (void)dummy; - if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string, doublePtr) != TCL_OK) { return TCL_ERROR; @@ -273,14 +271,12 @@ Tk_CanvasGetCoord( int Tk_CanvasGetCoordFromObj( - Tcl_Interp *dummy, /* Interpreter for error reporting. */ + TCL_UNUSED(Tcl_Interp *), /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ Tcl_Obj *obj, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { - (void)dummy; - return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr); } @@ -407,20 +403,17 @@ Tk_CanvasGetTextInfo( int Tk_CanvasTagsParseProc( - ClientData dummy, /* Not used.*/ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ - Tcl_Size offset) /* Offset into item (ignored). */ + TCL_UNUSED(Tcl_Size)) /* Offset into item (ignored). */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; Tcl_Size argc, i; const char **argv; Tk_Uid *newPtr; - (void)dummy; - (void)tkwin; - (void)offset; /* * Break the value up into the individual tag names. @@ -477,18 +470,15 @@ Tk_CanvasTagsParseProc( const char * Tk_CanvasTagsPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ - Tcl_Size offset, /* Ignored. */ + TCL_UNUSED(Tcl_Size), /* Ignored. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; - (void)dummy; - (void)tkwin; - (void)offset; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; @@ -522,16 +512,13 @@ Tk_CanvasTagsPrintProc( int TkCanvasDashParseProc( - ClientData dummy, /* Not used.*/ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ { - (void)dummy; - (void)tkwin; - return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } @@ -559,8 +546,8 @@ TkCanvasDashParseProc( const char * TkCanvasDashPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset in record for item. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with @@ -570,13 +557,11 @@ TkCanvasDashPrintProc( Tk_Dash *dash = (Tk_Dash *) (widgRec+offset); char *buffer, *p; int i = dash->number; - (void)dummy; - (void)tkwin; if (i < 0) { i = -i; *freeProcPtr = TCL_DYNAMIC; - buffer = (char *)ckalloc(i + 1); + buffer = (char *)ckalloc((Tcl_Size)i + 1); p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; memcpy(buffer, p, (unsigned int) i); buffer[i] = 0; @@ -585,13 +570,13 @@ TkCanvasDashPrintProc( *freeProcPtr = NULL; return ""; } - buffer = (char *)ckalloc(4 * i); + buffer = (char *)ckalloc(4 * (Tcl_Size)i); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - snprintf(buffer, 4 * i, "%d", *p++ & 0xff); + snprintf(buffer, 4 * (size_t)i, "%d", *p++ & 0xff); while (--i) { - snprintf(buffer + strlen(buffer), 4 * i - strlen(buffer), " %d", *p++ & 0xff); + snprintf(buffer + strlen(buffer), 4 * (size_t)i - strlen(buffer), " %d", *p++ & 0xff); } return buffer; } @@ -713,12 +698,11 @@ Tk_CreateSmoothMethod( static void SmoothMethodCleanupProc( - ClientData clientData, /* Points to "smoothMethod" AssocData for the + void *clientData, /* Points to "smoothMethod" AssocData for the * interpreter. */ - Tcl_Interp *dummy) /* Interpreter that is being deleted. */ + TCL_UNUSED(Tcl_Interp *)) /* Interpreter that is being deleted. */ { SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData; - (void)dummy; while (methods != NULL) { ptr = methods; @@ -746,9 +730,9 @@ SmoothMethodCleanupProc( int TkSmoothParseProc( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset) /* Offset into item. */ @@ -759,8 +743,6 @@ TkSmoothParseProc( int b; size_t length; SmoothAssocData *methods; - (void)dummy; - (void)tkwin; if (value == NULL || *value == 0) { *smoothPtr = NULL; @@ -840,19 +822,16 @@ TkSmoothParseProc( const char * TkSmoothPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset into item. */ - Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with + TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); - (void)dummy; - (void)tkwin; - (void)freeProcPtr; return smoothPtr ? smoothPtr->name : "0"; } @@ -900,7 +879,7 @@ Tk_GetDash( if (i <= 0) { goto badDashList; } - i = strlen(value); + i = (int)strlen(value); if (i > (int) sizeof(char *)) { dash->pattern.pt = pt = (char *)ckalloc(strlen(value)); } else { @@ -1454,7 +1433,7 @@ Tk_CanvasPsOutline( ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - Tcl_AppendToObj(psObj, "[", -1); + Tcl_AppendToObj(psObj, "[", TCL_INDEX_NONE); if (dash->number > 0) { Tcl_Obj *converted; char *p = ptr; @@ -1465,7 +1444,7 @@ Tk_CanvasPsOutline( } Tcl_AppendObjToObj(psObj, converted); if (dash->number & 1) { - Tcl_AppendToObj(psObj, " ", -1); + Tcl_AppendToObj(psObj, " ", TCL_INDEX_NONE); Tcl_AppendObjToObj(psObj, converted); } Tcl_DecrRefCount(converted); @@ -1484,22 +1463,22 @@ Tk_CanvasPsOutline( } Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else { - Tcl_AppendToObj(psObj, "] 0 setdash\n", -1); + Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } if (lptr != pattern) { ckfree(lptr); } } else { - Tcl_AppendToObj(psObj, "] 0 setdash\n", -1); + Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } Tk_CanvasPsColor(interp, canvas, color); if (stipple != None) { - Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", -1); + Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", TCL_INDEX_NONE); Tk_CanvasPsStipple(interp, canvas, stipple); } else { - Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", -1); + Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", TCL_INDEX_NONE); } return TCL_OK; @@ -1665,7 +1644,7 @@ TkCanvTranslatePath( int numVertex, /* Number of vertices specified by * coordArr[] */ double *coordArr, /* X and Y coordinates for each vertex */ - int closedPath, /* True if this is a closed polygon */ + TCL_UNUSED(int), /* True if this is a closed polygon */ XPoint *outArr) /* Write results here, if not NULL */ { int numOutput = 0; /* Number of output coordinates */ @@ -1677,7 +1656,6 @@ TkCanvTranslatePath( int i, j; /* Loop counters */ double limit[4]; /* Boundries at which clipping occurs */ double staticSpace[480]; /* Temp space from the stack */ - (void)closedPath; /* * Constrain all vertices of the path to be within a box that is no larger |