1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

add some more switch statement asserts

This commit is contained in:
Mitchell Livingston 2009-10-11 17:17:29 +00:00
parent e4e0400f31
commit 53273caef2
4 changed files with 13 additions and 7 deletions

View file

@ -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;
}
}

View file

@ -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]

View file

@ -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;

View file

@ -695,7 +695,7 @@ int trashDataFile(const char * filename)
return trackers;
}
- (NSMutableArray *) allTrackersFlat
- (NSArray *) allTrackersFlat
{
NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: fInfo->trackerCount];