diff options
Diffstat (limited to 'fs/hfs/string.c')
-rw-r--r-- | fs/hfs/string.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/hfs/string.c b/fs/hfs/string.c index cacc0a604..030850b82 100644 --- a/fs/hfs/string.c +++ b/fs/hfs/string.c @@ -81,11 +81,14 @@ static unsigned char casefold[256] = { /* * Hash a string to an integer in a case-independent way */ -unsigned int hfs_strhash(const struct hfs_name *cname) +unsigned long hfs_strhash(const struct hfs_name *cname) { - /* Currently just sum of the 'order' of first and last characters */ - return ((unsigned int)caseorder[cname->Name[0]] + - (unsigned int)caseorder[cname->Name[cname->Len - 1]]); + unsigned long hash = init_name_hash(); + unsigned int i; + for (i = 0; i < cname->Len; i++) { + hash = partial_name_hash(caseorder[cname->Name[i]], hash); + } + return end_name_hash(hash); } /* |