Xext: xcmisc: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
6f360d77bb
commit
c133b094ef
|
@ -52,20 +52,13 @@ ProcXCMiscGetVersion(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD16(minorVersion);
|
REQUEST_FIELD_CARD16(minorVersion);
|
||||||
|
|
||||||
xXCMiscGetVersionReply rep = {
|
xXCMiscGetVersionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.majorVersion = XCMiscMajorVersion,
|
.majorVersion = XCMiscMajorVersion,
|
||||||
.minorVersion = XCMiscMinorVersion
|
.minorVersion = XCMiscMinorVersion
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(majorVersion);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(minorVersion);
|
||||||
swaps(&rep.majorVersion);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.minorVersion);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -73,23 +66,17 @@ ProcXCMiscGetXIDRange(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq);
|
REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq);
|
||||||
|
|
||||||
xXCMiscGetXIDRangeReply rep;
|
|
||||||
XID min_id, max_id;
|
XID min_id, max_id;
|
||||||
GetXIDRange(client->index, FALSE, &min_id, &max_id);
|
GetXIDRange(client->index, FALSE, &min_id, &max_id);
|
||||||
rep = (xXCMiscGetXIDRangeReply) {
|
|
||||||
.type = X_Reply,
|
xXCMiscGetXIDRangeReply rep = {
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.start_id = min_id,
|
.start_id = min_id,
|
||||||
.count = max_id - min_id + 1
|
.count = max_id - min_id + 1
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(start_id);
|
||||||
swapl(&rep.start_id);
|
REPLY_FIELD_CARD32(count);
|
||||||
swapl(&rep.count);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -99,7 +86,6 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD16(length);
|
REQUEST_FIELD_CARD16(length);
|
||||||
REQUEST_FIELD_CARD32(count);
|
REQUEST_FIELD_CARD32(count);
|
||||||
|
|
||||||
xXCMiscGetXIDListReply rep;
|
|
||||||
XID *pids;
|
XID *pids;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
|
@ -111,18 +97,15 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
count = GetXIDList(client, stuff->count, pids);
|
count = GetXIDList(client, stuff->count, pids);
|
||||||
rep = (xXCMiscGetXIDListReply) {
|
|
||||||
.type = X_Reply,
|
xXCMiscGetXIDListReply rep = {
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = count,
|
.length = count,
|
||||||
.count = count
|
.count = count
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(length);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(count);
|
||||||
swapl(&rep.length);
|
REPLY_SEND();
|
||||||
swapl(&rep.count);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
|
|
||||||
if (count) {
|
if (count) {
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||||
|
|
Loading…
Reference in New Issue