summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorCyril Brulebois <kibi@debian.org>2011-05-24 18:33:11 +0200
committerCyril Brulebois <kibi@debian.org>2011-06-16 00:43:41 +0200
commit9da5aa09d70e26dd4d2ef878a21317dae7bf24de (patch)
tree88ce316bf3988ccaab45e9d0981ed4e8f6324506 /Xext
parentd9bda34d0df576d155e1d682d5e2a382b8e1ffda (diff)
Xext: Fix buggy checks.
XvMCScreenKey is defined as XvMCScreenKeyRec's address, so will never be NULL. Use the check proposed by Alan Coopersmith and Jeremy Huddleston instead. Those warnings go away accordingly: | CC xvmc.lo | xvmc.c: In function 'ProcXvMCListSubpictureTypes': | xvmc.c:490:22: warning: the comparison will always evaluate as 'false' for the address of 'XvMCScreenKeyRec' will never be NULL [-Waddress] | xvmc.c: In function 'XvMCExtensionInit': | xvmc.c:671:21: warning: the comparison will always evaluate as 'false' for the address of 'XvMCScreenKeyRec' will never be NULL [-Waddress] | xvmc.c: In function 'XvMCFindXvImage': | xvmc.c:749:22: warning: the comparison will always evaluate as 'false' for the address of 'XvMCScreenKeyRec' will never be NULL [-Waddress] Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Cyril Brulebois <kibi@debian.org>
Diffstat (limited to 'Xext')
-rw-r--r--Xext/xvmc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 4d29941ee..bc78b55ae 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -487,8 +487,8 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
- if(XvMCScreenKey == NULL) /* No XvMC adaptors */
- return BadMatch;
+ if (!dixPrivateKeyRegistered(XvMCScreenKey))
+ return BadMatch; /* No XvMC adaptors */
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return BadMatch; /* None this screen */
@@ -668,8 +668,8 @@ XvMCExtensionInit(void)
{
ExtensionEntry *extEntry;
- if(XvMCScreenKey == NULL) /* nobody supports it */
- return;
+ if (!dixPrivateKeyRegistered(XvMCScreenKey))
+ return;
if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes,
"XvMCRTContext")))
@@ -746,7 +746,8 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
XvMCAdaptorPtr adaptor = NULL;
int i;
- if(XvMCScreenKey == NULL) return NULL;
+ if (!dixPrivateKeyRegistered(XvMCScreenKey))
+ return NULL;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;