xfixes: Fix a couple of resource lookups

This commit is contained in:
Kristian Høgsberg 2009-04-14 14:24:31 -04:00
parent 0eb19f9437
commit e7785e8af3
2 changed files with 26 additions and 15 deletions

View File

@ -64,14 +64,19 @@ static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex;
static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
#define VERIFY_CURSOR(pCursor, cursor, client, access) { \ #define VERIFY_CURSOR(pCursor, cursor, client, access) \
pCursor = (CursorPtr)SecurityLookupIDByType((client), (cursor), \ do { \
RT_CURSOR, (access)); \ int err; \
if (!pCursor) { \ err = dixLookupResourceByType((pointer *) &pCursor, cursor, \
(client)->errorValue = (cursor); \ RT_CURSOR, client, access); \
return BadCursor; \ if (err == BadValue) { \
} \ client->errorValue = cursor; \
} return BadCursor; \
} else if (err != Success) { \
client->errorValue = cursor; \
return err; \
} \
} while (0)
/* /*
* There is a global list of windows selecting for cursor events * There is a global list of windows selecting for cursor events

View File

@ -32,13 +32,19 @@
extern _X_EXPORT RESTYPE RegionResType; extern _X_EXPORT RESTYPE RegionResType;
extern _X_EXPORT int XFixesErrorBase; extern _X_EXPORT int XFixesErrorBase;
#define VERIFY_REGION(pRegion, rid, client, mode) { \ #define VERIFY_REGION(pRegion, rid, client, mode) \
pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \ do { \
if (!pRegion) { \ int err; \
client->errorValue = rid; \ err = dixLookupResourceByType((pointer *) &pRegion, rid, \
return XFixesErrorBase + BadRegion; \ RegionResType, client, mode); \
} \ if (err == BadValue) { \
} client->errorValue = rid; \
return XFixesErrorBase + BadRegion; \
} else if (err != Success) { \
client->errorValue = rid; \
return err; \
} \
} while (0)
#define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \ #define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \
pRegion = 0; \ pRegion = 0; \