ProcX{Change|Query}WindowAccess: change device list from char* to XID*.

This commit is contained in:
Paulo Ricardo Zanoni 2007-07-10 10:08:44 +09:30 committed by Peter Hutterer
parent 5ccc09b182
commit c1a6841a64
2 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,7 @@ int
ProcXChangeWindowAccess(ClientPtr client) ProcXChangeWindowAccess(ClientPtr client)
{ {
int padding, err, i; int padding, err, i;
CARD8* deviceids = NULL; XID* deviceids = NULL;
WindowPtr win; WindowPtr win;
DeviceIntPtr* perm_devices = NULL; DeviceIntPtr* perm_devices = NULL;
DeviceIntPtr* deny_devices = NULL; DeviceIntPtr* deny_devices = NULL;
@ -73,10 +73,10 @@ ProcXChangeWindowAccess(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xChangeWindowAccessReq); REQUEST_AT_LEAST_SIZE(xChangeWindowAccessReq);
padding = (4 - ((stuff->npermit + stuff->ndeny) % 4)) % 4; padding = (4 - (((stuff->npermit + stuff->ndeny) * sizeof(XID)) % 4)) % 4;
if (stuff->length != ((sizeof(xChangeWindowAccessReq) + if (stuff->length != ((sizeof(xChangeWindowAccessReq) +
(stuff->npermit + stuff->ndeny + padding)) >> 2)) (((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2))
{ {
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, SendErrorToClient(client, IReqCode, X_ChangeWindowAccess,
0, BadLength); 0, BadLength);
@ -102,7 +102,7 @@ ProcXChangeWindowAccess(ClientPtr client)
} }
if (stuff->npermit || stuff->ndeny) if (stuff->npermit || stuff->ndeny)
deviceids = (CARD8*)&stuff[1]; deviceids = (XID*)&stuff[1];
if (stuff->npermit) if (stuff->npermit)
{ {

View File

@ -69,7 +69,7 @@ ProcXQueryWindowAccess(ClientPtr client)
DeviceIntPtr *perm, *deny; DeviceIntPtr *perm, *deny;
int nperm, ndeny, i; int nperm, ndeny, i;
int defaultRule; int defaultRule;
CARD8* deviceids; XID* deviceids;
xQueryWindowAccessReply rep; xQueryWindowAccessReply rep;
REQUEST(xQueryWindowAccessReq); REQUEST(xQueryWindowAccessReq);
@ -88,7 +88,7 @@ ProcXQueryWindowAccess(ClientPtr client)
rep.repType = X_Reply; rep.repType = X_Reply;
rep.RepType = X_QueryWindowAccess; rep.RepType = X_QueryWindowAccess;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.length = (nperm + ndeny + 3) >> 2; rep.length = ((nperm + ndeny) * sizeof(XID) + 3) >> 2;
rep.defaultRule = defaultRule; rep.defaultRule = defaultRule;
rep.npermit = nperm; rep.npermit = nperm;
rep.ndeny = ndeny; rep.ndeny = ndeny;
@ -96,7 +96,7 @@ ProcXQueryWindowAccess(ClientPtr client)
if (nperm + ndeny) if (nperm + ndeny)
{ {
deviceids = (CARD8*)xalloc((nperm + ndeny) * sizeof(CARD8)); deviceids = (XID*)xalloc((nperm + ndeny) * sizeof(XID));
if (!deviceids) if (!deviceids)
{ {
ErrorF("ProcXQueryWindowAccess: xalloc failure.\n"); ErrorF("ProcXQueryWindowAccess: xalloc failure.\n");
@ -110,7 +110,7 @@ ProcXQueryWindowAccess(ClientPtr client)
for (i = 0; i < ndeny; i++) for (i = 0; i < ndeny; i++)
deviceids[i + nperm] = deny[i]->id; deviceids[i + nperm] = deny[i]->id;
WriteToClient(client, nperm + ndeny, (char*)deviceids); WriteToClient(client, (nperm + ndeny) * sizeof(XID), (char*)deviceids);
xfree(deviceids); xfree(deviceids);
} }
return Success; return Success;