From f6a1bda2dff0c70aa13f3cb763a9b08c4c037c53 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 4 Jul 2016 00:28:47 +0200 Subject: Remove unneccesary casts from WriteToClient calls Casting return to (void) was used to tell lint that you intended to ignore the return value, so it didn't warn you about it. Casting the third argument to (char *) was used as the most generic pointer type in the days before compilers supported C89 (void *) (except for a couple places it's used for byte-sized pointer math). Signed-off-by: Alan Coopersmith Reviewed-by: Keith Packard Tested-by: Daniel Stone Backport to nx-libs: Mike Gabriel --- nx-X11/programs/Xserver/xkb/xkb.c | 40 ++++++++++++++++----------------- nx-X11/programs/Xserver/xkb/xkbEvents.c | 26 ++++++++++----------- 2 files changed, 33 insertions(+), 33 deletions(-) (limited to 'nx-X11/programs/Xserver/xkb') diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index 65a4c3747..52c5d36bf 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.c +++ b/nx-X11/programs/Xserver/xkb/xkb.c @@ -204,7 +204,7 @@ ProcXkbUseExtension(ClientPtr client) swaps(&rep.serverMajor); swaps(&rep.serverMinor); } - WriteToClient(client,SIZEOF(xkbUseExtensionReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbUseExtensionReply), &rep); return client->noClientException; } @@ -537,7 +537,7 @@ ProcXkbGetState(ClientPtr client) swaps(&rep.sequenceNumber); swaps(&rep.ptrBtnState); } - WriteToClient(client, SIZEOF(xkbGetStateReply), (char *)&rep); + WriteToClient(client, SIZEOF(xkbGetStateReply), &rep); return client->noClientException; } @@ -671,7 +671,7 @@ ProcXkbGetControls(ClientPtr client) swaps(&rep.axtOptsValues); swaps(&rep.axOptions); } - WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *)&rep); + WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep); return(client->noClientException); } @@ -1345,7 +1345,7 @@ char *desc,*start; swaps(&rep->totalSyms); swaps(&rep->totalActs); } - WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep); + WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), rep); WriteToClient(client, len, start); DEALLOCATE_LOCAL((char *)start); return client->noClientException; @@ -2536,7 +2536,7 @@ int size; swaps(&rep->nTotalSI); } - WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep); + WriteToClient(client, SIZEOF(xkbGetCompatMapReply), rep); if (data) { WriteToClient(client, size, data); DEALLOCATE_LOCAL((char *)data); @@ -2750,7 +2750,7 @@ ProcXkbGetIndicatorState(ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.state); } - WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *)&rep); + WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep); return client->noClientException; } @@ -2821,9 +2821,9 @@ register unsigned bit; swapl(&rep->which); swapl(&rep->realIndicators); } - WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep); + WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), rep); if (map) { - WriteToClient(client, length, (char *)map); + WriteToClient(client, length, map); DEALLOCATE_LOCAL((char *)map); } return client->noClientException; @@ -3025,7 +3025,7 @@ ProcXkbGetNamedIndicator(ClientPtr client) swapl(&rep.ctrls); } - WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), &rep); if (!supported) { xkbExtensionDeviceNotify edev; @@ -3432,7 +3432,7 @@ char * desc; ErrorF("BOGUS LENGTH in write names, expected %d, got %ld\n", length, (unsigned long)(desc-start)); } - WriteToClient(client, SIZEOF(xkbGetNamesReply), (char *)rep); + WriteToClient(client, SIZEOF(xkbGetNamesReply), rep); WriteToClient(client, length, start); DEALLOCATE_LOCAL((char *)start); return client->noClientException; @@ -4359,7 +4359,7 @@ XkbSendGeometry( ClientPtr client, swaps(&rep->nDoodads); swaps(&rep->nKeyAliases); } - WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *)rep); + WriteToClient(client, SIZEOF(xkbGetGeometryReply), rep); if (len>0) WriteToClient(client, len, start); if (start!=NULL) @@ -4977,7 +4977,7 @@ ProcXkbPerClientFlags(ClientPtr client) swapl(&rep.autoCtrls); swapl(&rep.autoCtrlValues); } - WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), &rep); return client->noClientException; } @@ -5106,9 +5106,9 @@ ProcXkbListComponents(ClientPtr client) swaps(&rep.nGeometries); swaps(&rep.extra); } - WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep); + WriteToClient(client,SIZEOF(xkbListComponentsReply),&rep); if (list.nPool && list.pool) { - WriteToClient(client,XkbPaddedSize(list.nPool), (char *)list.pool); + WriteToClient(client,XkbPaddedSize(list.nPool), list.pool); _XkbFree(list.pool); list.pool= NULL; } @@ -5368,7 +5368,7 @@ ProcXkbGetKbdByName(ClientPtr client) swaps(&rep.found); swaps(&rep.reported); } - WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), &rep); if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask)) XkbSendMap(client,finfo.xkb,&mrep); if (reported&XkbGBN_CompatMapMask) @@ -5559,7 +5559,7 @@ int length; swapl(&wire.physIndicators); swapl(&wire.state); } - WriteToClient(client,SIZEOF(xkbDeviceLedsWireDesc),(char *)&wire); + WriteToClient(client,SIZEOF(xkbDeviceLedsWireDesc), &wire); length+= SIZEOF(xkbDeviceLedsWireDesc); if (sli->namesPresent|sli->mapsPresent) { register unsigned i,bit; @@ -5571,7 +5571,7 @@ int length; if (client->swapped) { swapl(&awire); } - WriteToClient(client,4,(char *)&awire); + WriteToClient(client,4, &awire); length+= 4; } } @@ -5756,7 +5756,7 @@ char * str; swapl((int *)&rep.type); } - WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), &rep); str= (char*) ALLOCATE_LOCAL(nameLen); if (!str) @@ -5771,7 +5771,7 @@ char * str; xkbActionWireDesc * awire; sz= rep.nBtnsRtrn*SIZEOF(xkbActionWireDesc); awire= (xkbActionWireDesc *)&dev->button->xkb_acts[rep.firstBtnRtrn]; - WriteToClient(client,sz,(char *)awire); + WriteToClient(client,sz, awire); length-= sz; } if (nDeviceLedFBs>0) { @@ -6113,7 +6113,7 @@ xkbSetDebuggingFlagsReply rep; swapl(&rep.supportedFlags); swapl(&rep.supportedCtrls); } - WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), (char *)&rep); + WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), &rep); return client->noClientException; } diff --git a/nx-X11/programs/Xserver/xkb/xkbEvents.c b/nx-X11/programs/Xserver/xkb/xkbEvents.c index c36653f2e..7c392abe5 100644 --- a/nx-X11/programs/Xserver/xkb/xkbEvents.c +++ b/nx-X11/programs/Xserver/xkb/xkbEvents.c @@ -71,7 +71,7 @@ CARD16 changed; swapl(&pNKN->time); swaps(&pNKN->changed); } - WriteToClient(clients[i],sizeof(xEvent),(char *)pNKN); + WriteToClient(clients[i],sizeof(xEvent), pNKN); if (changed&XkbNKN_KeycodesMask) { clients[i]->minKC= pNKN->minKeyCode; clients[i]->maxKC= pNKN->maxKeyCode; @@ -88,9 +88,9 @@ CARD16 changed; if (clients[i]->swapped) { swaps(&event.u.u.sequenceNumber); } - WriteToClient(clients[i],SIZEOF(xEvent), (char *)&event); + WriteToClient(clients[i],SIZEOF(xEvent), &event); event.u.mappingNotify.request= MappingModifier; - WriteToClient(clients[i],SIZEOF(xEvent), (char *)&event); + WriteToClient(clients[i],SIZEOF(xEvent), &event); } } return; @@ -149,7 +149,7 @@ register CARD16 changed,bState; swaps(&pSN->changed); swaps(&pSN->ptrBtnState); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pSN); + WriteToClient(interest->client, sizeof(xEvent), pSN); } interest= interest->next; } @@ -193,7 +193,7 @@ CARD16 changed; swapl(&pMN->time); swaps(&pMN->changed); } - WriteToClient(clients[i],sizeof(xEvent),(char *)pMN); + WriteToClient(clients[i],sizeof(xEvent), pMN); } } return; @@ -317,7 +317,7 @@ Time time = 0; swapl(&pCN->enabledControlChanges); swapl(&pCN->time); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pCN); + WriteToClient(interest->client, sizeof(xEvent), pCN); } interest= interest->next; } @@ -364,7 +364,7 @@ CARD32 state,changed; swapl(&pEv->changed); swapl(&pEv->state); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } @@ -448,7 +448,7 @@ XID winID = 0; swapl(&bn.name); swapl(&bn.window); } - WriteToClient(interest->client, sizeof(xEvent), (char *)&bn); + WriteToClient(interest->client, sizeof(xEvent), &bn); } interest= interest->next; } @@ -492,7 +492,7 @@ CARD16 sk_delay,db_delay; swaps(&pEv->slowKeysDelay); swaps(&pEv->debounceDelay); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } @@ -540,7 +540,7 @@ CARD32 changedIndicators; swapl(&pEv->changedIndicators); swaps(&pEv->changedVirtualMods); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } @@ -587,7 +587,7 @@ CARD16 firstSI = 0, nSI = 0, nTotalSI = 0; swaps(&pEv->nSI); swaps(&pEv->nTotalSI); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } @@ -629,7 +629,7 @@ Time time = 0; swaps(&pEv->sequenceNumber); swapl(&pEv->time); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } @@ -692,7 +692,7 @@ CARD16 reason, supported = 0; swaps(&pEv->reason); swaps(&pEv->supported); } - WriteToClient(interest->client, sizeof(xEvent), (char *)pEv); + WriteToClient(interest->client, sizeof(xEvent), pEv); } interest= interest->next; } -- cgit v1.2.3