[Mesa-dev] [PATCH 5/9] mesa: fix truncated value warning

Brian Paul brianp at vmware.com
Mon Apr 2 07:40:45 PDT 2012


On 04/01/2012 04:24 PM, nobled wrote:
> Silences a clang warning:
>
> format_pack.c:2546:30: warning: implicit conversion from 'int' to
> 'GLubyte' (aka 'unsigned char') changes value from 65535 to 255
> [-Wconstant-conversion]
>                 d[i] = d[i] ? 0xffff : 0x0;
>                             ~ ^~~~~~
> ---
>   src/mesa/main/format_pack.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
> index 85b2c69..9df9b14 100644
> --- a/src/mesa/main/format_pack.c
> +++ b/src/mesa/main/format_pack.c
> @@ -2543,7 +2543,7 @@ _mesa_pack_colormask(gl_format format, const
> GLubyte colorMask[4], void *dst)
>            if (bits == 8) {
>               GLubyte *d = (GLubyte *) dst;
>               for (i = 0; i<  bytes; i++) {
> -               d[i] = d[i] ? 0xffff : 0x0;
> +               d[i] = d[i] ? 0xff : 0x0;
>               }
>            }
>            else if (bits == 16) {

 From the line numbers, it looks like this patch isn't against current 
Mesa/master.  In any case, Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list