dix: write out X_QueryColors 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
6e657b2ca5
commit
707fd2b1d7
|
@ -2952,7 +2952,6 @@ ProcQueryColors(ClientPtr client)
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
int count;
|
int count;
|
||||||
xrgb *prgbs;
|
xrgb *prgbs;
|
||||||
xQueryColorsReply qcr;
|
|
||||||
|
|
||||||
count =
|
count =
|
||||||
bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
|
bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
|
||||||
|
@ -2964,20 +2963,25 @@ ProcQueryColors(ClientPtr client)
|
||||||
free(prgbs);
|
free(prgbs);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
qcr = (xQueryColorsReply) {
|
|
||||||
|
xQueryColorsReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = bytes_to_int32(count * sizeof(xrgb)),
|
.length = bytes_to_int32(count * sizeof(xrgb)),
|
||||||
.nColors = count
|
.nColors = count
|
||||||
};
|
};
|
||||||
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
|
|
||||||
if (count) {
|
if (client->swapped) {
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
|
swaps(&rep.sequenceNumber);
|
||||||
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
|
swapl(&rep.length);
|
||||||
|
swaps(&rep.nColors);
|
||||||
|
SwapShorts((short*)prgbs, count * 4); // xrgb = 4 shorts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WriteToClient(client, sizeof(rep), &rep);
|
||||||
|
WriteToClient(client, count * sizeof(xrgb), prgbs);
|
||||||
free(prgbs);
|
free(prgbs);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
client->errorValue = stuff->cmap;
|
client->errorValue = stuff->cmap;
|
||||||
|
|
|
@ -310,38 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
|
||||||
WriteToClient(pClient, size, pRep);
|
WriteToClient(pClient, size, pRep);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _X_COLD
|
|
||||||
SwapRGB(xrgb * prgb)
|
|
||||||
{
|
|
||||||
swaps(&prgb->red);
|
|
||||||
swaps(&prgb->green);
|
|
||||||
swaps(&prgb->blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _X_COLD
|
|
||||||
SQColorsExtend(ClientPtr pClient, int size, xrgb * prgb)
|
|
||||||
{
|
|
||||||
int i, n;
|
|
||||||
xrgb *prgbT;
|
|
||||||
|
|
||||||
n = size / sizeof(xrgb);
|
|
||||||
prgbT = prgb;
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
SwapRGB(prgbT);
|
|
||||||
prgbT++;
|
|
||||||
}
|
|
||||||
WriteToClient(pClient, size, prgb);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _X_COLD
|
|
||||||
SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply * pRep)
|
|
||||||
{
|
|
||||||
swaps(&pRep->sequenceNumber);
|
|
||||||
swapl(&pRep->length);
|
|
||||||
swaps(&pRep->nColors);
|
|
||||||
WriteToClient(pClient, size, pRep);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _X_COLD
|
void _X_COLD
|
||||||
SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
|
SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
|
||||||
{
|
{
|
||||||
|
|
|
@ -806,7 +806,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
ReplyNotSwappd, /* 90 */
|
ReplyNotSwappd, /* 90 */
|
||||||
(ReplySwapPtr) SQueryColorsReply,
|
ReplyNotSwappd,
|
||||||
(ReplySwapPtr) SLookupColorReply,
|
(ReplySwapPtr) SLookupColorReply,
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
ReplyNotSwappd,
|
ReplyNotSwappd,
|
||||||
|
|
|
@ -68,14 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
xGetFontPathReply * /* pRep */ );
|
xGetFontPathReply * /* pRep */ );
|
||||||
|
|
||||||
extern void SQColorsExtend(ClientPtr /* pClient */ ,
|
|
||||||
int /* size */ ,
|
|
||||||
xrgb * /* prgb */ );
|
|
||||||
|
|
||||||
extern void SQueryColorsReply(ClientPtr /* pClient */ ,
|
|
||||||
int /* size */ ,
|
|
||||||
xQueryColorsReply * /* pRep */ );
|
|
||||||
|
|
||||||
extern void SLookupColorReply(ClientPtr /* pClient */ ,
|
extern void SLookupColorReply(ClientPtr /* pClient */ ,
|
||||||
int /* size */ ,
|
int /* size */ ,
|
||||||
xLookupColorReply * /* pRep */ );
|
xLookupColorReply * /* pRep */ );
|
||||||
|
|
Loading…
Reference in New Issue