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