diff options
author | Max <post@wickenrode.com> | 2014-12-13 18:02:01 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2014-12-13 18:02:01 +0100 |
commit | 876dde21d97897ad4ee98aa0d6b11898282982ce (patch) | |
tree | 49dfcdf83e94937bdc7a3f09ca82ccacec3a5aed | |
parent | 994057ae2a82dc110a385ced4239ce49cc0601f8 (diff) | |
download | sequelpro-876dde21d97897ad4ee98aa0d6b11898282982ce.tar.gz sequelpro-876dde21d97897ad4ee98aa0d6b11898282982ce.tar.bz2 sequelpro-876dde21d97897ad4ee98aa0d6b11898282982ce.zip |
Change [NSArray arrayWithObject:] to @[] literal
Note: [NSArray arrayWithObjects:...,nil] is left unchanged as that could possibly cause a NPE if converted to @[]
25 files changed, 60 insertions, 61 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m index 034d7bd1..ebbadd5a 100644 --- a/Source/GeneratePreviewForURL.m +++ b/Source/GeneratePreviewForURL.m @@ -474,7 +474,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, // just in case if(!iconImages || [iconImages count] < 1) - iconImages = [NSArray arrayWithObject:[NSImage imageNamed:NSImageNameStopProgressTemplate]]; + iconImages = @[[NSImage imageNamed:NSImageNameStopProgressTemplate]]; #warning Shouldn't that be "> 1"? if([iconImages count] > 0) diff --git a/Source/MGTemplateEngine.m b/Source/MGTemplateEngine.m index 941a7e1b..4a5d3192 100644 --- a/Source/MGTemplateEngine.m +++ b/Source/MGTemplateEngine.m @@ -542,7 +542,7 @@ [frame setObject:endMarkers forKey:BLOCK_END_NAMES_KEY]; NSArray *arguments = [matchInfo objectForKey:MARKER_ARGUMENTS_KEY]; if (!arguments) { - arguments = [NSArray array]; + arguments = @[]; } [frame setObject:arguments forKey:BLOCK_ARGUMENTS_KEY]; [frame setObject:[matchInfo objectForKey:MARKER_RANGE_KEY] forKey:BLOCK_START_MARKER_RANGE_KEY]; diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 8aabce60..56da49cf 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -738,7 +738,7 @@ if([pathComponents count] > 2) parameter = [pathComponents subarrayWithRange:NSMakeRange(2, [pathComponents count]-2)]; else - parameter = [NSArray array]; + parameter = @[]; NSFileManager *fm = [NSFileManager defaultManager]; @@ -1533,7 +1533,7 @@ if([[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey]) deletedDefaultBundles = [[[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey] retain]; else - deletedDefaultBundles = [[NSArray array] retain]; + deletedDefaultBundles = [@[] retain]; NSMutableString *infoAboutUpdatedDefaultBundles = [NSMutableString string]; BOOL doBundleUpdate = ([[NSUserDefaults standardUserDefaults] objectForKey:@"doBundleUpdate"]) ? YES : NO; @@ -1775,7 +1775,7 @@ // Sort items for menus NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:SPBundleInternLabelKey ascending:YES] autorelease]; for(NSString* scope in [bundleItems allKeys]) { - [[bundleItems objectForKey:scope] sortUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]]; + [[bundleItems objectForKey:scope] sortUsingDescriptors:@[sortDescriptor]]; [[bundleCategories objectForKey:scope] sortUsingSelector:@selector(compare:)]; } } @@ -1949,7 +1949,7 @@ // Sort if more than one found if([assignedKeyEquivalents count] > 1) { NSSortDescriptor *aSortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"title" ascending:YES selector:@selector(caseInsensitiveCompare:)] autorelease]; - NSArray *sorted = [assignedKeyEquivalents sortedArrayUsingDescriptors:[NSArray arrayWithObject:aSortDescriptor]]; + NSArray *sorted = [assignedKeyEquivalents sortedArrayUsingDescriptors:@[aSortDescriptor]]; [assignedKeyEquivalents setArray:sorted]; } } diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index aa400b05..4de339de 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -741,8 +741,8 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; - (IBAction)saveBundle:(id)sender { NSSavePanel *panel = [NSSavePanel savePanel]; - - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPUserBundleFileExtension]]; + + [panel setAllowedFileTypes:@[SPUserBundleFileExtension]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:NO]; @@ -1536,7 +1536,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; // Write data to the pasteboard NSArray *fileList = [NSArray arrayWithObjects:draggedFilePath, nil]; // NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; + [pboard declareTypes:@[NSFilenamesPboardType] owner:nil]; [pboard setPropertyList:fileList forType:NSFilenamesPboardType]; // Start the drag operation diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index 4384ae32..a28a27b7 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -312,7 +312,7 @@ static NSString *SPQuickConnectImageWhite = @"quick-connect-icon-white.pdf"; return NO; } - [pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:self]; + [pboard declareTypes:@[SPFavoritesPasteboardDragType] owner:self]; BOOL result = [pboard setData:[NSData data] forType:SPFavoritesPasteboardDragType]; diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m index 5ef4f3a4..5254e36d 100644 --- a/Source/SPConnectionControllerInitializer.m +++ b/Source/SPConnectionControllerInitializer.m @@ -320,7 +320,7 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; [favoritesOutlineView setDoubleAction:@selector(nodeDoubleClicked:)]; // Register drag types for the favorites outline view - [favoritesOutlineView registerForDraggedTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType]]; + [favoritesOutlineView registerForDraggedTypes:@[SPFavoritesPasteboardDragType]]; [favoritesOutlineView setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES]; } diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index ea7c49b1..d6fed676 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -143,7 +143,7 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; [contentFilterTextView setString:@""]; // Register drag types - [contentFilterTableView registerForDraggedTypes:[NSArray arrayWithObject:SPContentFilterPasteboardDragType]]; + [contentFilterTableView registerForDraggedTypes:@[SPContentFilterPasteboardDragType]]; [contentFilterArrayController setContent:contentFilters]; [contentFilterTableView reloadData]; @@ -333,7 +333,7 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; #ifndef SP_CODA NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionDefault]]; + [panel setAllowedFileTypes:@[SPFileExtensionDefault]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:NO]; @@ -556,7 +556,7 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard { - NSArray *pboardTypes = [NSArray arrayWithObject:SPContentFilterPasteboardDragType]; + NSArray *pboardTypes = @[SPContentFilterPasteboardDragType]; NSUInteger originalRow = [rows firstIndex]; if(originalRow < 1) return NO; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 9de7391d..21ce6970 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -197,7 +197,7 @@ NSBeep(); return; } - queries = [NSArray arrayWithObject:[SPSQLParser normaliseQueryForExecution:query]]; + queries = @[[SPSQLParser normaliseQueryForExecution:query]]; // Otherwise, run the selected text. } else { @@ -470,7 +470,7 @@ #ifndef SP_CODA NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]]; + [panel setAllowedFileTypes:@[SPFileExtensionSQL]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; @@ -504,7 +504,7 @@ { NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; + [pb declareTypes:@[NSStringPboardType] owner:nil]; [pb setString:[self buildHistoryString] forType:NSStringPboardType]; } @@ -2038,7 +2038,7 @@ if ([prefs boolForKey:SPReloadAfterEditingRow]) { reloadingExistingResult = YES; [self storeCurrentResultViewForRestoration]; - [self performQueries:[NSArray arrayWithObject:lastExecutedQuery] withCallback:NULL]; + [self performQueries:@[lastExecutedQuery] withCallback:NULL]; } else { #endif // otherwise, just update the data in the data storage @@ -2264,7 +2264,7 @@ sortColumn = tableColumn; else sortColumn = nil; - [self performQueries:[NSArray arrayWithObject:queryString] withCallback:@selector(tableSortCallback)]; + [self performQueries:@[queryString] withCallback:@selector(tableSortCallback)]; } - (void)tableSortCallback @@ -3392,7 +3392,7 @@ for (NSDictionary *favorite in [[SPQueryController sharedQueryController] favoritesForFileURL:[tableDocumentInstance fileURL]]) { if (![favorite isKindOfClass:[NSDictionary class]] || ![favorite objectForKey:@"name"]) continue; NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; - [paraStyle setTabStops:[NSArray array]]; + [paraStyle setTabStops:@[]]; [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] @@ -3418,7 +3418,7 @@ for (NSDictionary *favorite in [prefs objectForKey:SPQueryFavorites]) { if (![favorite isKindOfClass:[NSDictionary class]] || ![favorite objectForKey:@"name"]) continue; NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; - [paraStyle setTabStops:[NSArray array]]; + [paraStyle setTabStops:@[]]; [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 9d5b47e7..1bd9a8f9 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -428,7 +428,7 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, { SPMySQLResult *result = [connection queryString:query]; - if ([connection queryErrored]) return [NSArray array]; + if ([connection queryErrored]) return @[]; [result setReturnDataAsStrings:YES]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 7ab802da..88ab58ed 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -1841,7 +1841,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // show syntax(es) in sheet if (sender == self) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; + [pb declareTypes:@[NSStringPboardType] owner:self]; [pb setString:createSyntax forType:NSStringPboardType]; // Table syntax copied Growl notification @@ -2330,7 +2330,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; { NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]]; + [panel setAllowedFileTypes:@[SPFileExtensionSQL]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; @@ -2361,7 +2361,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Copy to the clipboard NSPasteboard *pb = [NSPasteboard generalPasteboard]; - [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; + [pb declareTypes:@[NSStringPboardType] owner:self]; [pb setString:createSyntax forType:NSStringPboardType]; // Table syntax copied Growl notification @@ -5264,7 +5264,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:&inError]; [fm removeItemAtPath:queryFileName error:nil]; if(inError == nil && query && [query length]) { - [customQueryInstance performQueries:[NSArray arrayWithObject:query] withCallback:NULL]; + [customQueryInstance performQueries:@[query] withCallback:NULL]; } } return; diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m index 93e5c42b..e5250e1d 100644 --- a/Source/SPEditorPreferencePane.m +++ b/Source/SPEditorPreferencePane.m @@ -131,7 +131,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; { NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPColorThemeFileExtension]]; + [panel setAllowedFileTypes:@[SPColorThemeFileExtension]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:NO]; @@ -770,7 +770,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; if ([fm fileExistsAtPath:themePath isDirectory:nil]) { NSArray *allItemsRaw = [fm contentsOfDirectoryAtPath:themePath error:NULL]; - if(!allItemsRaw) return [NSArray array]; + if(!allItemsRaw) return @[]; // Filter out all themes NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]]; @@ -791,7 +791,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined"; return (NSArray *)allItems; } - return [NSArray array]; + return @[]; } - (void)_saveColorThemeAtPath:(NSString *)path diff --git a/Source/SPExportControllerDelegate.m b/Source/SPExportControllerDelegate.m index aca7791f..43b1804f 100644 --- a/Source/SPExportControllerDelegate.m +++ b/Source/SPExportControllerDelegate.m @@ -155,7 +155,7 @@ // Check whether the group of items make up a token groupToken = [self tokenObjectForString:[[processedTokens subarrayWithRange:NSMakeRange(k, 1 + i - k)] componentsJoinedByString:@""]]; if ([groupToken isKindOfClass:[SPExportFileNameTokenObject class]]) { - [processedTokens replaceObjectsInRange:NSMakeRange(k, 1 + i - k) withObjectsFromArray:[NSArray arrayWithObject:groupToken]]; + [processedTokens replaceObjectsInRange:NSMakeRange(k, 1 + i - k) withObjectsFromArray:@[groupToken]]; i = k + 1; break; } diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m index d5564428..07d74ee0 100644 --- a/Source/SPFavoritesController.m +++ b/Source/SPFavoritesController.m @@ -237,7 +237,7 @@ static SPFavoritesController *sharedFavoritesController = nil; favoritesData = [[NSMutableDictionary alloc] initWithContentsOfFile:favoritesFile]; } else { - NSMutableDictionary *newFavorites = [NSMutableDictionary dictionaryWithObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Favorites", @"favorites label"), SPFavoritesGroupNameKey, [NSArray array], SPFavoriteChildrenKey, nil] forKey:SPFavoritesRootKey]; + NSMutableDictionary *newFavorites = [NSMutableDictionary dictionaryWithObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Favorites", @"favorites label"), SPFavoritesGroupNameKey, @[], SPFavoriteChildrenKey, nil] forKey:SPFavoritesRootKey]; error = nil; NSString *errorString = nil; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 9c2de5fc..2d8e9529 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -895,8 +895,7 @@ id ql = [NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel]; [[ql delegate] setDelegate:self]; - [ql setURLs:[NSArray arrayWithObject: - [NSURL fileURLWithPath:tmpFileName]] currentIndex:0 preservingDisplayState:YES]; + [ql setURLs:@[[NSURL fileURLWithPath:tmpFileName]] currentIndex:0 preservingDisplayState:YES]; // TODO: No interaction with iChat and iPhoto due to .scriptSuite warning: // unknown image format diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index e2319141..5db53418 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -467,7 +467,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [allSchemaKeys setObject:a forKey:connectionName]; } else { [schemaData setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"%@&DEL&no data loaded yet", connectionName]]; - [allSchemaKeys setObject:[NSArray array] forKey:connectionName]; + [allSchemaKeys setObject:@[] forKey:connectionName]; } [updatingConnections removeObject:connectionName]; diff --git a/Source/SPPrintAccessory.m b/Source/SPPrintAccessory.m index aab04630..043d04a1 100644 --- a/Source/SPPrintAccessory.m +++ b/Source/SPPrintAccessory.m @@ -49,7 +49,7 @@ - (NSArray *)localizedSummaryItems { - return [NSArray arrayWithObject:[NSDictionary dictionary]]; + return @[@{}]; } - (NSSet *)keyPathsForValuesAffectingPreview diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 3e33b533..0b1e59b6 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -226,7 +226,7 @@ static SPQueryController *sharedQueryController = nil; #ifndef SP_CODA NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]]; + [panel setAllowedFileTypes:@[SPFileExtensionSQL]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; diff --git a/Source/SPQueryDocumentsController.m b/Source/SPQueryDocumentsController.m index e42a734b..e4689c41 100644 --- a/Source/SPQueryDocumentsController.m +++ b/Source/SPQueryDocumentsController.m @@ -312,7 +312,7 @@ } #endif - return [NSArray array]; + return @[]; } /** @@ -355,7 +355,7 @@ - (NSArray *)queryFavoritesForFileURL:(NSURL *)fileURL andTabTrigger:(NSString *)tabTrigger includeGlobals:(BOOL)includeGlobals { - if (![tabTrigger length]) return [NSArray array]; + if (![tabTrigger length]) return @[]; NSMutableArray *result = [[NSMutableArray alloc] init]; @@ -390,7 +390,7 @@ */ - (NSArray*)functionList { - return (completionFunctionList != nil && [completionFunctionList count]) ? completionFunctionList : [NSArray array]; + return (completionFunctionList != nil && [completionFunctionList count]) ? completionFunctionList : @[]; } /** @@ -398,7 +398,7 @@ */ - (NSArray*)keywordList { - return (completionKeywordList != nil && [completionKeywordList count]) ? completionKeywordList : [NSArray array]; + return (completionKeywordList != nil && [completionKeywordList count]) ? completionKeywordList : @[]; } /** diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index c73501b8..38758a45 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -124,7 +124,7 @@ [self _initWithNoSelection]; // Register drag types - [favoritesTableView registerForDraggedTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType]]; + [favoritesTableView registerForDraggedTypes:@[SPFavoritesPasteboardDragType]]; [favoritesArrayController setContent:favorites]; [favoritesTableView reloadData]; @@ -310,7 +310,7 @@ #ifndef SP_CODA NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]]; + [panel setAllowedFileTypes:@[SPFileExtensionSQL]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; @@ -335,7 +335,7 @@ #ifndef SP_CODA NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionDefault]]; + [panel setAllowedFileTypes:@[SPFileExtensionDefault]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:NO]; @@ -677,7 +677,7 @@ - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard { - NSArray *pboardTypes = [NSArray arrayWithObject:SPFavoritesPasteboardDragType]; + NSArray *pboardTypes = @[SPFavoritesPasteboardDragType]; NSInteger originalRow = [rows firstIndex]; if(originalRow < 1) return NO; diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index 80c9f558..43da2068 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -126,7 +126,7 @@ { NSSavePanel *panel = [NSSavePanel savePanel]; - [panel setAllowedFileTypes:[NSArray arrayWithObject:@"cnf"]]; + [panel setAllowedFileTypes:@[@"cnf"]]; [panel setExtensionHidden:NO]; [panel setAllowsOtherFileTypes:YES]; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 9d875555..4ee09fd9 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -165,7 +165,7 @@ [self updateTriggersForCurrentTable]; } else { - return [NSArray array]; + return @[]; } } diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m index 4d2f580c..c027d339 100644 --- a/Source/SPTableStructureDelegate.m +++ b/Source/SPTableStructureDelegate.m @@ -74,7 +74,7 @@ else { // If the structure has loaded (not still loading!) and the table encoding // is set, use the appropriate collations. - collations = ([tableDocumentInstance structureLoaded] && [tableDataInstance tableEncoding] != nil) ? [databaseDataInstance getDatabaseCollationsForEncoding:[tableDataInstance tableEncoding]] : [NSArray array]; + collations = ([tableDocumentInstance structureLoaded] && [tableDataInstance tableEncoding] != nil) ? [databaseDataInstance getDatabaseCollationsForEncoding:[tableDataInstance tableEncoding]] : @[]; } [[tableColumn dataCell] removeAllItems]; @@ -254,7 +254,7 @@ if (![self saveRowOnDeselect]) return NO; if ([rows count] == 1) { - [pboard declareTypes:[NSArray arrayWithObject:SPDefaultPasteboardDragType] owner:nil]; + [pboard declareTypes:@[SPDefaultPasteboardDragType] owner:nil]; [pboard setString:[[NSNumber numberWithInteger:[rows firstIndex]] stringValue] forType:SPDefaultPasteboardDragType]; return YES; diff --git a/Source/SPTableStructureLoading.m b/Source/SPTableStructureLoading.m index 4c4e8c37..5366d49e 100644 --- a/Source/SPTableStructureLoading.m +++ b/Source/SPTableStructureLoading.m @@ -335,8 +335,8 @@ if (!selectedTable) { [tableSourceView reloadData]; // Empty indexesController's fields and indices explicitly before reloading - [indexesController setFields:[NSArray array]]; - [indexesController setIndexes:[NSArray array]]; + [indexesController setFields:@[]]; + [indexesController setIndexes:@[]]; [indexesTableView reloadData]; return; diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 523a7ade..17c61faf 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -381,7 +381,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; NSMutableArray *sortedDbs = [NSMutableArray array]; - [sortedDbs addObjectsFromArray:[allDbs sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]]; + [sortedDbs addObjectsFromArray:[allDbs sortedArrayUsingDescriptors:@[desc]]]; NSString *currentDb = nil; NSString *currentTable = nil; @@ -478,7 +478,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS [sortedTables addObject:aTableName_id]; } else { [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:[[db componentsSeparatedByString:SPUniqueSchemaDelimiter] lastObject], @"display", @"database-small", @"image", @"", @"isRef", nil]]; - [sortedTables addObjectsFromArray:[allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]]; + [sortedTables addObjectsFromArray:[allTables sortedArrayUsingDescriptors:@[desc]]]; if([sortedTables count] > 1 && [sortedTables containsObject:[NSString stringWithFormat:@"%@%@%@", db, SPUniqueSchemaDelimiter, currentTable]]) { [sortedTables removeObject:[NSString stringWithFormat:@"%@%@%@", db, SPUniqueSchemaDelimiter, currentTable]]; [sortedTables insertObject:[NSString stringWithFormat:@"%@%@%@", db, SPUniqueSchemaDelimiter, currentTable] atIndex:0]; @@ -508,7 +508,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS break; } if(!breakFlag) { - NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:@[desc]]; for(id field in sortedFields) { if(![field hasPrefix:@" "]) { NSString *fieldpath = [field substringFromIndex:[field rangeOfString:SPUniqueSchemaDelimiter].location]; @@ -1127,7 +1127,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS if (rtf) { - [pb declareTypes:[NSArray arrayWithObject:NSRTFPboardType] owner:self]; + [pb declareTypes:@[NSRTFPboardType] owner:self]; [pb setData:rtf forType:NSRTFPboardType]; } } @@ -1414,7 +1414,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS // if(currentDb != nil && dbs != nil && [dbs count] && [dbs objectForKey:currentDb]) { // NSArray *allTables = [[dbs objectForKey:currentDb] allKeys]; // NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; - // NSArray *sortedTables = [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + // NSArray *sortedTables = [allTables sortedArrayUsingDescriptors:@[desc]]; // [desc release]; // for(id table in sortedTables) { // NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:table]; @@ -1431,7 +1431,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS // } else { arr = [NSArray arrayWithArray:[[(NSObject*)[self delegate] valueForKeyPath:@"tablesListInstance"] allTableAndViewNames]]; if(arr == nil) { - arr = [NSArray array]; + arr = @[]; } for(id w in arr) [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"table-small-square", @"image", @"", @"isRef", nil]]; @@ -1440,13 +1440,13 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS else if([kind isEqualToString:@"$SP_ASLIST_ALL_DATABASES"]) { arr = [NSArray arrayWithArray:[[(NSObject*)[self delegate] valueForKeyPath:@"tablesListInstance"] allDatabaseNames]]; if(arr == nil) { - arr = [NSArray array]; + arr = @[]; } for(id w in arr) [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; arr = [NSArray arrayWithArray:[[(NSObject*)[self delegate] valueForKeyPath:@"tablesListInstance"] allSystemDatabaseNames]]; if(arr == nil) { - arr = [NSArray array]; + arr = @[]; } for(id w in arr) [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"database-small", @"image", @"", @"isRef", nil]]; @@ -1466,7 +1466,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:currentTable]; NSArray *allFields = [theTable allKeys]; NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; - NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:@[desc]]; [desc release]; for(id field in sortedFields) { if(![field hasPrefix:@" "]) { @@ -1499,7 +1499,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS } else { arr = [NSArray arrayWithArray:[[tableDocumentInstance valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"]]; if(arr == nil) { - arr = [NSArray array]; + arr = @[]; } for(id w in arr) [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"field-small-square", @"image", @"", @"isRef", nil]]; diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 3fdcaa63..abfac606 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -135,7 +135,7 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; treeSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"displayName" ascending:YES]; - [self setTreeSortDescriptors:[NSArray arrayWithObject:treeSortDescriptor]]; + [self setTreeSortDescriptors:@[treeSortDescriptor]]; [super windowDidLoad]; } |