dix: write out X_AllocNamedColor 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
f062333422
commit
df44f063a0
|
@ -2672,38 +2672,48 @@ ProcAllocNamedColor(ClientPtr client)
|
|||
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
|
||||
rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, X11_RESTYPE_COLORMAP,
|
||||
client, DixAddAccess);
|
||||
if (rc == Success) {
|
||||
xAllocNamedColorReply ancr = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
if (dixLookupBuiltinColor
|
||||
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
|
||||
&ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
|
||||
ancr.screenRed = ancr.exactRed;
|
||||
ancr.screenGreen = ancr.exactGreen;
|
||||
ancr.screenBlue = ancr.exactBlue;
|
||||
ancr.pixel = 0;
|
||||
if ((rc = AllocColor(pcmp,
|
||||
&ancr.screenRed, &ancr.screenGreen,
|
||||
&ancr.screenBlue, &ancr.pixel, client->index)))
|
||||
return rc;
|
||||
#ifdef XINERAMA
|
||||
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
|
||||
#endif /* XINERAMA */
|
||||
WriteReplyToClient(client, sizeof(xAllocNamedColorReply),
|
||||
&ancr);
|
||||
return Success;
|
||||
}
|
||||
else
|
||||
return BadName;
|
||||
|
||||
}
|
||||
else {
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->cmap;
|
||||
return rc;
|
||||
}
|
||||
|
||||
xAllocNamedColorReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
if (!dixLookupBuiltinColor
|
||||
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
|
||||
&rep.exactRed, &rep.exactGreen, &rep.exactBlue))
|
||||
return BadName;
|
||||
|
||||
rep.screenRed = rep.exactRed;
|
||||
rep.screenGreen = rep.exactGreen;
|
||||
rep.screenBlue = rep.exactBlue;
|
||||
rep.pixel = 0;
|
||||
|
||||
if ((rc = AllocColor(pcmp,
|
||||
&rep.screenRed, &rep.screenGreen,
|
||||
&rep.screenBlue, &rep.pixel, client->index)))
|
||||
return rc;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.pixel);
|
||||
swaps(&rep.exactRed);
|
||||
swaps(&rep.exactGreen);
|
||||
swaps(&rep.exactBlue);
|
||||
swaps(&rep.screenRed);
|
||||
swaps(&rep.screenGreen);
|
||||
swaps(&rep.screenBlue);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
|
||||
#endif /* XINERAMA */
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -310,20 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
|
|||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
|
||||
{
|
||||
swaps(&pRep->sequenceNumber);
|
||||
swapl(&pRep->pixel);
|
||||
swaps(&pRep->exactRed);
|
||||
swaps(&pRep->exactGreen);
|
||||
swaps(&pRep->exactBlue);
|
||||
swaps(&pRep->screenRed);
|
||||
swaps(&pRep->screenGreen);
|
||||
swaps(&pRep->screenBlue);
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep)
|
||||
{
|
||||
|
|
|
@ -800,7 +800,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SAllocNamedColorReply, /* 85 */
|
||||
ReplyNotSwappd, /* 85 */
|
||||
(ReplySwapPtr) SAllocColorCellsReply,
|
||||
(ReplySwapPtr) SAllocColorPlanesReply,
|
||||
ReplyNotSwappd,
|
||||
|
|
|
@ -68,11 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
|
|||
int /* size */ ,
|
||||
xGetFontPathReply * /* pRep */ );
|
||||
|
||||
extern void SAllocNamedColorReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xAllocNamedColorReply * /* pRep */
|
||||
);
|
||||
|
||||
extern void SAllocColorCellsReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xAllocColorCellsReply * /* pRep */
|
||||
|
|
Loading…
Reference in New Issue