mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
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:
parent
0ef215b284
commit
c720626d76
3 changed files with 26 additions and 22 deletions
|
@ -4,7 +4,7 @@
|
||||||
multibyte encodings) strings could be truncated at the wrong
|
multibyte encodings) strings could be truncated at the wrong
|
||||||
precision.
|
precision.
|
||||||
* Source/NSIndexPath.m: ([indexAtPosition:]) return NSNotFound if
|
* Source/NSIndexPath.m: ([indexAtPosition:]) return NSNotFound if
|
||||||
given a bad position.
|
given a bad position. ([compare:]) fix to match MacOS-X
|
||||||
* Source/NSObject.m: implement CRASH_ON_ZOMBIE
|
* Source/NSObject.m: implement CRASH_ON_ZOMBIE
|
||||||
* Documentation/Base.gsdoc: document it.
|
* Documentation/Base.gsdoc: document it.
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@
|
||||||
- (void) getIndexes: (unsigned*)aBuffer;
|
- (void) getIndexes: (unsigned*)aBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the index at the specified position or raise an exception.
|
* Return the index at the specified position or NSNotFound if there
|
||||||
|
* is no index at the specified position.
|
||||||
*/
|
*/
|
||||||
- (unsigned) indexAtPosition: (unsigned)position;
|
- (unsigned) indexAtPosition: (unsigned)position;
|
||||||
|
|
||||||
|
|
|
@ -78,35 +78,38 @@ static NSIndexPath *dummy = nil;
|
||||||
|
|
||||||
- (NSComparisonResult) compare: (NSIndexPath*)other
|
- (NSComparisonResult) compare: (NSIndexPath*)other
|
||||||
{
|
{
|
||||||
if (other == self)
|
if (other != self)
|
||||||
{
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
unsigned olength = other->_length;
|
||||||
|
unsigned *oindexes = other->_indexes;
|
||||||
|
unsigned end = (_length > olength) ? _length : olength;
|
||||||
unsigned pos;
|
unsigned pos;
|
||||||
|
|
||||||
for (pos = 0; pos < _length; pos++)
|
for (pos = 0; pos < end; pos++)
|
||||||
{
|
{
|
||||||
if (pos >= other->_length || other->_indexes[pos] < _indexes[pos])
|
if (pos >= _length)
|
||||||
{
|
|
||||||
return NSOrderedAscending;
|
|
||||||
}
|
|
||||||
if (other->_indexes[pos] > _indexes[pos])
|
|
||||||
{
|
{
|
||||||
return NSOrderedDescending;
|
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.
|
||||||
/*
|
*/
|
||||||
* Should never get here.
|
NSLog(@"Argh ... two identical index paths exist!");
|
||||||
*/
|
|
||||||
NSLog(@"Argh ... two identical index paths exist!");
|
|
||||||
return NSOrderedSame;
|
|
||||||
}
|
|
||||||
return NSOrderedDescending;
|
|
||||||
}
|
}
|
||||||
|
return NSOrderedSame;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) copyWithZone: (NSZone*)aZone
|
- (id) copyWithZone: (NSZone*)aZone
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue