diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index e42ce1e54..1274849c6 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -33,6 +33,7 @@ from The Open Group. #include #include +#include "dix/request_priv.h" #include "dix/resource_priv.h" #include "misc.h" @@ -45,6 +46,11 @@ from The Open Group. static int ProcXCMiscGetVersion(ClientPtr client) { + REQUEST_HEAD_STRUCT(xXCMiscGetVersionReq); + REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); + REQUEST_FIELD_CARD16(majorVersion); + REQUEST_FIELD_CARD16(minorVersion); + xXCMiscGetVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, @@ -53,8 +59,6 @@ ProcXCMiscGetVersion(ClientPtr client) .minorVersion = XCMiscMinorVersion }; - REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); @@ -67,10 +71,10 @@ ProcXCMiscGetVersion(ClientPtr client) static int ProcXCMiscGetXIDRange(ClientPtr client) { + REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq); + xXCMiscGetXIDRangeReply rep; XID min_id, max_id; - - REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); rep = (xXCMiscGetXIDRangeReply) { .type = X_Reply, @@ -91,13 +95,14 @@ ProcXCMiscGetXIDRange(ClientPtr client) static int ProcXCMiscGetXIDList(ClientPtr client) { - REQUEST(xXCMiscGetXIDListReq); + REQUEST_HEAD_STRUCT(xXCMiscGetXIDListReq); + REQUEST_FIELD_CARD16(length); + REQUEST_FIELD_CARD32(count); + xXCMiscGetXIDListReply rep; XID *pids; unsigned int count; - REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); - if (stuff->count > UINT32_MAX / sizeof(XID)) return BadAlloc; @@ -142,46 +147,10 @@ ProcXCMiscDispatch(ClientPtr client) } } -static int _X_COLD -SProcXCMiscGetVersion(ClientPtr client) -{ - REQUEST(xXCMiscGetVersionReq); - REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - swaps(&stuff->majorVersion); - swaps(&stuff->minorVersion); - return ProcXCMiscGetVersion(client); -} - -static int _X_COLD -SProcXCMiscGetXIDList(ClientPtr client) -{ - REQUEST(xXCMiscGetXIDListReq); - REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); - - swapl(&stuff->count); - return ProcXCMiscGetXIDList(client); -} - -static int _X_COLD -SProcXCMiscDispatch(ClientPtr client) -{ - REQUEST(xReq); - switch (stuff->data) { - case X_XCMiscGetVersion: - return SProcXCMiscGetVersion(client); - case X_XCMiscGetXIDRange: - return ProcXCMiscGetXIDRange(client); - case X_XCMiscGetXIDList: - return SProcXCMiscGetXIDList(client); - default: - return BadRequest; - } -} - void XCMiscExtensionInit(void) { AddExtension(XCMiscExtensionName, 0, 0, - ProcXCMiscDispatch, SProcXCMiscDispatch, + ProcXCMiscDispatch, ProcXCMiscDispatch, NULL, StandardMinorOpcode); }