diff options
Diffstat (limited to 'xorg-server/Xext/xcmisc.c')
-rw-r--r-- | xorg-server/Xext/xcmisc.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/xorg-server/Xext/xcmisc.c b/xorg-server/Xext/xcmisc.c index 99a6ece43..034bfb63b 100644 --- a/xorg-server/Xext/xcmisc.c +++ b/xorg-server/Xext/xcmisc.c @@ -38,27 +38,29 @@ from The Open Group. #include "extnsionst.h" #include "swaprep.h" #include <X11/extensions/xcmiscproto.h> -#include "modinit.h" +#include "extinit.h" #include <stdint.h> static int ProcXCMiscGetVersion(ClientPtr client) { - xXCMiscGetVersionReply rep; + xXCMiscGetVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = XCMiscMajorVersion, + .minorVersion = XCMiscMinorVersion + }; REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.majorVersion = XCMiscMajorVersion; - rep.minorVersion = XCMiscMinorVersion; + if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep); return Success; } @@ -70,17 +72,19 @@ ProcXCMiscGetXIDRange(ClientPtr client) REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.start_id = min_id; - rep.count = max_id - min_id + 1; + rep = (xXCMiscGetXIDRangeReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .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), (char *) &rep); + WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep); return Success; } @@ -102,16 +106,18 @@ ProcXCMiscGetXIDList(ClientPtr client) return BadAlloc; } count = GetXIDList(client, stuff->count, pids); - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = count; - rep.count = count; + rep = (xXCMiscGetXIDListReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = count, + .count = count + }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); swapl(&rep.count); } - WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep); + WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep); if (count) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, count * sizeof(XID), pids); @@ -184,7 +190,7 @@ SProcXCMiscDispatch(ClientPtr client) } void -XCMiscExtensionInit(INITARGS) +XCMiscExtensionInit(void) { AddExtension(XCMiscExtensionName, 0, 0, ProcXCMiscDispatch, SProcXCMiscDispatch, |