Xi: switch to using "rc" (instead of "err") as returncode.

All the rest of XI uses rc and returns rc in case of error, so make
mpx-related stuff comply. This stops the rest of XI sending the error
manually.
This is just a cosmetic change to be in line with the rest.
This commit is contained in:
Peter Hutterer 2008-01-03 18:36:33 +10:30
parent c7e9b67c54
commit 37194b1355
8 changed files with 69 additions and 96 deletions

View File

@ -63,7 +63,7 @@ SProcXChangeWindowAccess(ClientPtr client)
int int
ProcXChangeWindowAccess(ClientPtr client) ProcXChangeWindowAccess(ClientPtr client)
{ {
int padding, err, i; int padding, rc, i;
XID* deviceids = NULL; XID* deviceids = NULL;
WindowPtr win; WindowPtr win;
DeviceIntPtr* perm_devices = NULL; DeviceIntPtr* perm_devices = NULL;
@ -77,27 +77,21 @@ ProcXChangeWindowAccess(ClientPtr client)
if (stuff->length != ((sizeof(xChangeWindowAccessReq) + if (stuff->length != ((sizeof(xChangeWindowAccessReq) +
(((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2)) (((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2))
{ {
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, return BadLength;
0, BadLength);
return Success;
} }
err = dixLookupWindow(&win, stuff->win, client, DixWriteAccess); rc = dixLookupWindow(&win, stuff->win, client, DixWriteAccess);
if (err != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, return rc;
stuff->win, err);
return Success;
} }
/* Are we clearing? if so, ignore the rest */ /* Are we clearing? if so, ignore the rest */
if (stuff->clear) if (stuff->clear)
{ {
err = ACClearWindowAccess(client, win, stuff->clear); rc = ACClearWindowAccess(client, win, stuff->clear);
if (err != Success) return rc;
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0, err);
return Success;
} }
if (stuff->npermit || stuff->ndeny) if (stuff->npermit || stuff->ndeny)
@ -110,20 +104,18 @@ ProcXChangeWindowAccess(ClientPtr client)
if (!perm_devices) if (!perm_devices)
{ {
ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n"); ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n");
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0, return BadImplementation;
BadImplementation);
return Success;
} }
/* if one of the devices cannot be accessed, we don't do anything.*/ /* if one of the devices cannot be accessed, we don't do anything.*/
for (i = 0; i < stuff->npermit; i++) for (i = 0; i < stuff->npermit; i++)
{ {
err = dixLookupDevice(&perm_devices[i], deviceids[i], client, rc = dixLookupDevice(&perm_devices[i], deviceids[i], client,
DixWriteAccess); DixWriteAccess);
if (err != Success) if (rc != Success)
{ {
xfree(perm_devices); xfree(perm_devices);
return err; return rc;
} }
} }
} }
@ -135,36 +127,31 @@ ProcXChangeWindowAccess(ClientPtr client)
if (!deny_devices) if (!deny_devices)
{ {
ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n"); ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n");
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, 0,
BadImplementation);
xfree(perm_devices); xfree(perm_devices);
return Success; return BadImplementation;
} }
for (i = 0; i < stuff->ndeny; i++) for (i = 0; i < stuff->ndeny; i++)
{ {
err = dixLookupDevice(&deny_devices[i], rc = dixLookupDevice(&deny_devices[i],
deviceids[i+stuff->npermit], deviceids[i+stuff->npermit],
client, client,
DixWriteAccess); DixWriteAccess);
if (err != Success) if (rc != Success)
{ {
xfree(perm_devices); xfree(perm_devices);
xfree(deny_devices); xfree(deny_devices);
return err; return rc;
} }
} }
} }
err = ACChangeWindowAccess(client, win, stuff->defaultRule, rc = ACChangeWindowAccess(client, win, stuff->defaultRule,
perm_devices, stuff->npermit, perm_devices, stuff->npermit,
deny_devices, stuff->ndeny); deny_devices, stuff->ndeny);
if (err != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_ChangeWindowAccess, return rc;
stuff->win, err);
return Success;
} }
xfree(perm_devices); xfree(perm_devices);

View File

@ -71,7 +71,7 @@ SProcXChangeDeviceCursor(ClientPtr client)
int ProcXChangeDeviceCursor(ClientPtr client) int ProcXChangeDeviceCursor(ClientPtr client)
{ {
int err; int rc;
WindowPtr pWin = NULL; WindowPtr pWin = NULL;
DeviceIntPtr pDev = NULL; DeviceIntPtr pDev = NULL;
CursorPtr pCursor = NULL; CursorPtr pCursor = NULL;
@ -79,15 +79,15 @@ int ProcXChangeDeviceCursor(ClientPtr client)
REQUEST(xChangeDeviceCursorReq); REQUEST(xChangeDeviceCursorReq);
REQUEST_SIZE_MATCH(xChangeDeviceCursorReq); REQUEST_SIZE_MATCH(xChangeDeviceCursorReq);
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess); rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess);
if (err != Success) if (rc != Success)
return err; return rc;
if (stuff->win != None) if (stuff->win != None)
{ {
err = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess); rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
if (err != Success) if (rc != Success)
return err; return rc;
} }
if (stuff->cursor == None) if (stuff->cursor == None)
@ -103,9 +103,7 @@ int ProcXChangeDeviceCursor(ClientPtr client)
RT_CURSOR, DixReadAccess); RT_CURSOR, DixReadAccess);
if (!pCursor) if (!pCursor)
{ {
SendErrorToClient(client, IReqCode, X_ChangeDeviceCursor, return BadCursor;
stuff->cursor, BadCursor);
return Success;
} }
} }

View File

@ -93,7 +93,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
{ {
xExtendedGrabDeviceReply rep; xExtendedGrabDeviceReply rep;
DeviceIntPtr dev; DeviceIntPtr dev;
int err = Success, int rc = Success,
errval = 0, errval = 0,
i; i;
WindowPtr grab_window, WindowPtr grab_window,
@ -122,12 +122,12 @@ ProcXExtendedGrabDevice(ClientPtr client)
stuff->event_count + 2 * stuff->generic_event_count)) stuff->event_count + 2 * stuff->generic_event_count))
{ {
errval = 0; errval = 0;
err = BadLength; rc = BadLength;
goto cleanup; goto cleanup;
} }
err = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
if (err != Success) { if (rc != Success) {
goto cleanup; goto cleanup;
} }
@ -138,11 +138,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
goto cleanup; goto cleanup;
} }
err = dixLookupWindow(&grab_window, rc = dixLookupWindow(&grab_window,
stuff->grab_window, stuff->grab_window,
client, client,
DixReadAccess); DixReadAccess);
if (err != Success) if (rc != Success)
{ {
errval = stuff->grab_window; errval = stuff->grab_window;
goto cleanup; goto cleanup;
@ -150,11 +150,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
if (stuff->confine_to) if (stuff->confine_to)
{ {
err = dixLookupWindow(&confineTo, rc = dixLookupWindow(&confineTo,
stuff->confine_to, stuff->confine_to,
client, client,
DixReadAccess); DixReadAccess);
if (err != Success) if (rc != Success)
{ {
errval = stuff->confine_to; errval = stuff->confine_to;
goto cleanup; goto cleanup;
@ -170,7 +170,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
if (!cursor) if (!cursor)
{ {
errval = stuff->cursor; errval = stuff->cursor;
err = BadCursor; rc = BadCursor;
goto cleanup; goto cleanup;
} }
} }
@ -205,7 +205,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
cursor, tmp[stuff->deviceid].mask, cursor, tmp[stuff->deviceid].mask,
gemasks); gemasks);
if (err != Success) { if (rc != Success) {
errval = 0; errval = 0;
goto cleanup; goto cleanup;
} }
@ -215,13 +215,13 @@ cleanup:
if (gemasks) if (gemasks)
xfree(gemasks); xfree(gemasks);
if (err == Success) if (rc == Success)
{ {
WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep); WriteReplyToClient(client, sizeof(xGrabDeviceReply), &rep);
} }
else else
{ {
return err; return rc;
} }
return Success; return Success;
} }

View File

@ -86,8 +86,7 @@ ProcXFakeDeviceData(ClientPtr client)
if (stuff->length != (sizeof(xFakeDeviceDataReq) >> 2) + stuff->num_valuators) if (stuff->length != (sizeof(xFakeDeviceDataReq) >> 2) + stuff->num_valuators)
{ {
SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadLength); return BadLength;
return Success;
} }
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess); rc = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
@ -96,8 +95,7 @@ ProcXFakeDeviceData(ClientPtr client)
if (!fake_events && !(fake_events = InitEventList(GetMaximumEventsNum()))) if (!fake_events && !(fake_events = InitEventList(GetMaximumEventsNum())))
{ {
SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadAlloc); return BadAlloc;
return Success;
} }
if (stuff->num_valuators) if (stuff->num_valuators)
{ {
@ -106,8 +104,7 @@ ProcXFakeDeviceData(ClientPtr client)
valuators = xcalloc(stuff->num_valuators, sizeof(int)); valuators = xcalloc(stuff->num_valuators, sizeof(int));
if (!valuators) if (!valuators)
{ {
SendErrorToClient(client, IReqCode, X_FakeDeviceData, 0, BadAlloc); return BadAlloc;
return Success;
} }
for (i = 0; i < stuff->num_valuators; i++, valptr++) for (i = 0; i < stuff->num_valuators; i++, valptr++)
valuators[i] = (int)(*valptr); valuators[i] = (int)(*valptr);

View File

@ -64,7 +64,7 @@ SProcXQueryWindowAccess(ClientPtr client)
int int
ProcXQueryWindowAccess(ClientPtr client) ProcXQueryWindowAccess(ClientPtr client)
{ {
int err; int rc;
WindowPtr win; WindowPtr win;
DeviceIntPtr *perm, *deny; DeviceIntPtr *perm, *deny;
int nperm, ndeny, i; int nperm, ndeny, i;
@ -75,12 +75,10 @@ ProcXQueryWindowAccess(ClientPtr client)
REQUEST(xQueryWindowAccessReq); REQUEST(xQueryWindowAccessReq);
REQUEST_SIZE_MATCH(xQueryWindowAccessReq); REQUEST_SIZE_MATCH(xQueryWindowAccessReq);
err = dixLookupWindow(&win, stuff->win, client, DixReadAccess); rc = dixLookupWindow(&win, stuff->win, client, DixReadAccess);
if (err != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_QueryWindowAccess, return rc;
stuff->win, err);
return Success;
} }
ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny); ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny);
@ -100,9 +98,7 @@ ProcXQueryWindowAccess(ClientPtr client)
if (!deviceids) if (!deviceids)
{ {
ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n"); ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n");
SendErrorToClient(client, IReqCode, X_QueryWindowAccess, return BadImplementation;
0, BadImplementation);
return Success;
} }
for (i = 0; i < nperm; i++) for (i = 0; i < nperm; i++)

View File

@ -70,15 +70,15 @@ ProcXSetClientPointer(ClientPtr client)
DeviceIntPtr pDev; DeviceIntPtr pDev;
WindowPtr pWin; WindowPtr pWin;
ClientPtr targetClient; ClientPtr targetClient;
int err; int rc;
REQUEST(xSetClientPointerReq); REQUEST(xSetClientPointerReq);
REQUEST_SIZE_MATCH(xSetClientPointerReq); REQUEST_SIZE_MATCH(xSetClientPointerReq);
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess); rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
if (err != Success) if (rc != Success)
return err; return rc;
if (!IsPointerDevice(pDev) || !pDev->isMaster) if (!IsPointerDevice(pDev) || !pDev->isMaster)
{ {
@ -88,18 +88,18 @@ ProcXSetClientPointer(ClientPtr client)
if (stuff->win != None) if (stuff->win != None)
{ {
err = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess); rc = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess);
if (err != Success) if (rc != Success)
{ {
/* window could not be found. maybe the window ID given was a pure /* window could not be found. maybe the window ID given was a pure
client id? */ client id? */
/* XXX: Needs to be fixed for XACE */ /* XXX: Needs to be fixed for XACE */
err = dixLookupClient(&targetClient, stuff->win, rc = dixLookupClient(&targetClient, stuff->win,
client, DixWriteAccess); client, DixWriteAccess);
if (err != Success) if (rc != Success)
{ {
client->errorValue = stuff->win; client->errorValue = stuff->win;
return err; return rc;
} }
} else } else
targetClient= wClient(pWin); targetClient= wClient(pWin);

View File

@ -70,7 +70,7 @@ SProcXWarpDevicePointer(ClientPtr client)
int int
ProcXWarpDevicePointer(ClientPtr client) ProcXWarpDevicePointer(ClientPtr client)
{ {
int err; int rc;
int x, y; int x, y;
WindowPtr dest = NULL; WindowPtr dest = NULL;
DeviceIntPtr pDev; DeviceIntPtr pDev;
@ -82,19 +82,17 @@ ProcXWarpDevicePointer(ClientPtr client)
/* FIXME: panoramix stuff is missing, look at ProcWarpPointer */ /* FIXME: panoramix stuff is missing, look at ProcWarpPointer */
err = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess); rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
if (err != Success) if (rc != Success)
return err; return rc;
if (stuff->dst_win != None) if (stuff->dst_win != None)
{ {
err = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess); rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
if (err != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_WarpDevicePointer, return rc;
stuff->dst_win, err);
return Success;
} }
} }
@ -107,12 +105,10 @@ ProcXWarpDevicePointer(ClientPtr client)
int winX, winY; int winX, winY;
WindowPtr src; WindowPtr src;
err = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess); rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
if (err != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_WarpDevicePointer, return rc;
stuff->src_win, err);
return Success;
} }
winX = src->drawable.x; winX = src->drawable.x;

View File

@ -59,16 +59,15 @@ SProcXiSelectEvent(ClientPtr client)
int int
ProcXiSelectEvent(ClientPtr client) ProcXiSelectEvent(ClientPtr client)
{ {
int ret; int rc;
WindowPtr pWin; WindowPtr pWin;
REQUEST(xXiSelectEventReq); REQUEST(xXiSelectEventReq);
REQUEST_SIZE_MATCH(xXiSelectEventReq); REQUEST_SIZE_MATCH(xXiSelectEventReq);
ret = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (ret != Success) if (rc != Success)
{ {
SendErrorToClient(client, IReqCode, X_XiSelectEvent, 0, ret); return rc;
return Success;
} }
GEWindowSetMask(client, pWin, IReqCode, stuff->mask); GEWindowSetMask(client, pWin, IReqCode, stuff->mask);