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>
This commit is contained in:
Jamey Sharp 2010-04-24 23:56:36 -07:00
parent e291c56182
commit c38552d115
26 changed files with 169 additions and 137 deletions

View File

@ -519,6 +519,10 @@ void PanoramiXExtensionInit(int argc, char *argv[])
panoramiXGeneration = serverGeneration; panoramiXGeneration = serverGeneration;
success = TRUE; success = TRUE;
} }
SetResourceTypeErrorValue(XRT_WINDOW, BadWindow);
SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap);
SetResourceTypeErrorValue(XRT_GC, BadGC);
SetResourceTypeErrorValue(XRT_COLORMAP, BadColor);
} }
if (!success) { if (!success) {

View File

@ -74,7 +74,7 @@ int PanoramiXCreateWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&parent, stuff->parent, result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
if(stuff->class == CopyFromParent) if(stuff->class == CopyFromParent)
stuff->class = parent->u.win.class; stuff->class = parent->u.win.class;
@ -89,7 +89,7 @@ int PanoramiXCreateWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&backPix, tmp, result = dixLookupResourceByType((pointer *)&backPix, tmp,
XRT_PIXMAP, client, DixReadAccess); XRT_PIXMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & CWBorderPixmap) { if ((Mask)stuff->mask & CWBorderPixmap) {
@ -99,7 +99,7 @@ int PanoramiXCreateWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&bordPix, tmp, result = dixLookupResourceByType((pointer *)&bordPix, tmp,
XRT_PIXMAP, client, DixReadAccess); XRT_PIXMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & CWColormap) { if ((Mask)stuff->mask & CWColormap) {
@ -109,7 +109,7 @@ int PanoramiXCreateWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, tmp, result = dixLookupResourceByType((pointer *)&cmap, tmp,
XRT_COLORMAP, client, DixReadAccess); XRT_COLORMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
} }
} }
@ -179,7 +179,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
if((win->u.win.class == InputOnly) && if((win->u.win.class == InputOnly) &&
(stuff->valueMask & (~INPUTONLY_LEGAL_MASK))) (stuff->valueMask & (~INPUTONLY_LEGAL_MASK)))
@ -192,7 +192,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&backPix, tmp, result = dixLookupResourceByType((pointer *)&backPix, tmp,
XRT_PIXMAP, client, DixReadAccess); XRT_PIXMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->valueMask & CWBorderPixmap) { if ((Mask)stuff->valueMask & CWBorderPixmap) {
@ -202,7 +202,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&bordPix, tmp, result = dixLookupResourceByType((pointer *)&bordPix, tmp,
XRT_PIXMAP, client, DixReadAccess); XRT_PIXMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->valueMask & CWColormap) { if ((Mask)stuff->valueMask & CWColormap) {
@ -212,7 +212,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, tmp, result = dixLookupResourceByType((pointer *)&cmap, tmp,
XRT_COLORMAP, client, DixReadAccess); XRT_COLORMAP, client, DixReadAccess);
if (result != Success) 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, result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
client, DixDestroyAccess); client, DixDestroyAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -268,7 +268,7 @@ int PanoramiXDestroySubwindows(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW,
client, DixDestroyAccess); client, DixDestroyAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -294,7 +294,7 @@ int PanoramiXChangeSaveSet(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id; stuff->window = win->info[j].id;
@ -319,12 +319,12 @@ int PanoramiXReparentWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
result = dixLookupResourceByType((pointer *)&parent, stuff->parent, result = dixLookupResourceByType((pointer *)&parent, stuff->parent,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
x = stuff->x; x = stuff->x;
y = stuff->y; y = stuff->y;
@ -356,7 +356,7 @@ int PanoramiXMapWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->id, result = dixLookupResourceByType((pointer *)&win, stuff->id,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -379,7 +379,7 @@ int PanoramiXMapSubwindows(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->id, result = dixLookupResourceByType((pointer *)&win, stuff->id,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -402,7 +402,7 @@ int PanoramiXUnmapWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->id, result = dixLookupResourceByType((pointer *)&win, stuff->id,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -425,7 +425,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->id, result = dixLookupResourceByType((pointer *)&win, stuff->id,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
stuff->id = win->info[j].id; stuff->id = win->info[j].id;
@ -462,7 +462,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
if ((Mask)stuff->mask & CWSibling) { if ((Mask)stuff->mask & CWSibling) {
XID tmp; XID tmp;
@ -471,7 +471,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
} }
} }
@ -517,7 +517,7 @@ int PanoramiXCirculateWindow(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS_FORWARD(j) { FOR_NSCREENS_FORWARD(j) {
stuff->window = win->info[j].id; stuff->window = win->info[j].id;
@ -697,7 +697,7 @@ int PanoramiXFreePixmap(ClientPtr client)
result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP,
client, DixDestroyAccess); client, DixDestroyAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = pix->info[j].id; stuff->id = pix->info[j].id;
@ -742,7 +742,7 @@ int PanoramiXCreateGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & GCStipple) { if ((Mask)stuff->mask & GCStipple) {
@ -751,7 +751,7 @@ int PanoramiXCreateGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & GCClipMask) { if ((Mask)stuff->mask & GCClipMask) {
@ -760,7 +760,7 @@ int PanoramiXCreateGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
if ((Mask)stuff->mask & GCTile) { if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
@ -821,7 +821,7 @@ int PanoramiXChangeGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & GCStipple) { if ((Mask)stuff->mask & GCStipple) {
@ -830,7 +830,7 @@ int PanoramiXChangeGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} }
} }
if ((Mask)stuff->mask & GCClipMask) { if ((Mask)stuff->mask & GCClipMask) {
@ -839,7 +839,7 @@ int PanoramiXChangeGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) 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, result = dixLookupResourceByType((pointer *)&srcGC, stuff->srcGC, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC, result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
FOR_NSCREENS(j) { FOR_NSCREENS(j) {
stuff->srcGC = srcGC->info[j].id; stuff->srcGC = srcGC->info[j].id;
@ -900,7 +900,7 @@ int PanoramiXSetDashes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id; stuff->gc = gc->info[j].id;
@ -923,7 +923,7 @@ int PanoramiXSetClipRectangles(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id; stuff->gc = gc->info[j].id;
@ -946,7 +946,7 @@ int PanoramiXFreeGC(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC,
client, DixDestroyAccess); client, DixDestroyAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = gc->info[j].id; stuff->id = gc->info[j].id;
@ -973,7 +973,7 @@ int PanoramiXClearToBackground(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixWriteAccess); XRT_WINDOW, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
x = stuff->x; x = stuff->x;
y = stuff->y; y = stuff->y;
@ -1033,7 +1033,7 @@ int PanoramiXCopyArea(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
if((dst->type == XRT_WINDOW) && dst->u.win.root) if((dst->type == XRT_WINDOW) && dst->u.win.root)
dstIsRoot = TRUE; dstIsRoot = TRUE;
@ -1188,7 +1188,7 @@ int PanoramiXCopyPlane(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? BadGC : rc; return rc;
if((dst->type == XRT_WINDOW) && dst->u.win.root) if((dst->type == XRT_WINDOW) && dst->u.win.root)
dstIsRoot = TRUE; dstIsRoot = TRUE;
@ -1285,7 +1285,7 @@ int PanoramiXPolyPoint(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq)); 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq)); 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1973,7 +1973,7 @@ PanoramiXPolyText8(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2014,7 +2014,7 @@ PanoramiXPolyText16(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; 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, result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -2128,7 +2128,7 @@ int PanoramiXCreateColormap(ClientPtr client)
result = dixLookupResourceByType((pointer *)&win, stuff->window, result = dixLookupResourceByType((pointer *)&win, stuff->window,
XRT_WINDOW, client, DixReadAccess); XRT_WINDOW, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
if(!(newCmap = malloc(sizeof(PanoramiXRes)))) if(!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
@ -2169,7 +2169,7 @@ int PanoramiXFreeColormap(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
client, DixDestroyAccess); client, DixDestroyAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = cmap->info[j].id; stuff->id = cmap->info[j].id;
@ -2199,7 +2199,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
XRT_COLORMAP, client, XRT_COLORMAP, client,
DixReadAccess | DixWriteAccess); DixReadAccess | DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
if(!(newCmap = malloc(sizeof(PanoramiXRes)))) if(!(newCmap = malloc(sizeof(PanoramiXRes))))
return BadAlloc; return BadAlloc;
@ -2238,7 +2238,7 @@ int PanoramiXInstallColormap(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->id = cmap->info[j].id; stuff->id = cmap->info[j].id;
@ -2262,7 +2262,7 @@ int PanoramiXUninstallColormap(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->id = cmap->info[j].id; stuff->id = cmap->info[j].id;
@ -2286,7 +2286,7 @@ int PanoramiXAllocColor(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2310,7 +2310,7 @@ int PanoramiXAllocNamedColor(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2334,7 +2334,7 @@ int PanoramiXAllocColorCells(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2358,7 +2358,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2383,7 +2383,7 @@ int PanoramiXFreeColors(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2406,7 +2406,7 @@ int PanoramiXStoreColors(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;
@ -2430,7 +2430,7 @@ int PanoramiXStoreNamedColor(ClientPtr client)
result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap,
XRT_COLORMAP, client, DixWriteAccess); XRT_COLORMAP, client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadColor : result; return result;
FOR_NSCREENS_BACKWARD(j){ FOR_NSCREENS_BACKWARD(j){
stuff->cmap = cmap->info[j].id; stuff->cmap = cmap->info[j].id;

View File

@ -1272,7 +1272,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
XRT_PIXMAP, client, XRT_PIXMAP, client,
DixReadAccess); DixReadAccess);
if (status != Success) if (status != Success)
return (status == BadValue) ? BadPixmap : status; return status;
} }
} }
@ -1284,7 +1284,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
XRT_PIXMAP, client, XRT_PIXMAP, client,
DixReadAccess); DixReadAccess);
if (status != Success) if (status != Success)
return (status == BadValue) ? BadPixmap : status; return status;
} }
} }
@ -1296,7 +1296,7 @@ ProcScreenSaverSetAttributes (ClientPtr client)
XRT_COLORMAP, client, XRT_COLORMAP, client,
DixReadAccess); DixReadAccess);
if (status != Success) if (status != Success)
return (status == BadValue) ? BadColor : status; return status;
} }
} }

View File

@ -623,8 +623,7 @@ ProcSecurityRevokeAuthorization(
SecurityAuthorizationResType, client, SecurityAuthorizationResType, client,
DixDestroyAccess); DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? return rc;
SecurityErrorBase + XSecurityBadAuthorization : rc;
FreeResource(stuff->authId, RT_NONE); FreeResource(stuff->authId, RT_NONE);
return Success; return Success;
@ -1140,6 +1139,8 @@ SecurityExtensionInit(INITARGS)
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
(EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization);
/* Label objects that were created before we could register ourself */ /* Label objects that were created before we could register ourself */
SecurityLabelInitial(); SecurityLabelInitial();
} }

View File

@ -360,7 +360,7 @@ ProcPanoramiXShapeRectangles(
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS(j) { FOR_NSCREENS(j) {
stuff->dest = win->info[j].id; stuff->dest = win->info[j].id;
@ -459,13 +459,13 @@ ProcPanoramiXShapeMask(
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
if(stuff->src != None) { if(stuff->src != None) {
result = dixLookupResourceByType((pointer *)&pmap, stuff->src, result = dixLookupResourceByType((pointer *)&pmap, stuff->src,
XRT_PIXMAP, client, DixReadAccess); XRT_PIXMAP, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadPixmap : result; return result;
} else } else
pmap = NULL; pmap = NULL;
@ -589,12 +589,12 @@ ProcPanoramiXShapeCombine(
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW,
client, DixReadAccess); client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS(j) { FOR_NSCREENS(j) {
stuff->dest = win->info[j].id; stuff->dest = win->info[j].id;
@ -663,7 +663,7 @@ ProcPanoramiXShapeOffset(
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
client, DixWriteAccess); client, DixWriteAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadWindow : result; return result;
FOR_NSCREENS(j) { FOR_NSCREENS(j) {
stuff->dest = win->info[j].id; stuff->dest = win->info[j].id;

View File

@ -156,7 +156,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
client, DixReadAccess); \ client, DixReadAccess); \
if (rc != Success) \ if (rc != Success) \
return (rc == BadValue) ? BadShmSegCode : rc; \ return rc; \
} }
#define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
@ -286,6 +286,7 @@ ShmExtensionInit(INITARGS)
ShmReqCode = (unsigned char)extEntry->base; ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase; ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase; BadShmSegCode = extEntry->errorBase;
SetResourceTypeErrorValue(ShmSegType, BadShmSegCode);
EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
} }
} }
@ -584,7 +585,7 @@ ProcPanoramiXShmPutImage(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
XRT_GC, client, DixReadAccess); XRT_GC, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;

View File

@ -264,7 +264,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter,
counter, RTCounter, client, DixReadAccess))) counter, RTCounter, client, DixReadAccess)))
{ {
client->errorValue = counter; client->errorValue = counter;
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; return rc;
} }
if (pCounter != pTrigger->pCounter) if (pCounter != pTrigger->pCounter)
{ /* new counter for trigger */ { /* new counter for trigger */
@ -1328,7 +1328,7 @@ ProcSyncSetCounter(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
client, DixWriteAccess); client, DixWriteAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; return rc;
if (IsSystemCounter(pCounter)) if (IsSystemCounter(pCounter))
{ {
@ -1358,7 +1358,7 @@ ProcSyncChangeCounter(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
client, DixWriteAccess); client, DixWriteAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; return rc;
if (IsSystemCounter(pCounter)) if (IsSystemCounter(pCounter))
{ {
@ -1393,7 +1393,7 @@ ProcSyncDestroyCounter(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter, rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; return rc;
if (IsSystemCounter(pCounter)) if (IsSystemCounter(pCounter))
{ {
@ -1536,7 +1536,7 @@ ProcSyncQueryCounter(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter,
RTCounter, client, DixReadAccess); RTCounter, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; return rc;
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
@ -1660,7 +1660,7 @@ ProcSyncChangeAlarm(ClientPtr client)
status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
client, DixWriteAccess); client, DixWriteAccess);
if (status != Success) if (status != Success)
return (status == BadValue) ? SyncErrorBase + XSyncBadAlarm : status; return status;
vmask = stuff->valueMask; vmask = stuff->valueMask;
len = client->req_len - bytes_to_int32(sizeof(xSyncChangeAlarmReq)); len = client->req_len - bytes_to_int32(sizeof(xSyncChangeAlarmReq));
@ -1699,7 +1699,7 @@ ProcSyncQueryAlarm(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
client, DixReadAccess); client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; return rc;
rep.type = X_Reply; rep.type = X_Reply;
rep.length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)); rep.length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
@ -1756,7 +1756,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; return rc;
FreeResource(stuff->alarm, RT_NONE); FreeResource(stuff->alarm, RT_NONE);
return Success; return Success;
@ -2127,6 +2127,9 @@ SyncExtensionInit(void)
EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
SetResourceTypeErrorValue(RTCounter, SyncErrorBase + XSyncBadCounter);
SetResourceTypeErrorValue(RTAlarm, SyncErrorBase + XSyncBadAlarm);
/* /*
* Although SERVERTIME is implemented by the OS layer, we initialise it * Although SERVERTIME is implemented by the OS layer, we initialise it
* here because doing it in OsInit() is too early. The resource database * here because doing it in OsInit() is too early. The resource database

View File

@ -1025,7 +1025,6 @@ typedef struct _ShmDesc {
} ShmDescRec, *ShmDescPtr; } ShmDescRec, *ShmDescPtr;
extern RESTYPE ShmSegType; extern RESTYPE ShmSegType;
extern int BadShmSegCode;
extern int ShmCompletionCode; extern int ShmCompletionCode;
static int static int
@ -1077,7 +1076,7 @@ ProcXvShmPutImage(ClientPtr client)
status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg, status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg,
ShmSegType, serverClient, DixReadAccess); ShmSegType, serverClient, DixReadAccess);
if (status != Success) if (status != Success)
return (status == BadValue) ? BadShmSegCode : status; return status;
width = stuff->width; width = stuff->width;
height = stuff->height; height = stuff->height;
@ -1615,7 +1614,7 @@ XineramaXvStopVideo(ClientPtr client)
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
FOR_NSCREENS_BACKWARD(i) { FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) { if(port->info[i].id) {
@ -1640,7 +1639,7 @@ XineramaXvSetPortAttribute(ClientPtr client)
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
FOR_NSCREENS_BACKWARD(i) { FOR_NSCREENS_BACKWARD(i) {
if(port->info[i].id) { if(port->info[i].id) {
@ -1671,12 +1670,12 @@ XineramaXvShmPutImage(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
XRT_GC, client, DixReadAccess); XRT_GC, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1723,12 +1722,12 @@ XineramaXvPutImage(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
XRT_GC, client, DixReadAccess); XRT_GC, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1771,12 +1770,12 @@ XineramaXvPutVideo(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
XRT_GC, client, DixReadAccess); XRT_GC, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1819,12 +1818,12 @@ XineramaXvPutStill(ClientPtr client)
result = dixLookupResourceByType((pointer *)&gc, stuff->gc, result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
XRT_GC, client, DixReadAccess); XRT_GC, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? BadGC : result; return result;
result = dixLookupResourceByType((pointer *)&port, stuff->port, result = dixLookupResourceByType((pointer *)&port, stuff->port,
XvXRTPort, client, DixReadAccess); XvXRTPort, client, DixReadAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? _XvBadPort : result; return result;
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
@ -1910,6 +1909,7 @@ void XineramifyXv(void)
XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort"); XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
if (!xvsp0 || !XvXRTPort) return; if (!xvsp0 || !XvXRTPort) return;
SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
for(i = 0; i < xvsp0->nAdaptors; i++) { for(i = 0; i < xvsp0->nAdaptors; i++) {
Bool isOverlay; Bool isOverlay;

View File

@ -206,7 +206,7 @@ typedef struct _XvPortRec {
int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\ int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
XvRTPort, client, mode);\ XvRTPort, client, mode);\
if (rc != Success)\ if (rc != Success)\
return (rc == BadValue) ? _XvBadPort : rc;\ return rc;\
} }
typedef struct { typedef struct {

View File

@ -192,6 +192,7 @@ XvExtensionInit(void)
EventSwapVector[XvEventBase+XvPortNotify] = EventSwapVector[XvEventBase+XvPortNotify] =
(EventSwapPtr)WriteSwappedPortNotifyEvent; (EventSwapPtr)WriteSwappedPortNotifyEvent;
SetResourceTypeErrorValue(XvRTPort, _XvBadPort);
(void)MakeAtom(XvName, strlen(XvName), xTrue); (void)MakeAtom(XvName, strlen(XvName), xTrue);
} }

View File

@ -40,7 +40,6 @@ unsigned long XvMCGeneration = 0;
int XvMCReqCode; int XvMCReqCode;
int XvMCEventBase; int XvMCEventBase;
int XvMCErrorBase;
unsigned long XvMCRTContext; unsigned long XvMCRTContext;
unsigned long XvMCRTSurface; unsigned long XvMCRTSurface;
@ -276,7 +275,7 @@ ProcXvMCDestroyContext(ClientPtr client)
rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext, rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? XvMCBadContext + XvMCErrorBase : rc; return rc;
FreeResource(stuff->context_id, RT_NONE); FreeResource(stuff->context_id, RT_NONE);
@ -299,7 +298,7 @@ ProcXvMCCreateSurface(ClientPtr client)
result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess); XvMCRTContext, client, DixUseAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; return result;
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
@ -346,7 +345,7 @@ ProcXvMCDestroySurface(ClientPtr client)
rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface, rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? XvMCBadSurface + XvMCErrorBase : rc; return rc;
FreeResource(stuff->surface_id, RT_NONE); FreeResource(stuff->surface_id, RT_NONE);
@ -371,7 +370,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
XvMCRTContext, client, DixUseAccess); XvMCRTContext, client, DixUseAccess);
if (result != Success) if (result != Success)
return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; return result;
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
@ -463,7 +462,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture, rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? XvMCBadSubpicture + XvMCErrorBase : rc; return rc;
FreeResource(stuff->subpicture_id, RT_NONE); FreeResource(stuff->subpicture_id, RT_NONE);
@ -694,7 +693,9 @@ XvMCExtensionInit(void)
XvMCReqCode = extEntry->base; XvMCReqCode = extEntry->base;
XvMCEventBase = extEntry->eventBase; XvMCEventBase = extEntry->eventBase;
XvMCErrorBase = extEntry->errorBase; SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext);
SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface);
SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture);
} }
static Bool static Bool

View File

@ -29,7 +29,6 @@
static unsigned char DamageReqCode; static unsigned char DamageReqCode;
static int DamageEventBase; static int DamageEventBase;
static int DamageErrorBase;
static RESTYPE DamageExtType; static RESTYPE DamageExtType;
static RESTYPE DamageExtWinType; static RESTYPE DamageExtWinType;
@ -515,8 +514,8 @@ DamageExtensionInit(void)
{ {
DamageReqCode = (unsigned char)extEntry->base; DamageReqCode = (unsigned char)extEntry->base;
DamageEventBase = extEntry->eventBase; DamageEventBase = extEntry->eventBase;
DamageErrorBase = extEntry->errorBase;
EventSwapVector[DamageEventBase + XDamageNotify] = EventSwapVector[DamageEventBase + XDamageNotify] =
(EventSwapPtr) SDamageNotifyEvent; (EventSwapPtr) SDamageNotifyEvent;
SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage);
} }
} }

View File

@ -62,7 +62,7 @@ typedef struct _DamageExt {
int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \ int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \
DamageExtType, client, mode); \ DamageExtType, client, mode); \
if (rc != Success) \ if (rc != Success) \
return (rc == BadValue) ? DamageErrorBase + BadDamage : rc; \ return rc; \
} }
void void

View File

@ -422,12 +422,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
dbeWindowPrivResType, client, dbeWindowPrivResType, client,
DixDestroyAccess); DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; return rc;
rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType, rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType,
client, DixDestroyAccess); client, DixDestroyAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; return rc;
/* Make sure that the id is valid for the window. /* Make sure that the id is valid for the window.
* This is paranoid code since we already looked up the ID by type * This is paranoid code since we already looked up the ID by type
@ -1672,6 +1672,8 @@ DbeExtensionInit(void)
DbeResetProc, StandardMinorOpcode); DbeResetProc, StandardMinorOpcode);
dbeErrorBase = extEntry->errorBase; dbeErrorBase = extEntry->errorBase;
SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
} /* DbeExtensionInit() */ } /* DbeExtensionInit() */

View File

@ -268,6 +268,12 @@ CreateNewResourceType(DeleteType deleteFunc, char *name)
return next; return next;
} }
void
SetResourceTypeErrorValue(RESTYPE type, int errorValue)
{
resourceTypes[type & TypeMask].errorValue = errorValue;
}
RESTYPE RESTYPE
CreateNewResourceClass(void) CreateNewResourceClass(void)
{ {

View File

@ -157,6 +157,9 @@ typedef Bool (*FindComplexResType)(
extern _X_EXPORT RESTYPE CreateNewResourceType( extern _X_EXPORT RESTYPE CreateNewResourceType(
DeleteType /*deleteFunc*/, char * /*name*/); DeleteType /*deleteFunc*/, char * /*name*/);
extern _X_EXPORT void SetResourceTypeErrorValue(
RESTYPE /*type*/, int /*errorValue*/);
extern _X_EXPORT RESTYPE CreateNewResourceClass(void); extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
extern _X_EXPORT Bool InitClientResources( extern _X_EXPORT Bool InitClientResources(

View File

@ -344,7 +344,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
RROutputType, client, a);\ RROutputType, client, a);\
if (rc != Success) {\ if (rc != Success) {\
client->errorValue = id;\ client->errorValue = id;\
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;\ return rc;\
}\ }\
} }
@ -354,7 +354,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
RRCrtcType, client, a);\ RRCrtcType, client, a);\
if (rc != Success) {\ if (rc != Success) {\
client->errorValue = id;\ client->errorValue = id;\
return (rc == BadValue) ? RRErrorBase + BadRRCrtc : rc;\ return rc;\
}\ }\
} }
@ -364,7 +364,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
RRModeType, client, a);\ RRModeType, client, a);\
if (rc != Success) {\ if (rc != Success) {\
client->errorValue = id;\ client->errorValue = id;\
return (rc == BadValue) ? RRErrorBase + BadRRMode : rc;\ return rc;\
}\ }\
} }

View File

@ -634,6 +634,7 @@ RRCrtcInit (void)
RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC"); RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
if (!RRCrtcType) if (!RRCrtcType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
return TRUE; return TRUE;
} }
@ -806,7 +807,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
{ {
if (outputs) if (outputs)
free(outputs); free(outputs);
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc; return rc;
} }
/* validate crtc for this output */ /* validate crtc for this output */
for (j = 0; j < outputs[i]->numCrtcs; j++) for (j = 0; j < outputs[i]->numCrtcs; j++)

View File

@ -268,6 +268,7 @@ RRModeInit (void)
RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE"); RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
if (!RRModeType) if (!RRModeType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
return TRUE; return TRUE;
} }

View File

@ -423,6 +423,7 @@ RROutputInit (void)
RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT"); RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
if (!RROutputType) if (!RROutputType)
return FALSE; return FALSE;
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
return TRUE; return TRUE;
} }

View File

@ -58,7 +58,6 @@ and Jim Haggerty of Metheus.
#include "protocol-versions.h" #include "protocol-versions.h"
static RESTYPE RTContext; /* internal resource type for Record contexts */ static RESTYPE RTContext; /* internal resource type for Record contexts */
static int RecordErrorBase; /* first Record error number */
/* How many bytes of protocol data to buffer in a context. Don't set to less /* How many bytes of protocol data to buffer in a context. Don't set to less
* than 32. * than 32.
@ -133,7 +132,7 @@ static int numEnabledRCAPs;
int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \ int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
RTContext, _client, DixUseAccess); \ RTContext, _client, DixUseAccess); \
if (rc != Success) \ if (rc != Success) \
return (rc == BadValue) ? RecordErrorBase + XRecordBadContext : rc; \ return rc; \
} }
static int RecordDeleteContext( static int RecordDeleteContext(
@ -2911,7 +2910,7 @@ RecordExtensionInit(void)
DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL); DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
return; return;
} }
RecordErrorBase = extentry->errorBase; SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext);
} /* RecordExtensionInit */ } /* RecordExtensionInit */

View File

@ -1115,7 +1115,6 @@ ChangePicture (PicturePtr pPicture,
if (error != Success) if (error != Success)
{ {
client->errorValue = pid; client->errorValue = pid;
error = (error == BadValue) ? RenderErrBase + BadPicture : error;
break; break;
} }
if (pAlpha->pDrawable == NULL || if (pAlpha->pDrawable == NULL ||

View File

@ -412,7 +412,7 @@ extern _X_EXPORT RESTYPE GlyphSetType;
int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\ int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
PictureType, client, mode);\ PictureType, client, mode);\
if (rc != Success)\ if (rc != Success)\
return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\ return rc;\
} }
#define VERIFY_ALPHA(pPicture, pid, client, mode) {\ #define VERIFY_ALPHA(pPicture, pid, client, mode) {\

View File

@ -233,6 +233,10 @@ RenderClientCallback (CallbackListPtr *list,
pRenderClient->minor_version = 0; pRenderClient->minor_version = 0;
} }
#ifdef PANORAMIX
unsigned long XRT_PICTURE;
#endif
void void
RenderExtensionInit (void) RenderExtensionInit (void)
{ {
@ -253,6 +257,13 @@ RenderExtensionInit (void)
if (!extEntry) if (!extEntry)
return; return;
RenderErrBase = extEntry->errorBase; RenderErrBase = extEntry->errorBase;
#ifdef PANORAMIX
if (XRT_PICTURE)
SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
#endif
SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture);
SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat);
SetResourceTypeErrorValue(GlyphSetType, RenderErrBase + BadGlyphSet);
} }
static int static int
@ -532,7 +543,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
if (pFormat->type != PictTypeIndexed) if (pFormat->type != PictTypeIndexed)
{ {
@ -601,7 +612,7 @@ ProcRenderCreatePicture (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
if (pFormat->depth != pDrawable->depth) if (pFormat->depth != pDrawable->depth)
return BadMatch; return BadMatch;
@ -755,7 +766,7 @@ ProcRenderTrapezoids (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
} }
else else
pFormat = 0; pFormat = 0;
@ -795,7 +806,7 @@ ProcRenderTriangles (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
} }
else else
pFormat = 0; pFormat = 0;
@ -835,7 +846,7 @@ ProcRenderTriStrip (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
} }
else else
pFormat = 0; pFormat = 0;
@ -875,7 +886,7 @@ ProcRenderTriFan (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
} }
else else
pFormat = 0; pFormat = 0;
@ -922,7 +933,7 @@ ProcRenderCreateGlyphSet (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&format, stuff->format, rc = dixLookupResourceByType((pointer *)&format, stuff->format,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
switch (format->depth) { switch (format->depth) {
case 1: case 1:
@ -974,7 +985,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
if (rc != Success) if (rc != Success)
{ {
client->errorValue = stuff->existing; client->errorValue = stuff->existing;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; return rc;
} }
glyphSet->refcnt++; glyphSet->refcnt++;
if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
@ -998,7 +1009,7 @@ ProcRenderFreeGlyphSet (ClientPtr client)
if (rc != Success) if (rc != Success)
{ {
client->errorValue = stuff->glyphset; client->errorValue = stuff->glyphset;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; return rc;
} }
FreeResource (stuff->glyphset, RT_NONE); FreeResource (stuff->glyphset, RT_NONE);
return Success; return Success;
@ -1037,7 +1048,7 @@ ProcRenderAddGlyphs (ClientPtr client)
if (err != Success) if (err != Success)
{ {
client->errorValue = stuff->glyphset; client->errorValue = stuff->glyphset;
return (err == BadValue) ? RenderErrBase + BadGlyphSet : err; return err;
} }
err = BadAlloc; err = BadAlloc;
@ -1238,7 +1249,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
if (rc != Success) if (rc != Success)
{ {
client->errorValue = stuff->glyphset; client->errorValue = stuff->glyphset;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; return rc;
} }
nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)); nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
gids = (CARD32 *) (stuff + 1); gids = (CARD32 *) (stuff + 1);
@ -1300,7 +1311,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess); PictFormatType, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; return rc;
} }
else else
pFormat = 0; pFormat = 0;
@ -1308,7 +1319,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset,
GlyphSetType, client, DixUseAccess); GlyphSetType, client, DixUseAccess);
if (rc != Success) if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; return rc;
buffer = (CARD8 *) (stuff + 1); buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2); end = (CARD8 *) stuff + (client->req_len << 2);
@ -1371,7 +1382,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
free(glyphsBase); free(glyphsBase);
if (listsBase != listsLocal) if (listsBase != listsLocal)
free(listsBase); free(listsBase);
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; return rc;
} }
} }
buffer += 4; buffer += 4;
@ -2639,7 +2650,7 @@ SProcRenderDispatch (ClientPtr client)
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\ int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
XRT_PICTURE, client, mode);\ XRT_PICTURE, client, mode);\
if (rc != Success)\ if (rc != Success)\
return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\ return rc;\
} }
#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\ #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
@ -2652,8 +2663,6 @@ SProcRenderDispatch (ClientPtr client)
int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr); int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr);
unsigned long XRT_PICTURE;
static int static int
PanoramiXRenderCreatePicture (ClientPtr client) PanoramiXRenderCreatePicture (ClientPtr client)
{ {
@ -3330,6 +3339,8 @@ PanoramiXRenderInit (void)
XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource, XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource,
"XineramaPicture"); "XineramaPicture");
if (RenderErrBase)
SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture);
for (i = 0; i < RenderNumberRequests; i++) for (i = 0; i < RenderNumberRequests; i++)
PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; PanoramiXSaveRenderVector[i] = ProcRenderVector[i];
/* /*
@ -3365,6 +3376,7 @@ PanoramiXRenderReset (void)
int i; int i;
for (i = 0; i < RenderNumberRequests; i++) for (i = 0; i < RenderNumberRequests; i++)
ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; ProcRenderVector[i] = PanoramiXSaveRenderVector[i];
RenderErrBase = 0;
} }
#endif /* PANORAMIX */ #endif /* PANORAMIX */

View File

@ -259,5 +259,6 @@ XFixesExtensionInit(void)
(EventSwapPtr) SXFixesSelectionNotifyEvent; (EventSwapPtr) SXFixesSelectionNotifyEvent;
EventSwapVector[XFixesEventBase + XFixesCursorNotify] = EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
(EventSwapPtr) SXFixesCursorNotifyEvent; (EventSwapPtr) SXFixesCursorNotifyEvent;
SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion);
} }
} }

View File

@ -37,10 +37,7 @@ extern _X_EXPORT int XFixesErrorBase;
int err; \ int err; \
err = dixLookupResourceByType((pointer *) &pRegion, rid, \ err = dixLookupResourceByType((pointer *) &pRegion, rid, \
RegionResType, client, mode); \ RegionResType, client, mode); \
if (err == BadValue) { \ if (err != Success) { \
client->errorValue = rid; \
return XFixesErrorBase + BadRegion; \
} else if (err != Success) { \
client->errorValue = rid; \ client->errorValue = rid; \
return err; \ return err; \
} \ } \