mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
dbe: ProcDbeGetVisualInfo(): drop unncessary payload length computation
Since using x_rpcbuf, we don't need extra computation of the payload_length, as the x_rpcbuf already knows the amount of data written into it. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
b60c739384
commit
1bcff3fe35
41
dbe/dbe.c
41
dbe/dbe.c
@@ -561,12 +561,10 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDbeGetVisualInfoReq);
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
xDbeGetVisualInfoReply rep;
|
||||
Drawable *drawables;
|
||||
DrawablePtr *pDrawables = NULL;
|
||||
register int i, rc;
|
||||
register int count; /* number of visual infos in reply */
|
||||
register int length; /* length of reply */
|
||||
ScreenPtr pScreen;
|
||||
XdbeScreenVisualInfo *pScrVisInfo;
|
||||
|
||||
@@ -605,8 +603,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
length = 0;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
|
||||
pDrawables[i]->pScreen;
|
||||
@@ -623,25 +619,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||
/* Free visinfos that we allocated for previous screen infos. */
|
||||
goto clearRpcBuf;
|
||||
}
|
||||
|
||||
/* Account for n, number of xDbeVisInfo items in list. */
|
||||
length += sizeof(CARD32);
|
||||
|
||||
/* Account for n xDbeVisInfo items */
|
||||
length += pScrVisInfo[i].count * sizeof(xDbeVisInfo);
|
||||
}
|
||||
|
||||
rep = (xDbeGetVisualInfoReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(length),
|
||||
.m = count
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.m);
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
@@ -666,6 +643,24 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
if (rpcbuf.error) {
|
||||
rc = BadAlloc;
|
||||
goto clearRpcBuf;
|
||||
}
|
||||
|
||||
xDbeGetVisualInfoReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(rpcbuf.wpos),
|
||||
.m = count
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.m);
|
||||
}
|
||||
|
||||
rc = Success;
|
||||
WriteToClient(client, sizeof(xDbeGetVisualInfoReply), &rep);
|
||||
WriteRpcbufToClient(client, &rpcbuf);
|
||||
|
||||
Reference in New Issue
Block a user