1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

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.
This commit is contained in:
Carlos R. Mafra
2010-03-16 19:01:01 +01:00
parent 034339320f
commit 8018da8149
10 changed files with 12 additions and 12 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -384,17 +384,17 @@ void WMEnqueueNotification(WMNotificationQueue * queue, WMNotification * notific
#define NOTIF ((WMNotification*)cdata)
#define ITEM ((WMNotification*)item)
static int matchSenderAndName(void *item, void *cdata)
static int matchSenderAndName(const void *item, const void *cdata)
{
return (NOTIF->object == ITEM->object && strcmp(NOTIF->name, ITEM->name) == 0);
}
static int matchSender(void *item, void *cdata)
static int matchSender(const void *item, const void *cdata)
{
return (NOTIF->object == ITEM->object);
}
static int matchName(void *item, void *cdata)
static int matchName(const void *item, const void *cdata)
{
return (strcmp(NOTIF->name, ITEM->name) == 0);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}