[vlc-devel] [PATCH 4/7] text_renderer: avoid 0xff << 24 with an int type

Rémi Denis-Courmont remi at remlab.net
Tue May 6 22:13:02 CEST 2014


Le mardi 6 mai 2014, 19:08:28 Felix Abecassis a écrit :
> ---
>  modules/text_renderer/text_renderer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/text_renderer/text_renderer.c
> b/modules/text_renderer/text_renderer.c index 3648581..4119c34 100644
> --- a/modules/text_renderer/text_renderer.c
> +++ b/modules/text_renderer/text_renderer.c
> @@ -398,7 +398,7 @@ int HandleFontAttributes( xml_reader_t *p_xml_reader,
>      rv = PushFont( p_fonts,
>                     psz_fontname,
>                     i_font_size,
> -                   (i_font_color & 0xffffff) | ((i_font_alpha & 0xff) <<
> 24),
> +                   (i_font_color & 0xffffff) |
> ((uint32_t)(i_font_alpha & 0xff) << 24), i_karaoke_bg_color );

Won't this still fail if uint32_t has a lower rank than int?
Missing 'u' postfix maybe?

> 
>      free( psz_fontname );
> @@ -572,7 +572,7 @@ int ProcessNodes( filter_t *p_filter,
>                         p_default_style->psz_fontname,
>                         i_font_size,
>                         (i_font_color & 0xffffff) |
> -                          ((i_font_alpha & 0xff) << 24),
> +                       ((uint32_t)(i_font_alpha & 0xff) << 24),
>                         0x00ffffff );
>      }
>      if( p_default_style->i_style_flags & STYLE_BOLD )

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list