mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
Xi: ProcXISelectEvents() declare variables where needed
For better readability, declare the variables only where they're used, and try to scope them, instead of declaring them all on the very top. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
37ebc7d74b
commit
e223abb80e
@@ -146,20 +146,14 @@ SProcXISelectEvents(ClientPtr client)
|
||||
int
|
||||
ProcXISelectEvents(ClientPtr client)
|
||||
{
|
||||
int rc, num_masks;
|
||||
WindowPtr win;
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntRec dummy;
|
||||
xXIEventMask *evmask;
|
||||
int len;
|
||||
|
||||
REQUEST(xXISelectEventsReq);
|
||||
REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
|
||||
|
||||
if (stuff->num_masks == 0)
|
||||
return BadValue;
|
||||
|
||||
rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
||||
WindowPtr win;
|
||||
int rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
||||
|
||||
// when access to the window is denied, just pretend everything's okay
|
||||
if (rc == BadAccess)
|
||||
@@ -168,17 +162,19 @@ ProcXISelectEvents(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
len = sz_xXISelectEventsReq;
|
||||
int len = sz_xXISelectEventsReq;
|
||||
|
||||
/* check request validity */
|
||||
evmask = (xXIEventMask *) &stuff[1];
|
||||
num_masks = stuff->num_masks;
|
||||
xXIEventMask *evmask = (xXIEventMask *) &stuff[1];
|
||||
int num_masks = stuff->num_masks;
|
||||
while (num_masks--) {
|
||||
len += sizeof(xXIEventMask) + evmask->mask_len * 4;
|
||||
|
||||
if (bytes_to_int32(len) > client->req_len)
|
||||
return BadLength;
|
||||
|
||||
DeviceIntPtr dev;
|
||||
|
||||
if (evmask->deviceid != XIAllDevices &&
|
||||
evmask->deviceid != XIAllMasterDevices)
|
||||
rc = dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||
@@ -309,6 +305,8 @@ ProcXISelectEvents(ClientPtr client)
|
||||
evmask = (xXIEventMask *) &stuff[1];
|
||||
num_masks = stuff->num_masks;
|
||||
while (num_masks--) {
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntRec dummy = { 0 };
|
||||
if (evmask->deviceid == XIAllDevices ||
|
||||
evmask->deviceid == XIAllMasterDevices) {
|
||||
dummy.id = evmask->deviceid;
|
||||
|
||||
Reference in New Issue
Block a user