[vlc-devel] [PATCH] demux/mpeg: ts_bsearch_searchkey_Compare: fix warning

Rémi Denis-Courmont remi at remlab.net
Thu May 18 18:05:06 CEST 2017


Le torstaina 18. toukokuuta 2017, 12.19.37 EEST Filip Roséen a écrit :
> The address of this function is passed to bsearch, and bsearch accepts
> a pointer to int(void const*,void const*), meaning that the previous
> prototype would generate a warning (and strictly speaking was not
> valid).
> ---
>  modules/demux/mpeg/ts_pid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/modules/demux/mpeg/ts_pid.c b/modules/demux/mpeg/ts_pid.c
> index 27779a04d8..eed60a3a28 100644
> --- a/modules/demux/mpeg/ts_pid.c
> +++ b/modules/demux/mpeg/ts_pid.c
> @@ -65,7 +65,7 @@ struct searchkey
>      ts_pid_t **pp_last;
>  };
> 
> -static int ts_bsearch_searchkey_Compare( void *key, void *other )
> +static int ts_bsearch_searchkey_Compare( const void *key, const void *other
> ) {
>      struct searchkey *p_key = (struct searchkey *) key;
>      ts_pid_t *p_pid = *((ts_pid_t **) other);

Removing the const qualifier via cast is not a good practice, even if it is 
legal.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list