mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-28 05:39:35 +00:00
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:
@@ -55,20 +55,13 @@ ProcXCMiscGetVersion(ClientPtr client)
|
||||
REQUEST_FIELD_CARD16(minorVersion);
|
||||
|
||||
xXCMiscGetVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.majorVersion = XCMiscMajorVersion,
|
||||
.minorVersion = XCMiscMinorVersion
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swaps(&rep.majorVersion);
|
||||
swaps(&rep.minorVersion);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
|
||||
return Success;
|
||||
REPLY_FIELD_CARD16(majorVersion);
|
||||
REPLY_FIELD_CARD16(minorVersion);
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -76,23 +69,17 @@ ProcXCMiscGetXIDRange(ClientPtr client)
|
||||
{
|
||||
REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq);
|
||||
|
||||
xXCMiscGetXIDRangeReply rep;
|
||||
XID min_id, max_id;
|
||||
GetXIDRange(client->index, FALSE, &min_id, &max_id);
|
||||
rep = (xXCMiscGetXIDRangeReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
|
||||
xXCMiscGetXIDRangeReply rep = {
|
||||
.start_id = min_id,
|
||||
.count = max_id - min_id + 1
|
||||
};
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.start_id);
|
||||
swapl(&rep.count);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
|
||||
return Success;
|
||||
|
||||
REPLY_FIELD_CARD32(start_id);
|
||||
REPLY_FIELD_CARD32(count);
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -102,7 +89,6 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||
REQUEST_FIELD_CARD16(length);
|
||||
REQUEST_FIELD_CARD32(count);
|
||||
|
||||
xXCMiscGetXIDListReply rep;
|
||||
XID *pids;
|
||||
unsigned int count;
|
||||
|
||||
@@ -114,18 +100,15 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||
return BadAlloc;
|
||||
}
|
||||
count = GetXIDList(client, stuff->count, pids);
|
||||
rep = (xXCMiscGetXIDListReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
xXCMiscGetXIDListReply rep = {
|
||||
.length = count,
|
||||
.count = count
|
||||
};
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.count);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
|
||||
REPLY_FIELD_CARD32(length);
|
||||
REPLY_FIELD_CARD32(count);
|
||||
REPLY_SEND();
|
||||
|
||||
if (count) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||
|
||||
Reference in New Issue
Block a user