aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-10-04 04:18:32 +0200
committerMax <post@wickenrode.com>2015-10-04 04:18:32 +0200
commitcd3ebbe91342860da332eef7c744b143b3094bbf (patch)
treead114f1e6c54177da7fa516d72f02b60d34130dd
parent5239e6df5961a475e9497d30a33f48bfd99e8e5b (diff)
downloadsequelpro-cd3ebbe91342860da332eef7c744b143b3094bbf.tar.gz
sequelpro-cd3ebbe91342860da332eef7c744b143b3094bbf.tar.bz2
sequelpro-cd3ebbe91342860da332eef7c744b143b3094bbf.zip
Replace some for for() loops with FastEnumeration where i is not needed
Also has the advantage of causing an exception on concurrent modification
-rw-r--r--Source/SPTableContent.m17
1 files changed, 5 insertions, 12 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 2b185bca..6b0065dd 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -372,12 +372,11 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
- (void) setTableDetails:(NSDictionary *)tableDetails
{
NSString *newTableName;
- NSInteger i, sortColumnNumberToRestore = NSNotFound;
+ NSInteger sortColumnNumberToRestore = NSNotFound;
#ifndef SP_CODA
NSNumber *colWidth;
#endif
NSArray *columnNames;
- NSDictionary *columnDefinition;
NSMutableDictionary *preservedColumnWidths = nil;
NSTableColumn *theCol;
#ifndef SP_CODA
@@ -566,8 +565,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
[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++ ) {
- columnDefinition = NSArrayObjectAtIndex(dataColumns, i);
+ for (NSDictionary *columnDefinition in dataColumns ) {
// Set up the column
theCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"datacolumnindex"]];
@@ -1810,9 +1808,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
*/
- (IBAction)addRow:(id)sender
{
- NSMutableDictionary *column;
NSMutableArray *newRow = [NSMutableArray array];
- NSUInteger i;
// Check whether table editing is permitted (necessary as some actions - eg table double-click - bypass validation)
if ([tableDocumentInstance isWorking] || [tablesListInstance tableType] != SPTableTypeTable) return;
@@ -1820,8 +1816,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
// Check whether a save of the current row is required.
if ( ![self saveRowOnDeselect] ) return;
- for ( i = 0 ; i < [dataColumns count] ; i++ ) {
- column = NSArrayObjectAtIndex(dataColumns, i);
+ for (NSDictionary *column in dataColumns) {
if ([column objectForKey:@"default"] == nil || [[column objectForKey:@"default"] isNSNull]) {
[newRow addObject:[NSNull null]];
} else if ([[column objectForKey:@"default"] isEqualToString:@""]
@@ -3146,10 +3141,8 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper
*/
- (BOOL)tableContainsBlobOrTextColumns
{
- NSUInteger i;
-
- for ( i = 0 ; i < [dataColumns count]; i++ ) {
- if ( [tableDataInstance columnIsBlobOrText:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"name"]] ) {
+ for (NSDictionary *column in dataColumns) {
+ if ( [tableDataInstance columnIsBlobOrText:[column objectForKey:@"name"]] ) {
return YES;
}
}