case TR_PRI_HIGH: priorityIndex = POPUP_PRIORITY_HIGH; break;
case TR_PRI_NORMAL: priorityIndex = POPUP_PRIORITY_NORMAL; break;
case TR_PRI_LOW: priorityIndex = POPUP_PRIORITY_LOW; break;
- default: NSAssert1(NO, @"Unknown priority for adding torrent: %d", [fTorrent priority]);
+ default:
+ NSAssert1(NO, @"Unknown priority for adding torrent: %d", [fTorrent priority]);
+ priorityIndex = POPUP_PRIORITY_NORMAL;
}
[fPriorityPopUp selectItemAtIndex: priorityIndex];
case POPUP_PRIORITY_HIGH: priority = TR_PRI_HIGH; break;
case POPUP_PRIORITY_NORMAL: priority = TR_PRI_NORMAL; break;
case POPUP_PRIORITY_LOW: priority = TR_PRI_LOW; break;
- default: NSAssert1(NO, @"Unknown priority tag for adding torrent: %ld", [sender tag]);
+ default:
+ NSAssert1(NO, @"Unknown priority tag for adding torrent: %ld", [sender tag]);
+ priority = TR_PRI_NORMAL;
}
[fTorrent setPriority: priority];
}
case TR_PRI_HIGH: priorityIndex = POPUP_PRIORITY_HIGH; break;
case TR_PRI_NORMAL: priorityIndex = POPUP_PRIORITY_NORMAL; break;
case TR_PRI_LOW: priorityIndex = POPUP_PRIORITY_LOW; break;
- default: NSAssert1(NO, @"Unknown priority for adding torrent: %d", [fTorrent priority]);
+ default:
+ NSAssert1(NO, @"Unknown priority for adding torrent: %d", [fTorrent priority]);
+ priorityIndex = POPUP_PRIORITY_NORMAL;
}
[fPriorityPopUp selectItemAtIndex: priorityIndex];
case POPUP_PRIORITY_HIGH: priority = TR_PRI_HIGH; break;
case POPUP_PRIORITY_NORMAL: priority = TR_PRI_NORMAL; break;
case POPUP_PRIORITY_LOW: priority = TR_PRI_LOW; break;
- default: NSAssert1(NO, @"Unknown priority tag for adding torrent: %ld", [sender tag]);
+ default:
+ NSAssert1(NO, @"Unknown priority tag for adding torrent: %ld", [sender tag]);
+ priority = TR_PRI_NORMAL;
}
[fTorrent setPriority: priority];
}
NSString * title, * message;
- const NSInteger selected = [torrents count];
+ const NSUInteger selected = [torrents count];
if (selected == 1)
{
NSString * torrentName = [(Torrent *)[torrents objectAtIndex: 0] name];
NSMutableIndexSet * removeIndexes = [NSMutableIndexSet indexSet];
//needs to be a signed integer
- for (NSInteger indexInGroup = 0; indexInGroup < [[group torrents] count]; ++indexInGroup)
+ for (NSUInteger indexInGroup = 0; indexInGroup < [[group torrents] count]; ++indexInGroup)
{
Torrent * torrent = [[group torrents] objectAtIndex: indexInGroup];
const NSUInteger allIndex = [allTorrents indexOfObjectAtIndexes: unusedAllTorrentsIndexes options: NSEnumerationConcurrent passingTest: ^(id obj, NSUInteger idx, BOOL * stop) {
break;
default:
NSAssert1(NO, @"Unknown sort tag received: %ld", [menuItem tag]);
+ sortType = SORT_ORDER;
}
[menuItem setState: [sortType isEqualToString: [fDefaults stringForKey: @"Sort"]] ? NSOnState : NSOffState];
return result;
}
-- (NSRect) rectForStatusWithString: (NSAttributedString *) string withTitleRect: (NSRect) titleRect inBounds: (NSRect) bounds;
+- (NSRect) rectForStatusWithString: (NSAttributedString *) string withTitleRect: (NSRect) titleRect inBounds: (NSRect) bounds
{
const NSSize statusSize = [string size];
NSPoint mouseLocation = [self convertPoint: [[self window] mouseLocationOutsideOfEventStream] fromView: nil];
- for (NSInteger row = visibleRows.location, col = [self columnWithIdentifier: @"Priority"]; row < NSMaxRange(visibleRows); row++)
+ for (NSInteger row = visibleRows.location, col = [self columnWithIdentifier: @"Priority"]; (NSUInteger)row < NSMaxRange(visibleRows); row++)
{
FilePriorityCell * cell = (FilePriorityCell *)[self preparedCellAtColumn: col row: row];
}
else
{
- NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1)];
+ NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1u)];
CGFloat totalWidth;
if (count == 0)
[self.cancelButton setFrame:newCancelFrame];
}
-- (IBAction) rename: (id) sender;
+- (IBAction) rename: (id) sender
{
void (^completionHandler)(BOOL) = ^(BOOL didRename) {
if (didRename)
{
if (index != -1)
{
- for (NSInteger i = 0; i < [fGroups count]; i++)
+ for (NSUInteger i = 0; i < [fGroups count]; i++)
if (index == [[[fGroups objectAtIndex: i] objectForKey: @"Index"] integerValue])
return i;
}
return [menu autorelease];
}
-- (NSInteger) groupIndexForTorrent: (Torrent *) torrent;
+- (NSInteger) groupIndexForTorrent: (Torrent *) torrent
{
for (NSDictionary * group in fGroups)
{
#pragma mark -
#pragma mark Rule editor
-- (IBAction) toggleUseAutoAssignRules: (id) sender;
+- (IBAction) toggleUseAutoAssignRules: (id) sender
{
NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
if ([fAutoAssignRulesEnableCheck state] == NSOnState)
[fAutoAssignRulesEditButton setEnabled: [fAutoAssignRulesEnableCheck state] == NSOnState];
}
-- (IBAction) orderFrontRulesSheet: (id) sender;
+- (IBAction) orderFrontRulesSheet: (id) sender
{
if (!fGroupRulesSheetWindow)
[NSBundle loadNibNamed: @"GroupRules" owner: self];
contextInfo: NULL];
}
-- (IBAction) cancelRules: (id) sender;
+- (IBAction) cancelRules: (id) sender
{
[fGroupRulesSheetWindow orderOut: nil];
[NSApp endSheet: fGroupRulesSheetWindow];
}
}
-- (IBAction) saveRules: (id) sender;
+- (IBAction) saveRules: (id) sender
{
[fGroupRulesSheetWindow orderOut: nil];
[NSApp endSheet: fGroupRulesSheetWindow];
break;
default:
NSAssert1(NO, @"Unknown message log level: %ld", [fLevelButton indexOfSelectedItem]);
+ level = TR_LOG_INFO;
}
if ([[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"] == level)
break;
default:
NSAssert1(NO, @"Unknown message log level: %ld", level);
+ levelString = @"?";
}
return [NSString stringWithFormat: @"%@ %@ [%@] %@: %@", [message objectForKey: @"Date"],
NSAssert(![NSApp isOnYosemiteOrBetter], @"you should be using NSDateComponentsFormatter on >= 10.10");
NSParameterAssert(max > 0);
- NSMutableArray * timeArray = [NSMutableArray arrayWithCapacity: MIN(max, 5)];
+ NSMutableArray * timeArray = [NSMutableArray arrayWithCapacity: MIN(max, 5u)];
NSUInteger remaining = seconds; //causes problems for some users when it's a uint64_t
if (seconds >= 31557600) //official amount of seconds in one year
break;
default:
NSAssert1(NO, @"Unknown status label tag received: %ld", [menuItem tag]);
+ statusLabel = STATUS_RATIO_TOTAL;
}
[menuItem setState: [statusLabel isEqualToString: [[NSUserDefaults standardUserDefaults] stringForKey: @"StatusLabel"]]
//check if moving inside itself
NSArray * oldComponents = [oldFolder pathComponents],
* newComponents = [folder pathComponents];
- const NSInteger oldCount = [oldComponents count];
+ const NSUInteger oldCount = [oldComponents count];
if (oldCount < [newComponents count] && [[newComponents objectAtIndex: oldCount] isEqualToString: [self name]]
&& [folder hasPrefix: oldFolder])
//recreate the tracker structure
const int oldTrackerCount = fInfo->trackerCount;
tr_tracker_info * trackerStructs = tr_new(tr_tracker_info, oldTrackerCount+1);
- for (NSUInteger i=0; i < oldTrackerCount; ++i)
+ for (int i = 0; i < oldTrackerCount; ++i)
trackerStructs[i] = fInfo->trackers[i];
trackerStructs[oldTrackerCount].announce = (char *)[tracker UTF8String];
return fGroupValue;
}
-- (void) setGroupValue: (NSInteger) groupValue determinationType: (TorrentDeterminationType) determinationType;
+- (void) setGroupValue: (NSInteger) groupValue determinationType: (TorrentDeterminationType) determinationType
{
if (groupValue != fGroupValue)
{
- (BOOL) canChangeDownloadCheckForFile: (NSUInteger) index
{
- NSAssert2(index < [self fileCount], @"Index %ld is greater than file count %ld", index, [self fileCount]);
+ NSAssert2((NSInteger)index < [self fileCount], @"Index %ld is greater than file count %ld", index, [self fileCount]);
return [self canChangeDownloadCheckForFiles: [NSIndexSet indexSetWithIndex: index]];
}
- (NSSet *) filePrioritiesForIndexes: (NSIndexSet *) indexSet
{
BOOL low = NO, normal = NO, high = NO;
- NSMutableSet * priorities = [NSMutableSet setWithCapacity: MIN([indexSet count], 3)];
+ NSMutableSet * priorities = [NSMutableSet setWithCapacity: MIN([indexSet count], 3u)];
for (NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
{
imageSize, imageSize);
}
-- (NSUInteger) hitTestForEvent: (NSEvent *) event inRect: (NSRect) cellFrame ofView: (NSView *) controlView
+- (NSCellHitResult) hitTestForEvent: (NSEvent *) event inRect: (NSRect) cellFrame ofView: (NSView *) controlView
{
NSPoint point = [controlView convertPoint: [event locationInWindow] fromView: nil];
break;
default:
NSAssert1(NO, @"Unknown priority: %ld", [sender tag]);
+ priority = TR_PRI_NORMAL;
}
[fMenuTorrent setPriority: priority];