summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xext/saver.c8
-rw-r--r--Xext/security.c4
-rw-r--r--Xext/shape.c2
-rw-r--r--Xext/sync.c2
-rw-r--r--Xext/xselinux.c2
-rw-r--r--Xext/xtest.c6
-rw-r--r--Xi/exevents.c2
-rw-r--r--composite/compext.c10
-rw-r--r--dix/cursor.c8
-rw-r--r--dix/deprecated.c33
-rw-r--r--dix/dispatch.c48
-rw-r--r--dix/dixutils.c4
-rw-r--r--dix/events.c10
-rw-r--r--dix/gc.c8
-rw-r--r--dix/resource.c39
-rw-r--r--dix/window.c8
-rw-r--r--include/resource.h39
-rw-r--r--render/picture.c4
-rw-r--r--render/render.c8
-rw-r--r--xfixes/cursor.c4
-rw-r--r--xfixes/region.c6
21 files changed, 161 insertions, 94 deletions
diff --git a/Xext/saver.c b/Xext/saver.c
index cd6774928..357c2155f 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1026,7 +1026,7 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
- ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
client, DixReadAccess);
if (ret == Success)
{
@@ -1064,7 +1064,7 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
- ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
client, DixReadAccess);
if (ret == Success)
{
@@ -1158,7 +1158,7 @@ ScreenSaverSetAttributes (ClientPtr client)
break;
case CWColormap:
cmap = (Colormap) *pVlist;
- ret = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP,
+ ret = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
client, DixUseAccess);
if (ret != Success)
{
@@ -1182,7 +1182,7 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
- ret = dixLookupResource((pointer *)&pCursor, cursorID,
+ ret = dixLookupResourceByType((pointer *)&pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
if (ret != Success)
{
diff --git a/Xext/security.c b/Xext/security.c
index fc4691b0e..c9077c87e 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -1015,7 +1015,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
case ClientStateRunning:
state->authId = AuthorizationIDOfClient(pci->client);
- rc = dixLookupResource((pointer *)&pAuth, state->authId,
+ rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
SecurityAuthorizationResType, serverClient,
DixGetAttrAccess);
if (rc == Success) {
@@ -1030,7 +1030,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
case ClientStateGone:
case ClientStateRetained:
- rc = dixLookupResource((pointer *)&pAuth, state->authId,
+ rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
SecurityAuthorizationResType, serverClient,
DixGetAttrAccess);
if (rc == Success) {
diff --git a/Xext/shape.c b/Xext/shape.c
index 2a6a38b7d..15d2c5c5a 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -411,7 +411,7 @@ ProcShapeMask (ClientPtr client)
if (stuff->src == None)
srcRgn = 0;
else {
- rc = dixLookupResource((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? BadPixmap : rc;
diff --git a/Xext/sync.c b/Xext/sync.c
index a30895ddf..adb732447 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -263,7 +263,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter,
{
if (counter == None)
pCounter = NULL;
- else if (Success != (rc = dixLookupResource((pointer *)&pCounter,
+ else if (Success != (rc = dixLookupResourceByType ((pointer *)&pCounter,
counter, RTCounter, client, DixReadAccess)))
{
client->errorValue = counter;
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index f1003e637..cc973194f 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -553,7 +553,7 @@ SELinuxLabelInitial(void)
SELinuxScreen(NULL, NULL, &srec);
/* Do the default colormap */
- dixLookupResource(&unused, screenInfo.screens[i]->defColormap,
+ dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
RT_COLORMAP, serverClient, DixCreateAccess);
}
}
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6f0d1acf3..fe3816e9c 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -123,8 +123,8 @@ ProcXTestCompareCursor(ClientPtr client)
else if (stuff->cursor == XTestCurrentCursor)
pCursor = GetSpriteCursor(ptr);
else {
- rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
- client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
+ client, DixReadAccess);
if (rc != Success)
{
client->errorValue = stuff->cursor;
@@ -156,7 +156,7 @@ ProcXTestFakeInput(ClientPtr client)
int numValuators = 0;
int firstValuator = 0;
EventListPtr events;
- int nevents;
+ int nevents = 0;
int i;
int base = 0;
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 6a48a8ed7..20e0fbbfa 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1263,7 +1263,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode,
if (rcursor == None)
cursor = NullCursor;
else {
- rc = dixLookupResource((pointer *)&cursor, rcursor, RT_CURSOR,
+ rc = dixLookupResourceByType((pointer *)&cursor, rcursor, RT_CURSOR,
client, DixUseAccess);
if (rc != Success)
{
diff --git a/composite/compext.c b/composite/compext.c
index c1544021c..4fff20efa 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -144,7 +144,7 @@ ProcCompositeRedirectWindow (ClientPtr client)
REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
if (rc != Success)
{
@@ -162,7 +162,7 @@ ProcCompositeRedirectSubwindows (ClientPtr client)
REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
DixSetAttrAccess|DixManageAccess|DixBlendAccess);
if (rc != Success)
{
@@ -214,7 +214,7 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
DixGetAttrAccess);
if (rc != Success)
{
@@ -250,7 +250,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
DixGetAttrAccess);
if (rc != Success)
{
@@ -298,7 +298,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client,
DixGetAttrAccess);
if (rc != Success)
{
diff --git a/dix/cursor.c b/dix/cursor.c
index d1248c444..7ab15df0c 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -298,15 +298,15 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
GlyphSharePtr pShare;
DeviceIntPtr pDev;
- rc = dixLookupResource((pointer *)&sourcefont, source, RT_FONT, client,
- DixUseAccess);
+ rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client,
+ DixUseAccess);
if (rc != Success)
{
client->errorValue = source;
return (rc == BadValue) ? BadFont : rc;
}
- rc = dixLookupResource((pointer *)&maskfont, mask, RT_FONT, client,
- DixUseAccess);
+ rc = dixLookupResourceByType((pointer *)&maskfont, mask, RT_FONT, client,
+ DixUseAccess);
if (rc != Success && mask != None)
{
client->errorValue = mask;
diff --git a/dix/deprecated.c b/dix/deprecated.c
index d395c963a..5487b64bc 100644
--- a/dix/deprecated.c
+++ b/dix/deprecated.c
@@ -115,48 +115,65 @@ LookupClient(XID id, ClientPtr client)
return (i == Success) ? pClient : NULL;
}
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
pointer
SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
Mask access_mode)
{
pointer retval;
- int i = dixLookupResource(&retval, id, rtype, client, access_mode);
+ int i = dixLookupResourceByType(&retval, id, rtype, client, access_mode);
static int warn = 1;
if (warn > 0 && --warn)
ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
"are deprecated. Please convert your driver/module "
- "to use dixLookupResource().\n");
+ "to use dixLookupResourceByType().\n");
return (i == Success) ? retval : NULL;
}
-/* replaced by dixLookupResource */
pointer
SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
Mask access_mode)
{
pointer retval;
- int i = dixLookupResource(&retval, id, classes, client, access_mode);
+ int i = dixLookupResourceByClass(&retval, id, classes, client, access_mode);
static int warn = 1;
if (warn > 0 && --warn)
ErrorF("Warning: LookupIDByClass()/SecurityLookupIDByClass() "
"are deprecated. Please convert your driver/module "
- "to use dixLookupResource().\n");
+ "to use dixLookupResourceByClass().\n");
return (i == Success) ? retval : NULL;
}
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
pointer
LookupIDByType(XID id, RESTYPE rtype)
{
return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess);
}
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
pointer
LookupIDByClass(XID id, RESTYPE classes)
{
return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess);
}
+/* replaced by dixLookupResourceBy{Type,Class} */
+_X_EXPORT int
+dixLookupResource (pointer *result, XID id, RESTYPE rtype,
+ ClientPtr client, Mask mode)
+{
+ Bool istype = ((rtype & TypeMask) && (rtype != RC_ANY)) || (rtype == RT_NONE);
+
+ static int warn = 1;
+ if (warn > 0 && --warn)
+ ErrorF("Warning: dixLookupResource() "
+ "is deprecated. Please convert your driver/module "
+ "to use dixLookupResourceByType/dixLookupResourceByClass().\n");
+ if (istype)
+ return dixLookupResourceByType (result, id, rtype, client, mode);
+ else
+ return dixLookupResourceByClass (result, id, rtype, client, mode);
+}
+
/* end deprecated functions */
diff --git a/dix/dispatch.c b/dix/dispatch.c
index a92804841..0ed95df8b 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1116,11 +1116,11 @@ ProcQueryFont(ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id; /* EITHER font or gc */
- rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client,
- DixGetAttrAccess);
+ rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client,
+ DixGetAttrAccess);
if (rc == BadValue) {
- rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client,
- DixGetAttrAccess);
+ rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client,
+ DixGetAttrAccess);
if (rc == Success)
pFont = pGC->font;
}
@@ -1174,10 +1174,10 @@ ProcQueryTextExtents(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
client->errorValue = stuff->fid; /* EITHER font or gc */
- rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client,
- DixGetAttrAccess);
+ rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client,
+ DixGetAttrAccess);
if (rc == BadValue) {
- rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client,
+ rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client,
DixGetAttrAccess);
if (rc == Success)
pFont = pGC->font;
@@ -1322,7 +1322,7 @@ ProcFreePixmap(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResource((pointer *)&pMap, stuff->id, RT_PIXMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pMap, stuff->id, RT_PIXMAP, client,
DixDestroyAccess);
if (rc == Success)
{
@@ -2269,7 +2269,7 @@ ProcFreeColormap(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResource((pointer *)&pmap, stuff->id, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pmap, stuff->id, RT_COLORMAP, client,
DixDestroyAccess);
if (rc == Success)
{
@@ -2297,7 +2297,7 @@ ProcCopyColormapAndFree(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client);
- rc = dixLookupResource((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
+ rc = dixLookupResourceByType((pointer *)&pSrcMap, stuff->srcCmap, RT_COLORMAP,
client, DixReadAccess|DixRemoveAccess);
if (rc == Success)
{
@@ -2322,7 +2322,7 @@ ProcInstallColormap(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
DixInstallAccess);
if (rc != Success)
goto out;
@@ -2347,7 +2347,7 @@ ProcUninstallColormap(ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP, client,
DixUninstallAccess);
if (rc != Success)
goto out;
@@ -2413,7 +2413,7 @@ ProcAllocColor (ClientPtr client)
REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq);
- rc = dixLookupResource((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pmap, stuff->cmap, RT_COLORMAP, client,
DixAddAccess);
if (rc == Success)
{
@@ -2454,7 +2454,7 @@ ProcAllocNamedColor (ClientPtr client)
REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixAddAccess);
if (rc == Success)
{
@@ -2505,7 +2505,7 @@ ProcAllocColorCells (ClientPtr client)
REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixAddAccess);
if (rc == Success)
{
@@ -2572,7 +2572,7 @@ ProcAllocColorPlanes(ClientPtr client)
REQUEST(xAllocColorPlanesReq);
REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixAddAccess);
if (rc == Success)
{
@@ -2637,7 +2637,7 @@ ProcFreeColors(ClientPtr client)
REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixRemoveAccess);
if (rc == Success)
{
@@ -2672,7 +2672,7 @@ ProcStoreColors (ClientPtr client)
REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixWriteAccess);
if (rc == Success)
{
@@ -2706,7 +2706,7 @@ ProcStoreNamedColor (ClientPtr client)
REQUEST(xStoreNamedColorReq);
REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixWriteAccess);
if (rc == Success)
{
@@ -2740,7 +2740,7 @@ ProcQueryColors(ClientPtr client)
REQUEST(xQueryColorsReq);
REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixReadAccess);
if (rc == Success)
{
@@ -2793,7 +2793,7 @@ ProcLookupColor(ClientPtr client)
REQUEST(xLookupColorReq);
REQUEST_FIXED_SIZE(xLookupColorReq, stuff->nbytes);
- rc = dixLookupResource((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
+ rc = dixLookupResourceByType((pointer *)&pcmp, stuff->cmap, RT_COLORMAP, client,
DixReadAccess);
if (rc == Success)
{
@@ -2842,14 +2842,14 @@ ProcCreateCursor (ClientPtr client)
REQUEST_SIZE_MATCH(xCreateCursorReq);
LEGAL_NEW_RESOURCE(stuff->cid, client);
- rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client,
+ rc = dixLookupResourceByType((pointer *)&src, stuff->source, RT_PIXMAP, client,
DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->source;
return (rc == BadValue) ? BadPixmap : rc;
}
- rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
+ rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
DixReadAccess);
if (rc != Success)
{
@@ -2947,7 +2947,7 @@ ProcFreeCursor (ClientPtr client)
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
+ rc = dixLookupResourceByType((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
DixDestroyAccess);
if (rc == Success)
{
diff --git a/dix/dixutils.c b/dix/dixutils.c
index a382be63f..1bdeee064 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -216,7 +216,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
if (id == INVALID)
return BadDrawable;
- rc = dixLookupResource((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
+ rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
if (rc == BadValue)
return BadDrawable;
@@ -259,7 +259,7 @@ dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT))
goto bad;
- rc = dixLookupResource(&pRes, rid, RC_ANY, client, DixGetAttrAccess);
+ rc = dixLookupResourceByClass(&pRes, rid, RC_ANY, client, DixGetAttrAccess);
if (rc != Success)
goto bad;
diff --git a/dix/events.c b/dix/events.c
index 8c9623bb4..fa6c46996 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4307,7 +4307,7 @@ ProcGrabPointer(ClientPtr client)
cursor = NullCursor;
else
{
- rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR,
+ rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
client, DixUseAccess);
if (rc != Success)
{
@@ -4408,8 +4408,8 @@ ProcChangeActivePointerGrab(ClientPtr client)
newCursor = NullCursor;
else
{
- int rc = dixLookupResource((pointer *)&newCursor, stuff->cursor,
- RT_CURSOR, client, DixUseAccess);
+ int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor,
+ RT_CURSOR, client, DixUseAccess);
if (rc != Success)
{
client->errorValue = stuff->cursor;
@@ -5013,7 +5013,7 @@ ProcGrabButton(ClientPtr client)
cursor = NullCursor;
else
{
- rc = dixLookupResource((pointer *)&cursor, stuff->cursor, RT_CURSOR,
+ rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
client, DixUseAccess);
if (rc != Success)
if (!cursor)
@@ -5263,7 +5263,7 @@ ProcRecolorCursor(ClientPtr client)
REQUEST(xRecolorCursorReq);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
- rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
+ rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
client, DixWriteAccess);
if (rc != Success)
{
diff --git a/dix/gc.c b/dix/gc.c
index 1cf4cb83a..649016595 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -273,7 +273,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
else
{
NEXTVAL(XID, newpix);
- rc = dixLookupResource((pointer *)&pPixmap, newpix,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, newpix,
RT_PIXMAP, client, DixReadAccess);
}
if (rc == Success)
@@ -310,7 +310,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
else
{
NEXTVAL(XID, newstipple)
- rc = dixLookupResource((pointer *)&pPixmap, newstipple,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, newstipple,
RT_PIXMAP, client, DixReadAccess);
}
if (rc == Success)
@@ -353,7 +353,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
else
{
NEXTVAL(XID, newfont)
- rc = dixLookupResource((pointer *)&pFont, newfont,
+ rc = dixLookupResourceByType((pointer *)&pFont, newfont,
RT_FONT, client, DixUseAccess);
}
if (rc == Success)
@@ -420,7 +420,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
pPixmap = NullPixmap;
}
else {
- rc = dixLookupResource((pointer *)&pPixmap, pid,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, pid,
RT_PIXMAP, client,
DixReadAccess);
if (rc != Success) {
diff --git a/dix/resource.c b/dix/resource.c
index ec1d8cf4c..dc6945dd1 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -844,11 +844,10 @@ LegalNewID(XID id, ClientPtr client)
}
int
-dixLookupResource(pointer *result, XID id, RESTYPE rtype,
- ClientPtr client, Mask mode)
+dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
+ ClientPtr client, Mask mode)
{
int cid = CLIENT_ID(id);
- int istype = (rtype & TypeMask) && (rtype != RC_ANY);
ResourcePtr res = NULL;
*result = NULL;
@@ -857,8 +856,38 @@ dixLookupResource(pointer *result, XID id, RESTYPE rtype,
res = clientTable[cid].resources[Hash(cid, id)];
for (; res; res = res->next)
- if ((res->id == id) && ((istype && res->type == rtype) ||
- (!istype && res->type & rtype)))
+ if (res->id == id && res->type == rtype)
+ break;
+ }
+ if (!res)
+ return BadValue;
+
+ if (client) {
+ client->errorValue = id;
+ cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
+ res->value, RT_NONE, NULL, mode);
+ if (cid != Success)
+ return cid;
+ }
+
+ *result = res->value;
+ return Success;
+}
+
+int
+dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass,
+ ClientPtr client, Mask mode)
+{
+ int cid = CLIENT_ID(id);
+ ResourcePtr res = NULL;
+
+ *result = NULL;
+
+ if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
+ res = clientTable[cid].resources[Hash(cid, id)];
+
+ for (; res; res = res->next)
+ if (res->id == id && (res->type & rclass))
break;
}
if (!res)
diff --git a/dix/window.c b/dix/window.c
index 2a5da53ea..e2669f0c5 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1062,7 +1062,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
else
{
- rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
client, DixReadAccess);
if (rc == Success)
{
@@ -1122,7 +1122,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
pixID = pWin->parent->border.pixmap->drawable.id;
}
}
- rc = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
client, DixReadAccess);
if (rc == Success)
{
@@ -1284,7 +1284,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
error = BadMatch;
goto PatchUp;
}
- rc = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP,
+ rc = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
client, DixUseAccess);
if (rc != Success)
{
@@ -1360,7 +1360,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
else
{
- rc = dixLookupResource((pointer *)&pCursor, cursorID,
+ rc = dixLookupResourceByType((pointer *)&pCursor, cursorID,
RT_CURSOR, client, DixUseAccess);
if (rc != Success)
{
diff --git a/include/resource.h b/include/resource.h
index cb6e0644a..774f81b56 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -218,13 +218,20 @@ extern _X_EXPORT pointer LookupClientResourceComplex(
FindComplexResType func,
pointer cdata);
-extern _X_EXPORT int dixLookupResource(
+extern _X_EXPORT int dixLookupResourceByType(
pointer *result,
XID id,
RESTYPE rtype,
ClientPtr client,
Mask access_mode);
+extern _X_EXPORT int dixLookupResourceByClass(
+ pointer *result,
+ XID id,
+ RESTYPE rclass,
+ ClientPtr client,
+ Mask access_mode);
+
extern _X_EXPORT void GetXIDRange(
int /*client*/,
Bool /*server*/,
@@ -244,29 +251,43 @@ extern _X_EXPORT RESTYPE TypeMask;
* Please use the noted replacements instead.
*/
-/* replaced by dixLookupResource */
+#ifdef __GNUC__
+#define X_DEPRECATED __attribute__((deprecated))
+#else
+#define X_DEPRECATED
+#endif
+
+/* replaced by dixLookupResourceByType or dixLookupResourceByClass */
+extern int dixLookupResource(
+ pointer *result,
+ XID id,
+ RESTYPE rtype,
+ ClientPtr client,
+ Mask access_mode) X_DEPRECATED;
+
+/* replaced by dixLookupResourceByType */
extern _X_EXPORT pointer SecurityLookupIDByType(
ClientPtr client,
XID id,
RESTYPE rtype,
- Mask access_mode);
+ Mask access_mode) X_DEPRECATED;
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
extern _X_EXPORT pointer SecurityLookupIDByClass(
ClientPtr client,
XID id,
RESTYPE classes,
- Mask access_mode);
+ Mask access_mode) X_DEPRECATED;
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByType */
extern _X_EXPORT pointer LookupIDByType(
XID id,
- RESTYPE rtype);
+ RESTYPE rtype) X_DEPRECATED;
-/* replaced by dixLookupResource */
+/* replaced by dixLookupResourceByClass */
extern _X_EXPORT pointer LookupIDByClass(
XID id,
- RESTYPE classes);
+ RESTYPE classes) X_DEPRECATED;
#endif /* RESOURCE_H */
diff --git a/render/picture.c b/render/picture.c
index f99c53f86..462125f05 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1070,7 +1070,7 @@ ChangePicture (PicturePtr pPicture,
pAlpha = 0;
else
{
- error = dixLookupResource((pointer *)&pAlpha, pid,
+ error = dixLookupResourceByType((pointer *)&pAlpha, pid,
PictureType, client,
DixReadAccess);
if (error != Success)
@@ -1131,7 +1131,7 @@ ChangePicture (PicturePtr pPicture,
else
{
clipType = CT_PIXMAP;
- error = dixLookupResource((pointer *)&pPixmap, pid,
+ error = dixLookupResourceByType((pointer *)&pPixmap, pid,
RT_PIXMAP, client,
DixReadAccess);
if (error != Success)
diff --git a/render/render.c b/render/render.c
index abd0a68fa..270b8fb29 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1008,7 +1008,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
LEGAL_NEW_RESOURCE(stuff->gsid, client);
- rc = dixLookupResource((pointer *)&glyphSet, stuff->existing, GlyphSetType,
+ rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->existing, GlyphSetType,
client, DixGetAttrAccess);
if (rc != Success)
{
@@ -1032,7 +1032,7 @@ ProcRenderFreeGlyphSet (ClientPtr client)
REQUEST(xRenderFreeGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+ rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
client, DixDestroyAccess);
if (rc != Success)
{
@@ -1071,7 +1071,7 @@ ProcRenderAddGlyphs (ClientPtr client)
CARD32 component_alpha;
REQUEST_AT_LEAST_SIZE(xRenderAddGlyphsReq);
- err = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+ err = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
client, DixAddAccess);
if (err != Success)
{
@@ -1261,7 +1261,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
CARD32 glyph;
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- rc = dixLookupResource((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
+ rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType,
client, DixRemoveAccess);
if (rc != Success)
{
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index cd3df12bc..3f2698852 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -863,7 +863,7 @@ ProcXFixesHideCursor (ClientPtr client)
REQUEST_SIZE_MATCH (xXFixesHideCursorReq);
- ret = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+ ret = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
client, DixGetAttrAccess);
if (ret != Success) {
client->errorValue = stuff->window;
@@ -921,7 +921,7 @@ ProcXFixesShowCursor (ClientPtr client)
REQUEST_SIZE_MATCH (xXFixesShowCursorReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
client, DixGetAttrAccess);
if (rc != Success) {
client->errorValue = stuff->window;
diff --git a/xfixes/region.c b/xfixes/region.c
index 6db787f60..966eda051 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -115,7 +115,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client)
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
- rc = dixLookupResource((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
+ rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->bitmap, RT_PIXMAP,
client, DixReadAccess);
if (rc != Success)
{
@@ -160,7 +160,7 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client)
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
- rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
client, DixGetAttrAccess);
if (rc != Success)
{
@@ -682,7 +682,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
- rc = dixLookupResource((pointer *)&pWin, stuff->dest, RT_WINDOW,
+ rc = dixLookupResourceByType((pointer *)&pWin, stuff->dest, RT_WINDOW,
client, DixSetAttrAccess);
if (rc != Success)
{