Fix for new sort being unstable with a huge thanks to Shon Frazier. Reviewed by Me and Alexander Ljungberg.

This commit is contained in:
Randall Luecke committed 2010-08-11 22:33:14 -05:00
1 parent 2a5f4b98ed
commit dd9c085ae3
1 file changed
+3 -2
+3 -2
View File
@@ -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
{