Convert callers of LookupWindow() to dixLookupWindow().

This commit is contained in:
Eamon Walsh 2006-12-15 14:11:40 -05:00 committed by Eamon Walsh
parent 670bbb8731
commit 04c721854f
16 changed files with 141 additions and 132 deletions

View File

@ -355,13 +355,15 @@ int AttrValidate(
AppGroupPtr pAppGrp)
{
WindowPtr pWin;
int idepth, ivids, found;
int idepth, ivids, found, rc;
ScreenPtr pScreen;
DepthPtr pDepth;
ColormapPtr pColormap;
pWin = LookupWindow (pAppGrp->default_root, client);
/* XXX check that pWin is not NULL */
rc = dixLookupWindow(&pWin, pAppGrp->default_root, client,
DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
if (WindowTable[pScreen->myNum]->drawable.id != pAppGrp->default_root)
return BadWindow;

View File

@ -448,16 +448,15 @@ ProcCreateImageBuffers (client)
register int n;
WindowPtr pWin;
XID *ids;
int len, nbuf;
int i;
int err;
int len, nbuf, i, err, rc;
REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
if (len == 0)
return BadLength;
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (pWin->drawable.class == InputOnly)
return BadMatch;
switch (stuff->updateAction)
@ -584,10 +583,12 @@ ProcDestroyImageBuffers (client)
{
REQUEST (xMbufDestroyImageBuffersReq);
WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
if (!(pWin = LookupWindow (stuff->window, client)))
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
DestroyImageBuffers (pWin);
return Success;
}
@ -599,16 +600,16 @@ ProcSetMBufferAttributes (client)
REQUEST (xMbufSetMBufferAttributesReq);
WindowPtr pWin;
MultibuffersPtr pMultibuffers;
int len;
int len, rc;
Mask vmask;
Mask index2;
CARD32 updateHint;
XID *vlist;
REQUEST_AT_LEAST_SIZE (xMbufSetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadMatch;
@ -655,12 +656,12 @@ ProcGetMBufferAttributes (client)
MultibuffersPtr pMultibuffers;
XID *ids;
xMbufGetMBufferAttributesReply rep;
int i, n;
int i, n, rc;
REQUEST_SIZE_MATCH (xMbufGetMBufferAttributesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType);
if (!pMultibuffers)
return BadAccess;

View File

@ -958,12 +958,13 @@ ProcPanoramiXGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -984,12 +985,13 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -1009,12 +1011,13 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;

View File

@ -316,16 +316,16 @@ ProcShapeRectangles (client)
ScreenPtr pScreen;
REQUEST(xShapeRectanglesReq);
xRectangle *prects;
int nrects, ctype;
int nrects, ctype, rc;
RegionPtr srcRgn;
RegionPtr *destRgn;
CreateDftPtr createDefault;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
UpdateCurrentTime();
pWin = LookupWindow (stuff->dest, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
case ShapeBounding:
createDefault = CreateBoundingShape;
@ -526,12 +526,13 @@ ProcShapeCombine (client)
CreateDftPtr createDefault;
CreateDftPtr createSrc;
RegionPtr tmp;
int rc;
REQUEST_SIZE_MATCH (xShapeCombineReq);
UpdateCurrentTime();
pDestWin = LookupWindow (stuff->dest, client);
if (!pDestWin)
return BadWindow;
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (!pDestWin->optional)
MakeWindowOptional (pDestWin);
switch (stuff->destKind) {
@ -550,9 +551,9 @@ ProcShapeCombine (client)
}
pScreen = pDestWin->drawable.pScreen;
pSrcWin = LookupWindow (stuff->src, client);
if (!pSrcWin)
return BadWindow;
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->srcKind) {
case ShapeBounding:
srcRgn = wBoundingShape (pSrcWin);
@ -645,12 +646,13 @@ ProcShapeOffset (client)
ScreenPtr pScreen;
REQUEST(xShapeOffsetReq);
RegionPtr srcRgn;
int rc;
REQUEST_SIZE_MATCH (xShapeOffsetReq);
UpdateCurrentTime();
pWin = LookupWindow (stuff->dest, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
case ShapeBounding:
srcRgn = wBoundingShape (pWin);
@ -709,13 +711,13 @@ ProcShapeQueryExtents (client)
WindowPtr pWin;
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
register int n;
register int n, rc;
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -990,14 +992,14 @@ ProcShapeInputSelected (client)
REQUEST(xShapeInputSelectedReq);
WindowPtr pWin;
ShapeEventPtr pShapeEvent, *pHead;
int enabled;
int enabled, rc;
xShapeInputSelectedReply rep;
register int n;
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
pWin->drawable.id, EventType, DixReadAccess);
enabled = xFalse;
@ -1032,14 +1034,14 @@ ProcShapeGetRectangles (client)
WindowPtr pWin;
xShapeGetRectanglesReply rep;
xRectangle *rects;
int nrects, i;
int nrects, i, rc;
RegionPtr region;
register int n;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
switch (stuff->kind) {
case ShapeBounding:
region = wBoundingShape(pWin);

View File

@ -139,12 +139,12 @@ ProcXTestCompareCursor(client)
xXTestCompareCursorReply rep;
WindowPtr pWin;
CursorPtr pCursor;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
pWin = (WindowPtr)LookupWindow(stuff->window, client);
if (!pWin)
return(BadWindow);
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (stuff->cursor == None)
pCursor = NullCursor;
else if (stuff->cursor == XTestCurrentCursor)
@ -173,12 +173,10 @@ ProcXTestFakeInput(client)
register ClientPtr client;
{
REQUEST(xXTestFakeInputReq);
int nev;
int n;
int nev, n, type, rc;
xEvent *ev;
DeviceIntPtr dev = NULL;
WindowPtr root;
int type;
#ifdef XINPUT
Bool extension = FALSE;
deviceValuator *dv = NULL;
@ -367,9 +365,10 @@ ProcXTestFakeInput(client)
root = GetCurrentRootWindow();
else
{
root = LookupWindow(ev->u.keyButtonPointer.root, client);
if (!root)
return BadWindow;
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root, client,
DixUnknownAccess);
if (rc != Success)
return rc;
if (root->parent)
{
client->errorValue = ev->u.keyButtonPointer.root;

View File

@ -373,10 +373,8 @@ ProcXvQueryAdaptors(ClientPtr client)
xvFormat format;
xvAdaptorInfo ainfo;
xvQueryAdaptorsReply rep;
int totalSize;
int na;
int totalSize, na, nf, rc;
XvAdaptorPtr pa;
int nf;
XvFormatPtr pf;
WindowPtr pWin;
ScreenPtr pScreen;
@ -385,11 +383,9 @@ ProcXvQueryAdaptors(ClientPtr client)
REQUEST(xvQueryAdaptorsReq);
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
if(!(pWin = (WindowPtr)LookupWindow(stuff->window, client) ))
{
client->errorValue = stuff->window;
return (BadWindow);
}
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;

View File

@ -106,7 +106,7 @@ SProcXChangeDeviceDontPropagateList(register ClientPtr client)
int
ProcXChangeDeviceDontPropagateList(register ClientPtr client)
{
int i;
int i, rc;
WindowPtr pWin;
struct tmask tmp[EMASKSIZE];
OtherInputMasks *others;
@ -121,11 +121,10 @@ ProcXChangeDeviceDontPropagateList(register ClientPtr client)
return Success;
}
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceDontPropagateList, 0,
BadWindow);
rc);
return Success;
}

View File

@ -505,6 +505,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
WindowPtr pWin, confineTo;
CursorPtr cursor;
GrabPtr grab;
int rc;
if ((this_device_mode != GrabModeSync) &&
(this_device_mode != GrabModeAsync)) {
@ -524,15 +525,15 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
client->errorValue = ownerEvents;
return BadValue;
}
pWin = LookupWindow(grabWindow, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess);
if (rc != Success)
return rc;
if (rconfineTo == None)
confineTo = NullWindow;
else {
confineTo = LookupWindow(rconfineTo, client);
if (!confineTo)
return BadWindow;
rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess);
if (rc != Success)
return rc;
}
if (rcursor == None)
cursor = NullCursor;
@ -562,6 +563,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
WindowPtr pWin;
GrabPtr grab;
KeyClassPtr k = dev->key;
int rc;
if (k == NULL)
return BadMatch;
@ -588,9 +590,9 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
client->errorValue = ownerEvents;
return BadValue;
}
pWin = LookupWindow(grabWindow, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess);
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, pWin,
mask, ownerEvents, this_device_mode, other_devices_mode,
@ -810,7 +812,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
} else
effectiveFocus = pWin = inputFocus;
} else
pWin = LookupWindow(dest, client);
dixLookupWindow(&pWin, dest, client, DixUnknownAccess);
if (!pWin)
return BadWindow;
if ((propagate != xFalse) && (propagate != xTrue)) {

View File

@ -100,7 +100,7 @@ int
ProcXGetDeviceDontPropagateList(register ClientPtr client)
{
CARD16 count = 0;
int i;
int i, rc;
XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
@ -115,11 +115,10 @@ ProcXGetDeviceDontPropagateList(register ClientPtr client)
rep.length = 0;
rep.count = 0;
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetDeviceDontPropagateList, 0,
BadWindow);
rc);
return Success;
}

View File

@ -98,8 +98,7 @@ SProcXGetSelectedExtensionEvents(register ClientPtr client)
int
ProcXGetSelectedExtensionEvents(register ClientPtr client)
{
int i;
int total_length = 0;
int i, rc, total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
XEventClass *buf = NULL;
@ -118,9 +117,10 @@ ProcXGetSelectedExtensionEvents(register ClientPtr client)
rep.this_client_count = 0;
rep.all_clients_count = 0;
if (!(pWin = LookupWindow(stuff->window, client))) {
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_GetSelectedExtensionEvents, 0,
BadWindow);
rc);
return Success;
}

View File

@ -170,11 +170,9 @@ ProcXSelectExtensionEvent(register ClientPtr client)
return Success;
}
pWin = (WindowPtr) LookupWindow(stuff->window, client);
if (!pWin) {
client->errorValue = stuff->window;
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadWindow);
ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (ret != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0, ret);
return Success;
}

View File

@ -105,6 +105,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
int rc;
REQUEST(xUngrabDeviceButtonReq);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
@ -134,9 +135,9 @@ ProcXUngrabDeviceButton(ClientPtr client)
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, BadWindow);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceButton, 0, rc);
return Success;
}

View File

@ -105,6 +105,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
DeviceIntPtr mdev;
WindowPtr pWin;
GrabRec temporaryGrab;
int rc;
REQUEST(xUngrabDeviceKeyReq);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
@ -133,9 +134,9 @@ ProcXUngrabDeviceKey(ClientPtr client)
} else
mdev = (DeviceIntPtr) LookupKeyboardDevice();
pWin = LookupWindow(stuff->grabWindow, client);
if (!pWin) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, BadWindow);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
SendErrorToClient(client, IReqCode, X_UngrabDeviceKey, 0, rc);
return Success;
}
if (((stuff->key > dev->key->curKeySyms.maxKeyCode) ||

View File

@ -93,10 +93,10 @@ typedef struct _compPixmapVisit {
static Bool
compRepaintBorder (ClientPtr pClient, pointer closure)
{
WindowPtr pWindow = LookupWindow ((XID) closure, pClient);
WindowPtr pWindow;
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient,DixUnknownAccess);
if (pWindow)
{
if (rc == Success) {
RegionRec exposed;
REGION_NULL(pScreen, &exposed);

View File

@ -170,12 +170,13 @@ static int ProcPseudoramiXGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -196,12 +197,13 @@ static int ProcPseudoramiXGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -222,12 +224,13 @@ static int ProcPseudoramiXGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
xPanoramiXGetScreenSizeReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
if (!pWin)
return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;

View File

@ -116,14 +116,15 @@ ProcRRXineramaGetState(ClientPtr client)
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int n;
register int n, rc;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
Bool active = FALSE;
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
pWin = LookupWindow(stuff->window, client);
if(!pWin) return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if(rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
@ -180,11 +181,12 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
pWin = LookupWindow(stuff->window, client);
if(!pWin) return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
rep.length = 0;
@ -206,11 +208,12 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
WindowPtr pWin, pRoot;
ScreenPtr pScreen;
xPanoramiXGetScreenSizeReply rep;
register int n;
register int n, rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
pWin = LookupWindow (stuff->window, client);
if(!pWin) return BadWindow;
rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
pRoot = WindowTable[pScreen->myNum];