]> granicus.if.org Git - transmission/commitdiff
Fix some warnings revealed by CMake configuration compiler flags
authorMike Gelfand <mikedld@mikedld.com>
Sun, 11 Sep 2016 10:22:49 +0000 (13:22 +0300)
committerMike Gelfand <mikedld@mikedld.com>
Wed, 11 Jan 2017 20:43:56 +0000 (23:43 +0300)
15 files changed:
macosx/AddMagnetWindowController.m
macosx/AddWindowController.m
macosx/Controller.m
macosx/FileNameCell.m
macosx/FileOutlineView.m
macosx/FilePriorityCell.m
macosx/FileRenameSheetController.m
macosx/GroupsController.m
macosx/GroupsPrefsController.m
macosx/MessageWindowController.m
macosx/NSStringAdditions.m
macosx/StatusBarController.m
macosx/Torrent.m
macosx/TorrentCell.m
macosx/TorrentTableView.m

index 8e88019ad0086977244889a6251e8b3aa24af0ba..d02b2eeeaea23c071df14e6bb16ab39d8565ecd4 100644 (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];
     
         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];
 }
index 494ae90ec0b3af0271e04d6c453512083945eea2..f698e209d9488cd6ecad4b83367000676ea105e6 100644 (file)
         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];
 }
index 9628f72d571ae52a4f6a946f38a0f7d6c95a55c9..7dddff5357a88f736844b5cdb656a0ee82119f9b 100644 (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];
index 163c4aef69f0fd2d19eff7352167c76506ee2858..86adde5437f2773dd3e2fb2a7bc26371be56726d 100644 (file)
     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];
     
index 6b54110f0e975621301d8dfc04d2a87706b2f8b5..a66d614049c47339448d7cfae88c34e64b6c1c0a 100644 (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];
         
index 0982eabd2871bd5f6f243d8080496085ded18cc9..713c7b94f340c1f855d52adcd4743b99c0e58694 100644 (file)
     }
     else
     {
-        NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1)];
+        NSMutableArray * images = [NSMutableArray arrayWithCapacity: MAX(count, 1u)];
         CGFloat totalWidth;
         
         if (count == 0)
index 96662809338342424ceb4b3ec6b84054306f10ba..04eafb791cdaf7bab62fb4d814373cd121f3fba9 100644 (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)
index 448b23b1e414b41cf7e2ad7f777a729597b1c7d3..f3b29ffcf98fa74188a011465d779fa58253c972 100644 (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)
     {
index 82993de945f8bdbe60d7a9db8aee4219e2cc3d94..d2b7ce7787ce802a72d6c55688b454c1a55648ed 100644 (file)
 #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];
index 0d0ab0bce6320a52ea3b121e4d23db6695003127..e436401ea07b3e93a1b4e8187a0db08b9f1dd5ab 100644 (file)
             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"],
index d52a63949d91c65dbfd729bed17caeaa959ef278..ee38573d5d42a04f4f38767a1eda82c592494860 100644 (file)
     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
index c5c80740a9742908f54f0df3a1d0d7559b708377..75b67c8d772dddb1f240ec01de69f14ddcb82752 100644 (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"]]
index bcb4af6cb4d2ed6e81912739b3eb243b9ae6b5f0..fca916ff3a49f74a267790b166e20728bf9f121e 100644 (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])
     {
index ce3d3773aea4e3721bf6397ce71e376796f44fee..7ca0f82145b210efb5d4bb4c283888eb52b354d1 100644 (file)
                         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];
     
index 3e5de081aaa8b676585e8efdbb95a409d9bec9ad..baf2eca582f70613ae480b695c661303134e314b 100644 (file)
             break;
         default:
             NSAssert1(NO, @"Unknown priority: %ld", [sender tag]);
+            priority = TR_PRI_NORMAL;
     }
     
     [fMenuTorrent setPriority: priority];