Commit c38552d1 authored by Jamey Sharp's avatar Jamey Sharp

Add typed resource-lookup errors for non-core resource types.

Signed-off-by: Jamey Sharp's avatarJamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent e291c561
......@@ -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) {
......
This diff is collapsed.
......@@ -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;
}
}
......
......@@ -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();
}
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
......
......@@ -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 {
......
......@@ -192,6 +192,7 @@ XvExtensionInit(void)
EventSwapVector[XvEventBase+XvPortNotify] =
(EventSwapPtr)WriteSwappedPortNotifyEvent;
SetResourceTypeErrorValue(XvRTPort, _XvBadPort);
(void)MakeAtom(XvName, strlen(XvName), xTrue);
}
......
......@@ -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
......
......@@ -29,7 +29,6 @@
static unsigned char DamageReqCode;
static int DamageEventBase;
static int DamageErrorBase;
static RESTYPE DamageExtType;
static RESTYPE DamageExtWinType;
......@@ -515,8 +514,8 @@ DamageExtensionInit(void)
{
DamageReqCode = (unsigned char)extEntry->base;
DamageEventBase = extEntry->eventBase;
DamageErrorBase = extEntry->errorBase;
EventSwapVector[DamageEventBase + XDamageNotify] =
(EventSwapPtr) SDamageNotifyEvent;
SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage);
}
}
......@@ -62,7 +62,7 @@ typedef struct _DamageExt {
int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \
DamageExtType, client, mode); \
if (rc != Success) \
return (rc == BadValue) ? DamageErrorBase + BadDamage : rc; \
return rc; \
}
void
......
......@@ -422,12 +422,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
dbeWindowPrivResType, client,
DixDestroyAccess);
if (rc != Success)
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc;
return rc;
rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType,
client, DixDestroyAccess);
if (rc != Success)
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc;
return rc;
/* Make sure that the id is valid for the window.
* This is paranoid code since we already looked up the ID by type
......@@ -1672,6 +1672,8 @@ DbeExtensionInit(void)
DbeResetProc, StandardMinorOpcode);
dbeErrorBase = extEntry->errorBase;
SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
} /* DbeExtensionInit() */
......@@ -268,6 +268,12 @@ CreateNewResourceType(DeleteType deleteFunc, char *name)
return next;
}
void
SetResourceTypeErrorValue(RESTYPE type, int errorValue)
{
resourceTypes[type & TypeMask].errorValue = errorValue;
}
RESTYPE
CreateNewResourceClass(void)
{
......
......@@ -157,6 +157,9 @@ typedef Bool (*FindComplexResType)(
extern _X_EXPORT RESTYPE CreateNewResourceType(
DeleteType /*deleteFunc*/, char * /*name*/);
extern _X_EXPORT void SetResourceTypeErrorValue(
RESTYPE /*type*/, int /*errorValue*/);
extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
extern _X_EXPORT Bool InitClientResources(
......
......@@ -344,7 +344,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
RROutputType, client, a);\
if (rc != Success) {\
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);\
if (rc != Success) {\
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);\
if (rc != Success) {\
client->errorValue = id;\
return (rc == BadValue) ? RRErrorBase + BadRRMode : rc;\
return rc;\
}\
}
......
......@@ -634,6 +634,7 @@ RRCrtcInit (void)
RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC");
if (!RRCrtcType)
return FALSE;
SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc);
return TRUE;
}
......@@ -806,7 +807,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
{
if (outputs)
free(outputs);
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;
return rc;
}
/* validate crtc for this output */
for (j = 0; j < outputs[i]->numCrtcs; j++)
......
......@@ -268,6 +268,7 @@ RRModeInit (void)
RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE");
if (!RRModeType)
return FALSE;
SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode);
return TRUE;
}
......
......@@ -423,6 +423,7 @@ RROutputInit (void)
RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT");
if (!RROutputType)
return FALSE;
SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput);
return TRUE;
}
......
......@@ -58,7 +58,6 @@ and Jim Haggerty of Metheus.
#include "protocol-versions.h"
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
* than 32.
......@@ -133,7 +132,7 @@ static int numEnabledRCAPs;
int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
RTContext, _client, DixUseAccess); \
if (rc != Success) \
return (rc == BadValue) ? RecordErrorBase + XRecordBadContext : rc; \
return rc; \
}
static int RecordDeleteContext(
......@@ -2911,7 +2910,7 @@ RecordExtensionInit(void)
DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL);
return;
}
RecordErrorBase = extentry->errorBase;
SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext);
} /* RecordExtensionInit */
......@@ -1115,7 +1115,6 @@ ChangePicture (PicturePtr pPicture,
if (error != Success)
{
client->errorValue = pid;
error = (error == BadValue) ? RenderErrBase + BadPicture : error;
break;
}
if (pAlpha->pDrawable == NULL ||
......
......@@ -412,7 +412,7 @@ extern _X_EXPORT RESTYPE GlyphSetType;
int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
PictureType, client, mode);\
if (rc != Success)\
return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
return rc;\
}
#define VERIFY_ALPHA(pPicture, pid, client, mode) {\
......
......@@ -233,6 +233,10 @@ RenderClientCallback (CallbackListPtr *list,
pRenderClient->minor_version = 0;
}
#ifdef PANORAMIX
unsigned long XRT_PICTURE;
#endif
void
RenderExtensionInit (void)
{
......@@ -253,6 +257,13 @@ RenderExtensionInit (void)
if (!extEntry)
return;
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
......@@ -532,7 +543,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
if (pFormat->type != PictTypeIndexed)
{
......@@ -601,7 +612,7 @@ ProcRenderCreatePicture (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
if (pFormat->depth != pDrawable->depth)
return BadMatch;
......@@ -755,7 +766,7 @@ ProcRenderTrapezoids (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
}
else
pFormat = 0;
......@@ -795,7 +806,7 @@ ProcRenderTriangles (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
}
else
pFormat = 0;
......@@ -835,7 +846,7 @@ ProcRenderTriStrip (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
}
else
pFormat = 0;
......@@ -875,7 +886,7 @@ ProcRenderTriFan (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
}
else
pFormat = 0;
......@@ -922,7 +933,7 @@ ProcRenderCreateGlyphSet (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&format, stuff->format,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
switch (format->depth) {
case 1:
......@@ -974,7 +985,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->existing;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
return rc;
}
glyphSet->refcnt++;
if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet))
......@@ -998,7 +1009,7 @@ ProcRenderFreeGlyphSet (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->glyphset;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
return rc;
}
FreeResource (stuff->glyphset, RT_NONE);
return Success;
......@@ -1037,7 +1048,7 @@ ProcRenderAddGlyphs (ClientPtr client)
if (err != Success)
{
client->errorValue = stuff->glyphset;
return (err == BadValue) ? RenderErrBase + BadGlyphSet : err;
return err;
}
err = BadAlloc;
......@@ -1238,7 +1249,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
if (rc != Success)
{
client->errorValue = stuff->glyphset;
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
return rc;
}
nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
gids = (CARD32 *) (stuff + 1);
......@@ -1300,7 +1311,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
PictFormatType, client, DixReadAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
return rc;
}
else
pFormat = 0;
......@@ -1308,7 +1319,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset,
GlyphSetType, client, DixUseAccess);
if (rc != Success)
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
return rc;
buffer = (CARD8 *) (stuff + 1);
end = (CARD8 *) stuff + (client->req_len << 2);
......@@ -1371,7 +1382,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
free(glyphsBase);
if (listsBase != listsLocal)
free(listsBase);
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
return rc;
}
}
buffer += 4;
......@@ -2639,7 +2650,7 @@ SProcRenderDispatch (ClientPtr client)
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
XRT_PICTURE, client, mode);\
if (rc != Success)\
return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
return rc;\
}
#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
......@@ -2652,8 +2663,6 @@ SProcRenderDispatch (ClientPtr client)
int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr);
unsigned long XRT_PICTURE;