Minor fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6289 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2000-03-16 12:41:01 +00:00
parent 154341cecc
commit b597cab253
3 changed files with 33 additions and 3 deletions

View file

@ -478,7 +478,32 @@ failure:
- (unsigned) hash
{
return [self length];
unsigned char buf[64];
unsigned l = [self length];
unsigned ret =0;
l = MIN(l,64);
/*
* hash for empty data matches hash for empty string
*/
if (l == 0)
{
return 0xfffffffe;
}
[self getBytes: &buf range: NSMakeRange(0, l)];
while (l-- > 0)
{
ret = (ret << 5 ) + ret + buf[l];
}
// Again, match NSString
if (ret == 0)
{
ret = 0xffffffff;
}
return ret;
}
- (BOOL) isEqual: anObject