From 684951bdc0840ac29c29b54194314d43d6e6ff7a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 18 Jan 2022 18:12:57 -0800 Subject: [PATCH] Change a bunch of NSArray declarations to const collection literals --- Application/AppController.m | 8 ++++---- Application/PlaybackController.m | 8 ++++---- Audio/CogPluginMulti.m | 5 +++++ Audio/PluginController.m | 2 +- FileTree/DirectoryNode.m | 2 +- FileTree/PathWatcher.m | 2 +- Playlist/PlaylistController.m | 8 ++++---- Playlist/PlaylistLoader.m | 16 ++++++++-------- Playlist/XmlContainer.m | 2 +- Plugins/APL/APLDecoder.m | 4 ++-- Plugins/AdPlug/AdPlug/AdPlugDecoder.mm | 4 ++-- .../ArchiveSource/ArchiveContainer.m | 8 ++++---- .../ArchiveSource/ArchiveSource/ArchiveSource.m | 2 +- Plugins/CueSheet/CueSheetContainer.m | 6 +++--- Plugins/FFMPEG/FFMPEGDecoder.m | 4 ++-- Plugins/FileSource/FileSource.m | 2 +- Plugins/Flac/FlacDecoder.m | 4 ++-- Plugins/GME/GameContainer.m | 14 ++------------ Plugins/GME/GameDecoder.m | 4 ++-- Plugins/HTTPSource/HTTPSource.m | 2 +- .../HighlyComplete/HighlyComplete/HCDecoder.mm | 6 +++--- Plugins/Hively/Hively/HVLDecoder.m | 2 +- Plugins/M3u/M3uContainer.m | 8 ++++---- Plugins/MIDI/MIDI/MIDIContainer.mm | 6 +++--- Plugins/MIDI/MIDI/MIDIDecoder.mm | 6 +++--- Plugins/MIDI/MIDI/MIDIMetadataReader.mm | 2 +- Plugins/Musepack/MusepackDecoder.m | 4 ++-- Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm | 6 +++--- Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm | 6 +++--- Plugins/Opus/Opus/OpusDecoder.m | 4 ++-- Plugins/Pls/PlsContainer.m | 8 ++++---- Plugins/Shorten/ShortenDecoder.mm | 4 ++-- .../SilenceDecoder/SilenceDecoder.m | 4 ++-- .../SilenceDecoder/SilenceSource.m | 2 +- Plugins/TagLib/TagLibMetadataReader.m | 6 +++--- Plugins/TagLib/TagLibMetadataWriter.m | 4 ++-- Plugins/Vorbis/VorbisDecoder.m | 4 ++-- Plugins/WavPack/WavPackDecoder.m | 4 ++-- Plugins/libvgmPlayer/libvgmContainer.mm | 8 ++++---- Plugins/libvgmPlayer/libvgmDecoder.mm | 4 ++-- Plugins/sidplay/SidDecoder.mm | 2 +- Plugins/vgmstream/vgmstream/VGMContainer.m | 4 ++-- Plugins/vgmstream/vgmstream/VGMDecoder.m | 4 ++-- Preferences/Preferences/OutputsArrayController.m | 2 +- Spotlight/SpotlightPlaylistController.m | 2 +- Spotlight/SpotlightPlaylistEntry.m | 8 ++++---- Spotlight/SpotlightTransformers.m | 2 +- Spotlight/SpotlightWindowController.m | 15 +++++++-------- Utils/NSArray+ShuffleUtils.m | 6 +++--- Utils/SQLiteStore.m | 4 ++-- Utils/SideViewController.m | 6 +++--- Window/AUPlayerView.m | 2 +- 52 files changed, 128 insertions(+), 134 deletions(-) diff --git a/Application/AppController.m b/Application/AppController.m index 174b9928a..87502ef39 100644 --- a/Application/AppController.m +++ b/Application/AppController.m @@ -93,7 +93,7 @@ void* kAppControllerContext = &kAppControllerContext; /* Yes, this is deprecated. Yes, this is required to give the dialog * a default set of filename extensions to save, including adding an * extension if the user does not supply one. */ - [p setAllowedFileTypes:[NSArray arrayWithObjects:@"m3u", @"pls", nil]]; + [p setAllowedFileTypes:@[@"m3u", @"pls"]]; [p beginSheetModalForWindow:mainWindow completionHandler:^(NSInteger result) { if ( result == NSModalResponseOK ) { @@ -117,8 +117,8 @@ void* kAppControllerContext = &kAppControllerContext; { if (returnCode == NSModalResponseOK) { - [playlistLoader willInsertURLs:[NSArray arrayWithObject:[panel url]] origin:URLOriginInternal]; - [playlistLoader didInsertURLs:[playlistLoader addURLs:[NSArray arrayWithObject:[panel url]] sort:NO] origin:URLOriginInternal]; + [playlistLoader willInsertURLs:@[[panel url]] origin:URLOriginInternal]; + [playlistLoader didInsertURLs:[playlistLoader addURLs:@[[panel url]] sort:NO] origin:URLOriginInternal]; } } @@ -401,7 +401,7 @@ void* kAppControllerContext = &kAppControllerContext; - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { - NSArray* urls = [NSArray arrayWithObject:[NSURL fileURLWithPath:filename]]; + NSArray* urls = @[[NSURL fileURLWithPath:filename]]; [playlistLoader willInsertURLs:urls origin:URLOriginExternal]; [playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:NO] origin:URLOriginExternal]; return YES; diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index a90b05f11..710ffd0bc 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -218,13 +218,13 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) #elif 0 // Racing with this version is less likely to jam up the main thread if ([pe metadataLoaded] != YES) { - NSArray * entries = [NSArray arrayWithObject:pe]; + NSArray * entries = @[pe]; [playlistLoader loadInfoForEntries:entries]; } #else // Let's do it this way instead if ([pe metadataLoaded] != YES && loadData == YES) { - NSArray *entries = [NSArray arrayWithObject:pe]; + NSArray *entries = @[pe]; [playlistLoader performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries]; } #endif @@ -295,7 +295,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) [pboard clearContents]; - [pboard writeObjects:[NSArray arrayWithObjects:[[playlistController currentEntry] spam], nil]]; + [pboard writeObjects:@[[[playlistController currentEntry] spam]]]; } - (IBAction)eventSeekForward:(id)sender @@ -748,7 +748,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe) { pe = [playlistController getNextEntry:curEntry]; if (pe && [pe metadataLoaded] != YES) { - NSArray * entries = [NSArray arrayWithObject:pe]; + NSArray * entries = @[pe]; [playlistLoader performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries]; } } diff --git a/Audio/CogPluginMulti.m b/Audio/CogPluginMulti.m index d5a22d88c..169a088bf 100644 --- a/Audio/CogPluginMulti.m +++ b/Audio/CogPluginMulti.m @@ -47,6 +47,10 @@ NSArray * sortClassesByPriority(NSArray * theClasses) return -1.0; } ++ (NSArray *)fileTypeAssociations { + return nil; +} + - (id)initWithDecoders:(NSArray *)decoders { self = [super init]; @@ -145,6 +149,7 @@ NSArray * sortClassesByPriority(NSArray * theClasses) } } + @end @implementation CogContainerMulti diff --git a/Audio/PluginController.m b/Audio/PluginController.m index f0023aaf3..9e5f349ca 100644 --- a/Audio/PluginController.m +++ b/Audio/PluginController.m @@ -111,7 +111,7 @@ static PluginController *sharedPluginController = nil; for (NSString *pname in dirContents) { NSString *ppath; - ppath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,pname,nil]]; + ppath = [NSString pathWithComponents:@[path,pname]]; if ([[pname pathExtension] isEqualToString:@"bundle"]) { diff --git a/FileTree/DirectoryNode.m b/FileTree/DirectoryNode.m index 4ad1597c9..433d15f85 100644 --- a/FileTree/DirectoryNode.m +++ b/FileTree/DirectoryNode.m @@ -22,7 +22,7 @@ - (void)updatePath { - NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url includingPropertiesForKeys:[NSArray arrayWithObjects:NSURLNameKey, NSURLIsDirectoryKey, nil] options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles) errorHandler:^BOOL(NSURL *url, NSError *error) { + NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtURL:url includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey] options:(NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles) errorHandler:^BOOL(NSURL *url, NSError *error) { return NO; }]; NSMutableArray *fullPaths = [[NSMutableArray alloc] init]; diff --git a/FileTree/PathWatcher.m b/FileTree/PathWatcher.m index 04b70f5ad..729ab5991 100644 --- a/FileTree/PathWatcher.m +++ b/FileTree/PathWatcher.m @@ -48,7 +48,7 @@ static void myFSEventCallback( [self cleanUp]; //Create FSEvent stream - NSArray *pathsToWatch = [NSArray arrayWithObject:path]; + NSArray *pathsToWatch = @[path]; context = (FSEventStreamContext*)malloc(sizeof(FSEventStreamContext)); context->version = 0; diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index 32ffa3bf0..461d1c1ee 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -481,7 +481,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc if (([sortDescriptors count] != 0) && [[sortDescriptors[0] key] caseInsensitiveCompare:@"index"] == NSOrderedSame) { // Remove the sort descriptors - [super setSortDescriptors:[NSArray array]]; + [super setSortDescriptors:@[]]; [self rearrangeObjects]; return; @@ -494,7 +494,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc } - (IBAction)randomizeList:(id)sender { - [self setSortDescriptors:[NSArray array]]; + [self setSortDescriptors:@[]]; NSArray *unrandomized = [self content]; [[[self undoManager] prepareWithInvocationTarget:self] unrandomizeList:unrandomized]; @@ -964,7 +964,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc [queueList removeObject:queueItem]; - [store queueRemovePlaylistItems:[NSArray arrayWithObject:queueItem]]; + [store queueRemovePlaylistItems:@[queueItem]]; } else { queueItem.queued = YES; queueItem.queuePosition = (int) [queueList count]; @@ -991,7 +991,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc queueItem.queuePosition = -1; [queueList removeObject:queueItem]; - [store queueRemovePlaylistItems:[NSArray arrayWithObject:queueItem]]; + [store queueRemovePlaylistItems:@[queueItem]]; } int i = 0; diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index 5669adf5d..5cf7d05f4 100755 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -202,7 +202,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL } [fileHandle truncateFileAtOffset:0]; - NSArray * filterList = [NSArray arrayWithObjects:@"display", @"length", @"path", @"filename", @"status", @"statusMessage", @"spam", @"lengthText", @"positionText", @"stopAfter", @"shuffleIndex", @"index", @"current", @"queued", @"currentPosition", @"queuePosition", @"error", @"removed", @"URL", @"albumArt", nil]; + NSArray * filterList = @[@"display", @"length", @"path", @"filename", @"status", @"statusMessage", @"spam", @"lengthText", @"positionText", @"stopAfter", @"shuffleIndex", @"index", @"current", @"queued", @"currentPosition", @"queuePosition", @"error", @"removed", @"URL", @"albumArt"]; NSMutableDictionary * albumArtSet = [[NSMutableDictionary alloc] init]; @@ -263,7 +263,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL for (NSString *subpath in subpaths) { - NSString *absoluteSubpath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,subpath,nil]]; + NSString *absoluteSubpath = [NSString pathWithComponents:@[path,subpath]]; BOOL isDir; if ( [manager fileExistsAtPath:absoluteSubpath isDirectory:&isDir] && isDir == NO) @@ -277,7 +277,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL } NSSortDescriptor * sd_path = [[NSSortDescriptor alloc] initWithKey:@"path" ascending:YES]; - [urls sortUsingDescriptors:[NSArray arrayWithObject:sd_path]]; + [urls sortUsingDescriptors:@[sd_path]]; return urls; } @@ -312,7 +312,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc if (!urls) { [self setProgressBarStatus:-1]; - return [NSArray array]; + return @[]; } if (index < 0) @@ -468,7 +468,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc if (!count) { [self setProgressBarStatus:-1]; - return [NSArray array]; + return @[]; } progressstep = 20.0 / (double)(count); @@ -539,7 +539,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc [playlistController setSelectionIndexes:[NSIndexSet indexSet]]; { - NSArray* arrayFirst = [NSArray arrayWithObject:[entries objectAtIndex:0]]; + NSArray* arrayFirst = @[[entries objectAtIndex:0]]; NSMutableArray* arrayRest = [entries mutableCopy]; [arrayRest removeObjectAtIndex:0]; @@ -733,7 +733,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc - (NSArray*)addURL:(NSURL *)url { - return [self insertURLs:[NSArray arrayWithObject:url] atIndex:(int)[[playlistController content] count] sort:NO]; + return [self insertURLs:@[url] atIndex:(int)[[playlistController content] count] sort:NO]; } - (NSArray*)addDatabase @@ -793,7 +793,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc - (NSArray *)acceptablePlaylistTypes { - return [NSArray arrayWithObjects:@"m3u", @"pls", nil]; + return @[@"m3u", @"pls"]; } - (NSArray *)acceptableContainerTypes diff --git a/Playlist/XmlContainer.m b/Playlist/XmlContainer.m index a52b39c4d..64ec469fc 100644 --- a/Playlist/XmlContainer.m +++ b/Playlist/XmlContainer.m @@ -89,7 +89,7 @@ if (isArray) { items = (NSArray *) plist; albumArt = nil; - queueList = [NSArray array]; + queueList = @[]; } else { NSDictionary *dict = (NSDictionary *) plist; items = dict[@"items"]; diff --git a/Plugins/APL/APLDecoder.m b/Plugins/APL/APLDecoder.m index 79fcccf5c..a479ecd88 100644 --- a/Plugins/APL/APLDecoder.m +++ b/Plugins/APL/APLDecoder.m @@ -6,11 +6,11 @@ @implementation APLDecoder + (NSArray *)fileTypes { - return [NSArray arrayWithObject:@"apl"]; + return @[@"apl"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/x-apl", nil]; + return @[@"application/x-apl"]; } + (float)priority { diff --git a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm index 5d8c9bc63..1969dd269 100755 --- a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm +++ b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm @@ -193,7 +193,7 @@ static CAdPlugDatabase * g_database = NULL; } } - return array; + return [NSArray arrayWithArray:array]; } + (NSArray *)mimeTypes @@ -213,7 +213,7 @@ static CAdPlugDatabase * g_database = NULL; [ret addObject:@"vg.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } @end diff --git a/Plugins/ArchiveSource/ArchiveSource/ArchiveContainer.m b/Plugins/ArchiveSource/ArchiveSource/ArchiveContainer.m index e6132af9c..e013431e1 100644 --- a/Plugins/ArchiveSource/ArchiveSource/ArchiveContainer.m +++ b/Plugins/ArchiveSource/ArchiveSource/ArchiveContainer.m @@ -26,12 +26,12 @@ static NSString * g_make_unpack_path(NSString * archive, NSString * file, NSStri + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"zip", @"rar", @"7z", @"rsn", @"vgm7z", @"gz", nil]; + return @[@"zip", @"rar", @"7z", @"rsn", @"vgm7z", @"gz"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/zip", @"application/x-gzip", @"application/x-rar-compressed", @"application/x-7z-compressed", nil]; + return @[@"application/zip", @"application/x-gzip", @"application/x-rar-compressed", @"application/x-7z-compressed"]; } + (float)priority @@ -47,14 +47,14 @@ static NSString * g_make_unpack_path(NSString * archive, NSString * file, NSStri + (NSArray *)urlsForContainerURL:(NSURL *)url { if (![url isFileURL]) { - return [NSArray array]; + return @[]; } fex_t * fex; fex_err_t error = fex_open( &fex, [[url path] UTF8String] ); if ( error ) { ALog(@"Archive error: %s", error); - return [NSArray array]; + return @[]; } NSMutableArray *files = [NSMutableArray array]; diff --git a/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m b/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m index 87984b7ef..791d80db0 100644 --- a/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m +++ b/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m @@ -181,7 +181,7 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString ** + (NSArray *)schemes { - return [NSArray arrayWithObject:@"unpack"]; + return @[@"unpack"]; } - (void)dealloc { diff --git a/Plugins/CueSheet/CueSheetContainer.m b/Plugins/CueSheet/CueSheetContainer.m index e12ef4ed7..117dd5d38 100644 --- a/Plugins/CueSheet/CueSheetContainer.m +++ b/Plugins/CueSheet/CueSheetContainer.m @@ -17,12 +17,12 @@ + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"cue", @"ogg", @"opus", @"flac", @"wv", @"mp3", nil]; + return @[@"cue", @"ogg", @"opus", @"flac", @"wv", @"mp3"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/x-cue", nil]; //This is basically useless + return @[@"application/x-cue"]; //This is basically useless } + (float)priority @@ -33,7 +33,7 @@ + (NSArray *)urlsForContainerURL:(NSURL *)url { if (![url isFileURL]) { - return [NSArray array]; + return @[]; } if ([url fragment]) { diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 02f61bc7b..1e137d419 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -586,12 +586,12 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"wma", @"asf", @"tak", @"mp4", @"m4a", @"aac", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"wav", @"tta", @"vqf", @"vqe", @"vql", @"ra", @"rm", @"rmj", @"mka", @"weba", nil]; + return @[@"wma", @"asf", @"tak", @"mp4", @"m4a", @"aac", @"mp3", @"mp2", @"m2a", @"mpa", @"ape", @"ac3", @"dts", @"dtshd", @"wav", @"tta", @"vqf", @"vqe", @"vql", @"ra", @"rm", @"rmj", @"mka", @"weba"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/wma", @"application/x-wma", @"audio/x-wma", @"audio/x-ms-wma", @"audio/x-tak", @"application/ogg", @"audio/aacp", @"audio/mpeg", @"audio/mp4", @"audio/x-mp3", @"audio/x-mp2", @"audio/x-matroska", @"audio/x-ape", @"audio/x-ac3", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-at3", @"audio/wav", @"audio/tta", @"audio/x-tta", @"audio/x-twinvq", nil]; + return @[@"application/wma", @"application/x-wma", @"audio/x-wma", @"audio/x-ms-wma", @"audio/x-tak", @"application/ogg", @"audio/aacp", @"audio/mpeg", @"audio/mp4", @"audio/x-mp3", @"audio/x-mp2", @"audio/x-matroska", @"audio/x-ape", @"audio/x-ac3", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-at3", @"audio/wav", @"audio/tta", @"audio/x-tta", @"audio/x-twinvq"]; } + (NSArray *)fileTypeAssociations diff --git a/Plugins/FileSource/FileSource.m b/Plugins/FileSource/FileSource.m index 7dc82fb08..39f1ece01 100644 --- a/Plugins/FileSource/FileSource.m +++ b/Plugins/FileSource/FileSource.m @@ -152,7 +152,7 @@ + (NSArray *)schemes { - return [NSArray arrayWithObject:@"file"]; + return @[@"file"]; } - (void)dealloc { diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index e52e4ddee..d27330789 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -353,12 +353,12 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"flac", nil]; + return @[@"flac"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-flac", nil]; + return @[@"audio/x-flac"]; } + (float)priority diff --git a/Plugins/GME/GameContainer.m b/Plugins/GME/GameContainer.m index 28458b2c6..eb50f7641 100755 --- a/Plugins/GME/GameContainer.m +++ b/Plugins/GME/GameContainer.m @@ -18,9 +18,7 @@ + (NSArray *)fileTypes { //There doesn't seem to be a way to get this list. These are the only multitrack types. - return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sgc", - @"vgm",@"vgz", // These are included so they can override AdPlug - nil]; + return @[@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sgc"]; } + (NSArray *)mimeTypes @@ -41,14 +39,6 @@ return [NSMutableArray arrayWithObject:url]; } - // Dodge both VGMStream and AdPlug - NSString * extension = [url pathExtension]; - if (extension && ([extension caseInsensitiveCompare:@"vgm"] == NSOrderedSame || - [extension caseInsensitiveCompare:@"vgz"] == NSOrderedSame)) - { - return [NSMutableArray arrayWithObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingString:@"#0"]]]; - } - id audioSourceClass = NSClassFromString(@"AudioSource"); id source = [audioSourceClass audioSourceForURL:url]; @@ -71,7 +61,7 @@ if (NULL != error) { ALog(@"GME: Error loading file: %@ %s", [url path], error); - return [NSArray arrayWithObject:url]; + return @[url]; } NSURL *m3uurl = [url URLByDeletingPathExtension]; diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index 723b67b99..6d8d7ff19 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -209,7 +209,7 @@ gme_err_t readCallback( void* data, void* out, long count ) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc", nil]; + return @[@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc"]; } + (NSArray *)mimeTypes @@ -229,7 +229,7 @@ gme_err_t readCallback( void* data, void* out, long count ) [ret addObject:@"vg.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[ret]; } diff --git a/Plugins/HTTPSource/HTTPSource.m b/Plugins/HTTPSource/HTTPSource.m index 4e30d36e4..c0014ba7e 100644 --- a/Plugins/HTTPSource/HTTPSource.m +++ b/Plugins/HTTPSource/HTTPSource.m @@ -299,7 +299,7 @@ didCompleteWithError:(NSError *)error{ + (NSArray *)schemes { - return [NSArray arrayWithObjects:@"http", @"https", nil]; + return @[@"http", @"https"]; } @end diff --git a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm index 0bfbb9d65..6290dc65d 100644 --- a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm +++ b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm @@ -1739,12 +1739,12 @@ static int usf_info(void * context, const char * name, const char * value) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"psf",@"minipsf",@"psf2", @"minipsf2", @"ssf", @"minissf", @"dsf", @"minidsf", @"qsf", @"miniqsf", @"gsf", @"minigsf", @"ncsf", @"minincsf", @"2sf", @"mini2sf", @"usf", @"miniusf", nil]; + return @[@"psf",@"minipsf",@"psf2", @"minipsf2", @"ssf", @"minissf", @"dsf", @"minidsf", @"qsf", @"miniqsf", @"gsf", @"minigsf", @"ncsf", @"minincsf", @"2sf", @"mini2sf", @"usf", @"miniusf"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-psf", nil]; + return @[@"audio/x-psf"]; } + (float)priority @@ -1759,7 +1759,7 @@ static int usf_info(void * context, const char * name, const char * value) [ret addObject:@"vg.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } diff --git a/Plugins/Hively/Hively/HVLDecoder.m b/Plugins/Hively/Hively/HVLDecoder.m index 9456bc7a0..ceeea4cc9 100755 --- a/Plugins/Hively/Hively/HVLDecoder.m +++ b/Plugins/Hively/Hively/HVLDecoder.m @@ -191,7 +191,7 @@ static void oneTimeInit(void) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"hvl", @"ahx", nil]; + return @[@"hvl", @"ahx"]; } + (NSArray *)fileTypeAssociations diff --git a/Plugins/M3u/M3uContainer.m b/Plugins/M3u/M3uContainer.m index 4f77d0301..e888d068b 100644 --- a/Plugins/M3u/M3uContainer.m +++ b/Plugins/M3u/M3uContainer.m @@ -14,12 +14,12 @@ + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"m3u", @"m3u8", nil]; + return @[@"m3u", @"m3u8"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-mpegurl", @"audio/mpegurl", nil]; + return @[@"audio/x-mpegurl", @"audio/mpegurl"]; } + (float)priority @@ -77,7 +77,7 @@ id source = [audioSourceClass audioSourceForURL:url]; if (![source open:url]) - return [NSArray array]; + return @[]; long size = 0; long bytesread = 0; @@ -121,7 +121,7 @@ free(filecontents); if (!contents) { ALog(@"Could not open file...%@ %@", url, contents); - return [NSArray array]; + return @[]; } NSMutableArray *entries = [NSMutableArray array]; diff --git a/Plugins/MIDI/MIDI/MIDIContainer.mm b/Plugins/MIDI/MIDI/MIDIContainer.mm index 1d7a99fd8..a1ce7fc23 100755 --- a/Plugins/MIDI/MIDI/MIDIContainer.mm +++ b/Plugins/MIDI/MIDI/MIDIContainer.mm @@ -40,10 +40,10 @@ id source = [audioSourceClass audioSourceForURL:url]; if (![source open:url]) - return [NSArray array]; + return @[]; if (![source seekable]) - return [NSArray array]; + return @[]; [source seek:0 whence:SEEK_END]; long size = [source tell]; @@ -56,7 +56,7 @@ size_t track_count = 0; if ( !midi_processor::process_track_count( data, [[url pathExtension] UTF8String], track_count) ) - return [NSArray array]; + return @[]; NSMutableArray *tracks = [NSMutableArray array]; diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index c977c6419..2236c5f30 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -125,7 +125,7 @@ static OSType getOSType(const char * in_) if ( [[source url] isFileURL] ) { // Let's check for a SoundFont - NSArray * extensions = [NSArray arrayWithObjects:@"sflist", @"sf2pack", @"sf2", nil]; + NSArray * extensions = @[@"sflist", @"sf2pack", @"sf2"]; NSString * filePath = [[source url] path]; NSString * fileNameBase = [filePath lastPathComponent]; filePath = [filePath stringByDeletingLastPathComponent]; @@ -355,12 +355,12 @@ static OSType getOSType(const char * in_) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"mid", @"midi", @"kar", @"rmi", @"mids", @"mds", @"hmi", @"hmp", @"hmq", @"mus", @"xmi", @"lds", nil]; + return @[@"mid", @"midi", @"kar", @"rmi", @"mids", @"mds", @"hmi", @"hmp", @"hmq", @"mus", @"xmi", @"lds"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/midi", @"audio/x-midi", nil]; + return @[@"audio/midi", @"audio/x-midi"]; } + (float)priority diff --git a/Plugins/MIDI/MIDI/MIDIMetadataReader.mm b/Plugins/MIDI/MIDI/MIDIMetadataReader.mm index cc0808208..e314aff2d 100644 --- a/Plugins/MIDI/MIDI/MIDIMetadataReader.mm +++ b/Plugins/MIDI/MIDI/MIDIMetadataReader.mm @@ -66,7 +66,7 @@ midi_meta_data_item item; bool remap_display_name = !metadata.get_item( "title", item ); - NSArray * allowedKeys = [NSArray arrayWithObjects:@"title", @"artist", @"album", @"year", nil]; + NSArray * allowedKeys = @[@"title", @"artist", @"album", @"year"]; NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity:10]; diff --git a/Plugins/Musepack/MusepackDecoder.m b/Plugins/Musepack/MusepackDecoder.m index 31954f085..e4b787d43 100644 --- a/Plugins/Musepack/MusepackDecoder.m +++ b/Plugins/Musepack/MusepackDecoder.m @@ -220,12 +220,12 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) + (NSArray *)fileTypes { - return [NSArray arrayWithObject:@"mpc"]; + return @[@"mpc"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-musepack", nil]; + return @[@"audio/x-musepack"]; } + (float)priority diff --git a/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm b/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm index 6593aac15..0a43d6eab 100755 --- a/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm +++ b/Plugins/OpenMPT.old/OpenMPT/OMPTDecoder.mm @@ -180,12 +180,12 @@ static void g_push_archive_extensions(std::vector & list) [array addObject:[NSString stringWithUTF8String:ext->c_str()]]; } - return array; + return [NSArray arrayWithArray:array]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-it", @"audio/x-xm", @"audio/x-s3m", @"audio/x-mod", nil]; + return @[@"audio/x-it", @"audio/x-xm", @"audio/x-s3m", @"audio/x-mod"]; } + (float)priority @@ -200,7 +200,7 @@ static void g_push_archive_extensions(std::vector & list) [ret addObject:@"song.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } @end diff --git a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm index f4252bc97..d0cb941f4 100755 --- a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm +++ b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm @@ -172,12 +172,12 @@ static void g_push_archive_extensions(std::vector & list) [array addObject:[NSString stringWithUTF8String:ext->c_str()]]; } - return array; + return [NSArray arrayWithArray:array]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-it", @"audio/x-xm", @"audio/x-s3m", @"audio/x-mod", nil]; + return @[@"audio/x-it", @"audio/x-xm", @"audio/x-s3m", @"audio/x-mod"]; } + (float)priority @@ -192,7 +192,7 @@ static void g_push_archive_extensions(std::vector & list) [ret addObject:@"song.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } @end diff --git a/Plugins/Opus/Opus/OpusDecoder.m b/Plugins/Opus/Opus/OpusDecoder.m index 74298c03d..915782322 100644 --- a/Plugins/Opus/Opus/OpusDecoder.m +++ b/Plugins/Opus/Opus/OpusDecoder.m @@ -175,12 +175,12 @@ opus_int64 sourceTell(void *_stream) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"opus",@"ogg",nil]; + return @[@"opus",@"ogg"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-opus+ogg", @"application/ogg", nil]; + return @[@"audio/x-opus+ogg", @"application/ogg"]; } + (float)priority diff --git a/Plugins/Pls/PlsContainer.m b/Plugins/Pls/PlsContainer.m index 4897a8c10..ddbf071b6 100644 --- a/Plugins/Pls/PlsContainer.m +++ b/Plugins/Pls/PlsContainer.m @@ -14,12 +14,12 @@ + (NSArray *)fileTypes { - return [NSArray arrayWithObject:@"pls"]; + return @[@"pls"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-scpls", @"application/pls", nil]; + return @[@"audio/x-scpls", @"application/pls"]; } + (float)priority @@ -79,7 +79,7 @@ id source = [audioSourceClass audioSourceForURL:url]; if (![source open:url]) - return [NSArray array]; + return @[]; long size = 0; long bytesread = 0; @@ -123,7 +123,7 @@ free(filecontents); if (!contents) { ALog(@"Could not open file...%@ %@", url, contents); - return [NSArray array]; + return @[]; } NSMutableArray *entries = [NSMutableArray array]; diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index 5909117ef..19f8f738e 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -100,12 +100,12 @@ + (NSArray *)fileTypes { - return [NSArray arrayWithObject:@"shn"]; + return @[@"shn"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/x-shorten", nil]; //This is basically useless, since we cant stream shorten yet + return @[@"application/x-shorten"]; //This is basically useless, since we cant stream shorten yet } + (float)priority diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m index 5552333dd..f42e7f81a 100755 --- a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m @@ -92,12 +92,12 @@ enum { channels = 2 }; + (NSArray *)fileTypes { - return [NSArray array]; + return @[]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObject:@"audio/x-silence"]; + return @[@"audio/x-silence"]; } + (float)priority diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m index 3596a4400..28ba1a112 100644 --- a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m @@ -61,7 +61,7 @@ + (NSArray *)schemes { - return [NSArray arrayWithObject:@"silence"]; + return @[@"silence"]; } - (void)dealloc { diff --git a/Plugins/TagLib/TagLibMetadataReader.m b/Plugins/TagLib/TagLibMetadataReader.m index bdb548528..ec40d6122 100644 --- a/Plugins/TagLib/TagLibMetadataReader.m +++ b/Plugins/TagLib/TagLibMetadataReader.m @@ -228,18 +228,18 @@ + (NSArray *)coverNames { - return [NSArray arrayWithObjects:@"cover", @"folder", @"album", @"front", nil]; + return @[@"cover", @"folder", @"album", @"front"]; } + (NSArray *)fileTypes { //May be a way to get a list of supported formats - return [NSArray arrayWithObjects:@"ape", @"asf", @"wma", @"ogg", @"opus", @"mpc", @"flac", @"m4a", @"mp3", @"tak", @"ac3", @"apl", @"dts", @"dtshd", @"tta", @"wav", @"aif", @"aiff", @"wv", @"wvp", nil]; + return @[@"ape", @"asf", @"wma", @"ogg", @"opus", @"mpc", @"flac", @"m4a", @"mp3", @"tak", @"ac3", @"apl", @"dts", @"dtshd", @"tta", @"wav", @"aif", @"aiff", @"wv", @"wvp"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-ape", @"audio/x-ms-wma", @"application/ogg", @"application/x-ogg", @"audio/x-vorbis+ogg", @"audio/x-musepack", @"audio/x-flac", @"audio/x-m4a", @"audio/mpeg", @"audio/x-mp3", @"audio/x-tak", @"audio/x-ac3", @"audio/x-apl", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-tta", @"audio/wav", @"audio/aiff", @"audio/x-wavpack", nil]; + return @[@"audio/x-ape", @"audio/x-ms-wma", @"application/ogg", @"application/x-ogg", @"audio/x-vorbis+ogg", @"audio/x-musepack", @"audio/x-flac", @"audio/x-m4a", @"audio/mpeg", @"audio/x-mp3", @"audio/x-tak", @"audio/x-ac3", @"audio/x-apl", @"audio/x-dts", @"audio/x-dtshd", @"audio/x-tta", @"audio/wav", @"audio/aiff", @"audio/x-wavpack"]; } + (float)priority diff --git a/Plugins/TagLib/TagLibMetadataWriter.m b/Plugins/TagLib/TagLibMetadataWriter.m index ca85ff885..3c676c9fa 100644 --- a/Plugins/TagLib/TagLibMetadataWriter.m +++ b/Plugins/TagLib/TagLibMetadataWriter.m @@ -42,8 +42,8 @@ /* - NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil]; - NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil]; + NSArray *keys = @[@"key1", @"key2", @"key3"]; + NSArray *objects = @[@"value1", @"value2", @"value3"]; NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys]; for (id key in dictionary) diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index 7645d9838..539976d86 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -167,12 +167,12 @@ long sourceTell(void *datasource) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"ogg",nil]; + return @[@"ogg"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"application/ogg", @"application/x-ogg", @"audio/x-vorbis+ogg", nil]; + return @[@"application/ogg", @"application/x-ogg", @"audio/x-vorbis+ogg"]; } + (float)priority diff --git a/Plugins/WavPack/WavPackDecoder.m b/Plugins/WavPack/WavPackDecoder.m index a1fb1d056..1fc86822a 100644 --- a/Plugins/WavPack/WavPackDecoder.m +++ b/Plugins/WavPack/WavPackDecoder.m @@ -318,12 +318,12 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"wv", @"wvp", nil]; + return @[@"wv", @"wvp"]; } + (NSArray *)mimeTypes { - return [NSArray arrayWithObjects:@"audio/x-wavpack", nil]; + return @[@"audio/x-wavpack"]; } + (float)priority diff --git a/Plugins/libvgmPlayer/libvgmContainer.mm b/Plugins/libvgmPlayer/libvgmContainer.mm index bc2720f00..f4db4ad21 100755 --- a/Plugins/libvgmPlayer/libvgmContainer.mm +++ b/Plugins/libvgmPlayer/libvgmContainer.mm @@ -15,9 +15,9 @@ + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"s98", @"dro", @"gym", - @"vgm",@"vgz", // These are included so they can override AdPlug - nil]; + return @[@"s98", @"dro", @"gym", + @"vgm",@"vgz" // These are included so they can override AdPlug and VGMStream + ]; } + (NSArray *)mimeTypes @@ -39,7 +39,7 @@ } // None of the covered formats include subsongs, but dodge VGMStream and AdPlug - return [NSArray arrayWithObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingString:@"#0"]]]; + return @[[NSURL URLWithString:[[url absoluteString] stringByAppendingString:@"#0"]]]; } @end diff --git a/Plugins/libvgmPlayer/libvgmDecoder.mm b/Plugins/libvgmPlayer/libvgmDecoder.mm index 29329fd73..ffe3aef18 100755 --- a/Plugins/libvgmPlayer/libvgmDecoder.mm +++ b/Plugins/libvgmPlayer/libvgmDecoder.mm @@ -278,7 +278,7 @@ const int masterVol = 0x10000; // Fixed point 16.16 + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"vgm", @"vgz", @"s98", @"dro", @"gym", nil]; + return @[@"vgm", @"vgz", @"s98", @"dro", @"gym"]; } + (NSArray *)mimeTypes @@ -298,7 +298,7 @@ const int masterVol = 0x10000; // Fixed point 16.16 [ret addObject:@"vg.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } - (void)setSource:(id)s diff --git a/Plugins/sidplay/SidDecoder.mm b/Plugins/sidplay/SidDecoder.mm index 78e72fede..7dedc5e6e 100755 --- a/Plugins/sidplay/SidDecoder.mm +++ b/Plugins/sidplay/SidDecoder.mm @@ -361,7 +361,7 @@ static void sidTuneLoader(const char* fileName, std::vector& bufferRef) + (NSArray *)fileTypes { - return [NSArray arrayWithObjects:@"sid", @"mus", nil]; + return @[@"sid", @"mus"]; } + (NSArray *)mimeTypes diff --git a/Plugins/vgmstream/vgmstream/VGMContainer.m b/Plugins/vgmstream/vgmstream/VGMContainer.m index 6f3b31e57..cec19690e 100755 --- a/Plugins/vgmstream/vgmstream/VGMContainer.m +++ b/Plugins/vgmstream/vgmstream/VGMContainer.m @@ -56,7 +56,7 @@ if (!stream) { ALog(@"Open failed for file: %@", [url absoluteString]); - return [NSArray array]; + return @[]; } VGMInfoCache * sharedMyCache = [VGMInfoCache sharedCache]; @@ -81,7 +81,7 @@ stream = init_vgmstream_from_cogfile([path UTF8String], i); if (!stream) - return [NSArray array]; + return @[]; trackurl = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"#%i", i]]; [sharedMyCache stuffURL:trackurl stream:stream]; diff --git a/Plugins/vgmstream/vgmstream/VGMDecoder.m b/Plugins/vgmstream/vgmstream/VGMDecoder.m index b1d3c4135..af2a894ca 100644 --- a/Plugins/vgmstream/vgmstream/VGMDecoder.m +++ b/Plugins/vgmstream/vgmstream/VGMDecoder.m @@ -403,7 +403,7 @@ static NSString* get_description_tag(const char* description, const char *tag, c [array addObject:[NSString stringWithUTF8String:formats[i]]]; } - return array; + return [NSArray arrayWithArray:array]; } + (NSArray *)mimeTypes @@ -423,7 +423,7 @@ static NSString* get_description_tag(const char* description, const char *tag, c [ret addObject:@"vg.icns"]; [ret addObjectsFromArray:[self fileTypes]]; - return [NSArray arrayWithObject:ret]; + return @[[NSArray arrayWithArray:ret]]; } @end diff --git a/Preferences/Preferences/OutputsArrayController.m b/Preferences/Preferences/OutputsArrayController.m index cc13206c1..91d419c77 100644 --- a/Preferences/Preferences/OutputsArrayController.m +++ b/Preferences/Preferences/OutputsArrayController.m @@ -32,7 +32,7 @@ if (defaultDevice && defaultDeviceID != -1) { if ((deviceID == defaultDeviceID) || ([deviceName isEqualToString:defaultDeviceName])) { - [self setSelectedObjects:[NSArray arrayWithObject:deviceInfo]]; + [self setSelectedObjects:@[deviceInfo]]; // Update `outputDevice`, in case the ID has changed. [[NSUserDefaults standardUserDefaults] setObject:deviceInfo forKey:@"outputDevice"]; } diff --git a/Spotlight/SpotlightPlaylistController.m b/Spotlight/SpotlightPlaylistController.m index c82586657..d9c6c33a2 100644 --- a/Spotlight/SpotlightPlaylistController.m +++ b/Spotlight/SpotlightPlaylistController.m @@ -32,7 +32,7 @@ { data = [NSArchiver archivedDataWithRootObject:urls]; } - [pboard declareTypes:[NSArray arrayWithObjects:CogUrlsPboardType,nil] owner:nil]; //add it to pboard + [pboard declareTypes:@[CogUrlsPboardType] owner:nil]; //add it to pboard [pboard setData:data forType:CogUrlsPboardType]; [spotlightWindowController.query enableUpdates]; diff --git a/Spotlight/SpotlightPlaylistEntry.m b/Spotlight/SpotlightPlaylistEntry.m index 6a256e876..b638d44f0 100644 --- a/Spotlight/SpotlightPlaylistEntry.m +++ b/Spotlight/SpotlightPlaylistEntry.m @@ -19,15 +19,15 @@ static NSDictionary *importKeys; { // We need to translate the path string to a full URL NSArray *URLTransform = - [NSArray arrayWithObjects:@"URL", @"PathToURLTransformer", nil]; + @[@"URL", @"PathToURLTransformer"]; // Extract the artist name from the authors array NSArray *artistTransform = - [NSArray arrayWithObjects:@"artist", @"AuthorToArtistTransformer", nil]; + @[@"artist", @"AuthorToArtistTransformer"]; // Track numbers must sometimes be converted from NSNumber to NSString NSArray *trackTransform = - [NSArray arrayWithObjects:@"spotlightTrack", @"NumberToStringTransformer", nil]; + @[@"spotlightTrack", @"NumberToStringTransformer"]; importKeys = [NSDictionary dictionaryWithObjectsAndKeys: @"title", @"kMDItemTitle", @@ -91,4 +91,4 @@ static NSDictionary *importKeys; @synthesize length; @synthesize spotlightTrack; -@end \ No newline at end of file +@end diff --git a/Spotlight/SpotlightTransformers.m b/Spotlight/SpotlightTransformers.m index 6839234c1..ea61340b9 100644 --- a/Spotlight/SpotlightTransformers.m +++ b/Spotlight/SpotlightTransformers.m @@ -80,7 +80,7 @@ static SpotlightWindowController * searchController; if (value == nil) return nil; NSURL *scope = [NSURL URLWithString:value]; - return [NSArray arrayWithObject: scope]; + return @[scope]; } @end diff --git a/Spotlight/SpotlightWindowController.m b/Spotlight/SpotlightWindowController.m index 2709244b3..d8e7a7775 100644 --- a/Spotlight/SpotlightWindowController.m +++ b/Spotlight/SpotlightWindowController.m @@ -62,7 +62,7 @@ static NSPredicate * musicOnlyPredicate = nil; if (self = [super initWithWindowNibName:@"SpotlightPanel"]) { self.query = [[NSMetadataQuery alloc]init]; [self.query setDelegate:self]; - self.query.sortDescriptors = [NSArray arrayWithObjects: + self.query.sortDescriptors = @[ [[NSSortDescriptor alloc]initWithKey:@"kMDItemAuthors" ascending:YES selector:@selector(compareFirstString:)], @@ -71,8 +71,8 @@ static NSPredicate * musicOnlyPredicate = nil; selector:@selector(caseInsensitiveCompare:)], [[NSSortDescriptor alloc]initWithKey:@"kMDItemAudioTrackNumber" ascending:YES - selector:@selector(compareTrackNumbers:)], - nil]; + selector:@selector(compareTrackNumbers:)] + ]; // hook my query transformer up to me [PausingQueryTransformer setSearchController:self]; @@ -116,19 +116,18 @@ static NSPredicate * musicOnlyPredicate = nil; // musicOnlyPredicate NSPredicate *spotlightPredicate = [NSCompoundPredicate andPredicateWithSubpredicates: - [NSArray arrayWithObjects: musicOnlyPredicate, - searchPredicate, - nil]]; + @[musicOnlyPredicate, + searchPredicate]]; // Only preform a new search if the predicate has changed or there is a new path if(![self.query.predicate isEqual:spotlightPredicate] || ![self.query.searchScopes isEqualToArray: - [NSArray arrayWithObjects:pathControl.URL, nil]]) + @[pathControl.URL]]) { if([self.query isStarted]) [self.query stopQuery]; self.query.predicate = spotlightPredicate; // Set scope to contents of pathControl - self.query.searchScopes = [NSArray arrayWithObjects:pathControl.URL, nil]; + self.query.searchScopes = @[pathControl.URL]; [self.query startQuery]; DLog(@"Started query: %@", [self.query.predicate description]); } diff --git a/Utils/NSArray+ShuffleUtils.m b/Utils/NSArray+ShuffleUtils.m index cc06e76e5..9342bd3e8 100644 --- a/Utils/NSArray+ShuffleUtils.m +++ b/Utils/NSArray+ShuffleUtils.m @@ -37,7 +37,7 @@ NSUInteger i; for (i = 0; i < minCount; ++i) { - NSArray* p = [NSArray arrayWithObjects:[x objectAtIndex:i], [y objectAtIndex:i], nil]; + NSArray* p = @[[x objectAtIndex:i], [y objectAtIndex:i]]; [pairs addObject:p]; } @@ -55,7 +55,7 @@ [second addObject:[pair second]]; } - return [NSArray arrayWithObjects:first,second,nil]; + return @[first,second]; } @@ -78,4 +78,4 @@ } -@end \ No newline at end of file +@end diff --git a/Utils/SQLiteStore.m b/Utils/SQLiteStore.m index 68377577a..d1bd54bd3 100644 --- a/Utils/SQLiteStore.m +++ b/Utils/SQLiteStore.m @@ -18,7 +18,7 @@ NSString * getDatabasePath(void) NSArray * createSchema(void) { - return [NSArray arrayWithObjects: + return @[ @"CREATE TABLE IF NOT EXISTS stringdictionary ( \ stringid INTEGER PRIMARY KEY AUTOINCREMENT, \ referencecount INTEGER, \ @@ -67,7 +67,7 @@ NSArray * createSchema(void) queueid INTEGER PRIMARY KEY AUTOINCREMENT, \ queueindex INTEGER, \ entryid INTEGER \ - );", nil + );" ]; } diff --git a/Utils/SideViewController.m b/Utils/SideViewController.m index 061abd53c..b39eb031a 100644 --- a/Utils/SideViewController.m +++ b/Utils/SideViewController.m @@ -92,10 +92,10 @@ - (void)showSideView { if ([splitView isVertical]) { - [splitView setSubviews:[NSArray arrayWithObjects:[self view], mainView, nil]]; + [splitView setSubviews:@[[self view], mainView]]; } else { - [splitView setSubviews:[NSArray arrayWithObjects:mainView, [self view], nil]]; + [splitView setSubviews:@[mainView, [self view]]]; } [self setDividerPosition: [[NSUserDefaults standardUserDefaults] floatForKey:[self sideViewDividerPositionDefaultsKey]]]; @@ -107,7 +107,7 @@ - (void)hideSideView { - [splitView setSubviews:[NSArray arrayWithObject:mainView]]; + [splitView setSubviews:@[mainView]]; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:[self showSideViewDefaultsKey]]; [[mainView window] makeFirstResponder:mainView]; diff --git a/Window/AUPlayerView.m b/Window/AUPlayerView.m index 0de81d7d1..f99694eda 100644 --- a/Window/AUPlayerView.m +++ b/Window/AUPlayerView.m @@ -483,7 +483,7 @@ void equalizerApplyPreset(AudioUnit au, NSDictionary * preset) { splitView = [[NSSplitView alloc] initWithFrame:topRect]; - [splitView setSubviews:[NSArray arrayWithObjects:topView, auView, nil]]; + [splitView setSubviews:@[topView, auView]]; [self setContentView:splitView];