aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2014-12-13 19:48:41 +0100
committerMax <post@wickenrode.com>2014-12-13 19:48:41 +0100
commit3b251b8e3d4dc9a694ef76562b388ab07da54785 (patch)
tree8ce5a4c4c637bab883ed7e6667bff7b5b74adbc3 /Source/SPTableContent.m
parent876dde21d97897ad4ee98aa0d6b11898282982ce (diff)
downloadsequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.tar.gz
sequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.tar.bz2
sequelpro-3b251b8e3d4dc9a694ef76562b388ab07da54785.zip
Replace some NSDictionaries with literals
* [NSDictionary dictionary] → @{} * [NSDictionary dictionaryWithObject:forKey:] can safely be replaced. object==nil would have already thrown a NPE in the past. * Also replaced some (hopefully safe) NSArray initializers (ie. their objects should always exist).
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m18
1 files changed, 9 insertions, 9 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index ae49c772..67825671 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -568,7 +568,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
#else
NSFont *tableFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
#endif
- [tableContentView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [tableContentView setRowHeight:2.0f+NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height];
// Add the new columns to the table and filterTable
for ( i = 0 ; i < (NSInteger)[dataColumns count] ; i++ ) {
@@ -3333,7 +3333,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
NSDictionary *columnDefinition = [NSDictionary dictionaryWithDictionary:[cqColumnDefinition objectAtIndex:[[[[tableContentView tableColumns] objectAtIndex:columnIndex] identifier] integerValue]]];
if(!columnDefinition)
- return [NSArray arrayWithObjects:@(-2), @"", nil];
+ return @[@(-2), @""];
// Resolve the original table name for current column if AS was used
NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"];
@@ -3344,13 +3344,13 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
// No table/database name found indicates that the field's column contains data from more than one table as for UNION
// or the field data are not bound to any table as in SELECT 1 or if column database is unset
if(!tableForColumn || ![tableForColumn length] || !dbForColumn || ![dbForColumn length])
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
// if table and database name are given check if field can be identified unambiguously
// first without blob data
NSString *fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:NO];
if(!fieldIDQueryStr)
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
[tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Checking field data for editing...", @"checking field data for editing task description")];
@@ -3362,7 +3362,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
if ([mySQLConnection queryErrored]) {
[tableDocumentInstance endTask];
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
}
NSArray *tempRow = [tempResult getRowAsArray];
@@ -3372,7 +3372,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
fieldIDQueryStr = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"] includeBlobs:YES];
if(!fieldIDQueryStr) {
[tableDocumentInstance endTask];
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
}
tempResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@",
@@ -3382,14 +3382,14 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
if ([mySQLConnection queryErrored]) {
[tableDocumentInstance endTask];
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
}
tempRow = [tempResult getRowAsArray];
if([tempRow count] && [[tempRow objectAtIndex:0] integerValue] < 1) {
[tableDocumentInstance endTask];
- return [NSArray arrayWithObjects:@(-1), @"", nil];
+ return @[@(-1), @""];
}
}
@@ -4252,7 +4252,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
else if ([keyPath isEqualToString:SPGlobalResultTableFont]) {
NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]];
- [tableContentView setRowHeight:2.0f + NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height];
+ [tableContentView setRowHeight:2.0f + NSSizeToCGSize([@"{ǞṶḹÜ∑zgyf" sizeWithAttributes:@{NSFontAttributeName : tableFont}]).height];
[tableContentView setFont:tableFont];
[tableContentView reloadData];
}