[vlc-devel] [PATCH 2/2] vlc_arrays.h: Dictionary: Use the correct type to store hash

Francois Cartegnie fcvlcdev at free.fr
Fri Dec 4 10:40:00 CET 2020


Le 04/12/2020 à 10:31, Hugo Beauzée-Luyssen a écrit :
> ---
>   include/vlc_arrays.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
> index a7469359bb..44d9e5de6d 100644
> --- a/include/vlc_arrays.h
> +++ b/include/vlc_arrays.h
> @@ -456,7 +456,7 @@ vlc_dictionary_has_key( const vlc_dictionary_t * p_dict, const char * psz_key )
>       if( !p_dict->p_entries )
>           return 0;
>   
> -    int i_pos = DictHash( psz_key, p_dict->i_size );
> +    size_t i_pos = DictHash( psz_key, p_dict->i_size );


Due to the shifts I don't think the result will be the same when size_t 
< uint64_t

             i_hash += *psz_string++;
             i_hash += i_hash << 10;
             i_hash ^= i_hash >> 8;


-- 
Francois Cartegnie
VideoLAN - VLC Developer


More information about the vlc-devel mailing list