[vlc-devel] [PATCH 4/4] vlc_variables: fix a cast warning in var_CountChoices()

Rémi Denis-Courmont remi at remlab.net
Mon Jul 20 14:51:25 CEST 2015


Le 2015-07-20 15:15, Steve Lhomme a écrit :
> From: Steve Lhomme <robUx4 at gmail.com>
>
> ---
>  include/vlc_variables.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/vlc_variables.h b/include/vlc_variables.h
> index d855c30..4a4eedd 100644
> --- a/include/vlc_variables.h
> +++ b/include/vlc_variables.h
> @@ -592,7 +592,7 @@ static inline int var_CountChoices( vlc_object_t
> *p_obj, const char *psz_name )
>      vlc_value_t count;
>      if( var_Change( p_obj, psz_name, VLC_VAR_CHOICESCOUNT, &count, 
> NULL ) )
>          return 0;
> -    return count.i_int;
> +    return (int) count.i_int;

Semantically the correct type is size_t, not int, so this seems very 
wrong.

Besides, this patch is pointless. Adding a cast does not make a 
difference in that matter: Either way, the code is well defined so long 
as the converted value is INT_MAX or less.

>  }
>  #define var_CountChoices(a,b) var_CountChoices( VLC_OBJECT(a),b)

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



More information about the vlc-devel mailing list