dix: write out X_AllocColorPlanes reply directly
No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
3a233ac98a
commit
6e657b2ca5
|
@ -2795,7 +2795,6 @@ ProcAllocColorPlanes(ClientPtr client)
|
|||
rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
|
||||
client, DixAddAccess);
|
||||
if (rc == Success) {
|
||||
xAllocColorPlanesReply acpr;
|
||||
int npixels;
|
||||
long length;
|
||||
|
||||
|
@ -2808,7 +2807,8 @@ ProcAllocColorPlanes(ClientPtr client)
|
|||
client->errorValue = stuff->contiguous;
|
||||
return BadValue;
|
||||
}
|
||||
acpr = (xAllocColorPlanesReply) {
|
||||
|
||||
xAllocColorPlanesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nPixels = npixels
|
||||
|
@ -2821,19 +2821,29 @@ ProcAllocColorPlanes(ClientPtr client)
|
|||
if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
|
||||
(int) stuff->red, (int) stuff->green,
|
||||
(int) stuff->blue, (Bool) stuff->contiguous,
|
||||
ppixels, &acpr.redMask, &acpr.greenMask,
|
||||
&acpr.blueMask))) {
|
||||
ppixels, &rep.redMask, &rep.greenMask,
|
||||
&rep.blueMask))) {
|
||||
free(ppixels);
|
||||
return rc;
|
||||
}
|
||||
acpr.length = bytes_to_int32(length);
|
||||
rep.length = bytes_to_int32(length);
|
||||
|
||||
if (client->swapped) {
|
||||
SwapLongs(ppixels, rep.length);
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.nPixels);
|
||||
swapl(&rep.redMask);
|
||||
swapl(&rep.greenMask);
|
||||
swapl(&rep.blueMask);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
|
||||
#endif /* XINERAMA */
|
||||
{
|
||||
WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr);
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, length, ppixels);
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
WriteToClient(client, length, ppixels);
|
||||
}
|
||||
free(ppixels);
|
||||
return Success;
|
||||
|
|
|
@ -310,19 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
|
|||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SAllocColorPlanesReply(ClientPtr pClient, int size,
|
||||
xAllocColorPlanesReply * pRep)
|
||||
{
|
||||
swaps(&pRep->sequenceNumber);
|
||||
swapl(&pRep->length);
|
||||
swaps(&pRep->nPixels);
|
||||
swapl(&pRep->redMask);
|
||||
swapl(&pRep->greenMask);
|
||||
swapl(&pRep->blueMask);
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
SwapRGB(xrgb * prgb)
|
||||
{
|
||||
|
|
|
@ -802,7 +802,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd,
|
||||
ReplyNotSwappd, /* 85 */
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SAllocColorPlanesReply,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd, /* 90 */
|
||||
|
|
|
@ -68,11 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
|
|||
int /* size */ ,
|
||||
xGetFontPathReply * /* pRep */ );
|
||||
|
||||
extern void SAllocColorPlanesReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xAllocColorPlanesReply * /* pRep */
|
||||
);
|
||||
|
||||
extern void SQColorsExtend(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xrgb * /* prgb */ );
|
||||
|
|
Loading…
Reference in New Issue