On Tue 16.Mar'10 at 19:54:35 +0100, Tamas TEVESZ wrote: > On Tue, 16 Mar 2010, Carlos R. Mafra wrote: > > > Ok, so I pushed the following patch to #next in the hope of guiding > > further cleanups (the first one is included in the patch). But I wont > > merge it into #master untill addressing all the warnings (wmaker currently > > is warning-free for me, and I would like to keep it that way). > > good. > > good luck, though :))
Thanks, the patch below makes my compilation be warning-free again. I think we could make all those match*() functions into a generic one inside the WINGs library. I wanted to do the minimal fix now, but will be happy to see this unified someday. Would you agree with that? ---8<--- >From 6fe5511e9f84e68cdcf1412e119c411d3398a377 Mon Sep 17 00:00:00 2001 From: Carlos R. Mafra <[email protected]> Date: Tue, 16 Mar 2010 19:01:01 +0100 Subject: [PATCH 1/4] Constify WMMatchDataProc and fix fallout It addresses this warning dialog.c: In function ‘LoadHistory’: dialog.c:209: warning: passing argument 2 of ‘WMFindInArray’ from incompatible pointer type ../WINGs/WINGs/WUtil.h:455: note: expected ‘int (*)(void *, void *)’ but argument is of type ‘int (*)(const void *, const void *)’ but induces others in other places. One of them was this one window.c: In function ‘wManageWindow’: window.c:782: warning: passing argument 2 of ‘WMFindInArray’ from incompatible pointer type ../WINGs/WINGs/WUtil.h:455: note: expected ‘int (*)(const void *, const void *)’ but argument is of type ‘int (*)(void *, void *)’ which is fixed by constifying the arguments of matchIdentifier(). The other warnings are fixed similarly. --- WINGs/WINGs/WUtil.h | 2 +- WINGs/host.c | 2 +- WINGs/tree.c | 2 +- WINGs/wbox.c | 2 +- WINGs/wevent.c | 2 +- WINGs/wlist.c | 2 +- src/dock.c | 2 +- src/event.c | 2 +- src/window.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h index 347e70e..9569b32 100644 --- a/WINGs/WINGs/WUtil.h +++ b/WINGs/WINGs/WUtil.h @@ -142,7 +142,7 @@ typedef int WMCompareDataProc(const void *item1, const void *item2); typedef void WMFreeDataProc(void *data); /* Used by WMBag or WMArray for matching data */ -typedef int WMMatchDataProc(void *item, void *cdata); +typedef int WMMatchDataProc(const void *item, const void *cdata); diff --git a/WINGs/host.c b/WINGs/host.c index 53f9407..aeee6c7 100644 --- a/WINGs/host.c +++ b/WINGs/host.c @@ -218,7 +218,7 @@ void WMFlushHostCache() } } -static int matchAddress(void *item, void *cdata) +static int matchAddress(const void *item, const void *cdata) { return (strcmp((char *)item, (char *)cdata) == 0); } diff --git a/WINGs/tree.c b/WINGs/tree.c index 5781588..45c1497 100644 --- a/WINGs/tree.c +++ b/WINGs/tree.c @@ -125,7 +125,7 @@ void WMDeleteLeafForTreeNode(WMTreeNode * aNode, int index) WMDeleteFromArray(aNode->leaves, index); } -static int sameData(void *item, void *data) +static int sameData(const void *item, const void *data) { return (((WMTreeNode *) item)->data == data); } diff --git a/WINGs/wbox.c b/WINGs/wbox.c index b5ee1bc..2c7d949 100644 --- a/WINGs/wbox.c +++ b/WINGs/wbox.c @@ -194,7 +194,7 @@ void WMAddBoxSubviewAtEnd(WMBox * bPtr, WMView * view, Bool expand, Bool fill, i rearrange(bPtr); } -static int matchView(void *item, void *cdata) +static int matchView(const void *item, const void *cdata) { return (((SubviewItem *) item)->view == (WMView *) cdata); } diff --git a/WINGs/wevent.c b/WINGs/wevent.c index 6865838..8f7a5b6 100644 --- a/WINGs/wevent.c +++ b/WINGs/wevent.c @@ -78,7 +78,7 @@ void WMCreateEventHandler(WMView * view, unsigned long mask, WMEventProc * event WMAddToArray(view->eventHandlers, hPtr); } -static int matchHandler(void *item, void *cdata) +static int matchHandler(const void *item, const void *cdata) { #define H1 ((W_EventHandler*)item) #define H2 ((W_EventHandler*)cdata) diff --git a/WINGs/wlist.c b/WINGs/wlist.c index 759fe62..f8fbde8 100644 --- a/WINGs/wlist.c +++ b/WINGs/wlist.c @@ -638,7 +638,7 @@ static void handleEvents(XEvent * event, void *data) } } -static int matchTitle(void *item, void *title) +static int matchTitle(const void *item, const void *title) { return (strcmp(((WMListItem *) item)->text, (char *)title) == 0 ? 1 : 0); } diff --git a/src/dock.c b/src/dock.c index 46d45f4..0e932e8 100644 --- a/src/dock.c +++ b/src/dock.c @@ -195,7 +195,7 @@ static void toggleLoweredCallback(WMenu * menu, WMenuEntry * entry) wMenuPaint(menu); } -static int matchWindow(void *item, void *cdata) +static int matchWindow(const void *item, const void *cdata) { return (((WFakeGroupLeader *) item)->leader == (Window) cdata); } diff --git a/src/event.c b/src/event.c index 618a5e9..47ad717 100644 --- a/src/event.c +++ b/src/event.c @@ -529,7 +529,7 @@ static void saveTimestamp(XEvent * event) } } -static int matchWindow(void *item, void *cdata) +static int matchWindow(const void *item, const void *cdata) { return (((WFakeGroupLeader *) item)->origLeader == (Window) cdata); } diff --git a/src/window.c b/src/window.c index 22f97b4..7655498 100644 --- a/src/window.c +++ b/src/window.c @@ -564,7 +564,7 @@ static Window createFakeWindowGroupLeader(WScreen *scr, Window win, char *instan return leader; } -static int matchIdentifier(void *item, void *cdata) +static int matchIdentifier(const void *item, const void *cdata) { return (strcmp(((WFakeGroupLeader *) item)->identifier, (char *)cdata) == 0); } -- 1.7.0.2.182.ge007 -- To unsubscribe, send mail to [email protected].
