dix: write out X_AllocColor 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
725bb2d20d
commit
f062333422
|
@ -2627,30 +2627,38 @@ ProcAllocColor(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xAllocColorReq);
|
REQUEST_SIZE_MATCH(xAllocColorReq);
|
||||||
rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
|
rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
|
||||||
client, DixAddAccess);
|
client, DixAddAccess);
|
||||||
if (rc == Success) {
|
if (rc != Success) {
|
||||||
xAllocColorReply acr = {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.red = stuff->red,
|
|
||||||
.green = stuff->green,
|
|
||||||
.blue = stuff->blue,
|
|
||||||
.pixel = 0
|
|
||||||
};
|
|
||||||
if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
|
|
||||||
&acr.pixel, client->index)))
|
|
||||||
return rc;
|
|
||||||
#ifdef XINERAMA
|
|
||||||
if (noPanoramiXExtension || !pmap->pScreen->myNum)
|
|
||||||
#endif /* XINERAMA */
|
|
||||||
WriteReplyToClient(client, sizeof(xAllocColorReply), &acr);
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
client->errorValue = stuff->cmap;
|
client->errorValue = stuff->cmap;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xAllocColorReply rep = {
|
||||||
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = 0,
|
||||||
|
.red = stuff->red,
|
||||||
|
.green = stuff->green,
|
||||||
|
.blue = stuff->blue,
|
||||||
|
.pixel = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((rc = AllocColor(pmap, &rep.red, &rep.green, &rep.blue,
|
||||||
|
&rep.pixel, client->index)))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
if (client->swapped) {
|
||||||
|
swaps(&rep.sequenceNumber);
|
||||||
|
swaps(&rep.red);
|
||||||
|
swaps(&rep.green);
|
||||||
|
swaps(&rep.blue);
|
||||||
|
swapl(&rep.pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef XINERAMA
|
||||||
|
if (noPanoramiXExtension || !pmap->pScreen->myNum)
|
||||||
|
#endif /* XINERAMA */
|
||||||
|
WriteToClient(client, sizeof(rep), &rep);
|
||||||
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -310,17 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
|
||||||
WriteToClient(pClient, size, pRep);
|
WriteToClient(pClient, size, pRep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _X_COLD
|
|
||||||
SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
|
|
||||||
{
|
|
||||||
swaps(&pRep->sequenceNumber);
|
|
||||||
swaps(&pRep->red);
|
|
||||||
swaps(&pRep->green);
|
|
||||||
swaps(&pRep->blue);
|
|
||||||
swapl(&pRep->pixel);
|
|
||||||
WriteToClient(pClient, size, pRep);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _X_COLD
|
void _X_COLD
|
||||||
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
|
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
|
||||||
{
|
{
|
||||||
|
|
|
@ -799,7 +799,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
(ReplySwapPtr) SAllocColorReply,
|
ReplyNotSwappd,
|
||||||
(ReplySwapPtr) SAllocNamedColorReply, /* 85 */
|
(ReplySwapPtr) SAllocNamedColorReply, /* 85 */
|
||||||
(ReplySwapPtr) SAllocColorCellsReply,
|
(ReplySwapPtr) SAllocColorCellsReply,
|
||||||
(ReplySwapPtr) SAllocColorPlanesReply,
|
(ReplySwapPtr) SAllocColorPlanesReply,
|
||||||
|
|
|
@ -68,10 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
xGetFontPathReply * /* pRep */ );
|
xGetFontPathReply * /* pRep */ );
|
||||||
|
|
||||||
extern void SAllocColorReply(ClientPtr /* pClient */ ,
|
|
||||||
int /* size */ ,
|
|
||||||
xAllocColorReply * /* pRep */ );
|
|
||||||
|
|
||||||
extern void SAllocNamedColorReply(ClientPtr /* pClient */ ,
|
extern void SAllocNamedColorReply(ClientPtr /* pClient */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
xAllocNamedColorReply * /* pRep */
|
xAllocNamedColorReply * /* pRep */
|
||||||
|
|
Loading…
Reference in New Issue