diff options
author | Alasdair Kergon <agk@redhat.com> | 2006-01-09 20:35:24 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2006-01-09 20:35:24 +0000 |
commit | b6b0c621f6e7ec0d0b30fe4a694b50c6e91338f3 (patch) | |
tree | 626a0d580a9bcaa6e808135c75f6368cff5e46d4 /libdm/datastruct | |
parent | 079ac15ecec450986a751637603b99760dd9f4b2 (diff) | |
download | lvm2-b6b0c621f6e7ec0d0b30fe4a694b50c6e91338f3.tar.gz |
Fix hash function to avoid using a negative array offset.
Diffstat (limited to 'libdm/datastruct')
-rw-r--r-- | libdm/datastruct/hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c index f98689367..1a3ea8167 100644 --- a/libdm/datastruct/hash.c +++ b/libdm/datastruct/hash.c @@ -68,14 +68,14 @@ static struct dm_hash_node *_create_node(const char *str, unsigned len) return n; } -static unsigned long _hash(const char *str, unsigned len) +static unsigned long _hash(const unsigned char *str, unsigned len) { unsigned long h = 0, g; unsigned i; for (i = 0; i < len; i++) { h <<= 4; - h += _nums[(int) *str++]; + h += _nums[*str++]; g = h & ((unsigned long) 0xf << 16u); if (g) { h ^= g >> 16u; |