From b743b642627bb14da1b24ad3b98f5a97efaa8baf Mon Sep 17 00:00:00 2001 From: Dmitry Serov Date: Sat, 8 Jul 2017 15:23:05 +0700 Subject: [PATCH] NSArray init literals --- macosx/BlocklistDownloader.m | 12 +++---- macosx/Controller.m | 56 +++++++++++++++--------------- macosx/CreatorWindowController.m | 8 ++--- macosx/DragOverlayWindow.m | 4 +-- macosx/GroupsPrefsController.m | 4 +-- macosx/InfoGeneralViewController.m | 2 +- macosx/MessageWindowController.m | 4 +-- macosx/PrefsController.m | 4 +-- macosx/Torrent.m | 6 ++-- macosx/TorrentCell.m | 2 +- macosx/TorrentTableView.m | 14 ++++---- macosx/TrackerTableView.m | 6 ++-- macosx/WebSeedTableView.m | 2 +- 13 files changed, 62 insertions(+), 62 deletions(-) diff --git a/macosx/BlocklistDownloader.m b/macosx/BlocklistDownloader.m index d99db5c1b..896406ed5 100644 --- a/macosx/BlocklistDownloader.m +++ b/macosx/BlocklistDownloader.m @@ -204,12 +204,12 @@ BlocklistDownloader * fBLDownloader = nil; NSTask * unzip = [[NSTask alloc] init]; [unzip setLaunchPath: @"/usr/bin/unzip"]; [unzip setCurrentDirectoryPath: workingDirectory]; - [unzip setArguments: [NSArray arrayWithObjects: + [unzip setArguments: @[ @"-o", /* overwrite */ @"-q", /* quiet! */ fDestination, /* source zip file */ - @"-d", workingDirectory, /*destination*/ - nil]]; + @"-d", workingDirectory /*destination*/ + ]]; @try { @@ -231,10 +231,10 @@ BlocklistDownloader * fBLDownloader = nil; zipinfo = [[NSTask alloc] init]; [zipinfo setLaunchPath: @"/usr/bin/zipinfo"]; - [zipinfo setArguments: [NSArray arrayWithObjects: + [zipinfo setArguments: @[ @"-1", /* just the filename */ - fDestination, /* source zip file */ - nil]]; + fDestination /* source zip file */ + ]]; [zipinfo setStandardOutput: [NSPipe pipe]]; @try diff --git a/macosx/Controller.m b/macosx/Controller.m index 82f78d9da..a553d4c1d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -507,8 +507,8 @@ static void removeKeRangerRansomware() [fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.", "Main window -> 3rd bottom left button (remove all) tooltip")]; - [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]]; - [fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]]; + [fTableView registerForDraggedTypes: @[TORRENT_TABLE_VIEW_DATA_TYPE]]; + [fWindow registerForDraggedTypes: @[NSFilenamesPboardType, NSURLPboardType]]; //sort the sort menu items (localization is from strings file) NSMutableArray * sortMenuItems = [NSMutableArray arrayWithCapacity: 7]; @@ -531,7 +531,7 @@ static void removeKeRangerRansomware() } } - [sortMenuItems sortUsingDescriptors: [NSArray arrayWithObject: [NSSortDescriptor sortDescriptorWithKey: @"title" ascending: YES selector: @selector(localizedCompare:)]]]; + [sortMenuItems sortUsingDescriptors: @[[NSSortDescriptor sortDescriptorWithKey: @"title" ascending: YES selector: @selector(localizedCompare:)]]]; for (NSMenuItem * item in sortMenuItems) [fSortMenu insertItem: item atIndex: sortMenuIndex++]; @@ -929,7 +929,7 @@ static void removeKeRangerRansomware() { NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"]; - [self openFiles: [NSArray arrayWithObject: path] addType: ADD_URL forcePath: nil]; + [self openFiles: @[path] addType: ADD_URL forcePath: nil]; //delete the torrent file after opening [[NSFileManager defaultManager] removeItemAtPath: path error: NULL]; @@ -1184,7 +1184,7 @@ static void removeKeRangerRansomware() - (void) openCreatedFile: (NSNotification *) notification { NSDictionary * dict = [notification userInfo]; - [self openFiles: [NSArray arrayWithObject: [dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]]; + [self openFiles: @[[dict objectForKey: @"File"]] addType: ADD_CREATED forcePath: [dict objectForKey: @"Path"]]; [dict release]; } @@ -1211,7 +1211,7 @@ static void removeKeRangerRansomware() [panel setCanChooseFiles: YES]; [panel setCanChooseDirectories: NO]; - [panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]]; + [panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]]; [panel beginSheetModalForWindow: fWindow completionHandler: ^(NSInteger result) { if (result == NSFileHandlingPanelOKButton) @@ -1726,7 +1726,7 @@ static void removeKeRangerRansomware() if (![torrent isMagnet] && [[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]]) { NSSavePanel * panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]]; + [panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]]; [panel setExtensionHidden: NO]; [panel setNameFieldStringValue: [torrent name]]; @@ -1777,7 +1777,7 @@ static void removeKeRangerRansomware() NSPasteboard * pb = [NSPasteboard generalPasteboard]; [pb clearContents]; - [pb writeObjects: [NSArray arrayWithObject: text]]; + [pb writeObjects: @[text]]; } - (void) revealFile: (id) sender @@ -2279,7 +2279,7 @@ static void removeKeRangerRansomware() * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc], * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc]; - descriptors = [NSArray arrayWithObjects: stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor, nil]; + descriptors = @[stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_PROGRESS]) { @@ -2287,36 +2287,36 @@ static void removeKeRangerRansomware() * ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc], * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc]; - descriptors = [NSArray arrayWithObjects: progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor, nil]; + descriptors = @[progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_TRACKER]) { NSSortDescriptor * trackerDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"trackerSortKey" ascending: asc selector: @selector(localizedCaseInsensitiveCompare:)]; - descriptors = [NSArray arrayWithObjects: trackerDescriptor, nameDescriptor, nil]; + descriptors = @[trackerDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_ACTIVITY]) { NSSortDescriptor * rateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"totalRate" ascending: !asc]; NSSortDescriptor * activityDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateActivityOrAdd" ascending: !asc]; - descriptors = [NSArray arrayWithObjects: rateDescriptor, activityDescriptor, nameDescriptor, nil]; + descriptors = @[rateDescriptor, activityDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_DATE]) { NSSortDescriptor * dateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"dateAdded" ascending: asc]; - descriptors = [NSArray arrayWithObjects: dateDescriptor, nameDescriptor, nil]; + descriptors = @[dateDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_SIZE]) { NSSortDescriptor * sizeDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"size" ascending: asc]; - descriptors = [NSArray arrayWithObjects: sizeDescriptor, nameDescriptor, nil]; + descriptors = @[sizeDescriptor, nameDescriptor]; } else if ([sortType isEqualToString: SORT_NAME]) { - descriptors = [NSArray arrayWithObject: nameDescriptor]; + descriptors = @[nameDescriptor]; } else { @@ -2327,7 +2327,7 @@ static void removeKeRangerRansomware() NSSortDescriptor * orderDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: asc]; - descriptors = [NSArray arrayWithObject: orderDescriptor]; + descriptors = @[orderDescriptor]; } BOOL beganTableUpdate = !callUpdates; @@ -2677,7 +2677,7 @@ static void removeKeRangerRansomware() //now that all groups are there, sort them - don't insert on the fly in case groups were reordered in prefs NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES]; - [self rearrangeTorrentTableArray: fDisplayedTorrents forParent: nil withSortDescriptors: [NSArray arrayWithObject: groupDescriptor] beganTableUpdate: &beganUpdates]; + [self rearrangeTorrentTableArray: fDisplayedTorrents forParent: nil withSortDescriptors: @[groupDescriptor] beganTableUpdate: &beganUpdates]; } else { @@ -2716,7 +2716,7 @@ static void removeKeRangerRansomware() //we need the groups to be sorted, and we can do it without moving items in the table, too! NSSortDescriptor * groupDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"groupOrderValue" ascending: YES]; - [fDisplayedTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]]; + [fDisplayedTorrents sortUsingDescriptors: @[groupDescriptor]]; } else [fDisplayedTorrents setArray: allTorrents]; @@ -2939,7 +2939,7 @@ static void removeKeRangerRansomware() switch (tr_torrentParse(ctor, NULL)) { case TR_PARSE_OK: - [self openFiles: [NSArray arrayWithObject: fullFile] addType: ADD_AUTO forcePath: nil]; + [self openFiles: @[fullFile] addType: ADD_AUTO forcePath: nil]; NSString * notificationTitle = NSLocalizedString(@"Torrent File Auto Added", "notification title"); NSUserNotification* notification = [[NSUserNotification alloc] init]; @@ -3059,7 +3059,7 @@ static void removeKeRangerRansomware() [indexSet addIndex: [fTableView rowForItem: torrent]]; } - [pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self]; + [pasteboard declareTypes: @[TORRENT_TABLE_VIEW_DATA_TYPE] owner: self]; [pasteboard setData: [NSKeyedArchiver archivedDataWithRootObject: indexSet] forType: TORRENT_TABLE_VIEW_DATA_TYPE]; return YES; } @@ -3837,7 +3837,7 @@ static void removeKeRangerRansomware() [groupItem setTarget: self]; [groupItem setAction: @selector(allToolbarClicked:)]; - [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, nil]]; + [groupItem setIdentifiers: @[TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL]]; [segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG]; [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate"] forSegment: TOOLBAR_PAUSE_TAG]; @@ -3849,8 +3849,8 @@ static void removeKeRangerRansomware() [segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers", "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG]; - [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"), - NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]]; + [groupItem createMenu: @[NSLocalizedString(@"Pause All", "All toolbar item -> label"), + NSLocalizedString(@"Resume All", "All toolbar item -> label")]]; [segmentedControl release]; @@ -3883,7 +3883,7 @@ static void removeKeRangerRansomware() [groupItem setTarget: self]; [groupItem setAction: @selector(selectedToolbarClicked:)]; - [groupItem setIdentifiers: [NSArray arrayWithObjects: TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED, nil]]; + [groupItem setIdentifiers: @[TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED]]; [segmentedCell setTag: TOOLBAR_PAUSE_TAG forSegment: TOOLBAR_PAUSE_TAG]; [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate"] forSegment: TOOLBAR_PAUSE_TAG]; @@ -3895,8 +3895,8 @@ static void removeKeRangerRansomware() [segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers", "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG]; - [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"), - NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]]; + [groupItem createMenu: @[NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"), + NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label")]]; [segmentedControl release]; @@ -4637,7 +4637,7 @@ static void removeKeRangerRansomware() && (location = [clickContext objectForKey: @"Location"])) { NSURL * file = [NSURL fileURLWithPath: location]; - [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]]; } } @@ -4778,7 +4778,7 @@ static void removeKeRangerRansomware() [torrent update]; NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"queuePosition" ascending: YES]; - NSArray * descriptors = [NSArray arrayWithObject: descriptor]; + NSArray * descriptors = @[descriptor]; [fTorrents sortUsingDescriptors: descriptors]; [self sortTorrents: YES]; diff --git a/macosx/CreatorWindowController.m b/macosx/CreatorWindowController.m index 4a86248e8..54069e939 100644 --- a/macosx/CreatorWindowController.m +++ b/macosx/CreatorWindowController.m @@ -254,7 +254,7 @@ [panel setMessage: NSLocalizedString(@"Select the name and location for the torrent file.", "Create torrent -> location sheet -> message")]; - [panel setAllowedFileTypes: [NSArray arrayWithObjects: @"org.bittorrent.torrent", @"torrent", nil]]; + [panel setAllowedFileTypes: @[@"org.bittorrent.torrent", @"torrent"]]; [panel setCanSelectHiddenExtension: YES]; [panel setDirectoryURL: [fLocation URLByDeletingLastPathComponent]]; @@ -387,7 +387,7 @@ NSPasteboard * pb = [NSPasteboard generalPasteboard]; [pb clearContents]; - [pb writeObjects: [NSArray arrayWithObject: text]]; + [pb writeObjects: @[text]]; } - (BOOL) validateMenuItem: (NSMenuItem *) menuItem @@ -399,7 +399,7 @@ if (action == @selector(paste:)) return [[self window] firstResponder] == fTrackerTable - && [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + && [[NSPasteboard generalPasteboard] canReadObjectForClasses: @[[NSString class]] options: nil]; return YES; } @@ -408,7 +408,7 @@ { NSMutableArray * tempTrackers = [NSMutableArray array]; - NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil]; NSAssert(items != nil, @"no string items to paste; should not be able to call this method"); for (NSString * pbItem in items) diff --git a/macosx/DragOverlayWindow.m b/macosx/DragOverlayWindow.m index 3e586807a..5fae9b417 100644 --- a/macosx/DragOverlayWindow.m +++ b/macosx/DragOverlayWindow.m @@ -51,13 +51,13 @@ [self setReleasedWhenClosed: NO]; [self setIgnoresMouseEvents: YES]; - fFadeInAnimation = [[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject: + fFadeInAnimation = [[NSViewAnimation alloc] initWithViewAnimations: @[ [NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey, NSViewAnimationFadeInEffect, NSViewAnimationEffectKey, nil]]]; [fFadeInAnimation setDuration: 0.15]; [fFadeInAnimation setAnimationBlockingMode: NSAnimationNonblockingThreaded]; - fFadeOutAnimation = [[NSViewAnimation alloc] initWithViewAnimations: [NSArray arrayWithObject: + fFadeOutAnimation = [[NSViewAnimation alloc] initWithViewAnimations: @[ [NSDictionary dictionaryWithObjectsAndKeys: self, NSViewAnimationTargetKey, NSViewAnimationFadeOutEffect, NSViewAnimationEffectKey, nil]]]; [fFadeOutAnimation setDuration: 0.5]; diff --git a/macosx/GroupsPrefsController.m b/macosx/GroupsPrefsController.m index f007094b4..654b6c3ce 100644 --- a/macosx/GroupsPrefsController.m +++ b/macosx/GroupsPrefsController.m @@ -54,7 +54,7 @@ - (void) awakeFromNib { - [fTableView registerForDraggedTypes: [NSArray arrayWithObject: GROUP_TABLE_VIEW_DATA_TYPE]]; + [fTableView registerForDraggedTypes: @[GROUP_TABLE_VIEW_DATA_TYPE]]; [fSelectedColorView addObserver: self forKeyPath: @"color" options: 0 context: NULL]; @@ -105,7 +105,7 @@ - (BOOL) tableView: (NSTableView *) tableView writeRowsWithIndexes: (NSIndexSet *) rowIndexes toPasteboard: (NSPasteboard *) pboard { - [pboard declareTypes: [NSArray arrayWithObject: GROUP_TABLE_VIEW_DATA_TYPE] owner: self]; + [pboard declareTypes: @[GROUP_TABLE_VIEW_DATA_TYPE] owner: self]; [pboard setData: [NSKeyedArchiver archivedDataWithRootObject: rowIndexes] forType: GROUP_TABLE_VIEW_DATA_TYPE]; return YES; } diff --git a/macosx/InfoGeneralViewController.m b/macosx/InfoGeneralViewController.m index 01b5e3291..01a7e197b 100644 --- a/macosx/InfoGeneralViewController.m +++ b/macosx/InfoGeneralViewController.m @@ -125,7 +125,7 @@ return; NSURL * file = [NSURL fileURLWithPath: location]; - [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]]; } @end diff --git a/macosx/MessageWindowController.m b/macosx/MessageWindowController.m index 44025cc4a..4ebe3fcc1 100644 --- a/macosx/MessageWindowController.m +++ b/macosx/MessageWindowController.m @@ -325,7 +325,7 @@ NSPasteboard * pb = [NSPasteboard generalPasteboard]; [pb clearContents]; - [pb writeObjects: [NSArray arrayWithObject: messageString]]; + [pb writeObjects: @[messageString]]; } - (BOOL) validateMenuItem: (NSMenuItem *) menuItem @@ -397,7 +397,7 @@ - (void) writeToFile: (id) sender { NSSavePanel * panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes: [NSArray arrayWithObject: @"txt"]]; + [panel setAllowedFileTypes: @[@"txt"]]; [panel setCanSelectHiddenExtension: YES]; [panel setNameFieldStringValue: NSLocalizedString(@"untitled", "Save log panel -> default file name")]; diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index a5eafc3c3..aee6cd159 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -315,8 +315,8 @@ - (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar { - return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_GROUPS, TOOLBAR_BANDWIDTH, - TOOLBAR_PEERS, TOOLBAR_NETWORK, TOOLBAR_REMOTE, nil]; + return @[TOOLBAR_GENERAL, TOOLBAR_TRANSFERS, TOOLBAR_GROUPS, TOOLBAR_BANDWIDTH, + TOOLBAR_PEERS, TOOLBAR_NETWORK, TOOLBAR_REMOTE]; } - (NSArray *) toolbarSelectableItemIdentifiers: (NSToolbar *) toolbar diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 06965d4d6..2b55d98d4 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -528,7 +528,7 @@ bool trashDataFile(const char * filename, tr_error ** error) //attempt to move to trash if (![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation source: [path stringByDeletingLastPathComponent] destination: @"" - files: [NSArray arrayWithObject: [path lastPathComponent]] tag: nil]) + files: @[[path lastPathComponent]] tag: nil]) { //if cannot trash, just delete it (will work if it's on a remote volume) NSError * localError; @@ -1781,7 +1781,7 @@ bool trashDataFile(const char * filename, tr_error ** error) else { FileListNode * node = [[FileListNode alloc] initWithFileName: [self name] path: @"" size: [self size] index: 0 torrent: self]; - fFileList = [[NSArray arrayWithObject: node] retain]; + fFileList = [@[node] retain]; fFlatFileList = [fFileList retain]; [node release]; } @@ -1835,7 +1835,7 @@ bool trashDataFile(const char * filename, tr_error ** error) - (void) sortFileList: (NSMutableArray *) fileNodes { NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey: @"name" ascending: YES selector: @selector(localizedStandardCompare:)]; - [fileNodes sortUsingDescriptors: [NSArray arrayWithObject: descriptor]]; + [fileNodes sortUsingDescriptors: @[descriptor]]; [fileNodes enumerateObjectsWithOptions: NSEnumerationConcurrent usingBlock: ^(FileListNode * node, NSUInteger idx, BOOL * stop) { if ([node isFolder]) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 4924c9c59..e3c28cea4 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -211,7 +211,7 @@ if (location) { NSURL * file = [NSURL fileURLWithPath: location]; - [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: [NSArray arrayWithObject: file]]; + [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs: @[file]]; } } else; diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index ee8dc2fba..27025b952 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -533,7 +533,7 @@ [fController openURL: [url absoluteString]]; else { - NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil]; if (items) { NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil]; @@ -562,7 +562,7 @@ if ([[[NSPasteboard generalPasteboard] types] containsObject: NSURLPboardType]) return YES; - NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil]; if (items) { NSDataDetector * detector = [NSDataDetector dataDetectorWithTypes: NSTextCheckingTypeLink error: nil]; @@ -584,15 +584,15 @@ - (void) toggleControlForTorrent: (Torrent *) torrent { if ([torrent isActive]) - [fController stopTorrents: [NSArray arrayWithObject: torrent]]; + [fController stopTorrents: @[torrent]]; else { if ([NSEvent modifierFlags] & NSAlternateKeyMask) - [fController resumeTorrentsNoWait: [NSArray arrayWithObject: torrent]]; + [fController resumeTorrentsNoWait: @[torrent]]; else if ([torrent waitingToStart]) - [fController stopTorrents: [NSArray arrayWithObject: torrent]]; + [fController stopTorrents: @[torrent]]; else - [fController resumeTorrents: [NSArray arrayWithObject: torrent]]; + [fController resumeTorrents: @[torrent]]; } } @@ -616,7 +616,7 @@ [popover setDelegate: self]; [popover showRelativeToRect: rect ofView: self preferredEdge: NSMaxYEdge]; - [infoViewController setInfoForTorrents: [NSArray arrayWithObject: torrent]]; + [infoViewController setInfoForTorrents: @[torrent]]; [infoViewController updateInfo]; [infoViewController release]; diff --git a/macosx/TrackerTableView.m b/macosx/TrackerTableView.m index 37057d50f..b52440769 100644 --- a/macosx/TrackerTableView.m +++ b/macosx/TrackerTableView.m @@ -63,7 +63,7 @@ NSPasteboard * pb = [NSPasteboard generalPasteboard]; [pb clearContents]; - [pb writeObjects: [NSArray arrayWithObject: text]]; + [pb writeObjects: @[text]]; } - (void) paste: (id) sender @@ -72,7 +72,7 @@ BOOL added = NO; - NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: @[[NSString class]] options: nil]; NSAssert(items != nil, @"no string items to paste; should not be able to call this method"); for (NSString * pbItem in items) @@ -95,7 +95,7 @@ return [self numberOfSelectedRows] > 0; if (action == @selector(paste:)) - return fTorrent && [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; + return fTorrent && [[NSPasteboard generalPasteboard] canReadObjectForClasses: @[[NSString class]] options: nil]; return YES; } diff --git a/macosx/WebSeedTableView.m b/macosx/WebSeedTableView.m index 7a83938b4..344c675ec 100644 --- a/macosx/WebSeedTableView.m +++ b/macosx/WebSeedTableView.m @@ -47,7 +47,7 @@ NSPasteboard * pb = [NSPasteboard generalPasteboard]; [pb clearContents]; - [pb writeObjects: [NSArray arrayWithObject: text]]; + [pb writeObjects: @[text]]; } - (BOOL) validateMenuItem: (NSMenuItem *) menuItem -- 2.49.0