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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Dec 4 10:58:11 CET 2020


On Fri, Dec 4, 2020, at 10:40 AM, Francois Cartegnie wrote:
> 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;
> 
> 

Good point...

I'll stash this patch aside and will revisit it more thoroughly later

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list