diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index c408ef4d0..543b90953 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -767,6 +767,7 @@ typedef enum title = NSLocalizedString(@"Options", "Inspector -> title"); break; default: + NSAssert1(NO, @"Unknown info tab selected: %d", fCurrentTabTag); return; } @@ -1011,7 +1012,8 @@ typedef enum [components addObject: [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Port", "Inspector -> Peers tab -> table row tooltip"), portString]]; - switch ([[peer objectForKey: @"From"] intValue]) + const NSInteger peerFrom = [[peer objectForKey: @"From"] integerValue]; + switch (peerFrom) { case TR_PEER_FROM_TRACKER: [components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")]; @@ -1028,6 +1030,8 @@ typedef enum case TR_PEER_FROM_DHT: [components addObject: NSLocalizedString(@"From: distributed hash table", "Inspector -> Peers tab -> table row tooltip")]; break; + default: + NSAssert1(NO, @"Peer from unknown source: %d", peerFrom); } //determing status strings from flags @@ -1104,7 +1108,7 @@ typedef enum [self addTrackers]; } -#warning what?! +#warning is editing trackers needed? /*- (BOOL) tableView: (NSTableView *) tableView shouldEditTableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row { if (tableView != fTrackerTable) @@ -1273,6 +1277,7 @@ typedef enum setting = TR_RATIOLIMIT_GLOBAL; break; default: + NSAssert1(NO, @"Unknown option selected in ratio popup: %d", [sender indexOfSelectedItem]); return; } @@ -1310,6 +1315,7 @@ typedef enum priority = TR_PRI_LOW; break; default: + NSAssert1(NO, @"Unknown option selected in priority popup: %d", [sender indexOfSelectedItem]); return; } @@ -1441,7 +1447,7 @@ typedef enum return; Torrent * torrent = [fTorrents objectAtIndex: 0]; - //get update tracker stats + //get updated tracker stats if ([fTrackerTable editedRow] == -1) { [fTrackers release]; @@ -1554,6 +1560,7 @@ typedef enum case TAB_OPTIONS_TAG: return fOptionsView; default: + NSAssert1(NO, @"Unknown tab view for tag: %d", tag); return nil; } } diff --git a/macosx/MessageWindowController.m b/macosx/MessageWindowController.m index 32b3581b6..5407706c0 100644 --- a/macosx/MessageWindowController.m +++ b/macosx/MessageWindowController.m @@ -138,12 +138,11 @@ - (void) updateLog: (NSTimer *) timer { - static NSUInteger currentIndex = 0; - tr_msg_list * messages; if ((messages = tr_getQueuedMessages()) == NULL) return; + static NSUInteger currentIndex = 0; for (tr_msg_list * currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next) { NSString * name = currentMessage->name != NULL ? [NSString stringWithUTF8String: currentMessage->name] diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 741b61618..f7c76f778 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -130,7 +130,7 @@ - (uint64_t) sizeLeft; - (NSMutableArray *) allTrackerStats; -- (NSMutableArray *) allTrackersFlat; //used by GroupRules +- (NSArray *) allTrackersFlat; //used by GroupRules - (BOOL) addTrackerToNewTier: (NSString *) tracker; - (void) removeTrackersWithAnnounceAddresses: (NSSet *) trackers; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index a137e7363..ad2bba175 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -695,7 +695,7 @@ int trashDataFile(const char * filename) return trackers; } -- (NSMutableArray *) allTrackersFlat +- (NSArray *) allTrackersFlat { NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: fInfo->trackerCount];