From e291c561821ae86b7dd74269d5cd29bc31703962 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 24 Apr 2010 23:26:40 -0700 Subject: Return an appropriately-typed error from dixLookupResourceByType. Rather than always returning BadValue, associate an error status like BadWindow with a resource type like RT_WINDOW, and return the appropriate one for the requested type. This patch only touches the core protocol resource types. Others still return BadValue and need to be mapped appropriately. dixLookupResourceByType can now return BadImplementation, if the caller asked for a resource type that has not been allocated in the server. Signed-off-by: Jamey Sharp Reviewed-by: Adam Jackson --- xfixes/cursor.c | 9 +++------ xfixes/region.c | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'xfixes') diff --git a/xfixes/cursor.c b/xfixes/cursor.c index e963e3740..52bdb27f6 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -70,10 +70,7 @@ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); int err; \ err = dixLookupResourceByType((pointer *) &pCursor, cursor, \ RT_CURSOR, client, access); \ - if (err == BadValue) { \ - client->errorValue = cursor; \ - return BadCursor; \ - } else if (err != Success) { \ + if (err != Success) { \ client->errorValue = cursor; \ return err; \ } \ @@ -882,7 +879,7 @@ ProcXFixesHideCursor (ClientPtr client) client, DixGetAttrAccess); if (ret != Success) { client->errorValue = stuff->window; - return (ret == BadValue) ? BadWindow : ret; + return ret; } /* @@ -945,7 +942,7 @@ ProcXFixesShowCursor (ClientPtr client) client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; + return rc; } /* diff --git a/xfixes/region.c b/xfixes/region.c index 5f0c2c432..7a71c78f9 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -119,7 +119,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) if (rc != Success) { client->errorValue = stuff->bitmap; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } if (pPixmap->drawable.depth != 1) return BadMatch; @@ -164,7 +164,7 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client) if (rc != Success) { client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; + return rc; } switch (stuff->kind) { case WindowRegionBounding: @@ -675,7 +675,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) if (rc != Success) { client->errorValue = stuff->dest; - return (rc == BadValue) ? BadWindow : rc; + return rc; } VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; -- cgit v1.2.3