[PATCH] xv: Build left-shift constants from ints not longs

Olivier Fourdan ofourdan at redhat.com
Wed Mar 9 15:59:26 UTC 2016


----- Original Message -----
> We typically store these in ints in server, leading to warnings like:
> 
> xwayland-glamor-xv.c: In function ‘xwl_glamor_xv_add_adaptors’:
> xwayland-glamor-xv.c:339:16: warning: large integer implicitly truncated
> to unsigned type [-Woverflow]
>      pa->type = XvWindowMask | XvInputMask | XvImageMask;;
>                 ^
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  Xv.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/Xv.h b/Xv.h
> index ef3f786..f662df6 100644
> --- a/Xv.h
> +++ b/Xv.h
> @@ -59,8 +59,8 @@ typedef XID XvEncodingID;
>  #define XvInput          0
>  #define XvOutput         1
>  
> -#define XvInputMask      (1L<<XvInput)
> -#define XvOutputMask     (1L<<XvOutput)
> +#define XvInputMask      (1<<XvInput)
> +#define XvOutputMask     (1<<XvOutput)
>  #define XvVideoMask	 0x00000004
>  #define XvStillMask	 0x00000008
>  #define XvImageMask	 0x00000010
> @@ -100,13 +100,13 @@ typedef XID XvEncodingID;
>  
>  #define XvNumReasons (XvLastReason + 1)
>  
> -#define XvStartedMask     (1L<<XvStarted)
> -#define XvStoppedMask     (1L<<XvStopped)
> -#define XvBusyMask        (1L<<XvBusy)
> -#define XvPreemptedMask   (1L<<XvPreempted)
> -#define XvHardErrorMask   (1L<<XvHardError)
> +#define XvStartedMask     (1<<XvStarted)
> +#define XvStoppedMask     (1<<XvStopped)
> +#define XvBusyMask        (1<<XvBusy)
> +#define XvPreemptedMask   (1<<XvPreempted)
> +#define XvHardErrorMask   (1<<XvHardError)
>  
> -#define XvAnyReasonMask   ((1L<<XvNumReasons) - 1)
> +#define XvAnyReasonMask   ((1<<XvNumReasons) - 1)
>  #define XvNoReasonMask    0
>  
>  /* Errors */

Looks good to me.

Funny that we have:
#define XvNumReasons (XvLastReason + 1)
and a few lines below it:
#define XvAnyReasonMask   ((1L<<XvNumReasons) - 1)

Anyway,

Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>


More information about the xorg-devel mailing list