summaryrefslogtreecommitdiff
path: root/dix/dixutils.c
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-04-24 23:26:40 -0700
committerJamey Sharp <jamey@minilop.net>2010-05-19 12:32:48 -0700
commite291c561821ae86b7dd74269d5cd29bc31703962 (patch)
tree5b4c5b1448c6b08bd4cb6712eb6314e29f8e591f /dix/dixutils.c
parent90e612dcbe370da095d317fac62c80ac2447fa0b (diff)
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 <jamey@minilop.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'dix/dixutils.c')
-rw-r--r--dix/dixutils.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 5955eb84a..51dbd1481 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -231,9 +231,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
int
dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
{
- int rc;
- rc = dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access);
- return (rc == BadValue) ? BadGC : rc;
+ return dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access);
}
int
@@ -243,10 +241,10 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
GC *pGC;
client->errorValue = id; /* EITHER font or gc */
rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
- if (rc != BadValue)
+ if (rc != BadFont)
return rc;
rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
- if (rc == BadValue)
+ if (rc == BadGC)
return BadFont;
if (rc == Success)
*pFont = pGC->font;