Fix some warnings revealed by CMake configuration compiler flags

This commit is contained in:
Mike Gelfand 2016-09-11 13:22:49 +03:00
parent b6d2649ddc
commit ee0f7686b5
15 changed files with 36 additions and 23 deletions

View File

@ -80,7 +80,9 @@
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];
@ -239,7 +241,9 @@
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];
}

View File

@ -115,7 +115,9 @@
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];
@ -258,7 +260,9 @@
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];
}

View File

@ -1490,7 +1490,7 @@ static void removeKeRangerRansomware()
NSString * title, * message;
const NSInteger selected = [torrents count];
const NSUInteger selected = [torrents count];
if (selected == 1)
{
NSString * torrentName = [(Torrent *)[torrents objectAtIndex: 0] name];
@ -2620,7 +2620,7 @@ static void removeKeRangerRansomware()
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) {
@ -4160,6 +4160,7 @@ static void removeKeRangerRansomware()
break;
default:
NSAssert1(NO, @"Unknown sort tag received: %ld", [menuItem tag]);
sortType = SORT_ORDER;
}
[menuItem setState: [sortType isEqualToString: [fDefaults stringForKey: @"Sort"]] ? NSOnState : NSOffState];

View File

@ -193,7 +193,7 @@
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];

View File

@ -96,7 +96,7 @@
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];

View File

@ -124,7 +124,7 @@
}
else
{
NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1)];
NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1u)];
CGFloat totalWidth;
if (count == 0)

View File

@ -120,7 +120,7 @@ typedef void (^CompletionBlock)(BOOL);
[self.cancelButton setFrame:newCancelFrame];
}
- (IBAction) rename: (id) sender;
- (IBAction) rename: (id) sender
{
void (^completionHandler)(BOOL) = ^(BOOL didRename) {
if (didRename)

View File

@ -120,7 +120,7 @@ GroupsController * fGroupsInstance = nil;
{
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;
}
@ -336,7 +336,7 @@ GroupsController * fGroupsInstance = nil;
return [menu autorelease];
}
- (NSInteger) groupIndexForTorrent: (Torrent *) torrent;
- (NSInteger) groupIndexForTorrent: (Torrent *) torrent
{
for (NSDictionary * group in fGroups)
{

View File

@ -234,7 +234,7 @@
#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)
@ -250,7 +250,7 @@
[fAutoAssignRulesEditButton setEnabled: [fAutoAssignRulesEnableCheck state] == NSOnState];
}
- (IBAction) orderFrontRulesSheet: (id) sender;
- (IBAction) orderFrontRulesSheet: (id) sender
{
if (!fGroupRulesSheetWindow)
[NSBundle loadNibNamed: @"GroupRules" owner: self];
@ -266,7 +266,7 @@
contextInfo: NULL];
}
- (IBAction) cancelRules: (id) sender;
- (IBAction) cancelRules: (id) sender
{
[fGroupRulesSheetWindow orderOut: nil];
[NSApp endSheet: fGroupRulesSheetWindow];
@ -280,7 +280,7 @@
}
}
- (IBAction) saveRules: (id) sender;
- (IBAction) saveRules: (id) sender
{
[fGroupRulesSheetWindow orderOut: nil];
[NSApp endSheet: fGroupRulesSheetWindow];

View File

@ -354,6 +354,7 @@
break;
default:
NSAssert1(NO, @"Unknown message log level: %ld", [fLevelButton indexOfSelectedItem]);
level = TR_LOG_INFO;
}
if ([[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"] == level)
@ -527,6 +528,7 @@
break;
default:
NSAssert1(NO, @"Unknown message log level: %ld", level);
levelString = @"?";
}
return [NSString stringWithFormat: @"%@ %@ [%@] %@: %@", [message objectForKey: @"Date"],

View File

@ -164,7 +164,7 @@
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

View File

@ -234,6 +234,7 @@ typedef enum
break;
default:
NSAssert1(NO, @"Unknown status label tag received: %ld", [menuItem tag]);
statusLabel = STATUS_RATIO_TOTAL;
}
[menuItem setState: [statusLabel isEqualToString: [[NSUserDefaults standardUserDefaults] stringForKey: @"StatusLabel"]]

View File

@ -557,7 +557,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
//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])
@ -721,7 +721,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
//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];
@ -1376,7 +1376,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
return fGroupValue;
}
- (void) setGroupValue: (NSInteger) groupValue determinationType: (TorrentDeterminationType) determinationType;
- (void) setGroupValue: (NSInteger) groupValue determinationType: (TorrentDeterminationType) determinationType
{
if (groupValue != fGroupValue)
{
@ -1447,7 +1447,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
- (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]];
}
@ -1523,7 +1523,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
- (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])
{

View File

@ -131,7 +131,7 @@
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];

View File

@ -790,6 +790,7 @@
break;
default:
NSAssert1(NO, @"Unknown priority: %ld", [sender tag]);
priority = TR_PRI_NORMAL;
}
[fMenuTorrent setPriority: priority];