Update hashing code for strings to be the same as upstream gettext. The old version results in slightly different hash values for strings with ellipsis (and potentially other unicode characters). This relates to TDE/tdebase#394.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/228/head
Michele Calgaro 1 year ago
parent d67c4fd582
commit 987507131d
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -260,8 +260,8 @@ hash_string (const char *str_param)
while (*str != '\0') while (*str != '\0')
{ {
hval <<= 4; hval <<= 4;
hval += (unsigned long) *str++; hval += (unsigned char) *str++;
g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4)); g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
if (g != 0) if (g != 0)
{ {
hval ^= g >> (HASHWORDBITS - 8); hval ^= g >> (HASHWORDBITS - 8);

Loading…
Cancel
Save