aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/xvmc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/Xext/xvmc.c
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/Xext/xvmc.c')
-rw-r--r--xorg-server/Xext/xvmc.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index ad1b8abc0..b7bb0fc1b 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -1,6 +1,4 @@
-#define NEED_REPLIES
-#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -138,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;
@@ -158,7 +153,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.num = (adaptor) ? adaptor->num_surfaces : 0;
- rep.length = rep.num * sizeof(xvmcSurfaceInfo) >> 2;
+ rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char*)&rep);
@@ -194,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;
@@ -275,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);
@@ -299,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);
@@ -339,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);
@@ -365,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);
@@ -450,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);
@@ -477,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;
@@ -514,7 +519,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if(surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
- rep.length = rep.num * sizeof(xvImageFormatInfo) >> 2;
+ rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char*)&rep);
@@ -573,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);
@@ -587,8 +588,8 @@ ProcXvMCGetDRInfo(ClientPtr client)
rep.major = pScreenPriv->major;
rep.minor = pScreenPriv->minor;
rep.patchLevel = pScreenPriv->patchLevel;
- rep.nameLen = (strlen(pScreenPriv->clientDriverName) + 4) >> 2;
- rep.busIDLen = (strlen(pScreenPriv->busID) + 4) >> 2;
+ rep.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1);
+ rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<=2;
@@ -664,7 +665,7 @@ SProcXvMCDispatch (ClientPtr client)
return BadImplementation;
}
-void
+void
XvMCExtensionInit(void)
{
ExtensionEntry *extEntry;
@@ -712,7 +713,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
XvMCScreenKey = &XvMCScreenKeyIndex;
- if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec))))
+ if(!(pScreenPriv = xalloc(sizeof(XvMCScreenRec))))
return BadAlloc;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);