From 121af720bc29f65b64fcdcf520cb2d00368eb258 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Oct 2020 07:56:33 +0000 Subject: Fix many warnings related to the -Wshadow gcc compiler flag --- generic/tkCanvArc.c | 46 ++++++++++----------- generic/tkCanvLine.c | 61 ++++++++++++--------------- generic/tkCanvPoly.c | 29 +++++++------ generic/tkCanvText.c | 30 +++++++------- generic/tkCanvas.c | 75 +++++++++++++++------------------ generic/tkGrid.c | 33 +++++++-------- generic/tkImage.c | 2 - generic/tkImgPPM.c | 23 +++++------ generic/tkImgPhoto.c | 59 +++++++++++++------------- generic/tkPanedWindow.c | 85 +++++++++++++++++++------------------- generic/tkScrollbar.c | 16 +++---- generic/tkTest.c | 103 +++++++++++++++++++--------------------------- generic/tkText.c | 8 ++-- generic/tkTextBTree.c | 12 ++---- generic/tkTextWind.c | 2 - generic/ttk/ttkNotebook.c | 10 ++--- unix/tkUnixButton.c | 14 +++---- unix/tkUnixMenu.c | 75 ++++++++++++++++----------------- unix/tkUnixMenubu.c | 8 ++-- unix/tkUnixSelect.c | 58 +++++++++++++------------- 20 files changed, 346 insertions(+), 403 deletions(-) diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index c93b95a..ccfe116 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -352,8 +352,8 @@ ArcCoords( objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]); objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs)); - } else if ((objc == 1)||(objc == 4)) { - if (objc==1) { + } else if ((objc == 1) || (objc == 4)) { + if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; @@ -510,7 +510,7 @@ ConfigureArc( if (arcPtr->disabledFillStipple!=None) { stipple = arcPtr->disabledFillStipple; } - } + } if (arcPtr->style == ARC_STYLE) { newGC = NULL; @@ -576,11 +576,11 @@ ConfigureArc( static void DeleteArc( - Tk_Canvas canvas, /* Info about overall canvas. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { - ArcItem *arcPtr = (ArcItem *) itemPtr; + ArcItem *arcPtr = (ArcItem *)itemPtr; Tk_DeleteOutline(display, &(arcPtr->outline)); if (arcPtr->numOutlinePoints != 0) { @@ -626,7 +626,6 @@ DeleteArc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void ComputeArcBbox( Tk_Canvas canvas, /* Canvas that contains item. */ @@ -663,13 +662,13 @@ ComputeArcBbox( */ if (arcPtr->bbox[1] > arcPtr->bbox[3]) { - double tmp = arcPtr->bbox[3]; + tmp = arcPtr->bbox[3]; arcPtr->bbox[3] = arcPtr->bbox[1]; arcPtr->bbox[1] = tmp; } if (arcPtr->bbox[0] > arcPtr->bbox[2]) { - double tmp = arcPtr->bbox[2]; + tmp = arcPtr->bbox[2]; arcPtr->bbox[2] = arcPtr->bbox[0]; arcPtr->bbox[0] = tmp; @@ -678,7 +677,7 @@ ComputeArcBbox( ComputeArcOutline(canvas,arcPtr); /* - * To compute the bounding box, start with the the bbox formed by the two + * To compute the bounding box, start with the bbox formed by the two * endpoints of the arc. Then add in the center of the arc's oval (if * relevant) and the 3-o'clock, 6-o'clock, 9-o'clock, and 12-o'clock * positions, if they are relevant. @@ -769,8 +768,10 @@ DisplayArc( Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int x, int y, /* Describes region of canvas that must be */ - int width, int height) /* redisplayed (not used). */ + TCL_UNUSED(int), /* Describes region of canvas that must be */ + TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { ArcItem *arcPtr = (ArcItem *) itemPtr; short x1, y1, x2, y2; @@ -942,7 +943,6 @@ DisplayArc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double ArcToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1107,7 +1107,6 @@ ArcToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ArcToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1447,7 +1446,7 @@ ComputeArcOutline( */ if (arcPtr->numOutlinePoints == 0) { - arcPtr->outlinePtr = ckalloc(26 * sizeof(double)); + arcPtr->outlinePtr = (double *)ckalloc(26 * sizeof(double)); arcPtr->numOutlinePoints = 22; } outlinePtr = arcPtr->outlinePtr; @@ -1461,7 +1460,7 @@ ComputeArcOutline( * curved arc segment, which are marked with X's in the figure below: * * - * * * * + * * * * * * * * * * * * * * * * * @@ -1814,7 +1813,7 @@ ArcToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -2028,17 +2027,16 @@ ArcToPostscript( static int StyleParseProc( - ClientData clientData, /* some flags.*/ + 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. */ int offset) /* Offset into item. */ { int c; size_t length; - - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); if (value == NULL || *value == 0) { *stylePtr = PIESLICE_STYLE; @@ -2092,15 +2090,15 @@ StyleParseProc( static const char * StylePrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Ignored. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Ignored. */ char *widgRec, /* Pointer to record for item. */ int 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. */ { - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); if (*stylePtr == ARC_STYLE) { return "arc"; diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 7e74942..ba7753e 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -406,7 +406,7 @@ LineCoords( numPoints = objc/2; if (linePtr->numPoints != numPoints) { - coordPtr = ckalloc(sizeof(double) * objc); + coordPtr = (double *)ckalloc(sizeof(double) * objc); if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } @@ -602,7 +602,7 @@ ConfigureLine( static void DeleteLine( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { @@ -706,7 +706,7 @@ ComputeLineBbox( tsoffset = &linePtr->outline.tsoffset; if (tsoffset->flags & TK_OFFSET_INDEX) { - double *coordPtr = linePtr->coordPtr + coordPtr = linePtr->coordPtr + (tsoffset->flags & ~TK_OFFSET_INDEX); if (tsoffset->flags <= 0) { @@ -830,9 +830,10 @@ DisplayLine( Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int x, int y, int width, int height) - /* Describes region of canvas that must be - * redisplayed (not used). */ + TCL_UNUSED(int), /* Describes region of canvas that must be */ + TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { LineItem *linePtr = (LineItem *) itemPtr; XPoint staticPoints[MAX_STATIC_POINTS*3]; @@ -875,7 +876,7 @@ DisplayLine( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * 3 * sizeof(XPoint)); } if ((linePtr->smooth) && (linePtr->numPoints > 2)) { @@ -984,7 +985,7 @@ LineInsert( linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } - newCoordPtr = ckalloc(sizeof(double) * (length + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc)); for (i=0; icoordPtr[i]; } @@ -1319,7 +1320,6 @@ LineDeleteCoords( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double LineToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1365,7 +1365,7 @@ LineToPoint( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1547,7 +1547,6 @@ LineToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int LineToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1600,7 +1599,7 @@ LineToArea( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1695,8 +1694,6 @@ ScaleLine( linePtr->firstArrowPtr = NULL; } if (linePtr->lastArrowPtr != NULL) { - int i; - i = 2*(linePtr->numPoints-1); linePtr->coordPtr[i] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1]; @@ -1873,12 +1870,11 @@ TranslateLine( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ParseArrowShape( - ClientData clientData, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Window tkwin, /* Not used. */ + TCL_UNUSED(Tk_Window), /* Not used. */ const char *value, /* Textual specification of arrow shape. */ char *recordPtr, /* Pointer to item record in which to store * arrow information. */ @@ -1942,14 +1938,13 @@ ParseArrowShape( *-------------------------------------------------------------- */ - /* ARGSUSED */ static const char * PrintArrowShape( - ClientData clientData, /* Not used. */ - Tk_Window tkwin, /* Window associated with linePtr's widget. */ + TCL_UNUSED(void *), /* Not used. */ + TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ - int offset, /* Offset of arrow information in record. */ + TCL_UNUSED(int), /* Offset of arrow information in record. */ Tcl_FreeProc **freeProcPtr) /* Store address of function to call to free * string here. */ { @@ -1982,17 +1977,16 @@ PrintArrowShape( static int ArrowParseProc( - ClientData clientData, /* some flags.*/ + 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. */ int offset) /* Offset into item. */ { int c; size_t length; - - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); if (value == NULL || *value == 0) { *arrowPtr = ARROWS_NONE; @@ -2050,15 +2044,15 @@ ArrowParseProc( static const char * ArrowPrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int 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. */ { - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); switch (*arrowPtr) { case ARROWS_FIRST: @@ -2092,7 +2086,6 @@ ArrowPrintProc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ConfigureArrows( Tk_Canvas canvas, /* Canvas in which arrows will be displayed @@ -2153,7 +2146,7 @@ ConfigureArrows( if (linePtr->arrow != ARROWS_LAST) { poly = linePtr->firstArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = linePtr->coordPtr[0]; poly[1] = poly[11] = linePtr->coordPtr[1]; linePtr->firstArrowPtr = poly; @@ -2197,7 +2190,7 @@ ConfigureArrows( coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2); poly = linePtr->lastArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = coordPtr[2]; poly[1] = poly[11] = coordPtr[3]; linePtr->lastArrowPtr = poly; @@ -2254,7 +2247,7 @@ LineToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -2366,7 +2359,7 @@ LineToPostscript( linePtr->numPoints, linePtr->splineSteps, NULL, NULL); pointPtr = staticPoints; if (numPoints > MAX_STATIC_POINTS) { - pointPtr = ckalloc(numPoints * 2 * sizeof(double)); + pointPtr = (double *)ckalloc(numPoints * 2 * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr); diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index a537846..513613d 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -376,7 +376,7 @@ PolygonCoords( * another point to close the polygon. */ - polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2)); + polyPtr->coordPtr = (double *)ckalloc(sizeof(double) * (objc+2)); polyPtr->pointsAllocated = numPoints+1; } for (i = objc-1; i >= 0; i--) { @@ -564,7 +564,7 @@ ConfigurePolygon( static void DeletePolygon( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { @@ -825,7 +825,7 @@ TkFillPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } for (i=0, pPtr=pointPtr ; istate; @@ -971,7 +972,7 @@ DisplayPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); @@ -998,7 +999,7 @@ DisplayPolygon( * * PolygonInsert -- * - * Insert coords into a polugon item at a given index. + * Insert coords into a polygon item at a given index. * * Results: * None. @@ -1038,7 +1039,7 @@ PolygonInsert( while (beforeThis < 0) { beforeThis += length; } - newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc)); for (i=0; icoordPtr[i]; } @@ -1240,7 +1241,6 @@ PolygonDeleteCoords( *-------------------------------------------------------------- */ - /* ARGSUSED */ static double PolygonToPoint( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1288,7 +1288,7 @@ PolygonToPoint( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1430,7 +1430,6 @@ PolygonToPoint( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int PolygonToArea( Tk_Canvas canvas, /* Canvas containing item. */ @@ -1497,7 +1496,7 @@ PolygonToArea( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1667,7 +1666,7 @@ ScalePolygon( static int GetPolygonIndex( Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in @@ -1797,7 +1796,7 @@ PolygonToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 9a27efc..0945857 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -1031,8 +1031,8 @@ TextInsert( return; } - newStr = ckalloc(textPtr->numBytes + byteCount + 1); - memcpy(newStr, text, (size_t) byteIndex); + newStr = (char *)ckalloc(textPtr->numBytes + byteCount + 1); + memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); @@ -1112,8 +1112,8 @@ TextDeleteChars( byteCount = TkUtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); - newStr = ckalloc(textPtr->numBytes + 1 - byteCount); - memcpy(newStr, text, (size_t) byteIndex); + newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); + memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); ckfree(text); @@ -1267,7 +1267,6 @@ TextToArea( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void ScaleText( Tk_Canvas canvas, /* Canvas containing rectangle. */ @@ -1338,7 +1337,7 @@ TranslateText( static int GetTextIndex( Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular character in @@ -1354,13 +1353,13 @@ GetTextIndex( c = string[0]; - if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) { + if ((c == 'e') && (strncmp(string, "end", length) == 0)) { *indexPtr = textPtr->numChars; } else if ((c == 'i') - && (strncmp(string, "insert", (unsigned) length) == 0)) { + && (strncmp(string, "insert", length) == 0)) { *indexPtr = textPtr->insertPos; } else if ((c == 's') && (length >= 5) - && (strncmp(string, "sel.first", (unsigned) length) == 0)) { + && (strncmp(string, "sel.first", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); @@ -1369,7 +1368,7 @@ GetTextIndex( } *indexPtr = textInfoPtr->selectFirst; } else if ((c == 's') && (length >= 5) - && (strncmp(string, "sel.last", (unsigned) length) == 0)) { + && (strncmp(string, "sel.last", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); @@ -1379,7 +1378,7 @@ GetTextIndex( *indexPtr = textInfoPtr->selectLast; } else if (c == '@') { int x, y; - double tmp, c = textPtr->cosine, s = textPtr->sine; + double tmp, cs = textPtr->cosine, s = textPtr->sine; char *end; const char *p; @@ -1398,7 +1397,7 @@ GetTextIndex( x -= (int) textPtr->drawOrigin[0]; y -= (int) textPtr->drawOrigin[1]; *indexPtr = Tk_PointToChar(textPtr->textLayout, - (int) (x*c - y*s), (int) (y*c + x*s)); + (int) (x*cs - y*s), (int) (y*cs + x*s)); } else if (Tcl_GetIntFromObj(NULL, obj, indexPtr) == TCL_OK) { if (*indexPtr < 0) { *indexPtr = 0; @@ -1435,10 +1434,9 @@ GetTextIndex( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void SetTextCursor( - Tk_Canvas canvas, /* Record describing canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */ Tk_Item *itemPtr, /* Text item in which cursor position is to be * set. */ int index) /* Character index of character just before @@ -1477,7 +1475,7 @@ SetTextCursor( static int GetSelText( - Tk_Canvas canvas, /* Canvas containing selection. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */ Tk_Item *itemPtr, /* Text item containing selection. */ int offset, /* Byte offset within selection of first * character to be returned. */ @@ -1608,7 +1606,7 @@ TextToPostscript( Tcl_GetString(Tcl_GetObjResult(interp))); } - x = 0; y = 0; justify = NULL; /* lint. */ + x = 0; y = 0; justify = NULL; switch (textPtr->anchor) { case TK_ANCHOR_NW: x = 0; y = 0; break; case TK_ANCHOR_N: x = 1; y = 0; break; diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index c63520b..2ce5e50 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -517,7 +517,7 @@ ItemDisplay( canvasPtr->display, pixmap, screenX1, screenY1, width, height); } -static inline int +static int ItemIndex( TkCanvas *canvasPtr, Tk_Item *itemPtr, @@ -638,7 +638,7 @@ Tk_CanvasObjCmd( int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkCanvas *canvasPtr; Tk_Window newWin; @@ -662,7 +662,7 @@ Tk_CanvasObjCmd( * pointers). */ - canvasPtr = ckalloc(sizeof(TkCanvas)); + canvasPtr = (TkCanvas *)ckalloc(sizeof(TkCanvas)); canvasPtr->tkwin = newWin; canvasPtr->display = Tk_Display(newWin); canvasPtr->interp = interp; @@ -788,7 +788,7 @@ CanvasWidgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ @@ -835,7 +835,7 @@ CanvasWidgetCmd( Tcl_Preserve(canvasPtr); result = TCL_OK; - switch ((enum options) index) { + switch ((enum options)index) { case CANV_ADDTAG: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?"); @@ -897,7 +897,7 @@ CanvasWidgetCmd( break; } case CANV_BIND: { - ClientData object; + void *object; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?sequence? ?command?"); @@ -948,9 +948,9 @@ CanvasWidgetCmd( Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, - (char *) INT2PTR(searchPtr->id)); + INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); object = itemPtr; } @@ -1185,7 +1185,6 @@ CanvasWidgetCmd( tmpObj = Tcl_NewListObj(2, objv+4); FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto doneImove) { - int index; int x1, x2, y1, y2; int dontRedraw1, dontRedraw2; @@ -1238,7 +1237,6 @@ CanvasWidgetCmd( case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; - Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; @@ -1297,9 +1295,8 @@ CanvasWidgetCmd( } typePtr = matchPtr; - itemPtr = ckalloc(typePtr->itemSize); - itemPtr->id = canvasPtr->nextId; - canvasPtr->nextId++; + itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize); + itemPtr->id = canvasPtr->nextId++; itemPtr->tagPtr = itemPtr->staticTagSpace; itemPtr->tagSpace = TK_TAG_SPACE; itemPtr->numTags = 0; @@ -1315,7 +1312,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; @@ -1394,7 +1391,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; @@ -1531,7 +1528,6 @@ CanvasWidgetCmd( } break; case CANV_ICURSOR: { - int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index"); @@ -1556,7 +1552,6 @@ CanvasWidgetCmd( break; } case CANV_INDEX: { - int index; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId string"); @@ -1656,7 +1651,6 @@ CanvasWidgetCmd( } break; case CANV_LOWER: { - Tk_Item *itemPtr; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?"); @@ -1941,7 +1935,7 @@ CanvasWidgetCmd( break; } case CANV_SELECT: { - int index, optionindex; + int optionindex; static const char *const optionStrings[] = { "adjust", "clear", "from", "item", "to", NULL }; @@ -2413,7 +2407,7 @@ static void CanvasWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkCanvas *canvasPtr = instanceData; + TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; itemPtr = canvasPtr->firstItemPtr; @@ -2451,7 +2445,7 @@ static void DisplayCanvas( ClientData clientData) /* Information about widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; @@ -2705,7 +2699,7 @@ CanvasEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (eventPtr->type == Expose) { int x, y; @@ -2795,7 +2789,7 @@ static void CanvasCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; /* @@ -3287,7 +3281,7 @@ NextItem( static SearchUids * GetStaticUids(void) { - SearchUids *searchUids = + SearchUids *searchUids = (SearchUids *) Tcl_GetThreadData(&dataKey, sizeof(SearchUids)); if (searchUids->allUid == NULL) { @@ -3326,7 +3320,7 @@ TagSearchExprInit( TagSearchExpr *expr = *exprPtrPtr; if (expr == NULL) { - expr = ckalloc(sizeof(TagSearchExpr)); + expr = (TagSearchExpr *)ckalloc(sizeof(TagSearchExpr)); expr->allocated = 0; expr->uids = NULL; expr->next = NULL; @@ -3407,7 +3401,7 @@ TagSearchScan( * Allocate primary search struct on first call. */ - *searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch)); + *searchPtrPtr = searchPtr = (TagSearch *)ckalloc(sizeof(TagSearch)); searchPtr->expr = NULL; /* @@ -3415,7 +3409,7 @@ TagSearchScan( */ searchPtr->rewritebufferAllocated = 100; - searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated); + searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated); } TagSearchExprInit(&searchPtr->expr); @@ -3432,7 +3426,7 @@ TagSearchScan( if ((unsigned) searchPtr->stringLength >= searchPtr->rewritebufferAllocated) { searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100; - searchPtr->rewritebuffer = + searchPtr->rewritebuffer = (char *) ckrealloc(searchPtr->rewritebuffer, searchPtr->rewritebufferAllocated); } @@ -3615,10 +3609,10 @@ TagSearchScanExpr( if (expr->index >= expr->allocated-1) { expr->allocated += 15; if (expr->uids) { - expr->uids = ckrealloc(expr->uids, + expr->uids = (Tk_Uid *)ckrealloc(expr->uids, expr->allocated * sizeof(Tk_Uid)); } else { - expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid)); + expr->uids = (Tk_Uid *)ckalloc(expr->allocated * sizeof(Tk_Uid)); } } @@ -4028,9 +4022,9 @@ 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); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; } else { lastPtr = itemPtr = NULL; @@ -4249,7 +4243,7 @@ DoItem( Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; - newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); + newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); memcpy((void *) newTagPtr, itemPtr->tagPtr, itemPtr->numTags * sizeof(Tk_Uid)); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { @@ -5123,8 +5117,8 @@ 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 @@ -5250,7 +5244,7 @@ static void CanvasBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; @@ -5406,7 +5400,7 @@ CanvasFetchSelection( * not including terminating NULL * character. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset, buffer, maxBytes); @@ -5434,7 +5428,7 @@ static void CanvasLostSelection( ClientData clientData) /* Information about entry widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr); canvasPtr->textInfo.selItemPtr = NULL; @@ -5763,19 +5757,18 @@ CanvasSetOrigin( *---------------------------------------------------------------------- */ -/* ARGSUSED */ static const char ** TkGetStringsFromObjs( int objc, Tcl_Obj *const objv[]) { - register int i; + int i; const char **argv; if (objc <= 0) { return NULL; } - argv = ckalloc((objc+1) * sizeof(char *)); + argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index c222417..785bc7f 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -339,7 +339,7 @@ Tk_GridObjCmd( static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", "content", "forget", "info", "location", "propagate", - "remove", "rowconfigure", "size", "slaves", NULL + "remove", "rowconfigure", "size", "slaves", NULL }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, @@ -384,8 +384,8 @@ Tk_GridObjCmd( return GridPropagateCommand(tkwin, interp, objc, objv); case GRID_SIZE: return GridSizeCommand(tkwin, interp, objc, objv); - case GRID_CONTENT: case GRID_SLAVES: + case GRID_CONTENT: return GridContentCommand(tkwin, interp, objc, objv); /* @@ -1236,7 +1236,7 @@ GridRowColumnConfigureCommand( if (slotPtr != NULL) { if (slotType == ROW) { - int last = containerPtr->containerDataPtr->rowMax - 1; + last = containerPtr->containerDataPtr->rowMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) @@ -1245,7 +1245,7 @@ GridRowColumnConfigureCommand( } containerPtr->containerDataPtr->rowMax = last+1; } else { - int last = containerPtr->containerDataPtr->columnMax - 1; + last = containerPtr->containerDataPtr->columnMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) @@ -1733,10 +1733,9 @@ ArrangeGrid( containerPtr->flags &= ~REQUESTED_RELAYOUT; /* - * If the container has no content anymore, then don't do anything at all: - * just leave the container's size as-is. Otherwise there is no way to - * "relinquish" control over the container so another geometry manager can - * take over. + * If the container has no content anymore, then don't change the container size. + * Otherwise there is no way to "relinquish" control over the container + * so another geometry manager can take over. */ if (containerPtr->contentPtr == NULL) { @@ -1820,7 +1819,6 @@ ArrangeGrid( for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; contentPtr = contentPtr->nextPtr) { int x, y; /* Top left coordinate */ - int width, height; /* Slot or content size */ int col = contentPtr->column; int row = contentPtr->row; @@ -1931,7 +1929,7 @@ ResolveConstraints( int uniformGroups; /* Number of currently used uniform groups. */ int uniformGroupsAlloced; /* Size of allocated space for uniform * groups. */ - int weight, minSize; + int minSize; int prevGrow, accWeight, grow; /* @@ -2060,6 +2058,7 @@ ResolveConstraints( for (slot = 0; slot < gridCount; slot++) { if (layoutPtr[slot].uniform != NULL) { + int weight; for (start = 0; start < uniformGroups; start++) { if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) { break; @@ -2112,7 +2111,7 @@ ResolveConstraints( for (start = 0; start < uniformGroups; start++) { if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) { - weight = layoutPtr[slot].weight; + int weight = layoutPtr[slot].weight; weight = weight > 0 ? weight : 1; layoutPtr[slot].minSize = uniformGroupPtr[start].minSize * weight; @@ -2702,7 +2701,7 @@ InitContainerData( Gridder *containerPtr) { if (containerPtr->containerDataPtr == NULL) { - GridContainer *gridPtr = containerPtr->containerDataPtr = + GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *) ckalloc(sizeof(GridContainer)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; @@ -2989,7 +2988,7 @@ ConfigureContent( * If the stored container does not exist, just ignore it. */ - struct Gridder *contentPtr = GetGrid(content); + contentPtr = GetGrid(content); if (contentPtr->in != NULL) { if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent) == TCL_OK) { @@ -3129,7 +3128,7 @@ ConfigureContent( for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows; defaultColumnSpan++) { - const char *string = Tcl_GetString(objv[j + defaultColumnSpan]); + string = Tcl_GetString(objv[j + defaultColumnSpan]); if (*string != REL_HORIZ) { break; @@ -3431,9 +3430,9 @@ ConfigureContent( int lastRow, lastColumn; /* Implied end of table. */ string = Tcl_GetString(objv[j]); - firstChar = string[0]; + firstChar = string[0]; - if (firstChar == '.') { + if (firstChar == '.') { lastWindow = string; numSkip = 0; } @@ -3456,7 +3455,7 @@ ConfigureContent( */ for (width = 1; width + j < numWindows; width++) { - const char *string = Tcl_GetString(objv[j+width]); + string = Tcl_GetString(objv[j+width]); if (*string != REL_VERT) { break; diff --git a/generic/tkImage.c b/generic/tkImage.c index 763c65b..d42ed7d 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -361,8 +361,6 @@ Tk_ImageObjCmd( objc -= firstOption; args = (Tcl_Obj **) objv; if (oldimage) { - int i; - args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index 89d4387..fed1ca7 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -94,13 +94,13 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr, static int FileMatchPPM( Tcl_Channel chan, /* The image file, open for reading. */ - const char *fileName, /* The name of the image file. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(const char *), /* The name of the image file. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw PPM * file. */ - Tcl_Interp *interp) /* unused */ + TCL_UNUSED(Tcl_Interp *)) /* unused */ { int dummy; @@ -131,7 +131,7 @@ FileReadPPM( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ const char *fileName, /* The name of the image file. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ @@ -211,7 +211,7 @@ FileReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -281,7 +281,7 @@ static int FileWritePPM( Tcl_Interp *interp, const char *fileName, - Tcl_Obj *format, + TCL_UNUSED(Tcl_Obj *), Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan; @@ -368,7 +368,7 @@ FileWritePPM( static int StringWritePPM( Tcl_Interp *interp, - Tcl_Obj *format, + TCL_UNUSED(Tcl_Obj *), Tk_PhotoImageBlock *blockPtr) { int w, h, size, greenOffset, blueOffset; @@ -444,12 +444,12 @@ StringWritePPM( static int StringMatchPPM( Tcl_Obj *dataObj, /* The image data. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw PPM * file. */ - Tcl_Interp *interp) /* unused */ + TCL_UNUSED(Tcl_Interp *)) /* unused */ { int dummy; @@ -479,7 +479,7 @@ static int StringReadPPM( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Obj *dataObj, /* The image data. */ - Tcl_Obj *format, /* User-specified format string, or NULL. */ + TCL_UNUSED(Tcl_Obj *), /* User-specified format string, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo * image to be written to. */ @@ -578,7 +578,7 @@ StringReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -600,7 +600,6 @@ StringReadPPM( *p = (((int) *dataBuffer) * 255)/maxIntensity; } } else { - unsigned char *p; unsigned int value; for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index afbf7b0..8f5295f 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -216,10 +216,10 @@ static const char * GetExtension(const char *path); static void PhotoFormatThreadExitProc( - ClientData clientData) /* not used */ + TCL_UNUSED(void *)) /* not used */ { Tk_PhotoImageFormat *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); while (tsdPtr->oldFormatList != NULL) { @@ -262,14 +262,14 @@ Tk_CreateOldPhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; @@ -283,21 +283,21 @@ Tk_CreatePhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; if (isupper((unsigned char) *formatPtr->name)) { copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; } else { /* for compatibility with aMSN: make a copy of formatPtr->name */ - char *name = ckalloc(strlen(formatPtr->name) + 1); + char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; @@ -330,7 +330,7 @@ ImgPhotoCreate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ - const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ + TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it @@ -342,7 +342,7 @@ ImgPhotoCreate( * Allocate and initialize the photo image model record. */ - modelPtr = ckalloc(sizeof(PhotoModel)); + modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel)); memset(modelPtr, 0, sizeof(PhotoModel)); modelPtr->tkMaster = model; modelPtr->interp = interp; @@ -413,7 +413,7 @@ ImgPhotoCmd( int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -818,7 +818,7 @@ ImgPhotoCmd( } /* - * Extract the value of the desired pixel and format it as a string. + * Extract the value of the desired pixel and format it as a list. */ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; @@ -1797,7 +1797,7 @@ ImgPhotoConfigureModel( Tk_PhotoImageFormat *imageFormat; const char **args; - args = ckalloc((objc + 1) * sizeof(char *)); + args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = Tcl_GetString(objv[i]); length = objv[i]->length; @@ -2138,7 +2138,7 @@ ImgPhotoDelete( ClientData modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoModel *modelPtr = modelData; + PhotoModel *modelPtr = (PhotoModel *)modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { @@ -2190,7 +2190,7 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoModel structure for * image. */ { - PhotoModel *modelPtr = clientData; + PhotoModel *modelPtr = (PhotoModel *)clientData; modelPtr->imageCmd = NULL; if (modelPtr->tkMaster != NULL) { @@ -2263,7 +2263,7 @@ ImgPhotoSetSize( if (newPixSize == 0) { newPix32 = NULL; } else { - newPix32 = attemptckalloc(newPixSize); + newPix32 = (unsigned char *)attemptckalloc(newPixSize); if (newPix32 == NULL) { return TCL_ERROR; } @@ -2426,7 +2426,7 @@ MatchFileFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2566,7 +2566,7 @@ MatchStringFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2724,7 +2724,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoModel *modelPtr = (PhotoModel *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2786,7 +2786,7 @@ Tk_PhotoPutBlock( unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; - sourceBlock.pixelPtr = attemptckalloc(cpyLen); + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3077,10 +3077,10 @@ Tk_PhotoPutBlock( */ if (!(modelPtr->flags & COMPLEX_ALPHA)) { - register int x1; + int x1; for (x1=x ; x1pix32 + (y*modelPtr->width + x1)*4; newAlpha = destLinePtr[3]; @@ -3162,8 +3162,8 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoModel *modelPtr = (PhotoModel *) handle; - register Tk_PhotoImageBlock sourceBlock; + PhotoModel *modelPtr = (PhotoModel *) handle; + Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt; @@ -3232,7 +3232,7 @@ Tk_PhotoPutZoomedBlock( unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + sourceBlock.width * sourceBlock.pixelSize; - sourceBlock.pixelPtr = attemptckalloc(cpyLen); + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(cpyLen); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3837,7 +3837,7 @@ ImgGetPhoto( blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) || ((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) { - int newPixelSize,x,y; + int newPixelSize; unsigned char *srcPtr, *destPtr; char *data; @@ -3850,7 +3850,7 @@ ImgGetPhoto( if (blockPtr->height > (int)((UINT_MAX/newPixelSize)/blockPtr->width)) { return NULL; } - data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); + data = (char *)attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); if (data == NULL) { return NULL; } @@ -4058,7 +4058,7 @@ Tk_PhotoGetImage( /* *-------------------------------------------------------------- * - * TkPostscriptPhoto -- + * ImgPostscriptPhoto -- * * This function is called to output the contents of a photo image in * Postscript by calling the Tk_PostscriptPhoto function. @@ -4076,11 +4076,11 @@ static int ImgPhotoPostscript( ClientData clientData, /* Handle for the photo image. */ Tcl_Interp *interp, /* Interpreter. */ - Tk_Window tkwin, /* (unused) */ + TCL_UNUSED(Tk_Window), /* (unused) */ Tk_PostscriptInfo psInfo, /* Postscript info. */ int x, int y, /* First pixel to output. */ int width, int height, /* Width and height of area. */ - int prepass) /* (unused) */ + TCL_UNUSED(int)) /* (unused) */ { Tk_PhotoImageBlock block; @@ -4195,5 +4195,6 @@ Tk_PhotoSetSize_Panic( * mode: c * c-basic-offset: 4 * fill-column: 78 + * tab-width: 8 * End: */ diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index fec9448..06a42d4 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -13,8 +13,8 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#include "default.h" #include "tkInt.h" +#include "default.h" /* * Flag values for "sticky"ness. The 16 combinations subsume the packer's @@ -383,7 +383,7 @@ static const Tk_OptionSpec paneOptionSpecs[] = { int Tk_PanedWindowObjCmd( - ClientData clientData, /* NULL. */ + TCL_UNUSED(ClientData), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -437,7 +437,7 @@ Tk_PanedWindowObjCmd( * Allocate and initialize the widget record. */ - pwPtr = ckalloc(sizeof(PanedWindow)); + pwPtr = (PanedWindow *)ckalloc(sizeof(PanedWindow)); memset((void *)pwPtr, 0, (sizeof(PanedWindow))); pwPtr->tkwin = tkwin; pwPtr->display = Tk_Display(tkwin); @@ -535,7 +535,7 @@ PanedWindowWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int result = TCL_OK; static const char *const optionStrings[] = { "add", "cget", "configure", "forget", "identify", "panecget", @@ -604,7 +604,6 @@ PanedWindowWidgetObjCmd( break; case PW_FORGET: { - int i; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?"); @@ -903,7 +902,7 @@ ConfigurePanes( * structures may already have existed, some may be new. */ - inserts = ckalloc(sizeof(Pane *) * (firstOptionArg - 2)); + inserts = (Pane **)ckalloc(sizeof(Pane *) * (firstOptionArg - 2)); insertIndex = 0; /* @@ -970,7 +969,7 @@ ConfigurePanes( * out with their "natural" dimensions. */ - panePtr = ckalloc(sizeof(Pane)); + panePtr = (Pane *)ckalloc(sizeof(Pane)); memset(panePtr, 0, sizeof(Pane)); Tk_InitOptions(interp, (char *)panePtr, pwPtr->paneOpts, pwPtr->tkwin); @@ -1010,8 +1009,8 @@ ConfigurePanes( */ i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); - newPanes = ckalloc(i); - memset(newPanes, 0, (size_t) i); + newPanes = (Pane **)ckalloc(i); + memset(newPanes, 0, i); if (index == -1) { /* * If none of the existing panes have to be moved, just copy the old @@ -1249,7 +1248,7 @@ ConfigurePanedWindow( Tk_SavedOptions savedOptions; int typemask = 0; - if (Tk_SetOptions(interp, (char *) pwPtr, pwPtr->optionTable, objc, objv, + if (Tk_SetOptions(interp, (char *)pwPtr, pwPtr->optionTable, objc, objv, pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; @@ -1295,7 +1294,7 @@ PanedWindowWorldChanged( { XGCValues gcValues; GC newGC; - PanedWindow *pwPtr = instanceData; + PanedWindow *pwPtr = (PanedWindow *)instanceData; /* * Allocated a graphics context for drawing the paned window widget @@ -1352,7 +1351,7 @@ PanedWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int i; if (eventPtr->type == Expose) { @@ -1405,7 +1404,7 @@ static void PanedWindowCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1442,7 +1441,7 @@ static void DisplayPanedWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; @@ -1484,10 +1483,10 @@ DisplayPanedWindow( */ if (horizontal) { - sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderWidth(tkwin)); + sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashWidth = pwPtr->sashWidth; } else { - sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderWidth(tkwin)); + sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashHeight = pwPtr->sashWidth; } @@ -1627,10 +1626,10 @@ static void PanedWindowReqProc( ClientData clientData, /* Paned window's information about window * that got new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (Tk_IsMapped(pwPtr->tkwin)) { @@ -1673,9 +1672,9 @@ static void PanedWindowLostPaneProc( ClientData clientData, /* Grid structure for the pane that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the pane. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */ { - register Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) { @@ -1714,8 +1713,8 @@ ArrangePanes( ClientData clientData) /* Structure describing parent whose panes * are to be re-layed out. */ { - register PanedWindow *pwPtr = clientData; - register Pane *panePtr; + PanedWindow *pwPtr = (PanedWindow *)clientData; + Pane *panePtr; int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; @@ -1754,7 +1753,7 @@ ArrangePanes( */ paneDynSize = paneDynMinSize = 0; - internalBW = Tk_InternalBorderWidth(pwPtr->tkwin); + internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW); pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW); x = y = internalBW; @@ -2014,9 +2013,9 @@ ArrangePanes( static void Unlink( - register Pane *panePtr) /* Window to unlink. */ + Pane *panePtr) /* Window to unlink. */ { - register PanedWindow *containerPtr; + PanedWindow *containerPtr; int i, j; containerPtr = panePtr->containerPtr; @@ -2160,7 +2159,7 @@ PaneStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Pane *panePtr = clientData; + Pane *panePtr = (Pane *)clientData; PanedWindow *pwPtr = panePtr->containerPtr; if (eventPtr->type == DestroyNotify) { @@ -2200,7 +2199,7 @@ ComputeGeometry( pwPtr->flags |= REQUESTED_RELAYOUT; - x = y = internalBw = Tk_InternalBorderWidth(pwPtr->tkwin); + x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin); reqWidth = reqHeight = 0; /* @@ -2370,7 +2369,7 @@ ComputeGeometry( static void DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { ckfree(clientData); } @@ -2394,8 +2393,8 @@ DestroyOptionTables( static Tcl_Obj * GetSticky( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the * sticky value. */ @@ -2442,9 +2441,9 @@ GetSticky( static int SetSticky( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ - Tk_Window tkwin, /* Window for which option is being set. */ + TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ @@ -2521,8 +2520,8 @@ SetSticky( static void RestoreSticky( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { @@ -2754,7 +2753,7 @@ ProxyWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { @@ -2786,7 +2785,7 @@ static void DisplayProxyWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; @@ -2906,7 +2905,7 @@ PanedWindowProxyCommand( return TCL_ERROR; } - internalBW = Tk_InternalBorderWidth(pwPtr->tkwin); + internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (x < 0) { x = 0; @@ -2915,10 +2914,10 @@ PanedWindowProxyCommand( if (x > pwWidth) { x = pwWidth; } - y = Tk_InternalBorderWidth(pwPtr->tkwin); + y = Tk_InternalBorderLeft(pwPtr->tkwin); sashWidth = pwPtr->sashWidth; sashHeight = Tk_Height(pwPtr->tkwin) - - (2 * Tk_InternalBorderWidth(pwPtr->tkwin)); + (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } else { if (y < 0) { y = 0; @@ -2927,10 +2926,10 @@ PanedWindowProxyCommand( if (y > pwHeight) { y = pwHeight; } - x = Tk_InternalBorderWidth(pwPtr->tkwin); + x = Tk_InternalBorderLeft(pwPtr->tkwin); sashHeight = pwPtr->sashWidth; sashWidth = Tk_Width(pwPtr->tkwin) - - (2 * Tk_InternalBorderWidth(pwPtr->tkwin)); + (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } if (sashWidth < 1) { @@ -3066,7 +3065,7 @@ PanedWindowIdentifyCoords( } else { sashHeight = Tk_ReqHeight(pwPtr->tkwin); } - sashHeight -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin); + sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { sashWidth = pwPtr->handleSize; lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2; @@ -3094,7 +3093,7 @@ PanedWindowIdentifyCoords( } else { sashWidth = Tk_ReqWidth(pwPtr->tkwin); } - sashWidth -= 2 * Tk_InternalBorderWidth(pwPtr->tkwin); + sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); lpad = rpad = 0; } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 9a85532..8c80846 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -127,8 +127,8 @@ Tk_ScrollbarObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; - register TkScrollbar *scrollPtr; + Tk_Window tkwin = (Tk_Window)clientData; + TkScrollbar *scrollPtr; Tk_Window newWin; if (objc < 2) { @@ -223,7 +223,7 @@ ScrollbarWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; int result = TCL_OK; int length, cmdIndex; static const char *const commandNames[] = { @@ -308,7 +308,7 @@ ScrollbarWidgetObjCmd( break; } case COMMAND_DELTA: { - int xDelta, yDelta, pixels, length; + int xDelta, yDelta, pixels; double fraction; if (objc != 4) { @@ -337,7 +337,7 @@ ScrollbarWidgetObjCmd( break; } case COMMAND_FRACTION: { - int x, y, pos, length; + int x, y, pos; double fraction; if (objc != 4) { @@ -521,7 +521,7 @@ ScrollbarWidgetObjCmd( static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ @@ -584,7 +584,7 @@ TkScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); @@ -649,7 +649,7 @@ static void ScrollbarCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; /* diff --git a/generic/tkTest.c b/generic/tkTest.c index 3c17407..1fa821c 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -244,7 +244,7 @@ Tktest_Init( */ if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) { - return TCL_ERROR; + return TCL_ERROR; } Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL); @@ -324,10 +324,9 @@ Tktest_Init( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestbitmapObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -359,10 +358,9 @@ TestbitmapObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestborderObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(ClientData), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -394,10 +392,9 @@ TestborderObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcolorObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -428,10 +425,9 @@ TestcolorObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestcursorObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -457,19 +453,18 @@ TestcursorObjCmd( * A standard Tcl result. * * Side effects: - * All the intepreters created by previous calls to "testnewapp" get + * All the interpreters created by previous calls to "testnewapp" get * deleted. * *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestdeleteappsObjCmd( - ClientData clientData, /* Main window for application. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument strings. */ + TCL_UNUSED(void *), /* Main window for application. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */ { NewApp *nextPtr; @@ -500,7 +495,6 @@ TestdeleteappsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestobjconfigObjCmd( ClientData clientData, /* Main window for application. */ @@ -639,7 +633,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; - Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; @@ -650,7 +643,7 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(TypesRecord)); + recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -695,7 +688,6 @@ TestobjconfigObjCmd( case CHAIN1: { ExtensionWidgetRecord *recordPtr; - Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, @@ -707,7 +699,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, baseSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -748,7 +740,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, (ClientData) baseSpecs, 0} }; - Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, @@ -760,7 +751,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, extensionSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -917,7 +908,6 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; - Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; @@ -1072,7 +1062,7 @@ TestobjconfigObjCmd( Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; - Tk_Window tkwin = Tk_CreateWindowFromPath(interp, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window) clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { @@ -1080,7 +1070,7 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(ContentRecord)); + recordPtr = (ContentRecord *)ckalloc(sizeof(ContentRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, contentSpecs); @@ -1133,7 +1123,6 @@ TestobjconfigObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TrivialConfigObjCmd( ClientData clientData, /* Main window for application. */ @@ -1245,7 +1234,7 @@ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { @@ -1257,8 +1246,8 @@ TrivialCmdDeletedProc( * here. */ - Tk_FreeConfigOptions((char *) clientData, - headerPtr->optionTable, (Tk_Window) NULL); + Tk_FreeConfigOptions((char *)clientData, + headerPtr->optionTable, NULL); Tcl_EventuallyFree(clientData, TCL_DYNAMIC); } } @@ -1284,11 +1273,11 @@ TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TrivialCommandHeader *headerPtr = (TrivialCommandHeader *) clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { - Tk_FreeConfigOptions((char *) clientData, + Tk_FreeConfigOptions((char *)clientData, headerPtr->optionTable, headerPtr->tkwin); headerPtr->optionTable = NULL; headerPtr->tkwin = NULL; @@ -1316,7 +1305,6 @@ TrivialEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestfontObjCmd( ClientData clientData, /* Main window for application. */ @@ -1330,7 +1318,7 @@ TestfontObjCmd( Tk_Window tkwin; Tk_Font tkfont; - tkwin = (Tk_Window) clientData; + tkwin = (Tk_Window)clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); @@ -1376,7 +1364,6 @@ TestfontObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ImageCreate( Tcl_Interp *interp, /* Interpreter for application containing @@ -1385,7 +1372,7 @@ ImageCreate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ - const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ + TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it @@ -1410,14 +1397,14 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageModel)); + timPtr = (TImageModel *)ckalloc(sizeof(TImageModel)); timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -1442,7 +1429,6 @@ ImageCreate( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ImageObjCmd( ClientData clientData, /* Main window for application. */ @@ -1450,7 +1436,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; int x, y, width, height; if (objc < 2) { @@ -1505,7 +1491,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1514,7 +1500,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -1553,7 +1539,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; /* * The purpose of the test image type is to track the calls to an image @@ -1637,7 +1623,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->modelPtr->imageName); @@ -1671,7 +1657,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageModel *timPtr = (TImageModel *) clientData; + TImageModel *timPtr = (TImageModel *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); @@ -1702,7 +1688,6 @@ ImageDelete( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestmakeexistObjCmd( ClientData clientData, /* Main window for application. */ @@ -1710,7 +1695,7 @@ TestmakeexistObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; int i; Tk_Window tkwin; @@ -1743,7 +1728,6 @@ TestmakeexistObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarObjCmd( @@ -1753,7 +1737,7 @@ TestmenubarObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin, menubar; if (objc < 2) { @@ -1813,7 +1797,7 @@ TestmenubarObjCmd( #if defined(_WIN32) static int TestmetricsObjCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1858,7 +1842,6 @@ TestmetricsObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestpropObjCmd( ClientData clientData, /* Main window for application. */ @@ -1866,7 +1849,7 @@ TestpropObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = (Tk_Window) clientData; + Tk_Window mainWin = (Tk_Window)clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; @@ -1937,7 +1920,6 @@ TestpropObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int TestwrapperObjCmd( ClientData clientData, /* Main window for application. */ @@ -1953,7 +1935,7 @@ TestwrapperObjCmd( return TCL_ERROR; } - tkwin = (Tk_Window) clientData; + tkwin = (Tk_Window)clientData; winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; @@ -1990,17 +1972,16 @@ TestwrapperObjCmd( * CustomOptionSet Sets option value to new setting. * CustomOptionGet Creates a new Tcl_Obj. * CustomOptionRestore Resets option value to original value. - * CustomOptionFree Free storage for internal rep of - * option. + * CustomOptionFree Free storage for internal rep of option. * *---------------------------------------------------------------------- */ static int CustomOptionSet( - ClientData clientData, + TCL_UNUSED(void *), Tcl_Interp *interp, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), Tcl_Obj **value, char *recordPtr, int internalOffset, @@ -2045,7 +2026,7 @@ CustomOptionSet( if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); - newStr = ckalloc((*value)->length + 1); + newStr = (char *)ckalloc((*value)->length + 1); strcpy(newStr, string); } else { newStr = NULL; @@ -2059,8 +2040,8 @@ CustomOptionSet( static Tcl_Obj * CustomOptionGet( - ClientData clientData, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, int internalOffset) { diff --git a/generic/tkText.c b/generic/tkText.c index 5996688..c41fc67 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -701,7 +701,7 @@ TextWidgetObjCmd( { TkText *textPtr = (TkText *)clientData; int result = TCL_OK; - int index; + int idx; static const char *const optionStrings[] = { "bbox", "cget", "compare", "configure", "count", "debug", "delete", @@ -724,12 +724,12 @@ TextWidgetObjCmd( } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, - sizeof(char *), "option", 0, &index) != TCL_OK) { + sizeof(char *), "option", 0, &idx) != TCL_OK) { return TCL_ERROR; } textPtr->refCount++; - switch ((enum options) index) { + switch ((enum options) idx) { case TEXT_BBOX: { int x, y, width, height; const TkTextIndex *indexPtr; @@ -3124,7 +3124,7 @@ DeleteIndexRange( line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; - int arraySize, i; + int arraySize; TkTextIndex oldIndex2; oldIndex2 = index2; diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index fba26b9..7832992 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1070,7 +1070,7 @@ TkBTreeInsertChars( curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; - memcpy(segPtr->body.chars, string, (size_t)chunkSize); + memcpy(segPtr->body.chars, string, chunkSize); segPtr->body.chars[chunkSize] = 0; if (eol[-1] != '\n') { @@ -4169,7 +4169,7 @@ Rebalance( Node *otherPtr; Node *halfwayNodePtr = NULL; /* Initialization needed only */ TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */ - int totalChildren, firstChildren, i; + int totalChildren, firstChildren; /* * Too few children for this node. If this is the root then, it's @@ -4230,8 +4230,6 @@ Rebalance( otherPtr->children.linePtr = NULL; } if (nodePtr->level == 0) { - TkTextLine *linePtr; - for (linePtr = nodePtr->children.linePtr, i = 1; linePtr->nextPtr != NULL; linePtr = linePtr->nextPtr, i++) { @@ -4246,8 +4244,6 @@ Rebalance( i++; } } else { - Node *childPtr; - for (childPtr = nodePtr->children.nodePtr, i = 1; childPtr->nextPtr != NULL; childPtr = childPtr->nextPtr, i++) { @@ -4559,7 +4555,7 @@ CharSplitProc( newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; - memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t)index); + memcpy(newPtr1->body.chars, segPtr->body.chars, index); newPtr1->body.chars[index] = 0; newPtr2->typePtr = &tkTextCharType; newPtr2->nextPtr = segPtr->nextPtr; @@ -4660,7 +4656,7 @@ CharDeleteProc( static void CharCheckProc( TkTextSegment *segPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { /* * Make sure that the segment contains the number of characters indicated diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c160083..c9f34e4 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -160,7 +160,6 @@ TkTextWindowCmd( switch ((enum windOptions) optionIndex) { case WIND_CGET: { TkTextIndex index; - TkTextSegment *ewPtr; Tcl_Obj *objPtr; TkTextEmbWindowClient *client; @@ -201,7 +200,6 @@ TkTextWindowCmd( } case WIND_CONFIGURE: { TkTextIndex index; - TkTextSegment *ewPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?"); diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index bd7c7ba..83075bc 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -2,10 +2,10 @@ * Copyright (c) 2004, Joe English */ +#include "tkInt.h" #include #include #include -#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -294,7 +294,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; - Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); + Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -326,7 +326,7 @@ static Ttk_State TabState(Notebook *nb, int index) } break; } - if (tab->state == TAB_STATE_DISABLED) { + if (itab->state == TAB_STATE_DISABLED) { state |= TTK_STATE_DISABLED; } @@ -968,8 +968,8 @@ static int NotebookInsertCommand( /* Move existing content window: */ if (ConfigureTab(interp, nb, - (Tab *)Ttk_ContentData(nb->notebook.mgr,srcIndex), - Ttk_ContentWindow(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex), + Ttk_ContentWindow(nb->notebook.mgr, srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 6a99124..8d293f6 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -173,7 +173,7 @@ TkpDrawCheckIndicator( * Sanity check. */ - if (tkwin == NULL || display == None || d == None || bgBorder == NULL + if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL || indicatorColor == NULL) { return; } @@ -326,11 +326,9 @@ TkpDrawCheckIndicator( TkButton * TkpCreateButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - UnixButton *butPtr = ckalloc(sizeof(UnixButton)); - - return (TkButton *) butPtr; + return (TkButton *)ckalloc(sizeof(UnixButton)); } /* @@ -396,7 +394,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - register TkButton *butPtr = (TkButton *) clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -807,8 +805,6 @@ TkpDisplayButton( butPtr->borderWidth, relief); } if (butPtr->highlightWidth > 0) { - GC gc; - if (butPtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); } else { @@ -860,7 +856,7 @@ TkpDisplayButton( void TkpComputeButtonGeometry( - register TkButton *butPtr) /* Button whose geometry may have changed. */ + TkButton *butPtr) /* Button whose geometry may have changed. */ { int width, height, avgWidth, txtWidth, txtHeight; int haveImage = 0, haveText = 0; diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index fc8b4f2..4ef5af2 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -145,7 +145,7 @@ TkpNewMenu( void TkpDestroyMenu( - TkMenu *menuPtr) + TCL_UNUSED(TkMenu *)) { /* * Nothing to do. @@ -171,7 +171,7 @@ TkpDestroyMenu( void TkpDestroyMenuEntry( - TkMenuEntry *mEntryPtr) + TCL_UNUSED(TkMenuEntry *)) { /* * Nothing to do. @@ -199,7 +199,7 @@ TkpDestroyMenuEntry( int TkpConfigureMenuEntry( - register TkMenuEntry *mePtr)/* Information about menu entry; may or may + TkMenuEntry *mePtr)/* Information about menu entry; may or may * not already have values for some fields. */ { /* @@ -239,7 +239,7 @@ TkpConfigureMenuEntry( int TkpMenuNewEntry( - TkMenuEntry *mePtr) + TCL_UNUSED(TkMenuEntry *)) { return TCL_OK; } @@ -292,9 +292,9 @@ TkpSetWindowMenuBar( void TkpSetMainMenubar( - Tcl_Interp *interp, - Tk_Window tkwin, - const char *menuName) + TCL_UNUSED(Tcl_Interp *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(const char *)) { /* * Nothing to do. @@ -323,8 +323,8 @@ static void GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are drawing. */ TkMenuEntry *mePtr, /* The entry we are interested in. */ - Tk_Font tkfont, /* The precalculated font */ - const Tk_FontMetrics *fmPtr,/* The precalculated metrics */ + TCL_UNUSED(Tk_Font), /* The precalculated font */ + TCL_UNUSED(const Tk_FontMetrics *),/* The precalculated metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { @@ -445,7 +445,6 @@ DrawMenuEntryBackground( } else { relief = TK_RELIEF_RAISED; } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, @@ -524,7 +523,7 @@ DrawMenuEntryAccelerator( if (menuPtr->menuType == MENUBAR) { left += 5; } - Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, + Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel, mePtr->accelLength, left, (y + (height + fmPtr->ascent - fmPtr->descent) / 2)); } @@ -554,11 +553,11 @@ DrawMenuEntryIndicator( Tk_3DBorder border, /* The background color */ XColor *indicatorColor, /* The color to draw indicators with */ XColor *disableColor, /* The color use use when disabled */ - Tk_Font tkfont, /* The font to draw with */ - const Tk_FontMetrics *fmPtr,/* The font metrics of the font */ + TCL_UNUSED(Tk_Font), /* The font to draw with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics of the font */ int x, /* The left of the entry rect */ int y, /* The top of the entry rect */ - int width, /* Width of menu entry */ + TCL_UNUSED(int), /* Width of menu entry */ int height) /* Height of menu entry */ { /* @@ -623,11 +622,11 @@ DrawMenuEntryIndicator( static void DrawMenuSeparator( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are drawing */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are using */ - GC gc, /* The gc to draw into */ - Tk_Font tkfont, /* The font to draw with */ - const Tk_FontMetrics *fmPtr,/* The font metrics from the font */ + TCL_UNUSED(GC), /* The gc to draw into */ + TCL_UNUSED(Tk_Font), /* The font to draw with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The font metrics from the font */ int x, int y, int width, int height) { @@ -790,7 +789,7 @@ DrawMenuEntryLabel( imageHeight, d, leftEdge + imageXOffset, (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset)); } - } else if (mePtr->bitmapPtr != None) { + } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr); XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, @@ -818,7 +817,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && (menuPtr->disabledImageGC != None)) { + && (menuPtr->disabledImageGC != NULL)) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -852,7 +851,7 @@ DrawMenuUnderline( Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, - int width, int height) + TCL_UNUSED(int), int height) { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -931,7 +930,7 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ @@ -1021,9 +1020,9 @@ TkpPostTearoffMenu( static void GetMenuSeparatorGeometry( - TkMenu *menuPtr, /* The menu we are measuring */ - TkMenuEntry *mePtr, /* The entry we are measuring */ - Tk_Font tkfont, /* The precalculated font */ + TCL_UNUSED(TkMenu *), /* The menu we are measuring */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ + TCL_UNUSED(Tk_Font), /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ @@ -1051,7 +1050,7 @@ GetMenuSeparatorGeometry( static void GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are measuring */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are measuring */ Tk_Font tkfont, /* The precalculated font */ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The resulting width */ @@ -1092,15 +1091,13 @@ TkpComputeMenubarGeometry( Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int width, height, i, j, x, y, currentRowHeight, maxWidth; int maxWindowWidth, lastRowBreak, lastEntry; - int borderWidth, activeBorderWidth, helpMenuIndex = -1; + int activeBorderWidth, helpMenuIndex = -1; TkMenuEntry *mePtr; if (menuPtr->tkwin == NULL) { return; } - Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, - &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); maxWidth = 0; @@ -1122,7 +1119,7 @@ TkpComputeMenubarGeometry( /* * On the Mac especially, getting font metrics can be quite slow, so * we want to do it intelligently. We are going to precalculate them - * and pass them down to all of the measureing and drawing routines. + * and pass them down to all of the measuring and drawing routines. * We will measure the font metrics of the menu once, and if an entry * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. @@ -1269,11 +1266,11 @@ TkpComputeMenubarGeometry( static void DrawTearoffEntry( TkMenu *menuPtr, /* The menu we are drawing */ - TkMenuEntry *mePtr, /* The entry we are drawing */ + TCL_UNUSED(TkMenuEntry *), /* The entry we are drawing */ Drawable d, /* The drawable we are drawing into */ - GC gc, /* The gc we are drawing with */ - Tk_Font tkfont, /* The font we are drawing with */ - const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */ + TCL_UNUSED(GC), /* The gc we are drawing with */ + TCL_UNUSED(Tk_Font), /* The font we are drawing with */ + TCL_UNUSED(const Tk_FontMetrics *),/* The metrics we are drawing with */ int x, int y, int width, int height) { @@ -1324,8 +1321,8 @@ DrawTearoffEntry( void TkpInitializeMenuBindings( - Tcl_Interp *interp, /* The interpreter to set. */ - Tk_BindingTable bindingTable) + TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ + TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { /* @@ -1376,7 +1373,7 @@ SetHelpMenu( && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL) && (menuPtr->masterMenuPtr->tkwin != NULL)) { TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; - char *helpMenuName = ckalloc(strlen(Tk_PathName( + char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName( masterMenuPtr->tkwin)) + strlen(".help") + 1); strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin)); @@ -1852,8 +1849,8 @@ TkpComputeStandardMenuGeometry( void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ - const char *menuName) /* The name of the menu to reconfigure. */ + TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */ + TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */ { /* * Nothing to do. diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 2c6b99b..6677e83 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -25,16 +25,16 @@ * Returns a newly allocated TkMenuButton structure. * * Side effects: - * Registers an event handler for the widget. + * None * *---------------------------------------------------------------------- */ TkMenuButton * TkpCreateMenuButton( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - return ckalloc(sizeof(TkMenuButton)); + return (TkMenuButton *)ckalloc(sizeof(TkMenuButton)); } /* @@ -280,8 +280,6 @@ TkpDisplayMenuButton( mbPtr->borderWidth, mbPtr->relief); } if (mbPtr->highlightWidth != 0) { - GC gc; - if (mbPtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(mbPtr->highlightColorPtr, pixmap); } else { diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 4819183..527bc4c 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -240,17 +240,17 @@ TkSelGetSelection( void TkSelPropProc( - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register IncrInfo *incrPtr; - register TkSelHandler *selPtr; + IncrInfo *incrPtr; + TkSelHandler *selPtr; int length, numItems; unsigned long i; Atom target, formatType; long buffer[TK_SEL_WORDS_AT_ONCE]; TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display); Tk_ErrorHandler errorHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -356,7 +356,7 @@ TkSelPropProc( ((char *) buffer)[numItems] = 0; errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); /* * Encode the data using the proper format for each type. @@ -449,7 +449,7 @@ TkSelPropProc( if (srcLen > 3) { Tcl_Panic("selection conversion left too many bytes unconverted"); } - memcpy(incrPtr->converts[i].buffer, src, (size_t) srcLen+1); + memcpy(incrPtr->converts[i].buffer, src, srcLen + 1); Tcl_DStringFree(&ds); } else { /* @@ -519,10 +519,10 @@ TkSelPropProc( void TkSelEventProc( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X event: either SelectionClear, + XEvent *eventPtr) /* X event: either SelectionClear, * SelectionRequest, or SelectionNotify. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; Tcl_Interp *interp; @@ -540,12 +540,11 @@ TkSelEventProc( */ if (eventPtr->type == SelectionNotify) { - register TkSelRetrievalInfo *retrPtr; + TkSelRetrievalInfo *retrPtr; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; unsigned long numItems, bytesAfter; - Tcl_DString ds; for (retrPtr = pendingRetrievals; ; retrPtr = retrPtr->nextPtr) { if (retrPtr == NULL) { @@ -591,6 +590,7 @@ TkSelEventProc( if ((type == XA_STRING) || (type == dispPtr->textAtom) || (type == dispPtr->compoundTextAtom)) { Tcl_Encoding encoding; + Tcl_DString ds; if (format != 8) { Tcl_SetObjResult(retrPtr->interp, Tcl_ObjPrintf( @@ -649,7 +649,7 @@ TkSelEventProc( } if (propInfo[numItems] != '\0') { - propData = ckalloc(numItems + 1); + propData = (char *)ckalloc(numItems + 1); strcpy(propData, propInfo); propData[numItems] = '\0'; } @@ -742,7 +742,7 @@ static void SelTimeoutProc( ClientData clientData) /* Information about retrieval in progress. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; /* * Make sure that the retrieval is still in progress. Then see how long @@ -766,7 +766,7 @@ SelTimeoutProc( retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, - (ClientData) retrPtr); + retrPtr); } } @@ -796,7 +796,7 @@ ConvertSelection( * request; may not be selection's current * owner, be we set it to the current * owner. */ - register XSelectionRequestEvent *eventPtr) + XSelectionRequestEvent *eventPtr) /* Event describing request. */ { union { @@ -813,11 +813,11 @@ ConvertSelection( Tk_ErrorHandler errorHandler; TkSelectionInfo *infoPtr; TkSelInProgress ip; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1, - (int (*)()) NULL, NULL); + errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1, + -1, NULL, NULL); /* * Initialize the reply event. @@ -893,12 +893,12 @@ ConvertSelection( * below). */ - incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo)); + incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo)); incr.numIncrs = 0; for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; long buffer[TK_SEL_WORDS_AT_ONCE]; - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int numItems, format; char *propPtr; @@ -919,7 +919,7 @@ ConvertSelection( /* * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark - * the request as an errror. + * the request as an error. */ numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer, @@ -1064,7 +1064,7 @@ ConvertSelection( } Tcl_DeleteTimerHandler(incr.timeout); errorHandler = Tk_CreateErrorHandler(winPtr->display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L); Tk_DeleteErrorHandler(errorHandler); if (tsdPtr->pendingIncrs == &incr) { @@ -1124,9 +1124,9 @@ ConvertSelection( static void SelRcvIncrProc( ClientData clientData, /* Information about retrieval. */ - register XEvent *eventPtr) /* X PropertyChange event. */ + XEvent *eventPtr) /* X PropertyChange event. */ { - register TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -1374,7 +1374,7 @@ IncrTimeoutProc( * retrieval for which we are selection * owner. */ { - register IncrInfo *incrPtr = clientData; + IncrInfo *incrPtr = (IncrInfo *)clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { @@ -1435,7 +1435,7 @@ SelCvtToX( if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) { return NULL; } - propPtr = ckalloc(numFields * sizeof(long)); + propPtr = (long *)ckalloc(numFields * sizeof(long)); /* * Convert the fields one-by-one. @@ -1487,7 +1487,7 @@ SelCvtToX( static void SelCvtFromX32( - register long *propPtr, /* Property value from X. */ + long *propPtr, /* Property value from X. */ int numValues, /* Number of 32-bit values in property. */ Atom type, /* Type of property Should not be XA_STRING * (if so, don't bother calling this function @@ -1520,12 +1520,12 @@ SelCvtFromX32( static void SelCvtFromX8( - register char *propPtr, /* Property value from X. */ + char *propPtr, /* Property value from X. */ int numValues, /* Number of 8-bit values in property. */ - Atom type, /* Type of property Should not be XA_STRING + TCL_UNUSED(Atom), /* Type of property Should not be XA_STRING * (if so, don't bother calling this function * at all). */ - Tk_Window tkwin, /* Window to use for atom conversion. */ + TCL_UNUSED(Tk_Window), /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { /* -- cgit v0.12