diff --git a/dix/dispatch.c b/dix/dispatch.c index 2a477274c..0a20764cd 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2952,7 +2952,6 @@ ProcQueryColors(ClientPtr client) if (rc == Success) { int count; xrgb *prgbs; - xQueryColorsReply qcr; count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq)); @@ -2964,20 +2963,25 @@ ProcQueryColors(ClientPtr client) free(prgbs); return rc; } - qcr = (xQueryColorsReply) { + + xQueryColorsReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = bytes_to_int32(count * sizeof(xrgb)), .nColors = count }; - WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr); - if (count) { - client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; - WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + 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); return Success; - } else { client->errorValue = stuff->cmap; diff --git a/dix/swaprep.c b/dix/swaprep.c index 2e0690a80..100bf3a00 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -310,38 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * 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 SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index ec538feee..2f519cd38 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -806,7 +806,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 90 */ - (ReplySwapPtr) SQueryColorsReply, + ReplyNotSwappd, (ReplySwapPtr) SLookupColorReply, ReplyNotSwappd, ReplyNotSwappd, diff --git a/include/swaprep.h b/include/swaprep.h index eb29b4e34..e31c1e0ce 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -68,14 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ , int /* size */ , 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 */ , int /* size */ , xLookupColorReply * /* pRep */ );