mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-18 22:41:18 +00:00
Fix for new sort being unstable with a huge thanks to Shon Frazier. Reviewed by Me and Alexander Ljungberg.
This commit is contained in:
1 parent
2a5f4b98ed
commit
dd9c085ae3
1 file changed
+3
-2
@@ -1326,7 +1326,7 @@ CPEnumerationReverse = 1 << 1;
|
||||
*/
|
||||
- (void)sortUsingFunction:(Function)aFunction context:(id)aContext
|
||||
{
|
||||
var h, i, j, k, l, m, n = [self count];
|
||||
var h, i, j, k, l, m, n = [self count], o;
|
||||
var A, B = [];
|
||||
|
||||
for (h = 1; h < n; h += h)
|
||||
@@ -1343,7 +1343,8 @@ CPEnumerationReverse = 1 << 1;
|
||||
for (i = 0, k = l; k < j && j <= m + h; k++)
|
||||
{
|
||||
A = self[j];
|
||||
if (aFunction(A, B[i], aContext) == CPOrderedDescending)
|
||||
o = aFunction(A, B[i], aContext);
|
||||
if (o == CPOrderedDescending || o == CPOrderedSame)
|
||||
self[k] = B[i++];
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user