[PATCH v2 02/10] Xext: Fix buggy check.

Alan Coopersmith alan.coopersmith at oracle.com
Thu Jun 2 19:45:04 PDT 2011


On 06/ 2/11 06:00 PM, Cyril Brulebois wrote:
> XvMCScreenKey is defined as XvMCScreenKeyRec's address, so will never be
> NULL. Use the check proposed by Alan Coopersmith and Jeremy Huddleston
> instead.
> 
> This warning goes 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]
> 
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
>  Xext/xvmc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Xext/xvmc.c b/Xext/xvmc.c
> index d790d3c..bc78b55 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 */

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list