summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Brulebois <kibi@debian.org>2010-11-11 15:30:15 +0100
committerCyril Brulebois <kibi@debian.org>2010-12-07 18:42:44 +0100
commitffb93533fd8067c7383aef5e0018a197af59b46c (patch)
tree92eef5a68b7949707121032b0795f5e0c83c6225
parentd1b45b0fd54efb952f9ff435a516c1bfd85ca186 (diff)
Replace LookupIDByType() with dixLookupResourceByType(), take 1.
This patch has been prepared with the following Coccinelle semantic patch: @@ expression x, y; type t; identifier r; @@ -r = (t) LookupIDByType(x, y); +dixLookupResourceByType((pointer*)&r, x, y, NullClient, DixUnknownAccess); @@ expression x, y; type t; identifier r; @@ -t r = (t) LookupIDByType(x, y); +t r; +dixLookupResourceByType((pointer*)&r, x, y, NullClient, DixUnknownAccess); Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Cyril Brulebois <kibi@debian.org>
-rw-r--r--hw/dmx/dmxextension.c14
-rw-r--r--hw/dmx/dmxgcops.c4
-rw-r--r--hw/dmx/dmxwindow.c10
-rw-r--r--hw/dmx/glxProxy/glxcmds.c134
4 files changed, 104 insertions, 58 deletions
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index 009283505..45cb3db93 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -699,7 +699,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
PixmapPtr pPix;
int i;
- pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
for (i = 0; i < PanoramiXNumScreens; i++) {
@@ -708,8 +709,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
if (i == idx) continue; /* Self replication is bad */
- pSrc =
- (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
@@ -1365,7 +1366,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
PixmapPtr pPix;
int i;
- pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
for (i = 0; i < PanoramiXNumScreens; i++) {
@@ -1374,8 +1376,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
if (i == idx) continue; /* Self replication is bad */
- pSrc =
- (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
FoundPixImage = True;
diff --git a/hw/dmx/dmxgcops.c b/hw/dmx/dmxgcops.c
index 589c6377b..425aa7c96 100644
--- a/hw/dmx/dmxgcops.c
+++ b/hw/dmx/dmxgcops.c
@@ -533,8 +533,8 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv;
- pSrc = (PixmapPtr)LookupIDByType(pXinPix->info[i].id,
- RT_PIXMAP);
+ dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
*draw = pSrcPriv->pixmap;
diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c
index 44848281f..c3b470018 100644
--- a/hw/dmx/dmxwindow.c
+++ b/hw/dmx/dmxwindow.c
@@ -84,7 +84,8 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
parent = dmxScreen->scrnWin; /* This is our "Screen" window */
visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
@@ -191,8 +192,8 @@ void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
ColormapPtr pCmap;
dmxColormapPrivPtr pCmapPriv;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow),
- RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
*cmap = pCmapPriv->cmap;
} else {
@@ -545,7 +546,8 @@ static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
ColormapPtr pCmap;
dmxColormapPrivPtr pCmapPriv;
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP);
+ dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
attribs->colormap = pCmapPriv->cmap;
}
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index 6a0aae79b..050d1e3fe 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -129,7 +129,8 @@ static int CreateContext(__GLXclientState *cl,
if (shareList == None) {
shareglxc = NULL;
} else {
- shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes);
+ dixLookupResourceByType((pointer*) &shareglxc, shareList,
+ __glXContextRes, NullClient, DixUnknownAccess);
if (!shareglxc) {
client->errorValue = shareList;
return __glXBadContext;
@@ -420,14 +421,14 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) pDraw = pGlxWindow->pDraw;
}
@@ -450,14 +451,14 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) pDraw = pGlxWindow->pDraw;
}
@@ -470,14 +471,16 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pMember, req->member, client, 0,
DixGetAttrAccess);
if (rc != Success) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
}
if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(req->member,
- __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) pMember = pGlxWindow->pDraw;
}
@@ -505,7 +508,8 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
int to_screen = 0;
int s;
- glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (glxc) {
/*
** Just free the resource; don't actually destroy the context,
@@ -752,7 +756,8 @@ static int MakeCurrent(__GLXclientState *cl,
** Lookup new context. It must not be current for someone else.
*/
if (contextId != None) {
- glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!glxc) {
client->errorValue = contextId;
return __glXBadContext;
@@ -802,8 +807,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pGlxPixmap) {
/*
** Check if pixmap and context are similar.
@@ -826,7 +832,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -847,7 +855,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
if (pGlxPbuffer) {
if (pGlxPbuffer->pScreen != glxc->pScreen ||
pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
@@ -908,8 +918,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw) {
- pReadGlxPixmap = (__GLXpixmap *) LookupIDByType(readId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
if (pReadGlxPixmap) {
/*
** Check if pixmap and context are similar.
@@ -929,8 +940,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxReadWindow = (__glXWindow *)
- LookupIDByType(readId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadWindow) {
/*
** Drawable is a GLXWindow.
@@ -950,7 +962,9 @@ static int MakeCurrent(__GLXclientState *cl,
}
if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxReadPbuffer = (__glXPbuffer *)LookupIDByType(readId, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadPbuffer) {
if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
@@ -1303,7 +1317,8 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
/*
** Find the GL context.
*/
- glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!glxc) {
client->errorValue = req->context;
return __glXBadContext;
@@ -1449,12 +1464,14 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
/*
** Check that each context exists.
*/
- src = (__GLXcontext *) LookupIDByType(source, __glXContextRes);
+ dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!src) {
client->errorValue = source;
return __glXBadContext;
}
- dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes);
+ dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!dst) {
client->errorValue = dest;
return __glXBadContext;
@@ -1870,7 +1887,8 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
/*
** Check if it's a valid GLX pixmap.
*/
- pGlxPixmap = (__GLXpixmap *)LookupIDByType(glxpixmap, __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (!pGlxPixmap) {
client->errorValue = glxpixmap;
return __glXBadPixmap;
@@ -1953,8 +1971,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) {
/*
** Drawable is a GLX pixmap.
@@ -1965,7 +1983,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -2100,8 +2119,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
if (pGlxPixmap) {
/*
** Drawable is a GLX pixmap.
@@ -2111,7 +2130,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
if (pGlxWindow) {
/*
** Drawable is a GLXWindow.
@@ -2620,9 +2640,13 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
** Font can actually be either the ID of a font or the ID of a GC
** containing a font.
*/
- pFont = (FontPtr)LookupIDByType(req->font, RT_FONT);
+ dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
+ NullClient, DixUnknownAccess);
if (!pFont) {
- GC *pGC = (GC *)LookupIDByType(req->font, RT_GC);
+ GC *pGC;
+ dixLookupResourceByType((pointer*) &pGC, req->font,
+ RT_GC, NullClient,
+ DixUnknownAccess);
if (!pGC) {
client->errorValue = req->font;
return BadFont;
@@ -2998,7 +3022,8 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
int nReplyBytes;
req = (xGLXQueryContextReq *)pc;
- ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes);
+ dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (!ctx) {
client->errorValue = req->context;
return __glXBadContext;
@@ -3208,7 +3233,8 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
/*
** Check if it's a valid Pbuffer
*/
- pGlxPbuffer = (__glXPbuffer *)LookupIDByType(pbuffer, __glXPbufferRes);
+ dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
+ __glXPbufferRes, NullClient, DixUnknownAccess);
if (!pGlxPbuffer) {
client->errorValue = pbuffer;
return __glXBadPbuffer;
@@ -3280,8 +3306,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
if (pGlxPixmap) {
pDraw = pGlxPixmap->pDraw;
screen = pGlxPixmap->pScreen->myNum;
@@ -3290,7 +3318,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
if (pGlxWindow) {
pDraw = pGlxWindow->pDraw;
screen = pGlxWindow->pScreen->myNum;
@@ -3299,7 +3330,10 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
if (pGlxPbuffer) {
pDraw = (DrawablePtr)pGlxPbuffer;
screen = pGlxPbuffer->pScreen->myNum;
@@ -3436,8 +3470,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
- __glXPixmapRes);
+ __GLXpixmap *pGlxPixmap;
+ dixLookupResourceByType((pointer*) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
if (pGlxPixmap) {
pDraw = pGlxPixmap->pDraw;
screen = pGlxPixmap->pScreen->myNum;
@@ -3446,7 +3482,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes);
+ __glXWindow *pGlxWindow;
+ dixLookupResourceByType((pointer*) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
if (pGlxWindow) {
pDraw = pGlxWindow->pDraw;
screen = pGlxWindow->pScreen->myNum;
@@ -3455,7 +3494,10 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
}
if (!pDraw) {
- __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes);
+ __glXPbuffer *pGlxPbuffer;
+ dixLookupResourceByType((pointer*) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
if (pGlxPbuffer) {
pDraw = (DrawablePtr)pGlxPbuffer;
screen = pGlxPbuffer->pScreen->myNum;