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 23:50:33 +0900
commitd254bec7e79297da6887f22070687c7d5b735f06 (patch)
tree090cc1af2171c55adce79d1d1f7748a49d48aa7f
parent615cb38ff9f0cb12fc0abc33dd28e8d066ba2e1a (diff)
downloadtdelibs-d254bec7e79297da6887f22070687c7d5b735f06.tar.gz
tdelibs-d254bec7e79297da6887f22070687c7d5b735f06.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> (cherry picked from commit 987507131d72dcdd8008f18e301dd8bc3551a572)
-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);