mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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:
parent
154341cecc
commit
b597cab253
3 changed files with 33 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Mar 16 11:37:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSRange.m: NSRangeFromString() bugfix by karl@nfox.com
|
||||
* Source/NSData.m: ([-hash]) new implementation by karl
|
||||
|
||||
Sat Mar 11 21:04:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* GSDoc/gsdoc.m: Updated for recent version of xml library.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -65,7 +65,7 @@ NSRangeFromString(NSString* string)
|
|||
&& (*scanStringImp)(scanner, scanStringSel, @"location", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
||||
&& (*scanIntImp)(scanner, scanIntSel, &range.location)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @";", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @",", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"length", NULL)
|
||||
&& (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
|
||||
&& (*scanIntImp)(scanner, scanIntSel, &range.length)
|
||||
|
@ -79,7 +79,7 @@ NSString *
|
|||
NSStringFromRange(NSRange range)
|
||||
{
|
||||
setupCache();
|
||||
return [NSStringClass stringWithFormat: @"{location = %d, length = %d}",
|
||||
return [NSStringClass stringWithFormat: @"{location=%d, length=%d}",
|
||||
range.location, range.length];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue