diff --git a/macosx/StringAdditions.m b/macosx/StringAdditions.m index a6ec45ec6..32fcf97b9 100644 --- a/macosx/StringAdditions.m +++ b/macosx/StringAdditions.m @@ -161,27 +161,22 @@ { if ([self isEqualToString: string]) return NSOrderedSame; - - NSEnumerator * selfSections = [[self componentsSeparatedByString: @"."] objectEnumerator], - * newSections = [[string componentsSeparatedByString: @"."] objectEnumerator]; + NSArray * selfSections = [self componentsSeparatedByString: @"."], + * newSections = [string componentsSeparatedByString: @"."]; + + if ([selfSections count] != [newSections count]) + return [[NSNumber numberWithUnsignedInt: [selfSections count]] compare: + [NSNumber numberWithUnsignedInt: [newSections count]]]; + + NSEnumerator * selfSectionsEnum = [selfSections objectEnumerator], * newSectionsEnum = [newSections objectEnumerator]; + NSString * selfString, * newString; NSComparisonResult result; - NSString * selfString = [selfSections nextObject], * newString = [newSections nextObject]; - while (selfString && newString) - { + while ((selfString = [selfSectionsEnum nextObject]) && (newString = [newSectionsEnum nextObject])) if ((result = [selfString compare: newString options: NSNumericSearch]) != NSOrderedSame) return result; - - selfString = [selfSections nextObject]; - newString = [newSections nextObject]; - } - if (selfString) - return NSOrderedDescending; - else if (newString) - return NSOrderedAscending; - else - return NSOrderedSame; + return NSOrderedSame; } @end diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index c2e244b11..b78171c88 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -106,8 +106,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 if ([barImage size].width < width) [barImage setSize: NSMakeSize(width * 1.5, BAR_HEIGHT)]; - [barImage compositeToPoint: point fromRect: NSMakeRect(0, 0, width, BAR_HEIGHT) - operation: NSCompositeSourceOver]; + [barImage compositeToPoint: point fromRect: NSMakeRect(0, 0, width, BAR_HEIGHT) operation: NSCompositeSourceOver]; } - (void) buildSimpleBar: (float) width point: (NSPoint) point