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/dix/devices.c | 4 +- nx-X11/programs/Xserver/dix/dispatch.c | 16 +++---- nx-X11/programs/Xserver/dix/dixfonts.c | 4 +- nx-X11/programs/Xserver/dix/events.c | 4 +- nx-X11/programs/Xserver/dix/swaprep.c | 88 +++++++++++++++++----------------- 5 files changed, 58 insertions(+), 58 deletions(-) (limited to 'nx-X11/programs/Xserver/dix') diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c index 69a72fbad..ccce2324b 100644 --- a/nx-X11/programs/Xserver/dix/devices.c +++ b/nx-X11/programs/Xserver/dix/devices.c @@ -1041,7 +1041,7 @@ ProcGetModifierMapping(ClientPtr client) WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); /* Use the (modified by DDX) map that SetModifierMapping passed in */ - (void)WriteToClient(client, (int)(keyc->maxKeysPerModifier << 3), + WriteToClient(client, (int)(keyc->maxKeysPerModifier << 3), (char *)keyc->modifierKeyMap); return client->noClientException; } @@ -1178,7 +1178,7 @@ ProcGetPointerMapping(ClientPtr client) rep.nElts = butc->numButtons; rep.length = ((unsigned)rep.nElts + (4-1))/4; WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); - (void)WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]); + WriteToClient(client, (int)rep.nElts, &butc->map[1]); return Success; } diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 826adfb5c..63ea0ab87 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -945,7 +945,7 @@ ProcGetAtomName(register ClientPtr client) reply.sequenceNumber = client->sequence; reply.nameLength = len; WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply); - (void)WriteToClient(client, len, str); + WriteToClient(client, len, str); return(client->noClientException); } else @@ -2278,7 +2278,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ClientOrder(client)); /* Don't split me, gcc pukes when you do */ - (void)WriteToClient(client, + WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); } @@ -2322,7 +2322,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, ClientOrder (client)); /* Don't split me, gcc pukes when you do */ - (void)WriteToClient(client, + WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); } @@ -3441,7 +3441,7 @@ ProcGetFontPath(register ClientPtr client) WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply); if (stringLens || numpaths) - (void)WriteToClient(client, stringLens + numpaths, (char *)bufferStart); + WriteToClient(client, stringLens + numpaths, bufferStart); return(client->noClientException); } @@ -3835,8 +3835,8 @@ SendConnSetup(register ClientPtr client, char *reason) if (client->swapped) WriteSConnSetupPrefix(client, &csp); else - (void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp); - (void)WriteToClient(client, (int)csp.lengthReason, reason); + WriteToClient(client, sz_xConnSetupPrefix, &csp); + WriteToClient(client, (int)csp.lengthReason, reason); return (client->noClientException = -1); } @@ -3893,9 +3893,9 @@ SendConnSetup(register ClientPtr client, char *reason) } else { - (void)WriteToClient(client, sizeof(xConnSetupPrefix), + WriteToClient(client, sizeof(xConnSetupPrefix), (char *) lconnSetupPrefix); - (void)WriteToClient(client, (int)(lconnSetupPrefix->length << 2), + WriteToClient(client, (int)(lconnSetupPrefix->length << 2), lConnectionInfo); } client->clientState = ClientStateRunning; diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index 0ebb4e68d..421345ef6 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -821,7 +821,7 @@ finish: reply.length = (stringLens + nnames + 3) >> 2; client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); - (void) WriteToClient(client, stringLens + nnames, bufferStart); + WriteToClient(client, stringLens + nnames, bufferStart); DEALLOCATE_LOCAL(bufferStart); bail: @@ -1081,7 +1081,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) pFP++; } WriteSwappedDataToClient(client, length, reply); - (void) WriteToClient(client, namelen, name); + WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { free(fontInfo.props); diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 6fefa512a..d06d9b823 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -4494,11 +4494,11 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) this event was sent with "SendEvent." */ (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, &eventTo); - (void)WriteToClient(pClient, sizeof(xEvent), (char *)&eventTo); + WriteToClient(pClient, sizeof(xEvent), &eventTo); } } else { - (void)WriteToClient(pClient, count * sizeof(xEvent), (char *) events); + WriteToClient(pClient, count * sizeof(xEvent), events); } } diff --git a/nx-X11/programs/Xserver/dix/swaprep.c b/nx-X11/programs/Xserver/dix/swaprep.c index e5c722f31..cd6663333 100644 --- a/nx-X11/programs/Xserver/dix/swaprep.c +++ b/nx-X11/programs/Xserver/dix/swaprep.c @@ -86,7 +86,7 @@ Swap32Write(ClientPtr pClient, int size, register CARD32 *pbuf) { swapl(&pbuf[i]); } - (void)WriteToClient(pClient, size << 2, (char *) pbuf); + WriteToClient(pClient, size << 2, pbuf); } /** @@ -130,7 +130,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) from++; to++; } - (void)WriteToClient (pClient, nbytes, (char *) pbufT); + WriteToClient (pClient, nbytes, pbufT); } if (pbufT != tmpbuf) @@ -178,7 +178,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) from++; to++; } - (void)WriteToClient (pClient, nbytes, (char *) pbufT); + WriteToClient (pClient, nbytes, pbufT); } if (pbufT != tmpbuf) @@ -191,7 +191,7 @@ void SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep) { swaps(&pRep->sequenceNumber); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } /* Extra-large reply */ @@ -209,7 +209,7 @@ SGetWindowAttributesReply(ClientPtr pClient, int size, swapl(&pRep->allEventMasks); swapl(&pRep->yourEventMask); swaps(&pRep->doNotPropagateMask); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -222,7 +222,7 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) swaps(&pRep->width); swaps(&pRep->height); swaps(&pRep->borderWidth); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -233,7 +233,7 @@ SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) swapl(&pRep->root); swapl(&pRep->parent); swaps(&pRep->nChildren); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -241,7 +241,7 @@ SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->atom); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -250,7 +250,7 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nameLength); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } @@ -262,7 +262,7 @@ SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) swapl(&pRep->propertyType); swapl(&pRep->bytesAfter); swapl(&pRep->nItems); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -271,7 +271,7 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nProperties); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -280,7 +280,7 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->owner); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } @@ -295,7 +295,7 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) swaps(&pRep->winX); swaps(&pRep->winY); swaps(&pRep->mask); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -319,7 +319,7 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep) SwapTimecoord(pRepT); pRepT++; } - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -328,7 +328,7 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->nEvents); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -338,7 +338,7 @@ STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) swapl(&pRep->child); swaps(&pRep->dstX); swaps(&pRep->dstY); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -346,7 +346,7 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->focus); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } /* extra long reply */ @@ -355,7 +355,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } static @@ -420,7 +420,7 @@ void SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep) { SwapFont(pRep, TRUE); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -434,7 +434,7 @@ SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep swapl(&pRep->overallWidth); swapl(&pRep->overallLeft); swapl(&pRep->overallRight); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -443,7 +443,7 @@ SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nFonts); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -451,7 +451,7 @@ SListFontsWithInfoReply(ClientPtr pClient, int size, xListFontsWithInfoReply *pRep) { SwapFont((xQueryFontReply *)pRep, FALSE); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -460,7 +460,7 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nPaths); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -469,7 +469,7 @@ SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->visual); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); /* Fortunately, image doesn't need swapping */ } @@ -480,7 +480,7 @@ SListInstalledColormapsReply(ClientPtr pClient, int size, swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColormaps); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -494,7 +494,7 @@ SAllocColorReply(pClient, size, pRep) swaps(&pRep->green); swaps(&pRep->blue); swapl(&pRep->pixel); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -508,7 +508,7 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -518,7 +518,7 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) swapl(&pRep->length); swaps(&pRep->nPixels); swaps(&pRep->nMasks); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } @@ -531,7 +531,7 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep swapl(&pRep->redMask); swapl(&pRep->greenMask); swapl(&pRep->blueMask); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -555,7 +555,7 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb) SwapRGB(prgbT); prgbT++; } - (void)WriteToClient(pClient, size, (char *) prgb); + WriteToClient(pClient, size, prgb); } void @@ -564,7 +564,7 @@ SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColors); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -577,7 +577,7 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -586,7 +586,7 @@ SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) swaps(&pRep->sequenceNumber); swaps(&pRep->width); swaps(&pRep->height); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -594,7 +594,7 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -603,7 +603,7 @@ SGetKeyboardMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -612,7 +612,7 @@ SGetPointerMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -621,7 +621,7 @@ SGetModifierMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -632,7 +632,7 @@ SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply * swapl(&pRep->ledMask); swaps(&pRep->bellPitch); swaps(&pRep->bellDuration); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -642,7 +642,7 @@ SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pR swaps(&pRep->accelNumerator); swaps(&pRep->accelDenominator); swaps(&pRep->threshold); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -651,7 +651,7 @@ SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep) swaps(&pRep->sequenceNumber); swaps(&pRep->timeout); swaps(&pRep->interval); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -665,7 +665,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf) swaps (&host->length); bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2); } - (void)WriteToClient (pClient, size, buf); + WriteToClient (pClient, size, buf); } void @@ -674,7 +674,7 @@ SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nHosts); - (void)WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } @@ -1148,7 +1148,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) return; } SwapConnSetupInfo(pInfo, pInfoTBase); - (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); + WriteToClient(pClient, (int)size, pInfoTBase); DEALLOCATE_LOCAL(pInfoTBase); } @@ -1220,5 +1220,5 @@ WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp) xConnSetupPrefix cspT; SwapConnSetupPrefix(pcsp, &cspT); - (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT); + WriteToClient(pClient, sizeof(cspT), &cspT); } -- cgit v1.2.3