mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 17:41:05 +00:00
* Source/NSArray.m (compare()),
([-sortedArrayUsingFunction:context:]), ([-sortedArrayUsingFunction:context:hint:]), ([-sortUsingFunction:context:]): Changed declarations and implementation to account for 64 bit architectures. * Headers/gnustep/base/NSArray.h: Ditto. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16013 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e370e2e037
commit
4c716c039b
2 changed files with 14 additions and 8 deletions
|
@ -73,9 +73,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
- (NSData*) sortedArrayHint;
|
- (NSData*) sortedArrayHint;
|
||||||
- (NSArray*) sortedArrayUsingFunction: (int (*)(id, id, void*))comparator
|
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult (*)(id, id, void*))comparator
|
||||||
context: (void*)context;
|
context: (void*)context;
|
||||||
- (NSArray*) sortedArrayUsingFunction: (int (*)(id, id, void*))comparator
|
- (NSArray*) sortedArrayUsingFunction: (NSComparisonReslut (*)(id, id, void*))comparator
|
||||||
context: (void*)context
|
context: (void*)context
|
||||||
hint: (NSData*)hint;
|
hint: (NSData*)hint;
|
||||||
- (NSArray*) sortedArrayUsingSelector: (SEL)comparator;
|
- (NSArray*) sortedArrayUsingSelector: (SEL)comparator;
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
- (void) removeObjectsFromIndices: (unsigned*)indices
|
- (void) removeObjectsFromIndices: (unsigned*)indices
|
||||||
numIndices: (unsigned)count;
|
numIndices: (unsigned)count;
|
||||||
|
|
||||||
- (void) sortUsingFunction: (int(*)(id,id,void*))compare
|
- (void) sortUsingFunction: (NSComparisionResult (*)(id,id,void*))compare
|
||||||
context: (void*)context;
|
context: (void*)context;
|
||||||
- (void) sortUsingSelector: (SEL)comparator;
|
- (void) sortUsingSelector: (SEL)comparator;
|
||||||
|
|
||||||
|
|
|
@ -789,9 +789,15 @@ static SEL rlSel;
|
||||||
[self makeObjectsPerformSelector: aSelector withObject: argument];
|
[self makeObjectsPerformSelector: aSelector withObject: argument];
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare(id elem1, id elem2, void* context)
|
static NSComparisonResult
|
||||||
|
compare(id elem1, id elem2, void* context)
|
||||||
{
|
{
|
||||||
return (int)[elem1 performSelector: (SEL)context withObject: elem2];
|
NSComparisonResult (*imp)(id, SEL, id);
|
||||||
|
|
||||||
|
imp = (NSComparisonResult (*)(id, SEL, id))
|
||||||
|
[elem1 methodForSelector: context];
|
||||||
|
|
||||||
|
return (*imp)(elem1, context, elem2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -808,7 +814,7 @@ static int compare(id elem1, id elem2, void* context)
|
||||||
* according to a sort with comparator. This invokes
|
* according to a sort with comparator. This invokes
|
||||||
* -sortedArrayUsingFunction:context:hint: with a nil hint.
|
* -sortedArrayUsingFunction:context:hint: with a nil hint.
|
||||||
*/
|
*/
|
||||||
- (NSArray*) sortedArrayUsingFunction: (int(*)(id,id,void*))comparator
|
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||||
context: (void*)context
|
context: (void*)context
|
||||||
{
|
{
|
||||||
return [self sortedArrayUsingFunction: comparator context: context hint: nil];
|
return [self sortedArrayUsingFunction: comparator context: context hint: nil];
|
||||||
|
@ -829,7 +835,7 @@ static int compare(id elem1, id elem2, void* context)
|
||||||
* is passed two objects to compare, and the copntext as the third
|
* is passed two objects to compare, and the copntext as the third
|
||||||
* argument.
|
* argument.
|
||||||
*/
|
*/
|
||||||
- (NSArray*) sortedArrayUsingFunction: (int(*)(id,id,void*))comparator
|
- (NSArray*) sortedArrayUsingFunction: (NSComparisonResult(*)(id,id,void*))comparator
|
||||||
context: (void*)context
|
context: (void*)context
|
||||||
hint: (NSData*)hint
|
hint: (NSData*)hint
|
||||||
{
|
{
|
||||||
|
@ -1594,7 +1600,7 @@ static int compare(id elem1, id elem2, void* context)
|
||||||
* Sorts the array according to the supplied compare function
|
* Sorts the array according to the supplied compare function
|
||||||
* with the context information.
|
* with the context information.
|
||||||
*/
|
*/
|
||||||
- (void) sortUsingFunction: (int(*)(id,id,void*))compare
|
- (void) sortUsingFunction: (NSComparisonResult (*)(id,id,void*))compare
|
||||||
context: (void*)context
|
context: (void*)context
|
||||||
{
|
{
|
||||||
/* Shell sort algorithm taken from SortingInAction - a NeXT example */
|
/* Shell sort algorithm taken from SortingInAction - a NeXT example */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue