Manually released collections are not autoreleased anymore, pointer syntax adheres to codestyle

This commit is contained in:
Dmitry Serov 2017-07-18 00:34:52 +07:00
parent 22cabec67b
commit 65fb765fcc
6 changed files with 25 additions and 25 deletions

View File

@ -140,8 +140,7 @@ typedef enum
static void altSpeedToggledCallback(tr_session * handle UNUSED, bool active, bool byUser, void * controller)
{
NSDictionary * dict = @{@"Active": @(active),
@"ByUser": @(byUser)};
NSDictionary * dict = [[NSDictionary alloc] initWithObjects: @[@(active), @(byUser)] forKeys: @[@"Active", @"ByUser"]];
[(Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
withObject: dict waitUntilDone: NO];
}
@ -665,7 +664,7 @@ static void removeKeRangerRansomware()
forEventClass: kCoreEventClass andEventID: kAEOpenContents];
//if we were opened from a user notification, do the corresponding action
NSUserNotification * launchNotification = [notification userInfo][ NSApplicationLaunchUserNotificationKey];
NSUserNotification * launchNotification = [notification userInfo][NSApplicationLaunchUserNotificationKey];
if (launchNotification)
[self userNotificationCenter: nil didActivateNotification: launchNotification];
@ -904,7 +903,7 @@ static void removeKeRangerRansomware()
-(void) download: (NSURLDownload *) download didCreateDestination: (NSString *) path
{
NSMutableDictionary *dict = (NSMutableDictionary *)fPendingTorrentDownloads[[[download request] URL]];
NSMutableDictionary * dict = fPendingTorrentDownloads[[[download request] URL]];
dict[@"Path"] = path;
}
@ -1199,8 +1198,7 @@ static void removeKeRangerRansomware()
//called on by applescript
- (void) open: (NSArray *) files
{
NSDictionary * dict = @{@"Filenames": files,
@"AddType": @(ADD_MANUAL)};
NSDictionary * dict = [[NSDictionary alloc] initWithObjects: @[files, @(ADD_MANUAL)] forKeys: @[@"Filenames", @"AddType"]];
[self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dict waitUntilDone: NO];
}
@ -1221,8 +1219,10 @@ static void removeKeRangerRansomware()
for (NSURL * url in [panel URLs])
[filenames addObject: [url path]];
NSDictionary * dictionary = @{@"Filenames": filenames,
@"AddType": sender == fOpenIgnoreDownloadFolder ? @(ADD_SHOW_OPTIONS) : @(ADD_MANUAL)};
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjects: @[
filenames,
sender == fOpenIgnoreDownloadFolder ? @(ADD_SHOW_OPTIONS) : @(ADD_MANUAL)]
forKeys: @[@"Filenames", @"AddType"]];
[self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dictionary waitUntilDone: NO];
}
}];
@ -1347,7 +1347,7 @@ static void removeKeRangerRansomware()
if (!fPendingTorrentDownloads)
fPendingTorrentDownloads = [[NSMutableDictionary alloc] init];
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject: download forKey: @"Download"];
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithObject: download forKey: @"Download"];
fPendingTorrentDownloads[[request URL]] = dict;
}
}

View File

@ -565,8 +565,10 @@
case TR_MAKEMETA_OK:
if (fOpenWhenCreated)
{
NSDictionary * dict = @{@"File": [fLocation path],
@"Path": [[fPath URLByDeletingLastPathComponent] path]};
NSDictionary * dict = [[NSDictionary alloc] initWithObjects: @[
[fLocation path],
[[fPath URLByDeletingLastPathComponent] path]]
forKeys: @[@"File", @"Path"]];
[[NSNotificationCenter defaultCenter] postNotificationName: @"OpenCreatedTorrentFile" object: self userInfo: dict];
}

View File

@ -42,17 +42,15 @@
NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setLineBreakMode: NSLineBreakByTruncatingMiddle];
fMainLineAttributes = @{
NSForegroundColorAttributeName: [NSColor whiteColor],
NSFontAttributeName: bigFont,
NSShadowAttributeName: stringShadow,
NSParagraphStyleAttributeName: paragraphStyle};
fMainLineAttributes = [[NSDictionary alloc] initWithObjects: @[[NSColor whiteColor],
bigFont, stringShadow, paragraphStyle]
forKeys: @[NSForegroundColorAttributeName, NSFontAttributeName,
NSShadowAttributeName, NSParagraphStyleAttributeName]];
fSubLineAttributes = @{
NSForegroundColorAttributeName: [NSColor whiteColor],
NSFontAttributeName: smallFont,
NSShadowAttributeName: stringShadow,
NSParagraphStyleAttributeName: paragraphStyle};
fSubLineAttributes = [[NSDictionary alloc] initWithObjects: @[[NSColor whiteColor],
smallFont, stringShadow, paragraphStyle]
forKeys: @[NSForegroundColorAttributeName, NSFontAttributeName,
NSShadowAttributeName, NSParagraphStyleAttributeName]];
[stringShadow release];
[paragraphStyle release];

View File

@ -406,7 +406,7 @@
{
//make the array sorted by date
NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"Index" ascending: YES];
NSArray * descriptors = @[descriptor];
NSArray * descriptors = [[NSArray alloc] initWithObjects: descriptor, nil];
NSArray * sortedMessages = [fDisplayedMessages sortedArrayUsingDescriptors: descriptors];
[descriptors release];

View File

@ -53,8 +53,8 @@
NSMutableParagraphStyle * paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setAlignment: NSRightTextAlignment];
fAttributes = @{NSFontAttributeName: [NSFont systemFontOfSize: 11.0],
NSParagraphStyleAttributeName: paragraphStyle};
fAttributes = [[NSDictionary alloc] initWithObjects: @[[NSFont systemFontOfSize: 11.0], paragraphStyle]
forKeys: @[NSFontAttributeName, NSParagraphStyleAttributeName]];
[paragraphStyle release];
}

View File

@ -306,7 +306,7 @@ NSString * VDKQueueAccessRevocationNotification = @"VDKQueueAccessWasRevokedNoti
if (!_delegate || _alwaysPostNotifications)
{
NSDictionary *userInfoDict = @{@"path": fpath};
NSDictionary * userInfoDict = [[NSDictionary alloc] initWithObjects: @[fpath] forKeys: @[@"path"]];
[[[NSWorkspace sharedWorkspace] notificationCenter] postNotificationName:note object:self userInfo:userInfoDict];
[userInfoDict release];
}