mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
dix: ProcAllocColorPlanes(): use x_rpcbuf_t
Use x_rpcbuf_t for payload assembly and X_SEND_REPLY_WITH_RPCBUF() for sending it all out. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
0ca53c6908
commit
d734b75a37
@@ -2748,13 +2748,12 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||
}
|
||||
|
||||
xAllocColorPlanesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nPixels = npixels
|
||||
};
|
||||
length = (long) npixels *sizeof(Pixel);
|
||||
|
||||
Pixel *ppixels = calloc(1, length);
|
||||
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
|
||||
Pixel *ppixels = x_rpcbuf_reserve(&rpcbuf, length);
|
||||
if (!ppixels)
|
||||
return BadAlloc;
|
||||
if ((rc = AllocColorPlanes(client->index, pcmp, npixels,
|
||||
@@ -2762,15 +2761,12 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||
(int) stuff->blue, (Bool) stuff->contiguous,
|
||||
ppixels, &rep.redMask, &rep.greenMask,
|
||||
&rep.blueMask))) {
|
||||
free(ppixels);
|
||||
x_rpcbuf_clear(&rpcbuf);
|
||||
return rc;
|
||||
}
|
||||
rep.length = bytes_to_int32(length);
|
||||
|
||||
if (client->swapped) {
|
||||
SwapLongs(ppixels, rep.length);
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
SwapLongs(ppixels, length / 4);
|
||||
swaps(&rep.nPixels);
|
||||
swapl(&rep.redMask);
|
||||
swapl(&rep.greenMask);
|
||||
@@ -2781,10 +2777,9 @@ ProcAllocColorPlanes(ClientPtr client)
|
||||
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
|
||||
#endif /* XINERAMA */
|
||||
{
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
WriteToClient(client, length, ppixels);
|
||||
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
|
||||
}
|
||||
free(ppixels);
|
||||
x_rpcbuf_clear(&rpcbuf);
|
||||
return Success;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user