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:
parent
e4e0400f31
commit
53273caef2
4 changed files with 13 additions and 7 deletions
|
@ -767,6 +767,7 @@ typedef enum
|
||||||
title = NSLocalizedString(@"Options", "Inspector -> title");
|
title = NSLocalizedString(@"Options", "Inspector -> title");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
NSAssert1(NO, @"Unknown info tab selected: %d", fCurrentTabTag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1011,7 +1012,8 @@ typedef enum
|
||||||
[components addObject: [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Port",
|
[components addObject: [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Port",
|
||||||
"Inspector -> Peers tab -> table row tooltip"), portString]];
|
"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:
|
case TR_PEER_FROM_TRACKER:
|
||||||
[components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")];
|
[components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
@ -1028,6 +1030,8 @@ typedef enum
|
||||||
case TR_PEER_FROM_DHT:
|
case TR_PEER_FROM_DHT:
|
||||||
[components addObject: NSLocalizedString(@"From: distributed hash table", "Inspector -> Peers tab -> table row tooltip")];
|
[components addObject: NSLocalizedString(@"From: distributed hash table", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
NSAssert1(NO, @"Peer from unknown source: %d", peerFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
//determing status strings from flags
|
//determing status strings from flags
|
||||||
|
@ -1104,7 +1108,7 @@ typedef enum
|
||||||
[self addTrackers];
|
[self addTrackers];
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning what?!
|
#warning is editing trackers needed?
|
||||||
/*- (BOOL) tableView: (NSTableView *) tableView shouldEditTableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row
|
/*- (BOOL) tableView: (NSTableView *) tableView shouldEditTableColumn: (NSTableColumn *) tableColumn row: (NSInteger) row
|
||||||
{
|
{
|
||||||
if (tableView != fTrackerTable)
|
if (tableView != fTrackerTable)
|
||||||
|
@ -1273,6 +1277,7 @@ typedef enum
|
||||||
setting = TR_RATIOLIMIT_GLOBAL;
|
setting = TR_RATIOLIMIT_GLOBAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
NSAssert1(NO, @"Unknown option selected in ratio popup: %d", [sender indexOfSelectedItem]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,6 +1315,7 @@ typedef enum
|
||||||
priority = TR_PRI_LOW;
|
priority = TR_PRI_LOW;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
NSAssert1(NO, @"Unknown option selected in priority popup: %d", [sender indexOfSelectedItem]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1441,7 +1447,7 @@ typedef enum
|
||||||
return;
|
return;
|
||||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||||
|
|
||||||
//get update tracker stats
|
//get updated tracker stats
|
||||||
if ([fTrackerTable editedRow] == -1)
|
if ([fTrackerTable editedRow] == -1)
|
||||||
{
|
{
|
||||||
[fTrackers release];
|
[fTrackers release];
|
||||||
|
@ -1554,6 +1560,7 @@ typedef enum
|
||||||
case TAB_OPTIONS_TAG:
|
case TAB_OPTIONS_TAG:
|
||||||
return fOptionsView;
|
return fOptionsView;
|
||||||
default:
|
default:
|
||||||
|
NSAssert1(NO, @"Unknown tab view for tag: %d", tag);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,12 +138,11 @@
|
||||||
|
|
||||||
- (void) updateLog: (NSTimer *) timer
|
- (void) updateLog: (NSTimer *) timer
|
||||||
{
|
{
|
||||||
static NSUInteger currentIndex = 0;
|
|
||||||
|
|
||||||
tr_msg_list * messages;
|
tr_msg_list * messages;
|
||||||
if ((messages = tr_getQueuedMessages()) == NULL)
|
if ((messages = tr_getQueuedMessages()) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
static NSUInteger currentIndex = 0;
|
||||||
for (tr_msg_list * currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next)
|
for (tr_msg_list * currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next)
|
||||||
{
|
{
|
||||||
NSString * name = currentMessage->name != NULL ? [NSString stringWithUTF8String: currentMessage->name]
|
NSString * name = currentMessage->name != NULL ? [NSString stringWithUTF8String: currentMessage->name]
|
||||||
|
|
|
@ -130,7 +130,7 @@
|
||||||
- (uint64_t) sizeLeft;
|
- (uint64_t) sizeLeft;
|
||||||
|
|
||||||
- (NSMutableArray *) allTrackerStats;
|
- (NSMutableArray *) allTrackerStats;
|
||||||
- (NSMutableArray *) allTrackersFlat; //used by GroupRules
|
- (NSArray *) allTrackersFlat; //used by GroupRules
|
||||||
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
|
- (BOOL) addTrackerToNewTier: (NSString *) tracker;
|
||||||
- (void) removeTrackersWithAnnounceAddresses: (NSSet *) trackers;
|
- (void) removeTrackersWithAnnounceAddresses: (NSSet *) trackers;
|
||||||
|
|
||||||
|
|
|
@ -695,7 +695,7 @@ int trashDataFile(const char * filename)
|
||||||
return trackers;
|
return trackers;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMutableArray *) allTrackersFlat
|
- (NSArray *) allTrackersFlat
|
||||||
{
|
{
|
||||||
NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: fInfo->trackerCount];
|
NSMutableArray * allTrackers = [NSMutableArray arrayWithCapacity: fInfo->trackerCount];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue