summaryrefslogtreecommitdiff
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
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>
-rw-r--r--Xext/panoramiXprocs.c2
-rw-r--r--Xext/saver.c4
-rw-r--r--Xext/shape.c2
-rw-r--r--Xext/xtest.c2
-rw-r--r--Xi/exevents.c4
-rw-r--r--Xi/xichangecursor.c2
-rw-r--r--Xi/xipassivegrab.c2
-rw-r--r--composite/compext.c5
-rw-r--r--dix/cursor.c4
-rw-r--r--dix/dispatch.c46
-rw-r--r--dix/dixfonts.c1
-rw-r--r--dix/dixutils.c8
-rw-r--r--dix/events.c8
-rw-r--r--dix/gc.c2
-rw-r--r--dix/resource.c95
-rw-r--r--dix/window.c8
-rw-r--r--hw/xfree86/dixmods/extmod/xf86dga2.c4
-rw-r--r--render/picture.c1
-rw-r--r--render/render.c2
-rw-r--r--xfixes/cursor.c9
-rw-r--r--xfixes/region.c6
21 files changed, 124 insertions, 93 deletions
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index a1816958f..dbaae26c4 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -457,7 +457,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&pWin, stuff->window,
RT_WINDOW, client, DixWriteAccess);
if (result != Success)
- return (result == BadValue) ? BadWindow : result;
+ return result;
result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess);
diff --git a/Xext/saver.c b/Xext/saver.c
index 30c4a8c9b..63a41d6d7 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1043,7 +1043,6 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
- ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1081,7 +1080,6 @@ ScreenSaverSetAttributes (ClientPtr client)
}
else
{
- ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1163,7 +1161,6 @@ ScreenSaverSetAttributes (ClientPtr client)
client, DixUseAccess);
if (ret != Success)
{
- ret = (ret == BadValue) ? BadColor : ret;
client->errorValue = cmap;
goto PatchUp;
}
@@ -1187,7 +1184,6 @@ ScreenSaverSetAttributes (ClientPtr client)
RT_CURSOR, client, DixUseAccess);
if (ret != Success)
{
- ret = (ret == BadValue) ? BadCursor : ret;
client->errorValue = cursorID;
goto PatchUp;
}
diff --git a/Xext/shape.c b/Xext/shape.c
index 10ac2839c..f49e9a02b 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -415,7 +415,7 @@ ProcShapeMask (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
client, DixReadAccess);
if (rc != Success)
- return (rc == BadValue) ? BadPixmap : rc;
+ return rc;
if (pPixmap->drawable.pScreen != pScreen ||
pPixmap->drawable.depth != 1)
return BadMatch;
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 09c4677a2..263d0c16a 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -153,7 +153,7 @@ ProcXTestCompareCursor(ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
}
rep.type = X_Reply;
diff --git a/Xi/exevents.c b/Xi/exevents.c
index b24204d82..41b396c28 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1445,7 +1445,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success)
{
client->errorValue = param->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
access_mode |= DixForceAccess;
}
@@ -1543,7 +1543,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (rc != Success)
{
client->errorValue = param->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
access_mode |= DixForceAccess;
}
diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c
index f071e8406..e72cfac03 100644
--- a/Xi/xichangecursor.c
+++ b/Xi/xichangecursor.c
@@ -103,7 +103,7 @@ int ProcXIChangeCursor(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
if (rc != Success)
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
ChangeWindowDeviceCursor(pWin, pDev, pCursor);
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index a62fe7946..296614510 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -147,7 +147,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (status != Success)
{
client->errorValue = stuff->cursor;
- return (status == BadValue) ? BadCursor : status;
+ return status;
}
}
diff --git a/composite/compext.c b/composite/compext.c
index 3bb9a3701..ed437756e 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -140,10 +140,7 @@ ProcCompositeQueryVersion (ClientPtr client)
int err; \
err = dixLookupResourceByType((pointer *) &pWindow, wid, \
RT_WINDOW, client, mode); \
- if (err == BadValue) { \
- client->errorValue = wid; \
- return BadWindow; \
- } else if (err != Success) { \
+ if (err != Success) { \
client->errorValue = wid; \
return err; \
} \
diff --git a/dix/cursor.c b/dix/cursor.c
index a512309bb..7ff0a932e 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -316,14 +316,14 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
if (rc != Success)
{
client->errorValue = source;
- return (rc == BadValue) ? BadFont : rc;
+ return rc;
}
rc = dixLookupResourceByType((pointer *)&maskfont, mask, RT_FONT, client,
DixUseAccess);
if (rc != Success && mask != None)
{
client->errorValue = mask;
- return (rc == BadValue) ? BadFont : rc;
+ return rc;
}
if (sourcefont != maskfont)
pShare = (GlyphSharePtr)NULL;
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;
}
}
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 585754b57..ba1d0e246 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1238,7 +1238,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
client, DixUseAccess);
if (err != Success)
{
- err = (err == BadValue) ? BadFont : err;
/* restore pFont and fid for step 4 (described below) */
pFont = oldpFont;
fid = oldfid;
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;
diff --git a/dix/events.c b/dix/events.c
index 39ad4007c..9e05dc96c 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4697,7 +4697,7 @@ ProcChangeActivePointerGrab(ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
}
@@ -4820,7 +4820,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev,
if (rc != Success)
{
client->errorValue = curs;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
access_mode |= DixForceAccess;
}
@@ -5345,7 +5345,7 @@ ProcGrabButton(ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
access_mode |= DixForceAccess;
}
@@ -5608,7 +5608,7 @@ ProcRecolorCursor(ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->cursor;
- return (rc == BadValue) ? BadCursor : rc;
+ return rc;
}
pCursor->foreRed = stuff->foreRed;
diff --git a/dix/gc.c b/dix/gc.c
index 6281f25cd..65d05eb45 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -458,8 +458,6 @@ ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32)
if (rc != Success)
{
client->errorValue = vals[offset].val;
- if (rc == BadValue)
- rc = (xidfields[i].type == RT_PIXMAP) ? BadPixmap : BadFont;
return rc;
}
}
diff --git a/dix/resource.c b/dix/resource.c
index 143b51a77..fb4473a7e 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -183,7 +183,54 @@ RESTYPE lastResourceType;
static RESTYPE lastResourceClass;
RESTYPE TypeMask;
-static DeleteType *DeleteFuncs = (DeleteType *)NULL;
+struct ResourceType {
+ DeleteType deleteFunc;
+ int errorValue;
+};
+
+static struct ResourceType *resourceTypes;
+static const struct ResourceType predefTypes[] = {
+ [RT_NONE & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = (DeleteType)NoopDDA,
+ .errorValue = BadValue,
+ },
+ [RT_WINDOW & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = DeleteWindow,
+ .errorValue = BadWindow,
+ },
+ [RT_PIXMAP & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = dixDestroyPixmap,
+ .errorValue = BadPixmap,
+ },
+ [RT_GC & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = FreeGC,
+ .errorValue = BadGC,
+ },
+ [RT_FONT & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = CloseFont,
+ .errorValue = BadFont,
+ },
+ [RT_CURSOR & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = FreeCursor,
+ .errorValue = BadCursor,
+ },
+ [RT_COLORMAP & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = FreeColormap,
+ .errorValue = BadColor,
+ },
+ [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = FreeClientPixels,
+ .errorValue = BadColor,
+ },
+ [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = OtherClientGone,
+ .errorValue = BadValue,
+ },
+ [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = {
+ .deleteFunc = DeletePassiveGrab,
+ .errorValue = BadValue,
+ },
+};
CallbackListPtr ResourceStateCallback;
@@ -200,20 +247,20 @@ RESTYPE
CreateNewResourceType(DeleteType deleteFunc, char *name)
{
RESTYPE next = lastResourceType + 1;
- DeleteType *funcs;
+ struct ResourceType *types;
if (next & lastResourceClass)
return 0;
- funcs = (DeleteType *)realloc(DeleteFuncs,
- (next + 1) * sizeof(DeleteType));
- if (!funcs)
+ types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes));
+ if (!types)
return 0;
if (!dixRegisterPrivateOffset(next, -1))
return 0;
lastResourceType = next;
- DeleteFuncs = funcs;
- DeleteFuncs[next] = deleteFunc;
+ resourceTypes = types;
+ resourceTypes[next].deleteFunc = deleteFunc;
+ resourceTypes[next].errorValue = BadValue;
/* Called even if name is NULL, to remove any previous entry */
RegisterResourceName(next, name);
@@ -251,21 +298,11 @@ InitClientResources(ClientPtr client)
lastResourceType = RT_LASTPREDEF;
lastResourceClass = RC_LASTPREDEF;
TypeMask = RC_LASTPREDEF - 1;
- if (DeleteFuncs)
- free(DeleteFuncs);
- DeleteFuncs = malloc((lastResourceType + 1) * sizeof(DeleteType));
- if (!DeleteFuncs)
+ free(resourceTypes);
+ resourceTypes = malloc(sizeof(predefTypes));
+ if (!resourceTypes)
return FALSE;
- DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA;
- DeleteFuncs[RT_WINDOW & TypeMask] = DeleteWindow;
- DeleteFuncs[RT_PIXMAP & TypeMask] = dixDestroyPixmap;
- DeleteFuncs[RT_GC & TypeMask] = FreeGC;
- DeleteFuncs[RT_FONT & TypeMask] = CloseFont;
- DeleteFuncs[RT_CURSOR & TypeMask] = FreeCursor;
- DeleteFuncs[RT_COLORMAP & TypeMask] = FreeColormap;
- DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels;
- DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone;
- DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab;
+ memcpy(resourceTypes, predefTypes, sizeof(predefTypes));
}
clientTable[i = client->index].resources =
malloc(INITBUCKETS*sizeof(ResourcePtr));
@@ -462,7 +499,7 @@ AddResource(XID id, RESTYPE type, pointer value)
res = malloc(sizeof(ResourceRec));
if (!res)
{
- (*DeleteFuncs[type & TypeMask])(value, id);
+ (*resourceTypes[type & TypeMask].deleteFunc)(value, id);
return FALSE;
}
res->next = *head;
@@ -557,7 +594,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
CallResourceStateCallback(ResourceStateFreeing, res);
if (rtype != skipDeleteFuncType)
- (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
+ (*resourceTypes[rtype & TypeMask].deleteFunc)(res->value, res->id);
free(res);
if (*eltptr != elements)
prev = head; /* prev may no longer be valid */
@@ -594,7 +631,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
CallResourceStateCallback(ResourceStateFreeing, res);
if (!skipFree)
- (*DeleteFuncs[type & TypeMask])(res->value, res->id);
+ (*resourceTypes[type & TypeMask].deleteFunc)(res->value, res->id);
free(res);
break;
}
@@ -761,7 +798,7 @@ FreeClientNeverRetainResources(ClientPtr client)
CallResourceStateCallback(ResourceStateFreeing, this);
elements = *eltptr;
- (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
+ (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id);
free(this);
if (*eltptr != elements)
prev = &resources[j]; /* prev may no longer be valid */
@@ -815,7 +852,7 @@ FreeClientResources(ClientPtr client)
CallResourceStateCallback(ResourceStateFreeing, this);
- (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
+ (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id);
free(this);
}
}
@@ -873,6 +910,8 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
ResourcePtr res = NULL;
*result = NULL;
+ if ((rtype & TypeMask) > lastResourceType)
+ return BadImplementation;
if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
res = clientTable[cid].resources[Hash(cid, id)];
@@ -882,12 +921,14 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
break;
}
if (!res)
- return BadValue;
+ return resourceTypes[rtype & TypeMask].errorValue;
if (client) {
client->errorValue = id;
cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type,
res->value, RT_NONE, NULL, mode);
+ if (cid == BadValue)
+ return resourceTypes[rtype & TypeMask].errorValue;
if (cid != Success)
return cid;
}
diff --git a/dix/window.c b/dix/window.c
index 20cf45204..00854c6d5 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1056,7 +1056,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
else
{
- error = (rc == BadValue) ? BadPixmap : rc;
+ error = rc;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1116,7 +1116,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
}
else
{
- error = (rc == BadValue) ? BadPixmap : rc;
+ error = rc;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1264,7 +1264,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
client, DixUseAccess);
if (rc != Success)
{
- error = (rc == BadValue) ? BadColor : rc;
+ error = rc;
client->errorValue = cmap;
goto PatchUp;
}
@@ -1340,7 +1340,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
RT_CURSOR, client, DixUseAccess);
if (rc != Success)
{
- error = (rc == BadValue) ? BadCursor : rc;
+ error = rc;
client->errorValue = cursorID;
goto PatchUp;
}
diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 6587af947..906f4d5fc 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -436,7 +436,7 @@ ProcXDGAInstallColormap(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, RT_COLORMAP,
client, DixInstallAccess);
if (rc != Success)
- return (rc == BadValue) ? BadColor : rc;
+ return rc;
DGAInstallCmap(cmap);
return Success;
}
@@ -878,7 +878,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
DGAInstallCmap(pcmp);
return Success;
} else {
- return (rc == BadValue) ? BadColor : rc;
+ return rc;
}
}
diff --git a/render/picture.c b/render/picture.c
index aab939100..86e2e0f30 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1176,7 +1176,6 @@ ChangePicture (PicturePtr pPicture,
if (error != Success)
{
client->errorValue = pid;
- error = (error == BadValue) ? BadPixmap : error;
break;
}
}
diff --git a/render/render.c b/render/render.c
index 9aabcfb20..fc6dbb1f2 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1856,7 +1856,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
if (ret != Success)
{
free(cursors);
- return (ret == BadValue) ? BadCursor : ret;
+ return ret;
}
deltas[i] = elt->delay;
elt++;
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;