Convert callers of LookupDrawable() to dixLookupDrawable().

This commit is contained in:
Eamon Walsh 2006-12-15 16:36:29 -05:00 committed by Eamon Walsh
parent 25d5e0a629
commit 10aabb729d
6 changed files with 80 additions and 70 deletions

View File

@ -441,6 +441,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
__GLcontextModes *modes; __GLcontextModes *modes;
__GLXdrawable *pGlxDraw; __GLXdrawable *pGlxDraw;
__GLXpixmap *drawPixmap = NULL; __GLXpixmap *drawPixmap = NULL;
int rc;
/* This is the GLX 1.3 case - the client passes in a GLXWindow and /* This is the GLX 1.3 case - the client passes in a GLXWindow and
* we just return the __GLXdrawable. The first time a GLXPixmap * we just return the __GLXdrawable. The first time a GLXPixmap
@ -466,8 +467,8 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId,
* GLXWindow with the same XID as an X Window, so we wont get any * GLXWindow with the same XID as an X Window, so we wont get any
* resource ID clashes. Effectively, the X Window is now also a * resource ID clashes. Effectively, the X Window is now also a
* GLXWindow. */ * GLXWindow. */
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
VisualID vid = wVisual((WindowPtr)pDraw); VisualID vid = wVisual((WindowPtr)pDraw);
@ -1199,12 +1200,12 @@ static int ValidateCreateDrawable(ClientPtr client,
ScreenPtr pScreen; ScreenPtr pScreen;
VisualPtr pVisual; VisualPtr pVisual;
__GLXscreen *pGlxScreen; __GLXscreen *pGlxScreen;
int i; int i, rc;
LEGAL_NEW_RESOURCE(glxDrawableId, client); LEGAL_NEW_RESOURCE(glxDrawableId, client);
pDraw = (DrawablePtr) LookupDrawable(drawablId, client); rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess);
if (!pDraw || pDraw->type != type) { if (rc != Success || pDraw->type != type) {
client->errorValue = drawablId; client->errorValue = drawablId;
return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap; return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap;
} }
@ -2034,10 +2035,11 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
XID drawable = req->drawable; XID drawable = req->drawable;
int barrier = req->barrier; int barrier = req->barrier;
DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client); DrawablePtr pDraw;
int screen; int screen, rc;
if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) { rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess);
if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) {
screen = pDraw->pScreen->myNum; screen = pDraw->pScreen->myNum;
if (__glXSwapBarrierFuncs && if (__glXSwapBarrierFuncs &&
__glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) { __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) {

View File

@ -1092,8 +1092,8 @@ int XETrapRequestVector(ClientPtr client)
pdata->hdr.client = client->index; /* stuff client index in hdr */ pdata->hdr.client = client->index; /* stuff client index in hdr */
if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY)) if (BitIsTrue(penv->cur.data_config_flags_data,XETrapWinXY))
{ {
window_ptr = (WindowPtr) LookupDrawable(stuff->id, client); if (Success != dixLookupDrawable(&window_ptr, stuff->id,
if (window_ptr == 0L) client, 0, DixUnknownAccess))
{ /* Failed...invalidate the X and Y coordinate data. */ { /* Failed...invalidate the X and Y coordinate data. */
pdata->hdr.win_x = -1L; pdata->hdr.win_x = -1L;
pdata->hdr.win_y = -1L; pdata->hdr.win_y = -1L;

View File

@ -786,15 +786,15 @@ ProcGetBufferInfo (client)
DrawablePtr pDrawable; DrawablePtr pDrawable;
xMbufGetBufferInfoReply rep; xMbufGetBufferInfoReply rep;
ScreenPtr pScreen; ScreenPtr pScreen;
int i, j, k; int i, j, k, n, rc;
int n;
xMbufBufferInfo *pInfo; xMbufBufferInfo *pInfo;
int nInfo; int nInfo;
DepthPtr pDepth; DepthPtr pDepth;
pDrawable = (DrawablePtr) LookupDrawable (stuff->drawable, client); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
if (!pDrawable) DixUnknownAccess);
return BadDrawable; if (rc != Success)
return rc;
pScreen = pDrawable->pScreen; pScreen = pDrawable->pScreen;
nInfo = 0; nInfo = 0;
for (i = 0; i < pScreen->numDepths; i++) for (i = 0; i < pScreen->numDepths; i++)

View File

@ -780,16 +780,17 @@ ProcScreenSaverQueryInfo (client)
{ {
REQUEST(xScreenSaverQueryInfoReq); REQUEST(xScreenSaverQueryInfoReq);
xScreenSaverQueryInfoReply rep; xScreenSaverQueryInfoReply rep;
register int n; register int n, rc;
ScreenSaverStuffPtr pSaver; ScreenSaverStuffPtr pSaver;
DrawablePtr pDraw; DrawablePtr pDraw;
CARD32 lastInput; CARD32 lastInput;
ScreenSaverScreenPrivatePtr pPriv; ScreenSaverScreenPrivatePtr pPriv;
REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
if (!pDraw) DixUnknownAccess);
return BadDrawable; if (rc != Success)
return rc;
pSaver = &savedScreenInfo[pDraw->pScreen->myNum]; pSaver = &savedScreenInfo[pDraw->pScreen->myNum];
pPriv = GetScreenPrivate (pDraw->pScreen); pPriv = GetScreenPrivate (pDraw->pScreen);
@ -852,11 +853,13 @@ ProcScreenSaverSelectInput (client)
{ {
REQUEST(xScreenSaverSelectInputReq); REQUEST(xScreenSaverSelectInputReq);
DrawablePtr pDraw; DrawablePtr pDraw;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
if (!pDraw) DixUnknownAccess);
return BadDrawable; if (rc != Success)
return rc;
if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
return BadAlloc; return BadAlloc;
return Success; return Success;
@ -871,9 +874,7 @@ ScreenSaverSetAttributes (ClientPtr client)
ScreenPtr pScreen; ScreenPtr pScreen;
ScreenSaverScreenPrivatePtr pPriv = 0; ScreenSaverScreenPrivatePtr pPriv = 0;
ScreenSaverAttrPtr pAttr = 0; ScreenSaverAttrPtr pAttr = 0;
int ret; int ret, len, class, bw, depth;
int len;
int class, bw, depth;
unsigned long visual; unsigned long visual;
int idepth, ivisual; int idepth, ivisual;
Bool fOK; Bool fOK;
@ -891,9 +892,10 @@ ScreenSaverSetAttributes (ClientPtr client)
ColormapPtr pCmap; ColormapPtr pCmap;
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
if (!pDraw) DixUnknownAccess);
return BadDrawable; if (ret != Success)
return ret;
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
pParent = WindowTable[pScreen->myNum]; pParent = WindowTable[pScreen->myNum];
@ -1246,11 +1248,13 @@ ScreenSaverUnsetAttributes (ClientPtr client)
REQUEST(xScreenSaverSetAttributesReq); REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw; DrawablePtr pDraw;
ScreenSaverScreenPrivatePtr pPriv; ScreenSaverScreenPrivatePtr pPriv;
int rc;
REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
pDraw = (DrawablePtr) LookupDrawable (stuff->drawable, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
if (!pDraw) DixUnknownAccess);
return BadDrawable; if (rc != Success)
return rc;
pPriv = GetScreenPrivate (pDraw->pScreen); pPriv = GetScreenPrivate (pDraw->pScreen);
if (pPriv && pPriv->attr && pPriv->attr->client == client) if (pPriv && pPriv->attr && pPriv->attr->client == client)
{ {

View File

@ -1944,8 +1944,11 @@ ProcXpPutDocumentData(ClientPtr client)
if (stuff->drawable) { if (stuff->drawable) {
if (pContext->state & DOC_RAW_STARTED) if (pContext->state & DOC_RAW_STARTED)
return BadDrawable; return BadDrawable;
pDraw = (DrawablePtr)LookupDrawable(stuff->drawable, client); result = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
if (!pDraw || pDraw->pScreen->myNum != pContext->screenNum) DixUnknownAccess);
if (result != Success)
return result;
if (pDraw->pScreen->myNum != pContext->screenNum)
return BadDrawable; return BadDrawable;
} else { } else {
if (pContext->state & DOC_COOKED_STARTED) if (pContext->state & DOC_COOKED_STARTED)

View File

@ -430,9 +430,10 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw; DrawablePtr pDraw;
__GLXpixmap *pGlxPixmap = NULL; __GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL; __glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client); rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (!pDraw) { if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes); __glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -459,9 +460,10 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
DrawablePtr pDraw, pMember = NULL; DrawablePtr pDraw, pMember = NULL;
__GLXpixmap *pGlxPixmap = NULL; __GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL; __glXWindow *pGlxWindow = NULL;
int rc;
pDraw = (DrawablePtr) LookupDrawable(req->drawable, client); rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixUnknownAccess);
if (!pDraw) { if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
__glXPixmapRes); __glXPixmapRes);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
@ -479,8 +481,9 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
} }
if (req->member != None) { if (req->member != None) {
pMember = (DrawablePtr) LookupDrawable(req->member, client); rc = dixLookupDrawable(&pMember, req->member, client, 0,
if (!pMember) { DixUnknownAccess);
if (rc != Success) {
pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member, pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
__glXPixmapRes); __glXPixmapRes);
if (pGlxPixmap) pMember = pGlxPixmap->pDraw; if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
@ -734,7 +737,7 @@ static int MakeCurrent(__GLXclientState *cl,
#endif #endif
int from_screen = 0; int from_screen = 0;
int to_screen = 0; int to_screen = 0;
int s; int s, rc;
/* /*
** If one is None and the other isn't, it's a bad match. ** If one is None and the other isn't, it's a bad match.
@ -778,8 +781,8 @@ static int MakeCurrent(__GLXclientState *cl,
} }
if (drawId != None) { if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
/* /*
** Drawable is an X Window. ** Drawable is an X Window.
@ -885,8 +888,8 @@ static int MakeCurrent(__GLXclientState *cl,
} }
if (readId != None && readId != drawId ) { if (readId != None && readId != drawId ) {
pReadDraw = (DrawablePtr) LookupDrawable(readId, client); rc = dixLookupDrawable(&pReadDraw, readId, client, 0,DixUnknownAccess);
if (pReadDraw) { if (rc == Success) {
if (pReadDraw->type == DRAWABLE_WINDOW) { if (pReadDraw->type == DRAWABLE_WINDOW) {
/* /*
** Drawable is an X Window. ** Drawable is an X Window.
@ -1636,18 +1639,16 @@ static int CreateGLXPixmap(__GLXclientState *cl,
__GLXscreenInfo *pGlxScreen; __GLXscreenInfo *pGlxScreen;
__GLXvisualConfig *pGlxVisual; __GLXvisualConfig *pGlxVisual;
__GLXFBConfig *pFBConfig; __GLXFBConfig *pFBConfig;
int i; int i, s, rc;
int s;
int from_screen, to_screen; int from_screen, to_screen;
#ifdef PANORAMIX #ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL; PanoramiXRes *pXinDraw = NULL;
#endif #endif
pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
if (!pDraw || pDraw->type != DRAWABLE_PIXMAP) { DixUnknownAccess);
client->errorValue = pixmapId; if (rc != Success)
return BadPixmap; return rc;
}
/* /*
** Check if screen of visual matches screen of pixmap. ** Check if screen of visual matches screen of pixmap.
@ -1778,7 +1779,8 @@ static int CreateGLXPixmap(__GLXclientState *cl,
#ifdef PANORAMIX #ifdef PANORAMIX
if (pXinDraw) { if (pXinDraw) {
pRealDraw = (DrawablePtr) LookupDrawable(pXinDraw->info[s].id,client); dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
DixUnknownAccess);
} }
#endif #endif
@ -1944,14 +1946,13 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
__glXWindow *pGlxWindow = NULL; __glXWindow *pGlxWindow = NULL;
int from_screen = 0; int from_screen = 0;
int to_screen = 0; int to_screen = 0;
int s; int s, rc;
/* /*
** Check that the GLX drawable is valid. ** Check that the GLX drawable is valid.
*/ */
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum; from_screen = to_screen = pDraw->pScreen->myNum;
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
@ -2099,12 +2100,13 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
__GLXpixmap *pGlxPixmap = NULL; __GLXpixmap *pGlxPixmap = NULL;
__GLXcontext *glxc = NULL; __GLXcontext *glxc = NULL;
__glXWindow *pGlxWindow = NULL; __glXWindow *pGlxWindow = NULL;
int rc;
/* /*
** Check that the GLX drawable is valid. ** Check that the GLX drawable is valid.
*/ */
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
if (pDraw->type != DRAWABLE_WINDOW) { if (pDraw->type != DRAWABLE_WINDOW) {
/* /*
** Drawable is an X pixmap, which is not allowed. ** Drawable is an X pixmap, which is not allowed.
@ -2892,16 +2894,15 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
__GLXFBConfig *pGlxFBConfig = NULL; __GLXFBConfig *pGlxFBConfig = NULL;
VisualPtr pVisual; VisualPtr pVisual;
VisualID visId; VisualID visId;
int i; int i, rc;
/* /*
** Check if windowId is valid ** Check if windowId is valid
*/ */
pDraw = (DrawablePtr) LookupDrawable(windowId, client); rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
if (!pDraw || pDraw->type != DRAWABLE_WINDOW) { DixUnknownAccess);
client->errorValue = windowId; if (rc != Success)
return BadWindow; return rc;
}
/* /*
** Check if screen of window matches screen of fbconfig. ** Check if screen of window matches screen of fbconfig.
@ -3274,7 +3275,7 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0; GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL; DrawablePtr pDraw = NULL;
Display *dpy; Display *dpy;
int screen; int screen, rc;
DMXScreenInfo *dmxScreen; DMXScreenInfo *dmxScreen;
CARD32 *attribs = NULL; CARD32 *attribs = NULL;
int attribs_size; int attribs_size;
@ -3283,8 +3284,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif #endif
if (drawId != None) { if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw; WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0; be_drawable = 0;
@ -3435,7 +3436,7 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
GLXDrawable be_drawable = 0; GLXDrawable be_drawable = 0;
DrawablePtr pDraw = NULL; DrawablePtr pDraw = NULL;
Display *dpy; Display *dpy;
int screen; int screen, rc;
DMXScreenInfo *dmxScreen; DMXScreenInfo *dmxScreen;
char *attrbuf; char *attrbuf;
#ifdef PANORAMIX #ifdef PANORAMIX
@ -3444,8 +3445,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
#endif #endif
if (drawId != None) { if (drawId != None) {
pDraw = (DrawablePtr) LookupDrawable(drawId, client); rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess);
if (pDraw) { if (rc == Success) {
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
WindowPtr pWin = (WindowPtr)pDraw; WindowPtr pWin = (WindowPtr)pDraw;
be_drawable = 0; be_drawable = 0;