]> git.sesse.net Git - vlc/blobdiff - src/misc/hashtables.c
- mkdir Unicode wrapper (refs #543)
[vlc] / src / misc / hashtables.c
index c4c04568861a82fb44d80e70ce040ba68233e5d4..1bb3164726a7d5026fc85180d831ac50c4b78754 100644 (file)
@@ -78,8 +78,7 @@ static int FindSlot( hashtable_entry_t *p_array, int i_count, uint64_t i_hash )
 {
     int i_middle;
 
-
-    if( i_hash <= p_array[0].i_hash )
+    if( i_count == 0 || i_hash <= p_array[0].i_hash )
     {
         return 0;
     }
@@ -138,7 +137,7 @@ int vlc_HashLookup( hashtable_entry_t *p_array, int i_count,
 
     /* Hash found, let's check it looks like the entry
      * We don't check the whole entry, this could lead to bad surprises :( */
-    if( psz_name[0] == p_array[i].psz_name[0] )
+    if( psz_name[0] == p_array[i_pos].psz_name[0] )
     {
         return i_pos;
     }
@@ -218,7 +217,7 @@ static uint64_t HashString( const char *psz_string, int i_id )
         i_hash ^= i_hash >> 8;
     }
 
-    i_hash += ( i_id << 32 );
+    i_hash += ( (uint64_t)i_id << 32 );
 
     return i_hash;
 }