NSDictionary subscripting

This commit is contained in:
Dmitry Serov 2017-07-08 21:38:47 +07:00
parent 40a7b8879c
commit 95ae0688eb
17 changed files with 163 additions and 161 deletions

View File

@ -36,7 +36,7 @@ AboutWindowController * fAboutBoxInstance = nil;
{
NSDictionary * info = [[NSBundle mainBundle] infoDictionary];
[fVersionField setStringValue: [NSString stringWithFormat: @"%@ (%@)",
[info objectForKey: @"CFBundleShortVersionString"], [info objectForKey: (NSString *)kCFBundleVersionKey]]];
info[@"CFBundleShortVersionString"], info[(NSString *)kCFBundleVersionKey]]];
[fCopyrightField setStringValue: [[NSBundle mainBundle] localizedStringForKey: @"NSHumanReadableCopyright"
value: nil table: @"InfoPlist"]];

View File

@ -108,8 +108,8 @@
[stringShadow setShadowBlurRadius: 4.0];
fAttributes = [[NSMutableDictionary alloc] initWithCapacity: 3];
[fAttributes setObject: [NSColor whiteColor] forKey: NSForegroundColorAttributeName];
[fAttributes setObject: stringShadow forKey: NSShadowAttributeName];
fAttributes[NSForegroundColorAttributeName] = [NSColor whiteColor];
fAttributes[NSShadowAttributeName] = stringShadow;
[stringShadow release];
}
@ -126,7 +126,7 @@
NSSize stringSize;
do
{
[fAttributes setObject: [NSFont boldSystemFontOfSize: fontSize] forKey: NSFontAttributeName];
fAttributes[NSFontAttributeName] = [NSFont boldSystemFontOfSize: fontSize];
stringSize = [string sizeWithAttributes: fAttributes];
fontSize -= 1.0;
} while (NSWidth(badgeRect) < stringSize.width);

View File

@ -573,7 +573,7 @@ static void removeKeRangerRansomware()
[fTorrents addObject: torrent];
NSNumber * waitToStart;
if (!fPauseOnLaunch && (waitToStart = [historyItem objectForKey: @"WaitToStart"]) && [waitToStart boolValue])
if (!fPauseOnLaunch && (waitToStart = historyItem[@"WaitToStart"]) && [waitToStart boolValue])
[waitToStartTorrents addObject: torrent];
[torrent release];
@ -665,7 +665,7 @@ static void removeKeRangerRansomware()
forEventClass: kCoreEventClass andEventID: kAEOpenContents];
//if we were opened from a user notification, do the corresponding action
NSUserNotification * launchNotification = [[notification userInfo] objectForKey: NSApplicationLaunchUserNotificationKey];
NSUserNotification * launchNotification = [notification userInfo][ NSApplicationLaunchUserNotificationKey];
if (launchNotification)
[self userNotificationCenter: nil didActivateNotification: launchNotification];
@ -801,7 +801,7 @@ static void removeKeRangerRansomware()
{
for (NSDictionary * downloadDict in fPendingTorrentDownloads)
{
NSURLDownload * download = [downloadDict objectForKey: @"Download"];
NSURLDownload * download = downloadDict[@"Download"];
[download cancel];
[download release];
}
@ -904,7 +904,8 @@ static void removeKeRangerRansomware()
-(void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
{
[(NSMutableDictionary *)[fPendingTorrentDownloads objectForKey: [[download request] URL]] setObject: path forKey: @"Path"];
NSMutableDictionary *dict = (NSMutableDictionary *)fPendingTorrentDownloads[[[download request] URL]];
dict[@"Path"] = path;
}
- (void) download: (NSURLDownload *) download didFailWithError: (NSError *) error
@ -927,7 +928,7 @@ static void removeKeRangerRansomware()
- (void) downloadDidFinish: (NSURLDownload *) download
{
NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"];
NSString * path = fPendingTorrentDownloads[[[download request] URL]][@"Path"];
[self openFiles: @[path] addType: ADD_URL forcePath: nil];
@ -1184,13 +1185,13 @@ static void removeKeRangerRansomware()
- (void) openCreatedFile: (NSNotification *) notification
{
NSDictionary * dict = [notification userInfo];
[self openFiles: @[[dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]];
[self openFiles: @[dict[@"File"]] addType: ADD_CREATED forcePath: dict[@"Path"]];
[dict release];
}
- (void) openFilesWithDict: (NSDictionary *) dictionary
{
[self openFiles: [dictionary objectForKey: @"Filenames"] addType: [[dictionary objectForKey: @"AddType"] intValue] forcePath: nil];
[self openFiles: dictionary[@"Filenames"] addType: [dictionary[@"AddType"] intValue] forcePath: nil];
[dictionary release];
}
@ -1336,7 +1337,7 @@ static void removeKeRangerRansomware()
NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: urlString]
cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
if ([fPendingTorrentDownloads objectForKey: [request URL]])
if (fPendingTorrentDownloads[[request URL]])
{
NSLog(@"Already downloading %@", [request URL]);
return;
@ -1346,7 +1347,8 @@ static void removeKeRangerRansomware()
if (!fPendingTorrentDownloads)
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
[fPendingTorrentDownloads setObject: [NSMutableDictionary dictionaryWithObject: download forKey: @"Download"] forKey: [request URL]];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject: download forKey: @"Download"];
fPendingTorrentDownloads[[request URL]] = dict;
}
}
@ -1521,9 +1523,9 @@ static void removeKeRangerRansomware()
- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (NSDictionary *) dict
{
NSArray * torrents = [dict objectForKey: @"Torrents"];
NSArray * torrents = dict[@"Torrents"];
if (returnCode == NSAlertDefaultReturn)
[self confirmRemoveTorrents: torrents deleteData: [[dict objectForKey: @"DeleteData"] boolValue]];
[self confirmRemoveTorrents: torrents deleteData: [dict[@"DeleteData"] boolValue]];
[dict release];
}
@ -1983,16 +1985,16 @@ static void removeKeRangerRansomware()
if ([notification activationType] == NSUserNotificationActivationTypeActionButtonClicked) //reveal
{
Torrent * torrent = [self torrentForHash: [[notification userInfo] objectForKey: @"Hash"]];
Torrent * torrent = [self torrentForHash: [notification userInfo][@"Hash"]];
NSString * location = [torrent dataLocation];
if (!location)
location = [[notification userInfo] objectForKey: @"Location"];
location = [notification userInfo][@"Location"];
if (location)
[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[[NSURL fileURLWithPath: location]]];
}
else if ([notification activationType] == NSUserNotificationActivationTypeContentsClicked)
{
Torrent * torrent = [self torrentForHash: [[notification userInfo] objectForKey: @"Hash"]];
Torrent * torrent = [self torrentForHash: [notification userInfo][@"Hash"]];
if (torrent)
{
//select in the table - first see if it's already shown
@ -2072,7 +2074,7 @@ static void removeKeRangerRansomware()
{
Torrent * torrent = [notification object];
if ([[[notification userInfo] objectForKey: @"WasRunning"] boolValue])
if ([[notification userInfo][@"WasRunning"] boolValue])
{
if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
{
@ -2097,7 +2099,7 @@ static void removeKeRangerRansomware()
NSMutableDictionary * userInfo = [NSMutableDictionary dictionaryWithObject: [torrent hashString] forKey: @"Hash"];
if (location)
[userInfo setObject: location forKey: @"Location"];
userInfo[@"Location"] = location;
[notification setUserInfo: userInfo];
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notification];
@ -2107,7 +2109,7 @@ static void removeKeRangerRansomware()
GROWL_DOWNLOAD_COMPLETE, @"Type", nil];
if (location)
[clickContext setObject: location forKey: @"Location"];
clickContext[@"Location"] = location;
[GrowlApplicationBridge notifyWithTitle: notificationTitle
description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
@ -2156,7 +2158,7 @@ static void removeKeRangerRansomware()
NSMutableDictionary * userInfo = [NSMutableDictionary dictionaryWithObject: [torrent hashString] forKey: @"Hash"];
if (location)
[userInfo setObject: location forKey: @"Location"];
userInfo[@"Location"] = location;
[userNotification setUserInfo: userInfo];
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: userNotification];
@ -2165,7 +2167,7 @@ static void removeKeRangerRansomware()
NSMutableDictionary * clickContext = [NSMutableDictionary dictionaryWithObject: GROWL_SEEDING_COMPLETE forKey: @"Type"];
if (location)
[clickContext setObject: location forKey: @"Location"];
clickContext[@"Location"] = location;
[GrowlApplicationBridge notifyWithTitle: notificationTitle
description: [torrent name] notificationName: GROWL_SEEDING_COMPLETE
@ -2581,7 +2583,7 @@ static void removeKeRangerRansomware()
NSMutableDictionary * groupsByIndex = [NSMutableDictionary dictionaryWithCapacity: [fDisplayedTorrents count]];
for (TorrentGroup * group in fDisplayedTorrents)
[groupsByIndex setObject: group forKey: @([group groupIndex])];
groupsByIndex[@([group groupIndex])] = group;
const NSUInteger originalGroupCount = [fDisplayedTorrents count];
for (NSUInteger index = 0; index < originalGroupCount; ++index)
@ -2606,11 +2608,11 @@ static void removeKeRangerRansomware()
const NSInteger groupValue = [torrent groupValue];
if (groupValue != [group groupIndex])
{
TorrentGroup * newGroup = [groupsByIndex objectForKey: @(groupValue)];
TorrentGroup * newGroup = groupsByIndex[@(groupValue)];
if (!newGroup)
{
newGroup = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: newGroup forKey: @(groupValue)];
groupsByIndex[@(groupValue)] = newGroup;
[fDisplayedTorrents addObject: newGroup];
[fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
@ -2647,11 +2649,11 @@ static void removeKeRangerRansomware()
for (Torrent * torrent in [allTorrents objectsAtIndexes: unusedAllTorrentsIndexes])
{
const NSInteger groupValue = [torrent groupValue];
TorrentGroup * group = [groupsByIndex objectForKey: @(groupValue)];
TorrentGroup * group = groupsByIndex[@(groupValue)];
if (!group)
{
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: group forKey: @(groupValue)];
groupsByIndex[@(groupValue)] = group;
[fDisplayedTorrents addObject: group];
[fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndex: [fDisplayedTorrents count]-1] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
@ -2702,11 +2704,11 @@ static void removeKeRangerRansomware()
for (Torrent * torrent in allTorrents)
{
const NSInteger groupValue = [torrent groupValue];
TorrentGroup * group = [groupsByIndex objectForKey: @(groupValue)];
TorrentGroup * group = groupsByIndex[@(groupValue)];
if (!group)
{
group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease];
[groupsByIndex setObject: group forKey: @(groupValue)];
groupsByIndex[@(groupValue)] = group;
}
[[group torrents] addObject: torrent];
@ -2847,12 +2849,12 @@ static void removeKeRangerRansomware()
//dict has been retained
- (void) altSpeedToggledCallbackIsLimited: (NSDictionary *) dict
{
const BOOL isLimited = [[dict objectForKey: @"Active"] boolValue];
const BOOL isLimited = [dict[@"Active"] boolValue];
[fDefaults setBool: isLimited forKey: @"SpeedLimit"];
[fStatusBar updateSpeedFieldsToolTips];
if (![[dict objectForKey: @"ByUser"] boolValue])
if (![dict[@"ByUser"] boolValue])
[GrowlApplicationBridge notifyWithTitle: isLimited ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title") : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
notificationName: GROWL_AUTO_SPEED_LIMIT

View File

@ -127,8 +127,8 @@
statusColor = [NSColor darkGrayColor];
}
[fTitleAttributes setObject: titleColor forKey: NSForegroundColorAttributeName];
[fStatusAttributes setObject: statusColor forKey: NSForegroundColorAttributeName];
fTitleAttributes[NSForegroundColorAttributeName] = titleColor;
fStatusAttributes[NSForegroundColorAttributeName] = statusColor;
//title
NSAttributedString * titleString = [self attributedTitle];
@ -161,7 +161,7 @@
cellFrame.origin.x += PADDING_EXPANSION_FRAME;
cellFrame.origin.y += PADDING_EXPANSION_FRAME;
[fTitleAttributes setObject: [NSColor controlTextColor] forKey: NSForegroundColorAttributeName];
fTitleAttributes[NSForegroundColorAttributeName] = [NSColor controlTextColor];
NSAttributedString * titleString = [self attributedTitle];
[titleString drawInRect: cellFrame];
}

View File

@ -161,11 +161,11 @@ typedef enum
if (!removedIndexesForParents)
removedIndexesForParents = [NSMutableDictionary dictionary];
NSMutableIndexSet * removedIndexes = [removedIndexesForParents objectForKey: parent];
NSMutableIndexSet * removedIndexes = removedIndexesForParents[parent];
if (!removedIndexes)
{
removedIndexes = [NSMutableIndexSet indexSetWithIndex: previousIndex];
[removedIndexesForParents setObject: removedIndexes forKey: parent];
removedIndexesForParents[parent] = removedIndexes;
}
else
{

View File

@ -86,7 +86,7 @@
for (NSTrackingArea * area in [self trackingAreas])
{
if ([area owner] == self && [[area userInfo] objectForKey: @"Row"])
if ([area owner] == self && [area userInfo][@"Row"])
[self removeTrackingArea: area];
}
@ -114,7 +114,7 @@
- (void) mouseEntered: (NSEvent *) event
{
NSNumber * row;
if ((row = [(NSDictionary *)[event userData] objectForKey: @"Row"]))
if ((row = ((NSDictionary *)[event userData])[@"Row"]))
{
fMouseRow = [row intValue];
[self setNeedsDisplayInRect: [self frameOfCellAtColumn: [self columnWithIdentifier: @"Priority"] row: fMouseRow]];
@ -124,7 +124,7 @@
- (void) mouseExited: (NSEvent *) event
{
NSNumber * row;
if ((row = [(NSDictionary *)[event userData] objectForKey: @"Row"]))
if ((row = ((NSDictionary *)[event userData])[@"Row"]))
{
[self setNeedsDisplayInRect: [self frameOfCellAtColumn: [self columnWithIdentifier: @"Priority"] row: [row intValue]]];
fMouseRow = -1;

View File

@ -121,7 +121,7 @@ GroupsController * fGroupsInstance = nil;
if (index != -1)
{
for (NSUInteger i = 0; i < [fGroups count]; i++)
if (index == [[fGroups[i] objectForKey: @"Index"] integerValue])
if (index == [fGroups[i][@"Index"] integerValue])
return i;
}
return -1;
@ -129,19 +129,19 @@ GroupsController * fGroupsInstance = nil;
- (NSInteger) indexForRow: (NSInteger) row
{
return [[fGroups[row] objectForKey: @"Index"] integerValue];
return [fGroups[row][@"Index"] integerValue];
}
- (NSString *) nameForIndex: (NSInteger) index
{
NSInteger orderIndex = [self rowValueForIndex: index];
return orderIndex != -1 ? [fGroups[orderIndex] objectForKey: @"Name"] : nil;
return orderIndex != -1 ? fGroups[orderIndex][@"Name"] : nil;
}
- (void) setName: (NSString *) name forIndex: (NSInteger) index
{
NSInteger orderIndex = [self rowValueForIndex: index];
[fGroups[orderIndex] setObject: name forKey: @"Name"];
fGroups[orderIndex][@"Name"] = name;
[self saveGroups];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
@ -157,7 +157,7 @@ GroupsController * fGroupsInstance = nil;
- (NSColor *) colorForIndex: (NSInteger) index
{
NSInteger orderIndex = [self rowValueForIndex: index];
return orderIndex != -1 ? [fGroups[orderIndex] objectForKey: @"Color"] : nil;
return orderIndex != -1 ? fGroups[orderIndex][@"Color"] : nil;
}
- (void) setColor: (NSColor *) color forIndex: (NSInteger) index
@ -165,7 +165,7 @@ GroupsController * fGroupsInstance = nil;
NSMutableDictionary * dict = fGroups[[self rowValueForIndex: index]];
[dict removeObjectForKey: @"Icon"];
[dict setObject: color forKey: @"Color"];
dict[@"Color"] = color;
[[GroupsController groups] saveGroups];
[[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateGroups" object: self];
@ -177,14 +177,14 @@ GroupsController * fGroupsInstance = nil;
return NO;
NSInteger orderIndex = [self rowValueForIndex: index];
return [[fGroups[orderIndex] objectForKey: @"UsesCustomDownloadLocation"] boolValue];
return [fGroups[orderIndex][@"UsesCustomDownloadLocation"] boolValue];
}
- (void) setUsesCustomDownloadLocation: (BOOL) useCustomLocation forIndex: (NSInteger) index
{
NSMutableDictionary * dict = fGroups[[self rowValueForIndex: index]];
[dict setObject: @(useCustomLocation) forKey: @"UsesCustomDownloadLocation"];
dict[@"UsesCustomDownloadLocation"] = @(useCustomLocation);
[[GroupsController groups] saveGroups];
}
@ -192,13 +192,13 @@ GroupsController * fGroupsInstance = nil;
- (NSString *) customDownloadLocationForIndex: (NSInteger) index
{
NSInteger orderIndex = [self rowValueForIndex: index];
return orderIndex != -1 ? [fGroups[orderIndex] objectForKey: @"CustomDownloadLocation"] : nil;
return orderIndex != -1 ? fGroups[orderIndex][@"CustomDownloadLocation"] : nil;
}
- (void) setCustomDownloadLocation: (NSString *) location forIndex: (NSInteger) index
{
NSMutableDictionary * dict = fGroups[[self rowValueForIndex: index]];
[dict setObject: location forKey: @"CustomDownloadLocation"];
dict[@"CustomDownloadLocation"] = location;
[[GroupsController groups] saveGroups];
}
@ -209,7 +209,7 @@ GroupsController * fGroupsInstance = nil;
if (orderIndex == -1)
return NO;
NSNumber * assignRules = [fGroups[orderIndex] objectForKey: @"UsesAutoGroupRules"];
NSNumber * assignRules = fGroups[orderIndex][@"UsesAutoGroupRules"];
return assignRules && [assignRules boolValue];
}
@ -217,7 +217,7 @@ GroupsController * fGroupsInstance = nil;
{
NSMutableDictionary * dict = fGroups[[self rowValueForIndex: index]];
[dict setObject: @(useAutoAssignRules) forKey: @"UsesAutoGroupRules"];
dict[@"UsesAutoGroupRules"] = @(useAutoAssignRules);
[[GroupsController groups] saveGroups];
}
@ -228,7 +228,7 @@ GroupsController * fGroupsInstance = nil;
if (orderIndex == -1)
return nil;
return [fGroups[orderIndex] objectForKey: @"AutoGroupRules"];
return fGroups[orderIndex][@"AutoGroupRules"];
}
- (void) setAutoAssignRules: (NSPredicate *) predicate forIndex: (NSInteger) index
@ -237,7 +237,7 @@ GroupsController * fGroupsInstance = nil;
if (predicate)
{
[dict setObject: predicate forKey: @"AutoGroupRules"];
dict[@"AutoGroupRules"] = predicate;
[[GroupsController groups] saveGroups];
}
else
@ -252,7 +252,7 @@ GroupsController * fGroupsInstance = nil;
//find the lowest index
NSMutableIndexSet * candidates = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fGroups count]+1)];
for (NSDictionary * dict in fGroups)
[candidates removeIndex: [[dict objectForKey: @"Index"] integerValue]];
[candidates removeIndex: [dict[@"Index"] integerValue]];
const NSInteger index = [candidates firstIndex];
@ -265,7 +265,7 @@ GroupsController * fGroupsInstance = nil;
- (void) removeGroupWithRowIndex: (NSInteger) row
{
NSInteger index = [[fGroups[row] objectForKey: @"Index"] integerValue];
NSInteger index = [fGroups[row][@"Index"] integerValue];
[fGroups removeObjectAtIndex: row];
[[NSNotificationCenter defaultCenter] postNotificationName: @"GroupValueRemoved" object: self userInfo:
@ -312,10 +312,10 @@ GroupsController * fGroupsInstance = nil;
for (NSMutableDictionary * dict in fGroups)
{
item = [[NSMenuItem alloc] initWithTitle: [dict objectForKey: @"Name"] action: action keyEquivalent: @""];
item = [[NSMenuItem alloc] initWithTitle: dict[@"Name"] action: action keyEquivalent: @""];
[item setTarget: target];
[item setTag: [[dict objectForKey: @"Index"] integerValue]];
[item setTag: [dict[@"Index"] integerValue]];
NSImage * icon = [self imageForGroup: dict];
if (small)
@ -340,7 +340,7 @@ GroupsController * fGroupsInstance = nil;
{
for (NSDictionary * group in fGroups)
{
NSInteger row = [[group objectForKey: @"Index"] integerValue];
NSInteger row = [group[@"Index"] integerValue];
if ([self torrent: torrent doesMatchRulesForGroupAtIndex: row])
return row;
}
@ -369,7 +369,7 @@ GroupsController * fGroupsInstance = nil;
- (NSImage *) imageForGroup: (NSMutableDictionary *) dict
{
NSImage * image;
if ((image = [dict objectForKey: @"Icon"]))
if ((image = dict[@"Icon"]))
return image;
NSRect rect = NSMakeRect(0.0, 0.0, ICON_WIDTH, ICON_WIDTH);
@ -377,7 +377,7 @@ GroupsController * fGroupsInstance = nil;
NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: rect xRadius: 3.0 yRadius: 3.0];
NSImage * icon = [[NSImage alloc] initWithSize: rect.size];
NSColor * color = [dict objectForKey: @"Color"];
NSColor * color = dict[@"Color"];
[icon lockFocus];
@ -396,7 +396,7 @@ GroupsController * fGroupsInstance = nil;
[icon unlockFocus];
[dict setObject: icon forKey: @"Icon"];
dict[@"Icon"] = icon;
[icon release];
return icon;

View File

@ -269,10 +269,10 @@
if ([ident isEqualToString: @"DL From"])
{
NSNumber * rate;
return (rate = [webSeed objectForKey: @"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
return (rate = webSeed[@"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
}
else
return [webSeed objectForKey: @"Address"];
return webSeed[@"Address"];
}
else
{
@ -280,23 +280,23 @@
NSDictionary * peer = fPeers[row];
if ([ident isEqualToString: @"Encryption"])
return [[peer objectForKey: @"Encryption"] boolValue] ? [NSImage imageNamed: @"Lock"] : nil;
return [peer[@"Encryption"] boolValue] ? [NSImage imageNamed: @"Lock"] : nil;
else if ([ident isEqualToString: @"Client"])
return [peer objectForKey: @"Client"];
return peer[@"Client"];
else if ([ident isEqualToString: @"Progress"])
return [peer objectForKey: @"Progress"];
return peer[@"Progress"];
else if ([ident isEqualToString: @"UL To"])
{
NSNumber * rate;
return (rate = [peer objectForKey: @"UL To Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
return (rate = peer[@"UL To Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
}
else if ([ident isEqualToString: @"DL From"])
{
NSNumber * rate;
return (rate = [peer objectForKey: @"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
return (rate = peer[@"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate doubleValue]] : @"";
}
else
return [peer objectForKey: @"IP"];
return peer[@"IP"];
}
}
@ -310,7 +310,7 @@
if ([ident isEqualToString: @"Progress"])
{
NSDictionary * peer = fPeers[row];
[(PeerProgressIndicatorCell *)cell setSeed: [[peer objectForKey: @"Seed"] boolValue]];
[(PeerProgressIndicatorCell *)cell setSeed: [peer[@"Seed"] boolValue]];
}
}
}
@ -351,19 +351,19 @@
NSMutableArray * components = [NSMutableArray arrayWithCapacity: multiple ? 6 : 5];
if (multiple)
[components addObject: [peer objectForKey: @"Name"]];
[components addObject: peer[@"Name"]];
const CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
const CGFloat progress = [peer[@"Progress"] floatValue];
NSString * progressString = [NSString stringWithFormat: NSLocalizedString(@"Progress: %@",
"Inspector -> Peers tab -> table row tooltip"),
[NSString percentString: progress longDecimals: NO]];
if (progress < 1.0 && [[peer objectForKey: @"Seed"] boolValue])
if (progress < 1.0 && [peer[@"Seed"] boolValue])
progressString = [progressString stringByAppendingFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
"Inspector -> Peers tab -> table row tooltip")];
[components addObject: progressString];
NSString * protocolString = [[peer objectForKey: @"uTP"] boolValue] ? @"\u00b5TP" : @"TCP";
if ([[peer objectForKey: @"Encryption"] boolValue])
NSString * protocolString = [peer[@"uTP"] boolValue] ? @"\u00b5TP" : @"TCP";
if ([peer[@"Encryption"] boolValue])
protocolString = [protocolString stringByAppendingFormat: @" (%@)",
NSLocalizedString(@"encrypted", "Inspector -> Peers tab -> table row tooltip")];
[components addObject: [NSString stringWithFormat:
@ -372,14 +372,14 @@
NSString * portString;
NSInteger port;
if ((port = [[peer objectForKey: @"Port"] intValue]) > 0)
if ((port = [peer[@"Port"] intValue]) > 0)
portString = [NSString stringWithFormat: @"%ld", port];
else
portString = NSLocalizedString(@"N/A", "Inspector -> Peers tab -> table row tooltip");
[components addObject: [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Port",
"Inspector -> Peers tab -> table row tooltip"), portString]];
const NSInteger peerFrom = [[peer objectForKey: @"From"] integerValue];
const NSInteger peerFrom = [peer[@"From"] integerValue];
switch (peerFrom)
{
case TR_PEER_FROM_TRACKER:
@ -410,7 +410,7 @@
//determing status strings from flags
NSMutableArray * statusArray = [NSMutableArray arrayWithCapacity: 6];
NSString * flags = [peer objectForKey: @"Flags"];
NSString * flags = peer[@"Flags"];
if ([flags rangeOfString: @"D"].location != NSNotFound)
[statusArray addObject: NSLocalizedString(@"Currently downloading (interested and not choked)",
@ -442,7 +442,7 @@
else
{
if ([fTorrents count] > 1)
return [fWebSeeds[row] objectForKey: @"Name"];
return fWebSeeds[row][@"Name"];
}
return nil;

View File

@ -162,12 +162,12 @@
if ([item isKindOfClass: [NSDictionary class]])
{
const NSInteger tier = [[item objectForKey: @"Tier"] integerValue];
const NSInteger tier = [item[@"Tier"] integerValue];
NSString * tierString = tier == -1 ? NSLocalizedString(@"New Tier", "Inspector -> tracker table")
: [NSString stringWithFormat: NSLocalizedString(@"Tier %d", "Inspector -> tracker table"), tier];
if ([fTorrents count] > 1)
tierString = [tierString stringByAppendingFormat: @" - %@", [item objectForKey: @"Name"]];
tierString = [tierString stringByAppendingFormat: @" - %@", item[@"Name"]];
return tierString;
}
else
@ -323,10 +323,10 @@
{
Torrent * torrent = [(TrackerNode *)object torrent];
NSMutableSet * removeSet;
if (!(removeSet = [removeIdentifiers objectForKey: torrent]))
if (!(removeSet = removeIdentifiers[torrent]))
{
removeSet = [NSMutableSet set];
[removeIdentifiers setObject: removeSet forKey: torrent];
removeIdentifiers[torrent] = removeSet;
}
[removeSet addObject: [(TrackerNode *)object fullAnnounceAddress]];
@ -401,7 +401,7 @@
[fTrackerTable beginUpdates];
for (Torrent * torrent in removeIdentifiers)
[torrent removeTrackers: [removeIdentifiers objectForKey: torrent]];
[torrent removeTrackers: removeIdentifiers[torrent]];
//reset table with either new or old value
[fTrackers release];

View File

@ -532,7 +532,7 @@ typedef enum
- (void) resetInfoForTorrent: (NSNotification *) notification
{
Torrent * torrent = [[notification userInfo] objectForKey: @"Torrent"];
Torrent * torrent = [notification userInfo][@"Torrent"];
if (fTorrents && (!torrent || [fTorrents containsObject: torrent]))
[self resetInfo];
}

View File

@ -266,10 +266,10 @@
NSDictionary * message = fDisplayedMessages[row];
if ([ident isEqualToString: @"Date"])
return [message objectForKey: @"Date"];
return message[@"Date"];
else if ([ident isEqualToString: @"Level"])
{
const NSInteger level = [[message objectForKey: @"Level"] integerValue];
const NSInteger level = [message[@"Level"] integerValue];
switch (level)
{
case TR_LOG_ERROR:
@ -284,15 +284,15 @@
}
}
else if ([ident isEqualToString: @"Name"])
return [message objectForKey: @"Name"];
return message[@"Name"];
else
return [message objectForKey: @"Message"];
return message[@"Message"];
}
#warning don't cut off end
- (CGFloat) tableView: (NSTableView *) tableView heightOfRow: (NSInteger) row
{
NSString * message = [fDisplayedMessages[row] objectForKey: @"Message"];
NSString * message = fDisplayedMessages[row][@"Message"];
NSTableColumn * column = [tableView tableColumnWithIdentifier: @"Message"];
const CGFloat count = floorf([message sizeWithAttributes: fAttributes].width / [column width]);
@ -310,7 +310,7 @@
tableColumn: (NSTableColumn *) column row: (NSInteger) row mouseLocation: (NSPoint) mouseLocation
{
NSDictionary * message = fDisplayedMessages[row];
return [message objectForKey: @"File"];
return message[@"File"];
}
- (void) copy: (id) sender
@ -451,8 +451,8 @@
return YES;
const NSStringCompareOptions searchOptions = NSCaseInsensitiveSearch | NSDiacriticInsensitiveSearch;
return [[message objectForKey: @"Name"] rangeOfString: filterString options: searchOptions].location != NSNotFound
|| [[message objectForKey: @"Message"] rangeOfString: filterString options: searchOptions].location != NSNotFound;
return [message[@"Name"] rangeOfString: filterString options: searchOptions].location != NSNotFound
|| [message[@"Message"] rangeOfString: filterString options: searchOptions].location != NSNotFound;
}
- (void) updateListForFilter
@ -461,7 +461,7 @@
NSString * filterString = [fFilterField stringValue];
NSIndexSet * indexes = [fMessages indexesOfObjectsWithOptions: NSEnumerationConcurrent passingTest: ^BOOL(id message, NSUInteger idx, BOOL * stop) {
return [[(NSDictionary *)message objectForKey: @"Level"] integerValue] <= level && [self shouldIncludeMessageForFilter: filterString message: message];
return [((NSDictionary *)message)[@"Level"] integerValue] <= level && [self shouldIncludeMessageForFilter: filterString message: message];
}];
NSArray * tempMessages = [[fMessages objectsAtIndexes: indexes] sortedArrayUsingDescriptors: [fMessageTable sortDescriptors]];
@ -514,7 +514,7 @@
- (NSString *) stringForMessage: (NSDictionary *) message
{
NSString * levelString;
const NSInteger level = [[message objectForKey: @"Level"] integerValue];
const NSInteger level = [message[@"Level"] integerValue];
switch (level)
{
case TR_LOG_ERROR:
@ -531,9 +531,9 @@
levelString = @"?";
}
return [NSString stringWithFormat: @"%@ %@ [%@] %@: %@", [message objectForKey: @"Date"],
[message objectForKey: @"File"], levelString,
[message objectForKey: @"Name"], [message objectForKey: @"Message"], nil];
return [NSString stringWithFormat: @"%@ %@ [%@] %@: %@", message[@"Date"],
message[@"File"], levelString,
message[@"Name"], message[@"Message"], nil];
}
@end

View File

@ -105,8 +105,8 @@ void renameCallback(tr_torrent * torrent, const char * oldPathCharString, const
dispatch_async(dispatch_get_main_queue(), ^{
NSDictionary * contextDict = [(NSDictionary *)contextInfo autorelease];
Torrent * torrentObject = [contextDict objectForKey: @"Torrent"];
[torrentObject renameFinished: error == 0 nodes: [contextDict objectForKey: @"Nodes"] completionHandler: [contextDict objectForKey: @"CompletionHandler"] oldPath: oldPath newName: newName];
Torrent * torrentObject = contextDict[@"Torrent"];
[torrentObject renameFinished: error == 0 nodes: contextDict[@"Nodes"] completionHandler: contextDict[@"CompletionHandler"] oldPath: oldPath newName: newName];
});
}
}
@ -174,22 +174,22 @@ bool trashDataFile(const char * filename, tr_error ** error)
- (id) initWithHistory: (NSDictionary *) history lib: (tr_session *) lib forcePause: (BOOL) pause
{
self = [self initWithPath: [history objectForKey: @"InternalTorrentPath"]
hash: [history objectForKey: @"TorrentHash"]
self = [self initWithPath: history[@"InternalTorrentPath"]
hash: history[@"TorrentHash"]
torrentStruct: NULL
magnetAddress: nil
lib: lib
groupValue: [history objectForKey: @"GroupValue"]
removeWhenFinishSeeding: [history objectForKey: @"RemoveWhenFinishSeeding"]
downloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80
legacyIncompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80
? [history objectForKey: @"IncompleteFolder"] : nil];
groupValue: history[@"GroupValue"]
removeWhenFinishSeeding: history[@"RemoveWhenFinishSeeding"]
downloadFolder: history[@"DownloadFolder"] //upgrading from versions < 1.80
legacyIncompleteFolder: [history[@"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80
? history[@"IncompleteFolder"] : nil];
if (self)
{
//start transfer
NSNumber * active;
if (!pause && (active = [history objectForKey: @"Active"]) && [active boolValue])
if (!pause && (active = history[@"Active"]) && [active boolValue])
{
fStat = tr_torrentStat(fHandle);
[self startTransferNoQueue];
@ -197,16 +197,16 @@ bool trashDataFile(const char * filename, tr_error ** error)
//upgrading from versions < 1.30: get old added, activity, and done dates
NSDate * date;
if ((date = [history objectForKey: @"Date"]))
if ((date = history[@"Date"]))
tr_torrentSetAddedDate(fHandle, [date timeIntervalSince1970]);
if ((date = [history objectForKey: @"DateActivity"]))
if ((date = history[@"DateActivity"]))
tr_torrentSetActivityDate(fHandle, [date timeIntervalSince1970]);
if ((date = [history objectForKey: @"DateCompleted"]))
if ((date = history[@"DateCompleted"]))
tr_torrentSetDoneDate(fHandle, [date timeIntervalSince1970]);
//upgrading from versions < 1.60: get old stop ratio settings
NSNumber * ratioSetting;
if ((ratioSetting = [history objectForKey: @"RatioSetting"]))
if ((ratioSetting = history[@"RatioSetting"]))
{
switch ([ratioSetting intValue])
{
@ -216,7 +216,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
}
}
NSNumber * ratioLimit;
if ((ratioLimit = [history objectForKey: @"RatioLimit"]))
if ((ratioLimit = history[@"RatioLimit"]))
[self setRatioLimit: [ratioLimit floatValue]];
}
return self;
@ -613,7 +613,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
NSDictionary * systemAttributes;
if ((systemAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath: downloadFolder error: NULL]))
{
const uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
const uint64_t remainingSpace = [systemAttributes[NSFileSystemFreeSize] unsignedLongLongValue];
//if the remaining space is greater than the size left, then there is enough space regardless of preallocation
if (remainingSpace < [self sizeLeft] && remainingSpace < tr_torrentGetBytesLeftToAllocate(fHandle))
@ -968,21 +968,21 @@ bool trashDataFile(const char * filename, tr_error ** error)
tr_peer_stat * peer = &peers[i];
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 12];
[dict setObject: [self name] forKey: @"Name"];
[dict setObject: @(peer->from) forKey: @"From"];
[dict setObject: @(peer->addr) forKey: @"IP"];
[dict setObject: @(peer->port) forKey: @"Port"];
[dict setObject: @(peer->progress) forKey: @"Progress"];
[dict setObject: @(peer->isSeed) forKey: @"Seed"];
[dict setObject: @(peer->isEncrypted) forKey: @"Encryption"];
[dict setObject: @(peer->isUTP) forKey: @"uTP"];
[dict setObject: @(peer->client) forKey: @"Client"];
[dict setObject: @(peer->flagStr) forKey: @"Flags"];
dict[@"Name"] = [self name];
dict[@"From"] = @(peer->from);
dict[@"IP"] = @(peer->addr);
dict[@"Port"] = @(peer->port);
dict[@"Progress"] = @(peer->progress);
dict[@"Seed"] = @(peer->isSeed);
dict[@"Encryption"] = @(peer->isEncrypted);
dict[@"uTP"] = @(peer->isUTP);
dict[@"Client"] = @(peer->client);
dict[@"Flags"] = @(peer->flagStr);
if (peer->isUploadingTo)
[dict setObject: @(peer->rateToPeer_KBps) forKey: @"UL To Rate"];
dict[@"UL To Rate"] = @(peer->rateToPeer_KBps);
if (peer->isDownloadingFrom)
[dict setObject: @(peer->rateToClient_KBps) forKey: @"DL From Rate"];
dict[@"DL From Rate"] = @(peer->rateToClient_KBps);
[peerDicts addObject: dict];
}
@ -1007,11 +1007,11 @@ bool trashDataFile(const char * filename, tr_error ** error)
{
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
[dict setObject: [self name] forKey: @"Name"];
[dict setObject: @(fInfo->webseeds[i]) forKey: @"Address"];
dict[@"Name"] = [self name];
dict[@"Address"] = @(fInfo->webseeds[i]);
if (dlSpeeds[i] != -1.0)
[dict setObject: @(dlSpeeds[i]) forKey: @"DL From Rate"];
dict[@"DL From Rate"] = @(dlSpeeds[i]);
[webSeeds addObject: dict];
}
@ -1393,7 +1393,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
- (void) checkGroupValueForRemoval: (NSNotification *) notification
{
if (fGroupValue != -1 && [[[notification userInfo] objectForKey: @"Index"] integerValue] == fGroupValue)
if (fGroupValue != -1 && [[notification userInfo][@"Index"] integerValue] == fGroupValue)
fGroupValue = -1;
}

View File

@ -100,12 +100,12 @@
[paragraphStyle setLineBreakMode: NSLineBreakByTruncatingMiddle];
fTitleAttributes = [[NSMutableDictionary alloc] initWithCapacity: 3];
[fTitleAttributes setObject: [NSFont messageFontOfSize: 12.0] forKey: NSFontAttributeName];
[fTitleAttributes setObject: paragraphStyle forKey: NSParagraphStyleAttributeName];
fTitleAttributes[NSFontAttributeName] = [NSFont messageFontOfSize: 12.0];
fTitleAttributes[NSParagraphStyleAttributeName] = paragraphStyle;
fStatusAttributes = [[NSMutableDictionary alloc] initWithCapacity: 3];
[fStatusAttributes setObject: [NSFont messageFontOfSize: 9.0] forKey: NSFontAttributeName];
[fStatusAttributes setObject: paragraphStyle forKey: NSParagraphStyleAttributeName];
fStatusAttributes[NSFontAttributeName] = [NSFont messageFontOfSize: 9.0];
fStatusAttributes[NSParagraphStyleAttributeName] = paragraphStyle;
[paragraphStyle release];
@ -233,11 +233,11 @@
if (NSMouseInRect(mouseLocation, cellFrame, [controlView isFlipped]))
{
rowOptions |= NSTrackingAssumeInside;
[(TorrentTableView *)controlView setRowHover: [[userInfo objectForKey: @"Row"] integerValue]];
[(TorrentTableView *)controlView setRowHover: [userInfo[@"Row"] integerValue]];
}
NSMutableDictionary * rowInfo = [userInfo mutableCopy];
[rowInfo setObject: @"Row" forKey: @"Type"];
rowInfo[@"Type"] = @"Row";
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: cellFrame options: rowOptions owner: controlView userInfo: rowInfo];
[controlView addTrackingArea: area];
[rowInfo release];
@ -250,11 +250,11 @@
if (NSMouseInRect(mouseLocation, controlButtonRect, [controlView isFlipped]))
{
controlOptions |= NSTrackingAssumeInside;
[(TorrentTableView *)controlView setControlButtonHover: [[userInfo objectForKey: @"Row"] integerValue]];
[(TorrentTableView *)controlView setControlButtonHover: [userInfo[@"Row"] integerValue]];
}
NSMutableDictionary * controlInfo = [userInfo mutableCopy];
[controlInfo setObject: @"Control" forKey: @"Type"];
controlInfo[@"Type"] = @"Control";
NSTrackingArea * area = [[NSTrackingArea alloc] initWithRect: controlButtonRect options: controlOptions owner: controlView
userInfo: controlInfo];
[controlView addTrackingArea: area];
@ -267,11 +267,11 @@
if (NSMouseInRect(mouseLocation, revealButtonRect, [controlView isFlipped]))
{
revealOptions |= NSTrackingAssumeInside;
[(TorrentTableView *)controlView setRevealButtonHover: [[userInfo objectForKey: @"Row"] integerValue]];
[(TorrentTableView *)controlView setRevealButtonHover: [userInfo[@"Row"] integerValue]];
}
NSMutableDictionary * revealInfo = [userInfo mutableCopy];
[revealInfo setObject: @"Reveal" forKey: @"Type"];
revealInfo[@"Type"] = @"Reveal";
area = [[NSTrackingArea alloc] initWithRect: revealButtonRect options: revealOptions owner: controlView
userInfo: revealInfo];
[controlView addTrackingArea: area];
@ -284,11 +284,11 @@
if (NSMouseInRect(mouseLocation, actionButtonRect, [controlView isFlipped]))
{
actionOptions |= NSTrackingAssumeInside;
[(TorrentTableView *)controlView setActionButtonHover: [[userInfo objectForKey: @"Row"] integerValue]];
[(TorrentTableView *)controlView setActionButtonHover: [userInfo[@"Row"] integerValue]];
}
NSMutableDictionary * actionInfo = [userInfo mutableCopy];
[actionInfo setObject: @"Action" forKey: @"Type"];
actionInfo[@"Type"] = @"Action";
area = [[NSTrackingArea alloc] initWithRect: actionButtonRect options: actionOptions owner: controlView userInfo: actionInfo];
[controlView addTrackingArea: area];
[actionInfo release];
@ -389,8 +389,8 @@
statusColor = [NSColor darkGrayColor];
}
[fTitleAttributes setObject: titleColor forKey: NSForegroundColorAttributeName];
[fStatusAttributes setObject: statusColor forKey: NSForegroundColorAttributeName];
fTitleAttributes[NSForegroundColorAttributeName] = titleColor;
fStatusAttributes[NSForegroundColorAttributeName] = statusColor;
//minimal status
CGFloat minimalTitleRightBound;
@ -537,7 +537,7 @@
cellFrame.origin.x += PADDING_EXPANSION_FRAME;
cellFrame.origin.y += PADDING_EXPANSION_FRAME;
[fTitleAttributes setObject: [NSColor controlTextColor] forKey: NSForegroundColorAttributeName];
fTitleAttributes[NSForegroundColorAttributeName] = [NSColor controlTextColor];
NSAttributedString * titleString = [self attributedTitle];
[titleString drawInRect: cellFrame];
}

View File

@ -253,7 +253,7 @@
for (NSTrackingArea * area in [self trackingAreas])
{
if ([area owner] == self && [[area userInfo] objectForKey: @"Row"])
if ([area owner] == self && [area userInfo][@"Row"])
[self removeTrackingArea: area];
}
}
@ -293,10 +293,10 @@
NSDictionary * dict = (NSDictionary *)[event userData];
NSNumber * row;
if ((row = [dict objectForKey: @"Row"]))
if ((row = dict[@"Row"]))
{
NSInteger rowVal = [row integerValue];
NSString * type = [dict objectForKey: @"Type"];
NSString * type = dict[@"Type"];
if ([type isEqualToString: @"Action"])
fMouseActionRow = rowVal;
else if ([type isEqualToString: @"Control"])
@ -319,9 +319,9 @@
NSDictionary * dict = (NSDictionary *)[event userData];
NSNumber * row;
if ((row = [dict objectForKey: @"Row"]))
if ((row = dict[@"Row"]))
{
NSString * type = [dict objectForKey: @"Type"];
NSString * type = dict[@"Type"];
if ([type isEqualToString: @"Action"])
fMouseActionRow = -1;
else if ([type isEqualToString: @"Control"])
@ -349,7 +349,7 @@
- (void) outlineViewItemDidExpand: (NSNotification *) notification
{
NSInteger value = [[[notification userInfo] objectForKey: @"NSObject"] groupIndex];
NSInteger value = [[notification userInfo][@"NSObject"] groupIndex];
if (value < 0)
value = MAX_GROUP;
@ -362,7 +362,7 @@
- (void) outlineViewItemDidCollapse: (NSNotification *) notification
{
NSInteger value = [[[notification userInfo] objectForKey: @"NSObject"] groupIndex];
NSInteger value = [[notification userInfo][@"NSObject"] groupIndex];
if (value < 0)
value = MAX_GROUP;

View File

@ -119,8 +119,8 @@ NSMutableSet * fTrackerIconLoading;
statusColor = [NSColor darkGrayColor];
}
[fNameAttributes setObject: nameColor forKey: NSForegroundColorAttributeName];
[fStatusAttributes setObject: statusColor forKey: NSForegroundColorAttributeName];
fNameAttributes[NSForegroundColorAttributeName] = nameColor;
fStatusAttributes[NSForegroundColorAttributeName] = statusColor;
TrackerNode * node = (TrackerNode *)[self objectValue];

View File

@ -167,7 +167,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
@synchronized(self)
{
// Are we already watching this path?
VDKQueuePathEntry *pathEntry = [_watchedPathEntries objectForKey:path];
VDKQueuePathEntry *pathEntry = _watchedPathEntries[path];
if (pathEntry)
{
@ -194,7 +194,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
[pathEntry setSubscriptionFlags:flags];
[_watchedPathEntries setObject:pathEntry forKey:path];
_watchedPathEntries[path] = pathEntry;
kevent(_coreQueueFD, &ev, 1, NULL, 0, &nullts);
// Start the thread that fetches and processes our events if it's not already running.
@ -357,7 +357,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
@synchronized(self)
{
VDKQueuePathEntry *entry = [_watchedPathEntries objectForKey:aPath];
VDKQueuePathEntry *entry = _watchedPathEntries[aPath];
// Only add this path if we don't already have it.
if (!entry)
@ -380,7 +380,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
@synchronized(self)
{
VDKQueuePathEntry *entry = [_watchedPathEntries objectForKey:aPath];
VDKQueuePathEntry *entry = _watchedPathEntries[aPath];
// Only add this path if we don't already have it.
if (!entry)
@ -403,7 +403,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
@synchronized(self)
{
VDKQueuePathEntry *entry = [_watchedPathEntries objectForKey:aPath];
VDKQueuePathEntry *entry = _watchedPathEntries[aPath];
// Remove it only if we're watching it.
if (entry) {

View File

@ -40,7 +40,7 @@
NSIndexSet * indexes = [self selectedRowIndexes];
NSMutableArray * addresses = [NSMutableArray arrayWithCapacity: [indexes count]];
[fWebSeeds enumerateObjectsAtIndexes: indexes options: 0 usingBlock: ^(NSDictionary * webSeed, NSUInteger idx, BOOL * stop) {
[addresses addObject: [webSeed objectForKey: @"Address"]];
[addresses addObject: webSeed[@"Address"]];
}];
NSString * text = [addresses componentsJoinedByString: @"\n"];