vlc_arrays: fix vlc_dictionary_has_key

broken untested function went under the radar
and is testing index from hash instead of key.
50% false positive due to hash % size pos.

fixes random behaviour in ttml #18250
and probably playlist fetcher, dbus control
This commit is contained in:
Francois Cartegnie 2017-04-23 15:39:37 +02:00
parent 6657a82c63
commit 4cee7fe323
1 changed files with 7 additions and 1 deletions

View File

@ -432,7 +432,13 @@ vlc_dictionary_has_key( const vlc_dictionary_t * p_dict, const char * psz_key )
return 0;
int i_pos = DictHash( psz_key, p_dict->i_size );
return p_dict->p_entries[i_pos] != NULL;
const vlc_dictionary_entry_t * p_entry = p_dict->p_entries[i_pos];
for( ; p_entry != NULL; p_entry = p_entry->p_next )
{
if( !strcmp( psz_key, p_entry->psz_key ) )
break;
}
return p_entry != NULL;
}
static inline void *