Changeset 15 for Trunk/AILogSizeSort.m

Show
Ignore:
Timestamp:
09/29/08 23:42:07 (16 years ago)
Author:
jon
Message:

Simplified the comparison routine to just use primitive numbers instead of NSNumbers. Changed the description string to use more Adium-y terminology.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Trunk/AILogSizeSort.m

    r11 r15  
    175175        } 
    176176         
     177        unsigned long long sizeA = [AILogSizeSort getContactLogSize:objectA]; 
     178        unsigned long long sizeB = [AILogSizeSort getContactLogSize:objectB]; 
    177179         
    178         NSNumber *sizeA = [NSNumber numberWithUnsignedLongLong:[AILogSizeSort getContactLogSize:objectA]]; 
    179         NSNumber *sizeB = [NSNumber numberWithUnsignedLongLong:[AILogSizeSort getContactLogSize:objectB]]; 
    180          
    181         if([sizeB compare:sizeA] == NSOrderedSame) 
     180        if(sizeB == sizeA) 
    182181        { 
    183182                // Fall back to basic alphabetical sorting in the event of a tie. 
    184183                return [[objectA displayName] caseInsensitiveCompare:[objectB displayName]]; 
    185184        } 
     185        else if(sizeA > sizeB) 
     186        { 
     187                // There's a clear winner; run with it. 
     188                return NSOrderedAscending; 
     189        } 
    186190        else 
    187191        { 
    188                 // There's a clear winner; run with it. 
    189                 return [sizeB compare:sizeA]; 
     192                return NSOrderedDescending; 
    190193        } 
    191194}