diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-04-24 23:56:36 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-05-19 12:32:48 -0700 |
commit | c38552d115e3bc71ad6179a8ad0d68778e943793 (patch) | |
tree | af6a02d6e34896c2a91b49ba568dab6bbad8b7d8 /Xext | |
parent | e291c561821ae86b7dd74269d5cd29bc31703962 (diff) |
Add typed resource-lookup errors for non-core resource types.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/panoramiX.c | 4 | ||||
-rw-r--r-- | Xext/panoramiXprocs.c | 122 | ||||
-rw-r--r-- | Xext/saver.c | 6 | ||||
-rw-r--r-- | Xext/security.c | 5 | ||||
-rw-r--r-- | Xext/shape.c | 12 | ||||
-rw-r--r-- | Xext/shm.c | 5 | ||||
-rw-r--r-- | Xext/sync.c | 19 | ||||
-rw-r--r-- | Xext/xvdisp.c | 24 | ||||
-rw-r--r-- | Xext/xvdix.h | 2 | ||||
-rw-r--r-- | Xext/xvmain.c | 1 | ||||
-rw-r--r-- | Xext/xvmc.c | 15 |
11 files changed, 113 insertions, 102 deletions
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 31286d41f..edcbb49d5 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -519,6 +519,10 @@ void PanoramiXExtensionInit(int argc, char *argv[]) panoramiXGeneration = serverGeneration; success = TRUE; } + SetResourceTypeErrorValue(XRT_WINDOW, BadWindow); + SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap); + SetResourceTypeErrorValue(XRT_GC, BadGC); + SetResourceTypeErrorValue(XRT_COLORMAP, BadColor); } if (!success) { diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index dbaae26c4..8752ca519 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -74,7 +74,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(stuff->class == CopyFromParent) stuff->class = parent->u.win.class; @@ -89,7 +89,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & CWBorderPixmap) { @@ -99,7 +99,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & CWColormap) { @@ -109,7 +109,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; } } @@ -179,7 +179,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if((win->u.win.class == InputOnly) && (stuff->valueMask & (~INPUTONLY_LEGAL_MASK))) @@ -192,7 +192,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->valueMask & CWBorderPixmap) { @@ -202,7 +202,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->valueMask & CWColormap) { @@ -212,7 +212,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; } } @@ -242,7 +242,7 @@ int PanoramiXDestroyWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; @@ -268,7 +268,7 @@ int PanoramiXDestroySubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; @@ -294,7 +294,7 @@ int PanoramiXChangeSaveSet(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; @@ -319,12 +319,12 @@ int PanoramiXReparentWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; result = dixLookupResourceByType((pointer *)&parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; x = stuff->x; y = stuff->y; @@ -356,7 +356,7 @@ int PanoramiXMapWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -379,7 +379,7 @@ int PanoramiXMapSubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -402,7 +402,7 @@ int PanoramiXUnmapWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -425,7 +425,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -462,7 +462,7 @@ int PanoramiXConfigureWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if ((Mask)stuff->mask & CWSibling) { XID tmp; @@ -471,7 +471,7 @@ int PanoramiXConfigureWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; } } @@ -517,7 +517,7 @@ int PanoramiXCirculateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; @@ -697,7 +697,7 @@ int PanoramiXFreePixmap(ClientPtr client) result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = pix->info[j].id; @@ -742,7 +742,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCStipple) { @@ -751,7 +751,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCClipMask) { @@ -760,7 +760,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } @@ -813,7 +813,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); @@ -821,7 +821,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCStipple) { @@ -830,7 +830,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCClipMask) { @@ -839,7 +839,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } @@ -871,12 +871,12 @@ int PanoramiXCopyGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&srcGC, stuff->srcGC, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS(j) { stuff->srcGC = srcGC->info[j].id; @@ -900,7 +900,7 @@ int PanoramiXSetDashes(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; @@ -923,7 +923,7 @@ int PanoramiXSetClipRectangles(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; @@ -946,7 +946,7 @@ int PanoramiXFreeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = gc->info[j].id; @@ -973,7 +973,7 @@ int PanoramiXClearToBackground(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; x = stuff->x; y = stuff->y; @@ -1033,7 +1033,7 @@ int PanoramiXCopyArea(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; @@ -1188,7 +1188,7 @@ int PanoramiXCopyPlane(ClientPtr client) rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? BadGC : rc; + return rc; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; @@ -1285,7 +1285,7 @@ int PanoramiXPolyPoint(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq)); @@ -1345,7 +1345,7 @@ int PanoramiXPolyLine(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq)); @@ -1405,7 +1405,7 @@ int PanoramiXPolySegment(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1468,7 +1468,7 @@ int PanoramiXPolyRectangle(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1530,7 +1530,7 @@ int PanoramiXPolyArc(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1590,7 +1590,7 @@ int PanoramiXFillPoly(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1651,7 +1651,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1712,7 +1712,7 @@ int PanoramiXPolyFillArc(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1772,7 +1772,7 @@ int PanoramiXPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1973,7 +1973,7 @@ PanoramiXPolyText8(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2014,7 +2014,7 @@ PanoramiXPolyText16(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2055,7 +2055,7 @@ int PanoramiXImageText8(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2096,7 +2096,7 @@ int PanoramiXImageText16(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2128,7 +2128,7 @@ int PanoramiXCreateColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(!(newCmap = malloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2169,7 +2169,7 @@ int PanoramiXFreeColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; @@ -2199,7 +2199,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) XRT_COLORMAP, client, DixReadAccess | DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; if(!(newCmap = malloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2238,7 +2238,7 @@ int PanoramiXInstallColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->id = cmap->info[j].id; @@ -2262,7 +2262,7 @@ int PanoramiXUninstallColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; @@ -2286,7 +2286,7 @@ int PanoramiXAllocColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2310,7 +2310,7 @@ int PanoramiXAllocNamedColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2334,7 +2334,7 @@ int PanoramiXAllocColorCells(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2358,7 +2358,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2383,7 +2383,7 @@ int PanoramiXFreeColors(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->cmap = cmap->info[j].id; @@ -2406,7 +2406,7 @@ int PanoramiXStoreColors(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2430,7 +2430,7 @@ int PanoramiXStoreNamedColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; diff --git a/Xext/saver.c b/Xext/saver.c index 63a41d6d7..fdcbac567 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -1272,7 +1272,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_PIXMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadPixmap : status; + return status; } } @@ -1284,7 +1284,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_PIXMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadPixmap : status; + return status; } } @@ -1296,7 +1296,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_COLORMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadColor : status; + return status; } } diff --git a/Xext/security.c b/Xext/security.c index 32730e20d..e58ba10f8 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -623,8 +623,7 @@ ProcSecurityRevokeAuthorization( SecurityAuthorizationResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? - SecurityErrorBase + XSecurityBadAuthorization : rc; + return rc; FreeResource(stuff->authId, RT_NONE); return Success; @@ -1140,6 +1139,8 @@ SecurityExtensionInit(INITARGS) EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; + SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization); + /* Label objects that were created before we could register ourself */ SecurityLabelInitial(); } diff --git a/Xext/shape.c b/Xext/shape.c index f49e9a02b..93e4703e9 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -360,7 +360,7 @@ ProcPanoramiXShapeRectangles( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -459,13 +459,13 @@ ProcPanoramiXShapeMask( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(stuff->src != None) { result = dixLookupResourceByType((pointer *)&pmap, stuff->src, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } else pmap = NULL; @@ -589,12 +589,12 @@ ProcPanoramiXShapeCombine( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -663,7 +663,7 @@ ProcPanoramiXShapeOffset( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; diff --git a/Xext/shm.c b/Xext/shm.c index b2c42083e..3d9c63352 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -156,7 +156,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL}; rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ client, DixReadAccess); \ if (rc != Success) \ - return (rc == BadValue) ? BadShmSegCode : rc; \ + return rc; \ } #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ @@ -286,6 +286,7 @@ ShmExtensionInit(INITARGS) ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; + SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } } @@ -584,7 +585,7 @@ ProcPanoramiXShmPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; diff --git a/Xext/sync.c b/Xext/sync.c index f7ac405dd..a51262a99 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -264,7 +264,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter, counter, RTCounter, client, DixReadAccess))) { client->errorValue = counter; - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; } if (pCounter != pTrigger->pCounter) { /* new counter for trigger */ @@ -1328,7 +1328,7 @@ ProcSyncSetCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1358,7 +1358,7 @@ ProcSyncChangeCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1393,7 +1393,7 @@ ProcSyncDestroyCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1536,7 +1536,7 @@ ProcSyncQueryCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; rep.type = X_Reply; rep.length = 0; @@ -1660,7 +1660,7 @@ ProcSyncChangeAlarm(ClientPtr client) status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixWriteAccess); if (status != Success) - return (status == BadValue) ? SyncErrorBase + XSyncBadAlarm : status; + return status; vmask = stuff->valueMask; len = client->req_len - bytes_to_int32(sizeof(xSyncChangeAlarmReq)); @@ -1699,7 +1699,7 @@ ProcSyncQueryAlarm(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; + return rc; rep.type = X_Reply; rep.length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)); @@ -1756,7 +1756,7 @@ ProcSyncDestroyAlarm(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; + return rc; FreeResource(stuff->alarm, RT_NONE); return Success; @@ -2127,6 +2127,9 @@ SyncExtensionInit(void) EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent; + SetResourceTypeErrorValue(RTCounter, SyncErrorBase + XSyncBadCounter); + SetResourceTypeErrorValue(RTAlarm, SyncErrorBase + XSyncBadAlarm); + /* * Although SERVERTIME is implemented by the OS layer, we initialise it * here because doing it in OsInit() is too early. The resource database diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 250a9949a..d7338ad87 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1025,7 +1025,6 @@ typedef struct _ShmDesc { } ShmDescRec, *ShmDescPtr; extern RESTYPE ShmSegType; -extern int BadShmSegCode; extern int ShmCompletionCode; static int @@ -1077,7 +1076,7 @@ ProcXvShmPutImage(ClientPtr client) status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg, ShmSegType, serverClient, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadShmSegCode : status; + return status; width = stuff->width; height = stuff->height; @@ -1615,7 +1614,7 @@ XineramaXvStopVideo(ClientPtr client) result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { @@ -1640,7 +1639,7 @@ XineramaXvSetPortAttribute(ClientPtr client) result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { @@ -1671,12 +1670,12 @@ XineramaXvShmPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1723,12 +1722,12 @@ XineramaXvPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1771,12 +1770,12 @@ XineramaXvPutVideo(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1819,12 +1818,12 @@ XineramaXvPutStill(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1910,6 +1909,7 @@ void XineramifyXv(void) XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort"); if (!xvsp0 || !XvXRTPort) return; + SetResourceTypeErrorValue(XvXRTPort, _XvBadPort); for(i = 0; i < xvsp0->nAdaptors; i++) { Bool isOverlay; diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 44f8f6b18..a2106150e 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -206,7 +206,7 @@ typedef struct _XvPortRec { int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\ XvRTPort, client, mode);\ if (rc != Success)\ - return (rc == BadValue) ? _XvBadPort : rc;\ + return rc;\ } typedef struct { diff --git a/Xext/xvmain.c b/Xext/xvmain.c index f6d39d030..9a367bd4c 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -192,6 +192,7 @@ XvExtensionInit(void) EventSwapVector[XvEventBase+XvPortNotify] = (EventSwapPtr)WriteSwappedPortNotifyEvent; + SetResourceTypeErrorValue(XvRTPort, _XvBadPort); (void)MakeAtom(XvName, strlen(XvName), xTrue); } diff --git a/Xext/xvmc.c b/Xext/xvmc.c index abb8e0250..755038631 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -40,7 +40,6 @@ unsigned long XvMCGeneration = 0; int XvMCReqCode; int XvMCEventBase; -int XvMCErrorBase; unsigned long XvMCRTContext; unsigned long XvMCRTSurface; @@ -276,7 +275,7 @@ ProcXvMCDestroyContext(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadContext + XvMCErrorBase : rc; + return rc; FreeResource(stuff->context_id, RT_NONE); @@ -299,7 +298,7 @@ ProcXvMCCreateSurface(ClientPtr client) result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) - return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; + return result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -346,7 +345,7 @@ ProcXvMCDestroySurface(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadSurface + XvMCErrorBase : rc; + return rc; FreeResource(stuff->surface_id, RT_NONE); @@ -371,7 +370,7 @@ ProcXvMCCreateSubpicture(ClientPtr client) result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) - return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; + return result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -463,7 +462,7 @@ ProcXvMCDestroySubpicture(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadSubpicture + XvMCErrorBase : rc; + return rc; FreeResource(stuff->subpicture_id, RT_NONE); @@ -694,7 +693,9 @@ XvMCExtensionInit(void) XvMCReqCode = extEntry->base; XvMCEventBase = extEntry->eventBase; - XvMCErrorBase = extEntry->errorBase; + SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext); + SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface); + SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture); } static Bool |