dix: write out X_ListExtensions 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
a1e5033170
commit
fc13768c3e
|
@ -258,13 +258,12 @@ ProcQueryExtension(ClientPtr client)
|
|||
int
|
||||
ProcListExtensions(ClientPtr client)
|
||||
{
|
||||
xListExtensionsReply reply;
|
||||
char *bufptr, *buffer;
|
||||
int total_length = 0;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
|
||||
reply = (xListExtensionsReply) {
|
||||
xListExtensionsReply rep = {
|
||||
.type = X_Reply,
|
||||
.nExtensions = 0,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
@ -281,9 +280,9 @@ ProcListExtensions(ClientPtr client)
|
|||
continue;
|
||||
|
||||
total_length += strlen(extensions[i]->name) + 1;
|
||||
reply.nExtensions += 1;
|
||||
rep.nExtensions += 1;
|
||||
}
|
||||
reply.length = bytes_to_int32(total_length);
|
||||
rep.length = bytes_to_int32(total_length);
|
||||
buffer = bufptr = calloc(1, total_length);
|
||||
if (!buffer)
|
||||
return BadAlloc;
|
||||
|
@ -298,8 +297,12 @@ ProcListExtensions(ClientPtr client)
|
|||
bufptr += len;
|
||||
}
|
||||
}
|
||||
WriteReplyToClient(client, sizeof(xListExtensionsReply), &reply);
|
||||
if (reply.length)
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
}
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
WriteToClient(client, total_length, buffer);
|
||||
|
||||
free(buffer);
|
||||
|
|
|
@ -279,14 +279,6 @@ SwapFont(xQueryFontReply * pr, Bool hasGlyphs)
|
|||
}
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
|
||||
{
|
||||
swaps(&pRep->sequenceNumber);
|
||||
swapl(&pRep->length);
|
||||
WriteToClient(pClient, size, pRep);
|
||||
}
|
||||
|
||||
void _X_COLD
|
||||
SErrorEvent(xError * from, xError * to)
|
||||
{
|
||||
|
|
|
@ -814,7 +814,7 @@ ReplySwapPtr ReplySwapVector[256] = {
|
|||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
(ReplySwapPtr) SListExtensionsReply,
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd, /* 100 */
|
||||
ReplyNotSwappd,
|
||||
ReplyNotSwappd,
|
||||
|
|
|
@ -55,10 +55,6 @@ extern void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
|
|||
int /* size */ ,
|
||||
xTimecoord * /* pRep */ );
|
||||
|
||||
extern void SListExtensionsReply(ClientPtr /* pClient */ ,
|
||||
int /* size */ ,
|
||||
xListExtensionsReply * /* pRep */ );
|
||||
|
||||
extern void SErrorEvent(xError * /* from */ ,
|
||||
xError * /* to */ );
|
||||
|
||||
|
|
Loading…
Reference in New Issue