diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-04-24 23:26:40 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-05-19 12:32:48 -0700 |
commit | e291c561821ae86b7dd74269d5cd29bc31703962 (patch) | |
tree | 5b4c5b1448c6b08bd4cb6712eb6314e29f8e591f /dix/dispatch.c | |
parent | 90e612dcbe370da095d317fac62c80ac2447fa0b (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/dispatch.c')
-rw-r--r-- | dix/dispatch.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index c9e3188cc..c86011a83 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1240,7 +1240,7 @@ ProcCloseFont(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadFont : rc; + return rc; } } @@ -1453,7 +1453,7 @@ ProcFreePixmap(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } } @@ -2407,7 +2407,7 @@ ProcFreeColormap(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2428,7 +2428,7 @@ ProcCopyColormapAndFree(ClientPtr client) if (rc == Success) return CopyColormapAndFree(mid, pSrcMap, client->index); client->errorValue = stuff->srcCmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2445,15 +2445,18 @@ ProcInstallColormap(ClientPtr client) goto out; rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); - if (rc != Success) + if (rc != Success) { + if (rc == BadValue) + rc = BadColor; goto out; + } (*(pcmp->pScreen->InstallColormap)) (pcmp); return Success; out: client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2470,8 +2473,11 @@ ProcUninstallColormap(ClientPtr client) goto out; rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); - if (rc != Success) + if (rc != Success) { + if (rc == BadValue) + rc = BadColor; goto out; + } if(pcmp->mid != pcmp->pScreen->defColormap) (*(pcmp->pScreen->UninstallColormap)) (pcmp); @@ -2479,7 +2485,7 @@ ProcUninstallColormap(ClientPtr client) out: client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2552,7 +2558,7 @@ ProcAllocColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2598,7 +2604,7 @@ ProcAllocNamedColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2662,7 +2668,7 @@ ProcAllocColorCells (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2724,7 +2730,7 @@ ProcAllocColorPlanes(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2751,7 +2757,7 @@ ProcFreeColors(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2778,7 +2784,7 @@ ProcStoreColors (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2808,7 +2814,7 @@ ProcStoreNamedColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2855,7 +2861,7 @@ ProcQueryColors(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2894,7 +2900,7 @@ ProcLookupColor(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2920,7 +2926,7 @@ ProcCreateCursor (ClientPtr client) DixReadAccess); if (rc != Success) { client->errorValue = stuff->source; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client, @@ -2930,7 +2936,7 @@ ProcCreateCursor (ClientPtr client) if (stuff->mask != None) { client->errorValue = stuff->mask; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } } else if ( src->drawable.width != msk->drawable.width @@ -3031,7 +3037,7 @@ ProcFreeCursor (ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadCursor : rc; + return rc; } } |