xserver: Branch 'master'

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Apr 14 11:26:22 PDT 2009


 xfixes/cursor.c |   21 +++++++++++++--------
 xfixes/xfixes.h |   20 +++++++++++++-------
 2 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit e7785e8af3e34f9d1089d8499d16802984ab9823
Author: Kristian Høgsberg <krh at redhat.com>
Date:   Tue Apr 14 14:24:31 2009 -0400

    xfixes: Fix a couple of resource lookups

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 99403e5..33ab426 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -64,14 +64,19 @@ static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex;
 
 static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
 
-#define VERIFY_CURSOR(pCursor, cursor, client, access) { \
-    pCursor = (CursorPtr)SecurityLookupIDByType((client), (cursor), \
-					RT_CURSOR, (access)); \
-    if (!pCursor) { \
-	(client)->errorValue = (cursor); \
-	return BadCursor; \
-    } \
-}
+#define VERIFY_CURSOR(pCursor, cursor, client, access)			\
+    do {								\
+	int err;							\
+	err = dixLookupResourceByType((pointer *) &pCursor, cursor,	\
+				      RT_CURSOR, client, access);	\
+	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
diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h
index ade2f82..69d162f 100644
--- a/xfixes/xfixes.h
+++ b/xfixes/xfixes.h
@@ -32,13 +32,19 @@
 extern _X_EXPORT RESTYPE RegionResType;
 extern _X_EXPORT int XFixesErrorBase;
 
-#define VERIFY_REGION(pRegion, rid, client, mode) { \
-    pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \
-    if (!pRegion) { \
-	client->errorValue = rid; \
-	return XFixesErrorBase + BadRegion; \
-    } \
-}
+#define VERIFY_REGION(pRegion, rid, client, mode)			\
+    do {								\
+	int err;							\
+	err = dixLookupResourceByType((pointer *) &pRegion, rid,	\
+				      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) { \
     pRegion = 0; \


More information about the xorg-commit mailing list