diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-04-29 01:04:37 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2009-04-29 01:04:37 -0400 |
commit | 57aff88c7d0761e590806d07bee1c9410680c89f (patch) | |
tree | 48f05f58a72183556af3b0a7f3f286959d7e096a /Xext/xvmc.c | |
parent | 1abe0ee3da5e1268c7315f841d31337ea6524cf0 (diff) |
Fix most remaining deprecated resource lookups.
Callsites updated to use dixLookupResourceBy{Type,Class}.
TODO: Audit access modes to make sure they reflect the usage.
Diffstat (limited to 'Xext/xvmc.c')
-rw-r--r-- | Xext/xvmc.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/Xext/xvmc.c b/Xext/xvmc.c index 9166cf892..879a222bd 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -136,10 +136,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client) REQUEST(xvmcListSurfaceTypesReq); REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { - client->errorValue = stuff->port; - return _XvBadPort; - } + VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); if(XvMCScreenKey) { /* any adaptors at all */ ScreenPtr pScreen = pPort->pAdaptor->pScreen; @@ -192,10 +189,7 @@ ProcXvMCCreateContext(ClientPtr client) REQUEST(xvmcCreateContextReq); REQUEST_SIZE_MATCH(xvmcCreateContextReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { - client->errorValue = stuff->port; - return _XvBadPort; - } + VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); pScreen = pPort->pAdaptor->pScreen; @@ -273,11 +267,15 @@ ProcXvMCCreateContext(ClientPtr client) static int ProcXvMCDestroyContext(ClientPtr client) { + pointer val; + int rc; REQUEST(xvmcDestroyContextReq); REQUEST_SIZE_MATCH(xvmcDestroyContextReq); - if(!LookupIDByType(stuff->context_id, XvMCRTContext)) - return (XvMCBadContext + XvMCErrorBase); + rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext, + client, DixDestroyAccess); + if (rc != Success) + return (rc == BadValue) ? XvMCBadContext + XvMCErrorBase : rc; FreeResource(stuff->context_id, RT_NONE); @@ -297,8 +295,10 @@ ProcXvMCCreateSurface(ClientPtr client) REQUEST(xvmcCreateSurfaceReq); REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq); - if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) - return (XvMCBadContext + XvMCErrorBase); + result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, + XvMCRTContext, client, DixUseAccess); + if (result != Success) + return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -337,11 +337,15 @@ ProcXvMCCreateSurface(ClientPtr client) static int ProcXvMCDestroySurface(ClientPtr client) { + pointer val; + int rc; REQUEST(xvmcDestroySurfaceReq); REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq); - if(!LookupIDByType(stuff->surface_id, XvMCRTSurface)) - return (XvMCBadSurface + XvMCErrorBase); + rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface, + client, DixDestroyAccess); + if (rc != Success) + return (rc == BadValue) ? XvMCBadSurface + XvMCErrorBase : rc; FreeResource(stuff->surface_id, RT_NONE); @@ -363,8 +367,10 @@ ProcXvMCCreateSubpicture(ClientPtr client) REQUEST(xvmcCreateSubpictureReq); REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq); - if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) - return (XvMCBadContext + XvMCErrorBase); + result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, + XvMCRTContext, client, DixUseAccess); + if (result != Success) + return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -448,11 +454,15 @@ ProcXvMCCreateSubpicture(ClientPtr client) static int ProcXvMCDestroySubpicture(ClientPtr client) { + pointer val; + int rc; REQUEST(xvmcDestroySubpictureReq); REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq); - if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture)) - return (XvMCBadSubpicture + XvMCErrorBase); + rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture, + client, DixDestroyAccess); + if (rc != Success) + return (rc == BadValue) ? XvMCBadSubpicture + XvMCErrorBase : rc; FreeResource(stuff->subpicture_id, RT_NONE); @@ -475,10 +485,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client) REQUEST(xvmcListSubpictureTypesReq); REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { - client->errorValue = stuff->port; - return _XvBadPort; - } + VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); pScreen = pPort->pAdaptor->pScreen; @@ -571,11 +578,7 @@ ProcXvMCGetDRInfo(ClientPtr client) REQUEST(xvmcGetDRInfoReq); REQUEST_SIZE_MATCH(xvmcGetDRInfoReq); - - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { - client->errorValue = stuff->port; - return _XvBadPort; - } + VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); pScreen = pPort->pAdaptor->pScreen; pScreenPriv = XVMC_GET_PRIVATE(pScreen); |