Fixups for macos-x compatibility

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23271 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-08-13 09:17:53 +00:00
parent 476d56e76b
commit 384ab4003a
3 changed files with 26 additions and 22 deletions

View file

@ -78,35 +78,38 @@ static NSIndexPath *dummy = nil;
- (NSComparisonResult) compare: (NSIndexPath*)other
{
if (other == self)
{
return NSOrderedSame;
}
else
if (other != self)
{
unsigned olength = other->_length;
unsigned *oindexes = other->_indexes;
unsigned end = (_length > olength) ? _length : olength;
unsigned pos;
for (pos = 0; pos < _length; pos++)
for (pos = 0; pos < end; pos++)
{
if (pos >= other->_length || other->_indexes[pos] < _indexes[pos])
{
return NSOrderedAscending;
}
if (other->_indexes[pos] > _indexes[pos])
if (pos >= _length)
{
return NSOrderedDescending;
}
else if (pos >= olength)
{
return NSOrderedAscending;
}
if (oindexes[pos] < _indexes[pos])
{
return NSOrderedDescending;
}
if (oindexes[pos] > _indexes[pos])
{
return NSOrderedAscending;
}
}
if (_length == other->_length)
{
/*
* Should never get here.
*/
NSLog(@"Argh ... two identical index paths exist!");
return NSOrderedSame;
}
return NSOrderedDescending;
/*
* Should never get here.
*/
NSLog(@"Argh ... two identical index paths exist!");
}
return NSOrderedSame;
}
- (id) copyWithZone: (NSZone*)aZone