* Fix false positives in playlist caching optimization when we have duplicate file names in different directories.

This commit is contained in:
Justin Maggard
2012-02-10 23:35:11 +00:00
parent 6064099fb0
commit ab33ab34bc
5 changed files with 54 additions and 18 deletions

15
utils.c
View File

@ -253,6 +253,21 @@ make_dir(char * path, mode_t mode)
} while (1);
}
/* Simple, efficient hash function from Daniel J. Bernstein */
unsigned int
DJBHash(const char *str, int len)
{
unsigned int hash = 5381;
unsigned int i = 0;
for(i = 0; i < len; str++, i++)
{
hash = ((hash << 5) + hash) + (*str);
}
return hash;
}
int
is_video(const char * file)
{