dix: write out X_ListInstalledColormaps 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
1f2cf6fe4b
commit
725bb2d20d
|
@ -2572,7 +2572,7 @@ ProcUninstallColormap(ClientPtr client)
|
|||
int
|
||||
ProcListInstalledColormaps(ClientPtr client)
|
||||
{
|
||||
int nummaps, rc;
|
||||
int rc;
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xResourceReq);
|
||||
|
@ -2586,23 +2586,33 @@ ProcListInstalledColormaps(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
xListInstalledColormapsReply *preply = calloc(1,
|
||||
sizeof(xListInstalledColormapsReply) +
|
||||
pWin->drawable.pScreen->maxInstalledCmaps *
|
||||
sizeof(Colormap));
|
||||
if (!preply)
|
||||
Colormap *cm = calloc(pWin->drawable.pScreen->maxInstalledCmaps,
|
||||
sizeof(Colormap));
|
||||
if (!cm)
|
||||
return BadAlloc;
|
||||
|
||||
preply->type = X_Reply;
|
||||
preply->sequenceNumber = client->sequence;
|
||||
nummaps = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
||||
(pWin->drawable.pScreen, (Colormap *) &preply[1]);
|
||||
preply->nColormaps = nummaps;
|
||||
preply->length = nummaps;
|
||||
WriteReplyToClient(client, sizeof(xListInstalledColormapsReply), preply);
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, nummaps * sizeof(Colormap), &preply[1]);
|
||||
free(preply);
|
||||
const ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
const int nummaps = pScreen->ListInstalledColormaps(pScreen, cm);
|
||||
|
||||
xListInstalledColormapsReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nColormaps = nummaps,
|
||||
.length = nummaps,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.nColormaps);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
if (client->swapped)
|
||||
Swap32Write(client, nummaps * sizeof(Colormap), cm);
|
||||
else
|
||||
WriteToClient(client, nummaps * sizeof(Colormap), cm);
|
||||
free(cm);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -310,16 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
|
|||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SListInstalledColormapsReply(ClientPtr pClient, int size,
|
||||
xListInstalledColormapsReply * pRep)
|
||||
{
|
||||
swaps(&pRep->sequenceNumber);
|
||||
swapl(&pRep->length);
|
||||
swaps(&pRep->nColormaps);
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
|
||||
{
|
||||
|
|
|
@ -798,7 +798,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd, /* 80 */
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SListInstalledColormapsReply,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SAllocColorReply,
|
||||
(ReplySwapPtr) SAllocNamedColorReply, /* 85 */
|
||||
(ReplySwapPtr) SAllocColorCellsReply,
|
||||
|
|
|
@ -68,11 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
|
|||
int /* size */ ,
|
||||
xGetFontPathReply * /* pRep */ );
|
||||
|
||||
extern void SListInstalledColormapsReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xListInstalledColormapsReply
|
||||
* /* pRep */ );
|
||||
|
||||
extern void SAllocColorReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xAllocColorReply * /* pRep */ );
|
||||
|
|
Loading…
Reference in New Issue