From 381d1e050c4e92292956bbcd87b46a7631a4b568 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 29 Sep 2020 21:15:34 +0000 Subject: Fix [0008d6a6b3]: Mouse pointer position reported in non-existing window --- generic/tkCmds.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 193c3d6..f782144 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1623,7 +1623,12 @@ Tk_WinfoObjCmd( } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); + string = Tk_PathName(tkwin); + winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); + Tcl_ResetResult(interp); + if (winPtr && !(winPtr->flags & TK_ALREADY_DEAD)) { + Tcl_SetObjResult(interp, Tcl_NewStringObj(string, -1)); + } } break; case WIN_INTERPS: -- cgit v0.12 From c398d6bf2cc0c663cf503457d334bb99bee735f7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 1 Oct 2020 19:49:17 +0000 Subject: Another possible fix (but this does not match the documentation for in bind.n). --- generic/tkCmds.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index f782144..b8b1d3e 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1623,12 +1623,7 @@ Tk_WinfoObjCmd( } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { - string = Tk_PathName(tkwin); - winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); - Tcl_ResetResult(interp); - if (winPtr && !(winPtr->flags & TK_ALREADY_DEAD)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(string, -1)); - } + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); } break; case WIN_INTERPS: @@ -1694,10 +1689,7 @@ Tk_WinfoObjCmd( winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); Tcl_ResetResult(interp); - alive = 1; - if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) { - alive = 0; - } + alive = (winPtr != NULL); Tcl_SetObjResult(interp, Tcl_NewBooleanObj(alive)); break; } -- cgit v0.12 From 30699869c5cf8459e81c4bcedbe819d6887a02cb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 2 Oct 2020 15:07:23 +0000 Subject: Fix more warnings, related to -Wshadow, now in MacOSX code --- macosx/tkMacOSXColor.c | 10 +- macosx/tkMacOSXCursor.c | 268 +++++++++++++++++++------------------- macosx/tkMacOSXDialog.c | 10 +- macosx/tkMacOSXFont.c | 59 ++++----- macosx/tkMacOSXKeyboard.c | 3 +- macosx/tkMacOSXMenu.c | 84 ++++++------ macosx/tkMacOSXPrivate.h | 8 +- macosx/ttkMacOSXTheme.c | 324 +++++++++++++++++++++++----------------------- 8 files changed, 391 insertions(+), 375 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 208fc8b..5f549b1 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -31,7 +31,7 @@ static NSAppearance *lightAqua = nil; static NSAppearance *darkAqua = nil; #endif static NSColorSpace* sRGB = NULL; -static CGFloat windowBackground[4] = +static const CGFloat WINDOWBACKGROUND[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; void initColorTable() @@ -92,9 +92,9 @@ void initColorTable() for (key in [systemColorList allKeys]) { int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; char *name; - entry = ckalloc(sizeof(SystemColorDatum)); + entry = (SystemColorDatum *)ckalloc(sizeof(SystemColorDatum)); bzero(entry, sizeof(SystemColorDatum)); - name = ckalloc(length + 1); + name = (char *)ckalloc(length + 1); strcpy(name, key.UTF8String); name[0] = toupper(name[0]); if (!strcmp(name, "WindowBackgroundColor")) { @@ -124,7 +124,7 @@ void initColorTable() */ numSystemColors = index; - systemColorIndex = ckalloc(numSystemColors * sizeof(SystemColorDatum*)); + systemColorIndex = (SystemColorDatum **)ckalloc(numSystemColors * sizeof(SystemColorDatum *)); for (hPtr = Tcl_FirstHashEntry(&systemColors, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); @@ -297,7 +297,7 @@ GetRGBA( if ([NSApp macOSVersion] < 101400) { for (int i = 0; i < 3; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB]; diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 894a44d..4b2de7f 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -54,131 +54,131 @@ struct CursorName { #define MacXCursorData(n) ((id)tkMacOSXXCursors[TK_MAC_XCURSOR_##n]) static const struct CursorName cursorNames[] = { - {"none", NONE, nil}, - {"arrow", SELECTOR, @"arrowCursor"}, - {"top_left_arrow", SELECTOR, @"arrowCursor"}, - {"left_ptr", SELECTOR, @"arrowCursor"}, - {"copyarrow", SELECTOR, @"dragCopyCursor", @"_copyDragCursor"}, - {"aliasarrow", SELECTOR, @"dragLinkCursor", @"_linkDragCursor"}, - {"contextualmenuarrow", SELECTOR, @"contextualMenuCursor"}, - {"movearrow", SELECTOR, @"_moveCursor"}, - {"ibeam", SELECTOR, @"IBeamCursor"}, - {"text", SELECTOR, @"IBeamCursor"}, - {"xterm", SELECTOR, @"IBeamCursor"}, - {"cross", SELECTOR, @"crosshairCursor"}, - {"crosshair", SELECTOR, @"crosshairCursor"}, - {"cross-hair", SELECTOR, @"crosshairCursor"}, - {"tcross", SELECTOR, @"crosshairCursor"}, - {"hand", SELECTOR, @"openHandCursor"}, - {"openhand", SELECTOR, @"openHandCursor"}, - {"closedhand", SELECTOR, @"closedHandCursor"}, - {"fist", SELECTOR, @"closedHandCursor"}, - {"pointinghand", SELECTOR, @"pointingHandCursor"}, - {"resize", SELECTOR, @"arrowCursor"}, - {"resizeleft", SELECTOR, @"resizeLeftCursor"}, - {"resizeright", SELECTOR, @"resizeRightCursor"}, - {"resizeleftright", SELECTOR, @"resizeLeftRightCursor"}, - {"resizeup", SELECTOR, @"resizeUpCursor"}, - {"resizedown", SELECTOR, @"resizeDownCursor"}, - {"resizeupdown", SELECTOR, @"resizeUpDownCursor"}, - {"resizebottomleft", SELECTOR, @"_bottomLeftResizeCursor"}, - {"resizetopleft", SELECTOR, @"_topLeftResizeCursor"}, - {"resizebottomright", SELECTOR, @"_bottomRightResizeCursor"}, - {"resizetopright", SELECTOR, @"_topRightResizeCursor"}, - {"notallowed", SELECTOR, @"operationNotAllowedCursor"}, - {"poof", SELECTOR, @"disappearingItemCursor"}, - {"wait", SELECTOR, @"busyButClickableCursor"}, - {"spinning", SELECTOR, @"busyButClickableCursor"}, - {"countinguphand", SELECTOR, @"busyButClickableCursor"}, - {"countingdownhand", SELECTOR, @"busyButClickableCursor"}, - {"countingupanddownhand", SELECTOR, @"busyButClickableCursor"}, + {"none", NONE, nil, nil, {0, 0}}, + {"arrow", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"top_left_arrow", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"left_ptr", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"copyarrow", SELECTOR, @"dragCopyCursor", @"_copyDragCursor", {0, 0}}, + {"aliasarrow", SELECTOR, @"dragLinkCursor", @"_linkDragCursor", {0, 0}}, + {"contextualmenuarrow", SELECTOR, @"contextualMenuCursor", nil, {0, 0}}, + {"movearrow", SELECTOR, @"_moveCursor", nil, {0, 0}}, + {"ibeam", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"text", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"xterm", SELECTOR, @"IBeamCursor", nil, {0, 0}}, + {"cross", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"crosshair", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"cross-hair", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"tcross", SELECTOR, @"crosshairCursor", nil, {0, 0}}, + {"hand", SELECTOR, @"openHandCursor", nil, {0, 0}}, + {"openhand", SELECTOR, @"openHandCursor", nil, {0, 0}}, + {"closedhand", SELECTOR, @"closedHandCursor", nil, {0, 0}}, + {"fist", SELECTOR, @"closedHandCursor", nil, {0, 0}}, + {"pointinghand", SELECTOR, @"pointingHandCursor", nil, {0, 0}}, + {"resize", SELECTOR, @"arrowCursor", nil, {0, 0}}, + {"resizeleft", SELECTOR, @"resizeLeftCursor", nil, {0, 0}}, + {"resizeright", SELECTOR, @"resizeRightCursor", nil, {0, 0}}, + {"resizeleftright", SELECTOR, @"resizeLeftRightCursor", nil, {0, 0}}, + {"resizeup", SELECTOR, @"resizeUpCursor", nil, {0, 0}}, + {"resizedown", SELECTOR, @"resizeDownCursor", nil, {0, 0}}, + {"resizeupdown", SELECTOR, @"resizeUpDownCursor", nil, {0, 0}}, + {"resizebottomleft", SELECTOR, @"_bottomLeftResizeCursor", nil, {0, 0}}, + {"resizetopleft", SELECTOR, @"_topLeftResizeCursor", nil, {0, 0}}, + {"resizebottomright", SELECTOR, @"_bottomRightResizeCursor", nil, {0, 0}}, + {"resizetopright", SELECTOR, @"_topRightResizeCursor", nil, {0, 0}}, + {"notallowed", SELECTOR, @"operationNotAllowedCursor", nil, {0, 0}}, + {"poof", SELECTOR, @"disappearingItemCursor", nil, {0, 0}}, + {"wait", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"spinning", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countinguphand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countingdownhand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, + {"countingupanddownhand", SELECTOR, @"busyButClickableCursor", nil, {0, 0}}, {"help", IMAGENAMED, @"NSHelpCursor", nil, {8, 8}}, -// {"hand", IMAGEBITMAP, MacCursorData(hand)}, - {"bucket", IMAGEBITMAP, MacCursorData(bucket)}, - {"cancel", IMAGEBITMAP, MacCursorData(cancel)}, -// {"resize", IMAGEBITMAP, MacCursorData(resize)}, - {"eyedrop", IMAGEBITMAP, MacCursorData(eyedrop)}, - {"eyedrop-full", IMAGEBITMAP, MacCursorData(eyedrop_full)}, - {"zoom-in", IMAGEBITMAP, MacCursorData(zoom_in)}, - {"zoom-out", IMAGEBITMAP, MacCursorData(zoom_out)}, - {"X_cursor", IMAGEBITMAP, MacXCursorData(X_cursor)}, -// {"arrow", IMAGEBITMAP, MacXCursorData(arrow)}, - {"based_arrow_down", IMAGEBITMAP, MacXCursorData(based_arrow_down)}, - {"based_arrow_up", IMAGEBITMAP, MacXCursorData(based_arrow_up)}, - {"boat", IMAGEBITMAP, MacXCursorData(boat)}, - {"bogosity", IMAGEBITMAP, MacXCursorData(bogosity)}, - {"bottom_left_corner", IMAGEBITMAP, MacXCursorData(bottom_left_corner)}, - {"bottom_right_corner", IMAGEBITMAP, MacXCursorData(bottom_right_corner)}, - {"bottom_side", IMAGEBITMAP, MacXCursorData(bottom_side)}, - {"bottom_tee", IMAGEBITMAP, MacXCursorData(bottom_tee)}, - {"box_spiral", IMAGEBITMAP, MacXCursorData(box_spiral)}, - {"center_ptr", IMAGEBITMAP, MacXCursorData(center_ptr)}, - {"circle", IMAGEBITMAP, MacXCursorData(circle)}, - {"clock", IMAGEBITMAP, MacXCursorData(clock)}, - {"coffee_mug", IMAGEBITMAP, MacXCursorData(coffee_mug)}, -// {"cross", IMAGEBITMAP, MacXCursorData(cross)}, - {"cross_reverse", IMAGEBITMAP, MacXCursorData(cross_reverse)}, -// {"crosshair", IMAGEBITMAP, MacXCursorData(crosshair)}, - {"diamond_cross", IMAGEBITMAP, MacXCursorData(diamond_cross)}, - {"dot", IMAGEBITMAP, MacXCursorData(dot)}, - {"dotbox", IMAGEBITMAP, MacXCursorData(dotbox)}, - {"double_arrow", IMAGEBITMAP, MacXCursorData(double_arrow)}, - {"draft_large", IMAGEBITMAP, MacXCursorData(draft_large)}, - {"draft_small", IMAGEBITMAP, MacXCursorData(draft_small)}, - {"draped_box", IMAGEBITMAP, MacXCursorData(draped_box)}, - {"exchange", IMAGEBITMAP, MacXCursorData(exchange)}, - {"fleur", IMAGEBITMAP, MacXCursorData(fleur)}, - {"gobbler", IMAGEBITMAP, MacXCursorData(gobbler)}, - {"gumby", IMAGEBITMAP, MacXCursorData(gumby)}, - {"hand1", IMAGEBITMAP, MacXCursorData(hand1)}, - {"hand2", IMAGEBITMAP, MacXCursorData(hand2)}, - {"heart", IMAGEBITMAP, MacXCursorData(heart)}, - {"icon", IMAGEBITMAP, MacXCursorData(icon)}, - {"iron_cross", IMAGEBITMAP, MacXCursorData(iron_cross)}, -// {"left_ptr", IMAGEBITMAP, MacXCursorData(left_ptr)}, - {"left_side", IMAGEBITMAP, MacXCursorData(left_side)}, - {"left_tee", IMAGEBITMAP, MacXCursorData(left_tee)}, - {"leftbutton", IMAGEBITMAP, MacXCursorData(leftbutton)}, - {"ll_angle", IMAGEBITMAP, MacXCursorData(ll_angle)}, - {"lr_angle", IMAGEBITMAP, MacXCursorData(lr_angle)}, - {"man", IMAGEBITMAP, MacXCursorData(man)}, - {"middlebutton", IMAGEBITMAP, MacXCursorData(middlebutton)}, - {"mouse", IMAGEBITMAP, MacXCursorData(mouse)}, - {"pencil", IMAGEBITMAP, MacXCursorData(pencil)}, - {"pirate", IMAGEBITMAP, MacXCursorData(pirate)}, - {"plus", IMAGEBITMAP, MacXCursorData(plus)}, - {"question_arrow", IMAGEBITMAP, MacXCursorData(question_arrow)}, - {"right_ptr", IMAGEBITMAP, MacXCursorData(right_ptr)}, - {"right_side", IMAGEBITMAP, MacXCursorData(right_side)}, - {"right_tee", IMAGEBITMAP, MacXCursorData(right_tee)}, - {"rightbutton", IMAGEBITMAP, MacXCursorData(rightbutton)}, - {"rtl_logo", IMAGEBITMAP, MacXCursorData(rtl_logo)}, - {"sailboat", IMAGEBITMAP, MacXCursorData(sailboat)}, - {"sb_down_arrow", IMAGEBITMAP, MacXCursorData(sb_down_arrow)}, - {"sb_h_double_arrow", IMAGEBITMAP, MacXCursorData(sb_h_double_arrow)}, - {"sb_left_arrow", IMAGEBITMAP, MacXCursorData(sb_left_arrow)}, - {"sb_right_arrow", IMAGEBITMAP, MacXCursorData(sb_right_arrow)}, - {"sb_up_arrow", IMAGEBITMAP, MacXCursorData(sb_up_arrow)}, - {"sb_v_double_arrow", IMAGEBITMAP, MacXCursorData(sb_v_double_arrow)}, - {"shuttle", IMAGEBITMAP, MacXCursorData(shuttle)}, - {"sizing", IMAGEBITMAP, MacXCursorData(sizing)}, - {"spider", IMAGEBITMAP, MacXCursorData(spider)}, - {"spraycan", IMAGEBITMAP, MacXCursorData(spraycan)}, - {"star", IMAGEBITMAP, MacXCursorData(star)}, - {"target", IMAGEBITMAP, MacXCursorData(target)}, -// {"tcross", IMAGEBITMAP, MacXCursorData(tcross)}, -// {"top_left_arrow", IMAGEBITMAP, MacXCursorData(top_left_arrow)}, - {"top_left_corner", IMAGEBITMAP, MacXCursorData(top_left_corner)}, - {"top_right_corner", IMAGEBITMAP, MacXCursorData(top_right_corner)}, - {"top_side", IMAGEBITMAP, MacXCursorData(top_side)}, - {"top_tee", IMAGEBITMAP, MacXCursorData(top_tee)}, - {"trek", IMAGEBITMAP, MacXCursorData(trek)}, - {"ul_angle", IMAGEBITMAP, MacXCursorData(ul_angle)}, - {"umbrella", IMAGEBITMAP, MacXCursorData(umbrella)}, - {"ur_angle", IMAGEBITMAP, MacXCursorData(ur_angle)}, - {"watch", IMAGEBITMAP, MacXCursorData(watch)}, -// {"xterm", IMAGEBITMAP, MacXCursorData(xterm)}, - {NULL} +// {"hand", IMAGEBITMAP, MacCursorData(hand), nil, {0, 0}}, + {"bucket", IMAGEBITMAP, MacCursorData(bucket), nil, {0, 0}}, + {"cancel", IMAGEBITMAP, MacCursorData(cancel), nil, {0, 0}}, +// {"resize", IMAGEBITMAP, MacCursorData(resize), nil, {0, 0}}, + {"eyedrop", IMAGEBITMAP, MacCursorData(eyedrop), nil, {0, 0}}, + {"eyedrop-full", IMAGEBITMAP, MacCursorData(eyedrop_full), nil, {0, 0}}, + {"zoom-in", IMAGEBITMAP, MacCursorData(zoom_in), nil, {0, 0}}, + {"zoom-out", IMAGEBITMAP, MacCursorData(zoom_out), nil, {0, 0}}, + {"X_cursor", IMAGEBITMAP, MacXCursorData(X_cursor), nil, {0, 0}}, +// {"arrow", IMAGEBITMAP, MacXCursorData(arrow), nil, {0, 0}}, + {"based_arrow_down", IMAGEBITMAP, MacXCursorData(based_arrow_down), nil, {0, 0}}, + {"based_arrow_up", IMAGEBITMAP, MacXCursorData(based_arrow_up), nil, {0, 0}}, + {"boat", IMAGEBITMAP, MacXCursorData(boat), nil, {0, 0}}, + {"bogosity", IMAGEBITMAP, MacXCursorData(bogosity), nil, {0, 0}}, + {"bottom_left_corner", IMAGEBITMAP, MacXCursorData(bottom_left_corner), nil, {0, 0}}, + {"bottom_right_corner", IMAGEBITMAP, MacXCursorData(bottom_right_corner), nil, {0, 0}}, + {"bottom_side", IMAGEBITMAP, MacXCursorData(bottom_side), nil, {0, 0}}, + {"bottom_tee", IMAGEBITMAP, MacXCursorData(bottom_tee), nil, {0, 0}}, + {"box_spiral", IMAGEBITMAP, MacXCursorData(box_spiral), nil, {0, 0}}, + {"center_ptr", IMAGEBITMAP, MacXCursorData(center_ptr), nil, {0, 0}}, + {"circle", IMAGEBITMAP, MacXCursorData(circle), nil, {0, 0}}, + {"clock", IMAGEBITMAP, MacXCursorData(clock), nil, {0, 0}}, + {"coffee_mug", IMAGEBITMAP, MacXCursorData(coffee_mug), nil, {0, 0}}, +// {"cross", IMAGEBITMAP, MacXCursorData(cross), nil, {0, 0}}, + {"cross_reverse", IMAGEBITMAP, MacXCursorData(cross_reverse), nil, {0, 0}}, +// {"crosshair", IMAGEBITMAP, MacXCursorData(crosshair), nil, {0, 0}}, + {"diamond_cross", IMAGEBITMAP, MacXCursorData(diamond_cross), nil, {0, 0}}, + {"dot", IMAGEBITMAP, MacXCursorData(dot), nil, {0, 0}}, + {"dotbox", IMAGEBITMAP, MacXCursorData(dotbox), nil, {0, 0}}, + {"double_arrow", IMAGEBITMAP, MacXCursorData(double_arrow), nil, {0, 0}}, + {"draft_large", IMAGEBITMAP, MacXCursorData(draft_large), nil, {0, 0}}, + {"draft_small", IMAGEBITMAP, MacXCursorData(draft_small), nil, {0, 0}}, + {"draped_box", IMAGEBITMAP, MacXCursorData(draped_box), nil, {0, 0}}, + {"exchange", IMAGEBITMAP, MacXCursorData(exchange), nil, {0, 0}}, + {"fleur", IMAGEBITMAP, MacXCursorData(fleur), nil, {0, 0}}, + {"gobbler", IMAGEBITMAP, MacXCursorData(gobbler), nil, {0, 0}}, + {"gumby", IMAGEBITMAP, MacXCursorData(gumby), nil, {0, 0}}, + {"hand1", IMAGEBITMAP, MacXCursorData(hand1), nil, {0, 0}}, + {"hand2", IMAGEBITMAP, MacXCursorData(hand2), nil, {0, 0}}, + {"heart", IMAGEBITMAP, MacXCursorData(heart), nil, {0, 0}}, + {"icon", IMAGEBITMAP, MacXCursorData(icon), nil, {0, 0}}, + {"iron_cross", IMAGEBITMAP, MacXCursorData(iron_cross), nil, {0, 0}}, +// {"left_ptr", IMAGEBITMAP, MacXCursorData(left_ptr), nil, {0, 0}}, + {"left_side", IMAGEBITMAP, MacXCursorData(left_side), nil, {0, 0}}, + {"left_tee", IMAGEBITMAP, MacXCursorData(left_tee), nil, {0, 0}}, + {"leftbutton", IMAGEBITMAP, MacXCursorData(leftbutton), nil, {0, 0}}, + {"ll_angle", IMAGEBITMAP, MacXCursorData(ll_angle), nil, {0, 0}}, + {"lr_angle", IMAGEBITMAP, MacXCursorData(lr_angle), nil, {0, 0}}, + {"man", IMAGEBITMAP, MacXCursorData(man), nil, {0, 0}}, + {"middlebutton", IMAGEBITMAP, MacXCursorData(middlebutton), nil, {0, 0}}, + {"mouse", IMAGEBITMAP, MacXCursorData(mouse), nil, {0, 0}}, + {"pencil", IMAGEBITMAP, MacXCursorData(pencil), nil, {0, 0}}, + {"pirate", IMAGEBITMAP, MacXCursorData(pirate), nil, {0, 0}}, + {"plus", IMAGEBITMAP, MacXCursorData(plus), nil, {0, 0}}, + {"question_arrow", IMAGEBITMAP, MacXCursorData(question_arrow), nil, {0, 0}}, + {"right_ptr", IMAGEBITMAP, MacXCursorData(right_ptr), nil, {0, 0}}, + {"right_side", IMAGEBITMAP, MacXCursorData(right_side), nil, {0, 0}}, + {"right_tee", IMAGEBITMAP, MacXCursorData(right_tee), nil, {0, 0}}, + {"rightbutton", IMAGEBITMAP, MacXCursorData(rightbutton), nil, {0, 0}}, + {"rtl_logo", IMAGEBITMAP, MacXCursorData(rtl_logo), nil, {0, 0}}, + {"sailboat", IMAGEBITMAP, MacXCursorData(sailboat), nil, {0, 0}}, + {"sb_down_arrow", IMAGEBITMAP, MacXCursorData(sb_down_arrow), nil, {0, 0}}, + {"sb_h_double_arrow", IMAGEBITMAP, MacXCursorData(sb_h_double_arrow), nil, {0, 0}}, + {"sb_left_arrow", IMAGEBITMAP, MacXCursorData(sb_left_arrow), nil, {0, 0}}, + {"sb_right_arrow", IMAGEBITMAP, MacXCursorData(sb_right_arrow), nil, {0, 0}}, + {"sb_up_arrow", IMAGEBITMAP, MacXCursorData(sb_up_arrow), nil, {0, 0}}, + {"sb_v_double_arrow", IMAGEBITMAP, MacXCursorData(sb_v_double_arrow), nil, {0, 0}}, + {"shuttle", IMAGEBITMAP, MacXCursorData(shuttle), nil, {0, 0}}, + {"sizing", IMAGEBITMAP, MacXCursorData(sizing), nil, {0, 0}}, + {"spider", IMAGEBITMAP, MacXCursorData(spider), nil, {0, 0}}, + {"spraycan", IMAGEBITMAP, MacXCursorData(spraycan), nil, {0, 0}}, + {"star", IMAGEBITMAP, MacXCursorData(star), nil, {0, 0}}, + {"target", IMAGEBITMAP, MacXCursorData(target), nil, {0, 0}}, +// {"tcross", IMAGEBITMAP, MacXCursorData(tcross), nil, {0, 0}}, +// {"top_left_arrow", IMAGEBITMAP, MacXCursorData(top_left_arrow), nil, {0, 0}}, + {"top_left_corner", IMAGEBITMAP, MacXCursorData(top_left_corner), nil, {0, 0}}, + {"top_right_corner", IMAGEBITMAP, MacXCursorData(top_right_corner), nil, {0, 0}}, + {"top_side", IMAGEBITMAP, MacXCursorData(top_side), nil, {0, 0}}, + {"top_tee", IMAGEBITMAP, MacXCursorData(top_tee), nil, {0, 0}}, + {"trek", IMAGEBITMAP, MacXCursorData(trek), nil, {0, 0}}, + {"ul_angle", IMAGEBITMAP, MacXCursorData(ul_angle), nil, {0, 0}}, + {"umbrella", IMAGEBITMAP, MacXCursorData(umbrella), nil, {0, 0}}, + {"ur_angle", IMAGEBITMAP, MacXCursorData(ur_angle), nil, {0, 0}}, + {"watch", IMAGEBITMAP, MacXCursorData(watch), nil, {0, 0}}, +// {"xterm", IMAGEBITMAP, MacXCursorData(xterm), nil, {0, 0}}, + {NULL, 0, nil, nil, {0, 0}} }; /* @@ -375,7 +375,7 @@ FindCursorByName( TkCursor * TkGetCursorByName( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - Tk_Window tkwin, /* Window in which cursor will be used. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ Tk_Uid string) /* Description of cursor. See manual entry * for details on legal syntax. */ { @@ -390,7 +390,7 @@ TkGetCursorByName( if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK) { if (argc) { - macCursorPtr = ckalloc(sizeof(TkMacOSXCursor)); + macCursorPtr = (TkMacOSXCursor *)ckalloc(sizeof(TkMacOSXCursor)); macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr; macCursorPtr->macCursor = nil; macCursorPtr->type = 0; @@ -429,13 +429,15 @@ TkGetCursorByName( TkCursor * TkCreateCursorFromData( - Tk_Window tkwin, /* Window in which cursor will be used. */ - const char *source, /* Bitmap data for cursor shape. */ - const char *mask, /* Bitmap data for cursor mask. */ - int width, int height, /* Dimensions of cursor. */ - int xHot, int yHot, /* Location of hot-spot in cursor. */ - XColor fgColor, /* Foreground color for cursor. */ - XColor bgColor) /* Background color for cursor. */ + TCL_UNUSED(Tk_Window), /* Window in which cursor will be used. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor shape. */ + TCL_UNUSED(const char *), /* Bitmap data for cursor mask. */ + TCL_UNUSED(int), /* Dimensions of cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(int), /* Location of hot-spot in cursor. */ + TCL_UNUSED(int), + TCL_UNUSED(XColor), /* Foreground color for cursor. */ + TCL_UNUSED(XColor)) /* Background color for cursor. */ { return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index c2b1b15..42cb4a5 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -870,15 +870,15 @@ Tk_GetOpenFileObjCmd( selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { - NSUInteger i; + NSUInteger j; - for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { - if (filterCompatible(extension, i)) { - selectedFilterIndex = i; + for (j = 0; j < [filterInfo.fileTypeNames count]; j++) { + if (filterCompatible(extension, j)) { + selectedFilterIndex = j; break; } } - if (i == selectedFilterIndex) { + if (j == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index f7b87dc..34dc8c2 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -56,25 +56,25 @@ struct SystemFontMapEntry { #define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ } static const struct SystemFontMapEntry systemFontMap[] = { ThemeFont(System, "TkDefaultFont", "TkIconFont"), - ThemeFont(EmphasizedSystem, "TkCaptionFont"), + ThemeFont(EmphasizedSystem, "TkCaptionFont", NULL), ThemeFont(SmallSystem, "TkHeadingFont", "TkTooltipFont"), - ThemeFont(SmallEmphasizedSystem), - ThemeFont(Application, "TkTextFont"), - ThemeFont(Label, "TkSmallCaptionFont"), - ThemeFont(Views), - ThemeFont(MenuTitle), - ThemeFont(MenuItem, "TkMenuFont"), - ThemeFont(MenuItemMark), - ThemeFont(MenuItemCmdKey), - ThemeFont(WindowTitle), - ThemeFont(PushButton), - ThemeFont(UtilityWindowTitle), - ThemeFont(AlertHeader), - ThemeFont(Toolbar), - ThemeFont(MiniSystem), - { kThemeSystemFontDetail, "systemDetailSystemFont" }, - { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont" }, - { -1, NULL } + ThemeFont(SmallEmphasizedSystem, NULL, NULL), + ThemeFont(Application, "TkTextFont", NULL), + ThemeFont(Label, "TkSmallCaptionFont", NULL), + ThemeFont(Views, NULL, NULL), + ThemeFont(MenuTitle, NULL, NULL), + ThemeFont(MenuItem, "TkMenuFont", NULL), + ThemeFont(MenuItemMark, NULL, NULL), + ThemeFont(MenuItemCmdKey, NULL, NULL), + ThemeFont(WindowTitle, NULL, NULL), + ThemeFont(PushButton, NULL, NULL), + ThemeFont(UtilityWindowTitle, NULL, NULL), + ThemeFont(AlertHeader, NULL, NULL), + ThemeFont(Toolbar, NULL, NULL), + ThemeFont(MiniSystem, NULL, NULL), + { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, + { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, + { -1, NULL, NULL, NULL } }; #undef ThemeFont @@ -162,7 +162,7 @@ static int CreateNamedSystemFont(Tcl_Interp *interp, * our string's unicode characters. */ char *p; - unsigned int index; + NSUInteger index; Tcl_DStringInit(&_ds); Tcl_DStringSetLength(&_ds, 3 * [_string length]); @@ -550,7 +550,7 @@ TkpFontPkgInit( TkFont * TkpGetNativeFont( - Tk_Window tkwin, /* For display where font will be used. */ + TCL_UNUSED(Tk_Window), /* For display where font will be used. */ const char *name) /* Platform-specific font name. */ { MacFont *fontPtr = NULL; @@ -569,7 +569,7 @@ TkpGetNativeFont( ctFont = CTFontCreateUIFontForLanguage( HIThemeGetUIFontType(themeFontId), 0, NULL); if (ctFont) { - fontPtr = ckalloc(sizeof(MacFont)); + fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); InitFont((NSFont*) ctFont, NULL, fontPtr); } @@ -637,7 +637,7 @@ TkpGetFontFromAttributes( Tcl_Panic("Could not determine NSFont from TkFontAttributes"); } if (tkFontPtr == NULL) { - fontPtr = ckalloc(sizeof(MacFont)); + fontPtr = (MacFont *)ckalloc(sizeof(MacFont)); } else { fontPtr = (MacFont *) tkFontPtr; TkpDeleteFont(tkFontPtr); @@ -699,7 +699,7 @@ TkpDeleteFont( void TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ - Tk_Window tkwin) /* For display to query. */ + TCL_UNUSED(Tk_Window)) /* For display to query. */ { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; @@ -772,7 +772,7 @@ TkpGetSubFonts( void TkpGetFontAttrsForChar( - Tk_Window tkwin, /* Window on the font's display */ + TCL_UNUSED(Tk_Window), /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes* faPtr) /* Output: Font attributes */ @@ -1162,7 +1162,7 @@ TkpDrawCharsInContext( void TkpDrawAngledCharsInContext( - Display *display, /* Display on which to draw. */ + TCL_UNUSED(Display *), /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must @@ -1206,6 +1206,7 @@ TkpDrawAngledCharsInContext( if (!string) { return; } + context = drawingContext.context; fg = TkMacOSXCreateCGColor(gc, gc->foreground); attributes = [fontPtr->nsAttributes mutableCopy]; @@ -1325,8 +1326,8 @@ TkMacOSXNSFontAttributesForFont( int TkMacOSXIsCharacterMissing( - Tk_Font tkfont, /* The font we are looking in. */ - unsigned int searchChar) /* The character we are looking for. */ + TCL_UNUSED(Tk_Font), /* The font we are looking in. */ + TCL_UNUSED(unsigned int)) /* The character we are looking for. */ { return 0; } @@ -1365,8 +1366,8 @@ TkMacOSXFontDescriptionForNSFontAndNSFontAttributes( NSStrikethroughStyleAttributeName]; objv[i++] = Tcl_NewStringObj(familyName, -1); - objv[i++] = Tcl_NewIntObj([nsFont pointSize]); -#define S(s) Tcl_NewStringObj(STRINGIFY(s),(int)(sizeof(STRINGIFY(s))-1)) + objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]); +#define S(s) Tcl_NewStringObj(STRINGIFY(s), (sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index 378c30e..b9bf3be 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -151,6 +151,7 @@ static int KeyDataToUnicode(UniChar *uniChars, int maxChars, @implementation TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #else @@ -662,7 +663,7 @@ XKeysymToKeycode( macKC.x.keychar = (unsigned int) data; hPtr = Tcl_FindHashEntry(&unichar2xvirtual, INT2PTR(macKC.x.keychar)); if (hPtr != NULL) { - unsigned long data = (unsigned long) Tcl_GetHashValue(hPtr); + data = (unsigned long) Tcl_GetHashValue(hPtr); macKC.x.xvirtual = (unsigned int) data; } } diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 8005517..3d5a996 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -36,19 +36,19 @@ #define SPECIALMENU(n, f) {.name = "." #n, .len = sl(#n) + 1, \ .flag = ENTRY_##f##_MENU } static const struct { - const char *name; const size_t len; const int flag; + const char *name; size_t len; int flag; } specialMenus[] = { SPECIALMENU(help, HELP), SPECIALMENU(apple, APPLE), SPECIALMENU(window, WINDOWS), - {NULL} + {NULL, 0, 0} }; #undef SPECIALMENU #define MODIFIER(n, f) {.name = #n, .len = sl(#n), .mask = f } static const struct { - const char *name; const size_t len; const NSUInteger mask; -} modifiers[] = { + const char *name; size_t len; NSUInteger mask; +} allModifiers[] = { MODIFIER(Control, NSControlKeyMask), MODIFIER(Ctrl, NSControlKeyMask), MODIFIER(Option, NSAlternateKeyMask), @@ -58,13 +58,13 @@ static const struct { MODIFIER(Command, NSCommandKeyMask), MODIFIER(Cmd, NSCommandKeyMask), MODIFIER(Meta, NSCommandKeyMask), - {NULL} + {NULL, 0, 0} }; #undef MODIFIER #define ACCEL(n, c) {.name = #n, .len = sl(#n), .ch = c } static const struct { - const char *name; const size_t len; const UniChar ch; + const char *name; size_t len; UniChar ch; } specialAccelerators[] = { ACCEL(PageUp, NSPageUpFunctionKey), ACCEL(PageDown, NSPageDownFunctionKey), @@ -86,7 +86,7 @@ static const struct { ACCEL(Help, NSHelpFunctionKey), ACCEL(Power, 0x233d), ACCEL(Eject, 0xf804), - {NULL} + {NULL, 0, 0} }; #undef ACCEL #undef sl @@ -348,6 +348,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (BOOL) menuHasKeyEquivalent: (NSMenu *) menu forEvent: (NSEvent *) event target: (id *) target action: (SEL *) action { + (void)menu; + /* * Use lowercaseString when comparing keyEquivalents since the notion of * a shifted upper case letter does not make much sense. @@ -404,6 +406,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuWillOpen: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { //RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], @@ -413,6 +417,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuDidClose: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { RecursivelyClearActiveMenu(_tkMenu); } @@ -420,6 +426,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item { + (void)menu; + if (_tkMenu) { GenerateMenuSelectEvent(self, item); } @@ -428,6 +436,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuNeedsUpdate: (NSMenu *) menu { TkMenu *menuPtr = (TkMenu *) _tkMenu; + (void)menu; if (menuPtr) { Tcl_Interp *interp = menuPtr->interp; @@ -453,6 +462,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuBeginTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -468,6 +478,7 @@ TKBackgroundLoop *backgroundLoop = nil; - (void) menuEndTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -701,7 +712,6 @@ TkpConfigureMenuEntry( image = TkMacOSXGetNSImageFromBitmap(mePtr->menuPtr->display, bitmap, gc, imageWidth, imageHeight); if (gc->foreground == defaultFg) { - // Use a semantic foreground color by default [image setTemplate:YES]; } } @@ -857,7 +867,7 @@ TkpDestroyMenuEntry( int TkpPostMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -954,7 +964,7 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -1217,18 +1227,18 @@ ParseAccelerator( *maskPtr = 0; while (1) { i = 0; - while (modifiers[i].name) { - int l = modifiers[i].len; + while (allModifiers[i].name) { + int l = allModifiers[i].len; - if (!strncasecmp(accel, modifiers[i].name, l) && + if (!strncasecmp(accel, allModifiers[i].name, l) && (accel[l] == '-' || accel[l] == '+')) { - *maskPtr |= modifiers[i].mask; + *maskPtr |= allModifiers[i].mask; accel += l+1; break; } i++; } - if (!modifiers[i].name || !*accel) { + if (!allModifiers[i].name || !*accel) { break; } } @@ -1452,14 +1462,14 @@ TkpComputeStandardMenuGeometry( } } else { NSUInteger modifMask = [menuItem keyEquivalentModifierMask]; - int i = 0; + int j = 0; - while (modifiers[i].name) { - if (modifMask & modifiers[i].mask) { - modifMask &= ~modifiers[i].mask; + while (allModifiers[j].name) { + if (modifMask & allModifiers[j].mask) { + modifMask &= ~allModifiers[j].mask; modifierWidth += modifierCharWidth; } - i++; + j++; } accelWidth = [[menuItem keyEquivalent] sizeWithAttributes: TkMacOSXNSFontAttributesForFont(tkfont)].width; @@ -1763,8 +1773,8 @@ TkpMenuThreadInit(void) 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. @@ -1792,8 +1802,8 @@ TkpMenuNotifyToplevelCreate( 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. */ { /* @@ -1846,17 +1856,17 @@ TkpComputeMenubarGeometry( void TkpDrawMenuEntry( - TkMenuEntry *mePtr, /* The entry to draw */ - Drawable d, /* What to draw into */ - Tk_Font tkfont, /* Precalculated font for menu */ - const Tk_FontMetrics *menuMetricsPtr, + TCL_UNUSED(TkMenuEntry *), /* The entry to draw */ + TCL_UNUSED(Drawable), /* What to draw into */ + TCL_UNUSED(Tk_Font), /* Precalculated font for menu */ + TCL_UNUSED(const Tk_FontMetrics *), /* Precalculated metrics for menu */ - int x, /* X-coordinate of topleft of entry */ - int y, /* Y-coordinate of topleft of entry */ - int width, /* Width of the entry rectangle */ - int height, /* Height of the current rectangle */ - int strictMotif, /* Boolean flag */ - int drawArrow) /* Whether or not to draw the cascade arrow + TCL_UNUSED(int), /* X-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Y-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Width of the entry rectangle */ + TCL_UNUSED(int), /* Height of the current rectangle */ + TCL_UNUSED(int), /* Boolean flag */ + TCL_UNUSED(int)) /* Whether or not to draw the cascade arrow * for cascade items. */ { } @@ -1905,7 +1915,7 @@ TkMacOSXPreprocessMenu(void) int TkMacOSXUseMenuID( - short macID) /* The id to take out of the table */ + TCL_UNUSED(short)) /* The id to take out of the table */ { return TCL_OK; } @@ -1928,8 +1938,8 @@ TkMacOSXUseMenuID( int TkMacOSXDispatchMenuEvent( - int menuID, /* The menu id of the menu we are invoking */ - int index) /* The one-based index of the item that was + TCL_UNUSED(int), /* The menu id of the menu we are invoking */ + TCL_UNUSED(int)) /* The one-based index of the item that was * selected. */ { return TCL_ERROR; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 8cb3e15..4c07557 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -103,11 +103,11 @@ * debug message in case of failure. */ #define ChkErr(f, ...) ({ \ - OSStatus err = f(__VA_ARGS__); \ - if (err != noErr) { \ - TkMacOSXDbgOSErr(f, err); \ + OSStatus err_ = f(__VA_ARGS__); \ + if (err_ != noErr) { \ + TkMacOSXDbgOSErr(f, err_); \ } \ - err;}) + err_;}) #else /* TK_MAC_DEBUG */ #define TKLog(f, ...) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 87ec507..1e7797d 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -169,7 +169,7 @@ static inline CGRect BoxToRect( */ static Ttk_StateTable ThemeStateTable[] = { - {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, @@ -232,11 +232,11 @@ static CGRect NormalizeButtonBounds( * support Dark Mode anyway. */ -static CGFloat windowBackground[4] = { +static const CGFloat WINDOWBACKGROUND[4] = { 235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0 }; -static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0}; -static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; +static const CGFloat WHITERGBA[4] = {1.0, 1.0, 1.0, 1.0}; +static const CGFloat BLACKRGBA[4] = {0.0, 0.0, 0.0, 1.0}; /*---------------------------------------------------------------------- * GetBackgroundColor -- @@ -276,7 +276,7 @@ static void GetBackgroundColor( [windowColor getComponents: rgba]; } else { for (int i = 0; i < 4; i++) { - rgba[i] = windowBackground[i]; + rgba[i] = WINDOWBACKGROUND[i]; } } } @@ -314,7 +314,7 @@ static void DrawDownArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -336,7 +336,7 @@ static void DrawUpArrow( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -406,7 +406,7 @@ static void DrawUpDownArrows( CGRect bounds, CGFloat inset, CGFloat size, - CGFloat *rgba) + const CGFloat *rgba) { CGFloat x, y; @@ -633,9 +633,9 @@ static void DrawListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, BLACKRGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, BLACKRGBA); } } } @@ -757,9 +757,9 @@ static void DrawDarkButton( darkSelectedGradient, 2); } if (kind == kThemePopupButton) { - DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA); + DrawUpDownArrows(context, arrowBounds, 3, 7, WHITERGBA); } else { - DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 4, 8, WHITERGBA); } } @@ -818,7 +818,7 @@ static void DrawDarkIncDecButton( darkSelectedGradient, 2); CGContextRestoreGState(context); } - DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA); + DrawUpDownArrows(context, bounds, 3, 5, WHITERGBA); HighlightButtonBorder(context, bounds); } @@ -1245,9 +1245,9 @@ static void DrawDarkListHeader( arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { - DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawUpArrow(context, arrowBounds, 3, 8, WHITERGBA); } else if (state & TTK_STATE_SELECTED) { - DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA); + DrawDownArrow(context, arrowBounds, 3, 8, WHITERGBA); } } } @@ -1277,7 +1277,7 @@ static ThemeButtonParams ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight}; static Ttk_StateTable ButtonValueTable[] = { - {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} @@ -1306,7 +1306,7 @@ static Ttk_StateTable ButtonAdornmentTable[] = { static inline HIThemeButtonDrawInfo computeButtonDrawInfo( ThemeButtonParams *params, Ttk_State state, - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { /* @@ -1342,13 +1342,13 @@ static inline HIThemeButtonDrawInfo computeButtonDrawInfo( static void ButtonElementMinSize( void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { - ThemeButtonParams *params = clientData; + ThemeButtonParams *params = (ThemeButtonParams *)clientData; if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, minHeight); @@ -1420,7 +1420,7 @@ static void ButtonElementSize( static void ButtonElementDraw( void *clientData, - void *elementRecord, + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1510,25 +1510,25 @@ static Ttk_ElementSpec ButtonElementSpec = { /* Tab position logic, c.f. ttkNotebook.c TabState() */ static Ttk_StateTable TabStyleTable[] = { - {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND}, - {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND}, - {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED}, - {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED}, - {kThemeTabFront, TTK_STATE_SELECTED}, - {kThemeTabNonFrontPressed, TTK_STATE_PRESSED}, - {kThemeTabNonFront, 0} + {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND, 0}, + {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0}, + {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED, 0}, + {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0}, + {kThemeTabFront, TTK_STATE_SELECTED, 0}, + {kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0}, + {kThemeTabNonFront, 0, 0} }; static Ttk_StateTable TabAdornmentTable[] = { - {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, - {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB}, - {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB}, - {kHIThemeTabAdornmentTrailingSeparator, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabAdornmentTrailingSeparator, 0, 0}, }; static Ttk_StateTable TabPositionTable[] = { - {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, - {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB}, - {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB}, - {kHIThemeTabPositionMiddle, 0}, + {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB, 0}, + {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabPositionMiddle, 0, 0}, }; /* @@ -1572,10 +1572,10 @@ static Ttk_StateTable TabPositionTable[] = { */ static void TabElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), int *minHeight, Ttk_Padding *paddingPtr) { @@ -1585,8 +1585,8 @@ static void TabElementSize( } static void TabElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1626,19 +1626,19 @@ static Ttk_ElementSpec TabElementSpec = { */ static void PaneElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(9, 5, 9, 9); } static void PaneElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1687,19 +1687,19 @@ static Ttk_ElementSpec PaneElementSpec = { */ static void GroupElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(4); } static void GroupElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1748,22 +1748,22 @@ static Ttk_ElementOptionSpec EntryElementOptions[] = { Tk_Offset(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, Tk_Offset(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, - {0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void EntryElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(7, 5, 7, 6); } static void EntryElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -1875,9 +1875,9 @@ static Ttk_ElementSpec EntryElementSpec = { static Ttk_Padding ComboboxPadding = {4, 2, 20, 2}; static void ComboboxElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) @@ -1888,8 +1888,8 @@ static void ComboboxElementSize( } static void ComboboxElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -1953,12 +1953,12 @@ static Ttk_ElementSpec ComboboxElementSpec = { static Ttk_Padding SpinbuttonMargins = {0, 0, 2, 0}; static void SpinButtonUpElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -1969,8 +1969,8 @@ static void SpinButtonUpElementSize( } static void SpinButtonUpElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2010,12 +2010,12 @@ static Ttk_ElementSpec SpinButtonUpElementSpec = { SpinButtonUpElementDraw }; static void SpinButtonDownElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -2026,8 +2026,8 @@ static void SpinButtonDownElementSize( } static void SpinButtonDownElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2104,21 +2104,21 @@ typedef struct { } TrackElement; static Ttk_ElementOptionSpec TrackElementOptions[] = { - {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj)}, - {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj)}, - {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj)}, - {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj)}, - {0, 0, 0} + {"-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, fromObj), NULL}, + {"-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, toObj), NULL}, + {"-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement, valueObj), NULL}, + {"-orient", TK_OPTION_STRING, Tk_Offset(TrackElement, orientObj), NULL}, + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TrackElementSize( void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { - TrackElementData *data = clientData; + TrackElementData *data = (TrackElementData *)clientData; SInt32 size = 24; /* reasonable default ... */ ChkErr(GetThemeMetric, data->thicknessMetric, &size); @@ -2137,6 +2137,7 @@ static void TrackElementDraw( TrackElement *elem = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; + CGRect bounds; Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); @@ -2149,7 +2150,7 @@ static void TrackElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, @@ -2175,7 +2176,7 @@ static void TrackElementDraw( } BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack @@ -2209,12 +2210,12 @@ static Ttk_ElementSpec TrackElementSpec = { */ static void SliderElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { *minWidth = *minHeight = 24; } @@ -2254,15 +2255,15 @@ static Ttk_ElementOptionSpec PbarElementOptions[] = { Tk_Offset(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, Tk_Offset(PbarElement, modeObj), "determinate"}, - {0, 0, 0, 0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void PbarElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 size = 24; /* @@@ Check HIG for correct default */ @@ -2271,7 +2272,7 @@ static void PbarElementSize( } static void PbarElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2281,6 +2282,7 @@ static void PbarElementDraw( PbarElement *pbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; double value = 0, maximum = 100, factor; + CGRect bounds; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); @@ -2293,7 +2295,7 @@ static void PbarElementDraw( * bounds variable avoids UBSan (-fsanitize=alignment) complaints. */ - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); HIThemeTrackDrawInfo info = { .version = 0, .kind = @@ -2313,7 +2315,7 @@ static void PbarElementDraw( BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { - CGRect bounds = BoxToRect(d, b); + bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack @@ -2349,12 +2351,12 @@ typedef struct static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, Tk_Offset(ScrollbarElement, orientObj), "horizontal"}, - {0, 0, 0, 0} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void TroughElementSize( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) @@ -2393,12 +2395,12 @@ static CGFloat darkActiveThumb[4] = { 158.0 / 255, 158.0 / 255, 159.0 / 255, 1.0 }; static void TroughElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_State)) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2435,12 +2437,12 @@ static Ttk_ElementSpec TroughElementSpec = { TroughElementDraw }; static void ThumbElementSize( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; @@ -2456,7 +2458,7 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, @@ -2571,12 +2573,12 @@ static Ttk_ElementSpec ThumbElementSpec = { ThumbElementDraw }; static void ArrowElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { if ([NSApp macOSVersion] < 100800) { *minHeight = *minWidth = 14; @@ -2602,19 +2604,19 @@ static Ttk_ElementSpec ArrowElementSpec = { */ static void SeparatorElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { *minWidth = *minHeight = 1; } static void SeparatorElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2654,12 +2656,12 @@ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { HIThemeGrowBoxDrawInfo info = { .version = 0, @@ -2676,9 +2678,9 @@ static void SizegripElementSize( } static void SizegripElementDraw( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), Drawable d, Ttk_Box b, unsigned int state) @@ -2753,8 +2755,8 @@ static Ttk_ElementSpec SizegripElementSpec = { */ static void FillElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -2791,7 +2793,7 @@ static void BackgroundElementDraw( void *elementRecord, Tk_Window tkwin, Drawable d, - Ttk_Box b, + TCL_UNUSED(Ttk_Box), unsigned int state) { FillElementDraw(clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), @@ -2828,12 +2830,12 @@ static Ttk_ElementSpec BackgroundElementSpec = { */ static void ToolbarBackgroundElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, - Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_Box), + TCL_UNUSED(Ttk_State)) { ThemeBrush brush = kThemeBrushToolbarBackground; CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); @@ -2867,16 +2869,16 @@ typedef struct { static Ttk_ElementOptionSpec FieldElementOptions[] = { {"-fieldbackground", TK_OPTION_BORDER, Tk_Offset(FieldElement, backgroundObj), "white"}, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void FieldElementDraw( - void *clientData, + TCL_UNUSED(void *), void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, - Ttk_State state) + TCL_UNUSED(Ttk_State)) { FieldElement *e = elementRecord; Tk_3DBorder backgroundPtr = @@ -2904,28 +2906,28 @@ static Ttk_ElementSpec FieldElementSpec = { */ static Ttk_StateTable TreeHeaderValueTable[] = { - {kThemeButtonOn, TTK_STATE_ALTERNATE}, - {kThemeButtonOn, TTK_STATE_SELECTED}, - {kThemeButtonOff, 0} + {kThemeButtonOn, TTK_STATE_ALTERNATE, 0}, + {kThemeButtonOn, TTK_STATE_SELECTED, 0}, + {kThemeButtonOff, 0, 0} }; static Ttk_StateTable TreeHeaderAdornmentTable[] = { {kThemeAdornmentHeaderButtonSortUp, - TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW}, + TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW, 0}, {kThemeAdornmentDefault, - TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW}, - {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE}, - {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED}, - {kThemeAdornmentFocus, TTK_STATE_FOCUS}, - {kThemeAdornmentNone, 0} + TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW, 0}, + {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE, 0}, + {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED, 0}, + {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, + {kThemeAdornmentNone, 0, 0} }; static void TreeAreaElementSize ( - void *clientData, - void *elementRecord, - Tk_Window tkwin, - int *minWidth, - int *minHeight, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), + TCL_UNUSED(int *), + TCL_UNUSED(int *), Ttk_Padding *paddingPtr) { @@ -2964,7 +2966,7 @@ static void TreeHeaderElementSize( static void TreeHeaderElementDraw( void *clientData, - void *elementRecord, + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, @@ -3020,12 +3022,12 @@ static Ttk_StateTable DisclosureValueTable[] = { {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( - void *clientData, - void *elementRecord, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), int *minWidth, int *minHeight, - Ttk_Padding *paddingPtr) + TCL_UNUSED(Ttk_Padding *)) { SInt32 s; @@ -3036,8 +3038,8 @@ static void DisclosureElementSize( } static void DisclosureElementDraw( - void *clientData, - void *elementRecord, + TCL_UNUSED(void *), + TCL_UNUSED(void *), Tk_Window tkwin, Drawable d, Ttk_Box b, -- cgit v0.12 From 40174136d5d646395c582fb62ee167c984c101a1 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 2 Oct 2020 19:49:57 +0000 Subject: Backout code changes, improve documentation. --- doc/bind.n | 3 ++- generic/tkCmds.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/bind.n b/doc/bind.n index 87940e8..db89eae 100644 --- a/doc/bind.n +++ b/doc/bind.n @@ -283,7 +283,8 @@ it is destroyed. When the \fBDestroy\fR event is delivered to a widget, it is in a .QW half-dead -state: the widget still exists, but most operations on it will fail. +state: the widget still exists, but most operations on it will behave +in an undefined manner, and/or return arbitrary results. .RE .IP "\fBFocusIn\fR, \fBFocusOut\fR" 5 The \fBFocusIn\fR and \fBFocusOut\fR events are generated diff --git a/generic/tkCmds.c b/generic/tkCmds.c index b8b1d3e..193c3d6 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -1689,7 +1689,10 @@ Tk_WinfoObjCmd( winPtr = (TkWindow *) Tk_NameToWindow(interp, string, tkwin); Tcl_ResetResult(interp); - alive = (winPtr != NULL); + alive = 1; + if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) { + alive = 0; + } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(alive)); break; } -- cgit v0.12 From 4aac16b3acabf0ecbe29c13ca92830022105f23e Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 4 Oct 2020 19:31:08 +0000 Subject: Remove duplicate line introduced in [c1f5badf]. That line had already been added in [07ff4144] when dealing with geometry management loops. --- generic/tkGeometry.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 5ecac0e..013347b 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -426,7 +426,6 @@ Tk_MaintainGeometry( ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; - ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; if (container == Tk_Parent(window)) { /* * If the window is a direct descendant of the container, don't bother @@ -574,7 +573,6 @@ Tk_UnmaintainGeometry( ((TkWindow *)window)->maintainerPtr = NULL; - ((TkWindow *)window)->maintainerPtr = NULL; if (container == Tk_Parent(window)) { /* * If the window is a direct descendant of the container, -- cgit v0.12 From 91500fc2feafa36fe71ce1453075b73386d16e34 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 5 Oct 2020 07:40:06 +0000 Subject: Let Travis builds fail when X11 tests on Ubuntu fail --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index da271b1..f52dc1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ jobs: - make install - make test-classic >out-classic.txt - cat out-classic.txt + - grep -q "Failed 0" out-classic.txt - make test-ttk >out-ttk.txt - cat out-ttk.txt - grep -q "Failed 0" out-ttk.txt -- cgit v0.12 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