diff --git a/ChangeLog b/ChangeLog index 67f3acf5d..93a53a28c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-03 22:12 Alexander Malmberg + + * Source/NSString.m (-hash), + Source/GSString.m ([NSConstantString -hash]): Fix guard against + returning a zero hash. + 2004-04-29 23:00 Alexander Malmberg * configure.ac: Test for iconv support by compiling a program that diff --git a/Source/GSString.m b/Source/GSString.m index 096bda74a..8bc12479f 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -1184,7 +1184,7 @@ getCString_u(ivars self, char *buffer, unsigned int maxLength, can't deal with our leftoverRange case, so we need to use a bit of complexity instead. */ unsigned int len; - + /* TODO: this is an extremely ugly hack to work around buggy iconvs that return -1/E2BIG for buffers larger than 0x40000acf */ if (maxLength > 0x40000000) @@ -3831,14 +3831,11 @@ agree, create a new GSUnicodeInlineString otherwise. * The hash caching in our concrete string classes uses zero to denote * an empty cache value, so we MUST NOT return a hash of zero. */ + ret &= 0x0fffffff; if (ret == 0) { ret = 0x0fffffff; } - else - { - ret &= 0x0fffffff; - } } else { diff --git a/Source/NSString.m b/Source/NSString.m index e5871cbba..105ac98fc 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -2193,14 +2193,11 @@ handle_printf_atsign (FILE *stream, * The hash caching in our concrete string classes uses zero to denote * an empty cache value, so we MUST NOT return a hash of zero. */ + ret &= 0x0fffffff; if (ret == 0) { ret = 0x0fffffff; } - else - { - ret &= 0x0fffffff; - } return ret; } else