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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,7 +70,7 @@ SProcXWarpDevicePointer(ClientPtr client)
int
ProcXWarpDevicePointer(ClientPtr client)
{
int err;
int rc;
int x, y;
WindowPtr dest = NULL;
DeviceIntPtr pDev;
@ -82,19 +82,17 @@ ProcXWarpDevicePointer(ClientPtr client)
/* 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)
return err;
if (rc != Success)
return rc;
if (stuff->dst_win != None)
{
err = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
if (err != Success)
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
if (rc != Success)
{
SendErrorToClient(client, IReqCode, X_WarpDevicePointer,
stuff->dst_win, err);
return Success;
return rc;
}
}
@ -107,12 +105,10 @@ ProcXWarpDevicePointer(ClientPtr client)
int winX, winY;
WindowPtr src;
err = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
if (err != Success)
rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
if (rc != Success)
{
SendErrorToClient(client, IReqCode, X_WarpDevicePointer,
stuff->src_win, err);
return Success;
return rc;
}
winX = src->drawable.x;

View File

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