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