summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-09-19 22:08:24 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-09-19 22:08:24 +0900
commit987507131d72dcdd8008f18e301dd8bc3551a572 (patch)
treed5940f77f85b95001595bcf88eddfbd69d963cf3
parentd67c4fd58202569729ea6d7ec6117a7a7f36ad0e (diff)
downloadtdelibs-987507131d72dcdd8008f18e301dd8bc3551a572.tar.gz
tdelibs-987507131d72dcdd8008f18e301dd8bc3551a572.zip
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>
-rw-r--r--tdecore/libintl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tdecore/libintl.cpp b/tdecore/libintl.cpp
index 5d2f6a086..c7b8c7ee6 100644
--- a/tdecore/libintl.cpp
+++ b/tdecore/libintl.cpp
@@ -260,8 +260,8 @@ hash_string (const char *str_param)
while (*str != '\0')
{
hval <<= 4;
- hval += (unsigned long) *str++;
- g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
+ hval += (unsigned char) *str++;
+ g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
if (g != 0)
{
hval ^= g >> (HASHWORDBITS - 8);