diff options
-rw-r--r-- | Source/CMCopyTable.m | 5 | ||||
-rw-r--r-- | Source/CMTextView.m | 4 | ||||
-rw-r--r-- | Source/CustomQuery.m | 8 | ||||
-rw-r--r-- | Source/SPContentFilterManager.m | 1 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 2 | ||||
-rw-r--r-- | Source/SPQueryFavoriteManager.m | 3 | ||||
-rw-r--r-- | Source/SPTableData.m | 4 | ||||
-rw-r--r-- | Source/SPUserManager.m | 2 | ||||
-rw-r--r-- | Source/TableDocument.m | 8 | ||||
-rw-r--r-- | Source/TableDump.m | 1 | ||||
-rw-r--r-- | Source/TablesList.m | 12 |
11 files changed, 26 insertions, 24 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m index 159bcaf6..8893696d 100644 --- a/Source/CMCopyTable.m +++ b/Source/CMCopyTable.m @@ -256,8 +256,10 @@ int MENU_EDIT_COPY_AS_SQL = 2002; if (![[self delegate] isKindOfClass:[CustomQuery class]] && [rowData isSPNotLoaded]) { // Abort if there are no indices on this table or if there's no table name given. - if (![[tableInstance argumentForRow:rowIndex] length] || selectedTable == nil) + if (![[tableInstance argumentForRow:rowIndex] length] || selectedTable == nil) { + [columnMappings release]; return nil; + } //if we have indexes, use argumentForRow dbDataRow = [[mySQLConnection queryString: @@ -294,6 +296,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002; } break; default: + [columnMappings release]; return nil; } } diff --git a/Source/CMTextView.m b/Source/CMTextView.m index ed032400..ecc89e71 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -446,7 +446,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) // Start autoHelp timer if([prefs boolForKey:SPCustomQueryUpdateAutoHelp]) - [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] floatValue]]; + [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] floatValue]]; } @@ -461,7 +461,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) selector:@selector(autoHelp) object:nil]; [self performSelector:@selector(autoHelp) withObject:nil - afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] floatValue]]; + afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] floatValue]]; } long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask); diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 6a979509..0982e16f 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -107,7 +107,7 @@ - (IBAction)runSelectedQueries:(id)sender { NSArray *queries; - NSString *query; + NSString *query = nil; NSRange selectedRange = [textView selectedRange]; SPSQLParser *queryParser; @@ -726,7 +726,7 @@ // If no results were returned, redraw the empty table and post notifications before returning. if ( !fullResultCount ) { [customQueryView reloadData]; - [streamingResult release]; + if (streamingResult) [streamingResult release]; // Notify any listeners that the query has completed [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; @@ -753,11 +753,9 @@ // If more than one table name is found set resultTableName to nil. // resultTableName will be set to the original table name (not defined via AS) provided by mysql return // and the resultTableName can differ due to case-sensitive/insensitive settings!. - BOOL resultShowsColumnsFromOneTable = YES; NSString *resultTableName = [[cqColumnDefinition objectAtIndex:0] objectForKey:@"org_table"]; for(id field in cqColumnDefinition) { if(![[field objectForKey:@"org_table"] isEqualToString:resultTableName]) { - resultShowsColumnsFromOneTable = NO; resultTableName = nil; break; } @@ -2772,7 +2770,7 @@ [prefs setObject:favorites forKey:SPQueryFavorites]; } else { [[SPQueryController sharedQueryController] addFavorite:[NSMutableDictionary dictionaryWithObjects: - [NSArray arrayWithObjects:[queryFavoriteNameTextField stringValue], [queryToBeAddded mutableCopy], nil] + [NSArray arrayWithObjects:[queryFavoriteNameTextField stringValue], [[queryToBeAddded mutableCopy] autorelease], nil] forKeys:[NSArray arrayWithObjects:@"name", @"query", nil]] forFileURL:[tableDocumentInstance fileURL]]; } diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index 7af9f6bc..540000ab 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -762,6 +762,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; + if (spf) [spf release]; return; } diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index e47a128a..378bec77 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -195,7 +195,7 @@ NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@"foo"] autorelease]; // - [column setDataCell:[ImageAndTextCell new]]; + [column setDataCell:[[ImageAndTextCell new] autorelease]]; [column setEditable:NO]; [theTableView addTableColumn:column]; [column setWidth:[theTableView bounds].size.width]; diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index a1b1a080..17818e87 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -728,6 +728,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; + if (spf) [spf release]; return; } @@ -745,6 +746,7 @@ // } [favoritesArrayController rearrangeObjects]; [favoritesTableView reloadData]; + [spf release]; } else { NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")] defaultButton:NSLocalizedString(@"OK", @"OK button") @@ -754,6 +756,7 @@ [alert setAlertStyle:NSInformationalAlertStyle]; [alert runModal]; + [spf release]; return; } } diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 6f7c6702..fb777b9d 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -809,6 +809,8 @@ */ - (NSDictionary *) parseFieldDefinitionStringParts:(NSArray *)definitionParts { + if (![definitionParts count]) return [NSDictionary dictionary]; + SPSQLParser *detailParser; SPSQLParser *fieldParser = [[SPSQLParser alloc] init]; NSMutableDictionary *fieldDetails = [[NSMutableDictionary alloc] init]; @@ -816,8 +818,6 @@ NSString *detailString; int i, definitionPartsIndex = 0, partsArrayLength; - if (![definitionParts count]) return [NSDictionary dictionary]; - // Skip blank items within the definition parts while (definitionPartsIndex < [definitionParts count] && ![[[definitionParts objectAtIndex:definitionPartsIndex] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]) diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 067508c8..811e353e 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -376,7 +376,7 @@ - (NSArray *)treeSortDescriptors { - NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"displayName" ascending:YES]; + NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"displayName" ascending:YES] autorelease]; return [NSArray arrayWithObject:descriptor]; } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index e8ad22bf..284d1b62 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -295,6 +295,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; + if (spf) [spf release]; [self close]; return; } @@ -1703,7 +1704,7 @@ id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:colOffs]; if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]]; + tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; [createTableSyntaxTextField setStringValue:[NSString stringWithFormat:@"Create syntax for %@ '%@'", typeString, [self table]]]; @@ -2549,6 +2550,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; + if (spf) [spf release]; // [self close]; return NO; } @@ -3451,7 +3453,7 @@ { if(saveOperation == NSSaveOperation) { // Dummy error to avoid crashes after Canceling the Save Panel - *outError = [NSError errorWithDomain:@"SP_DOMAIN" code:1000 userInfo:nil]; + if (outError) *outError = [NSError errorWithDomain:@"SP_DOMAIN" code:1000 userInfo:nil]; [self saveConnectionSheet:nil]; return NO; } @@ -3600,7 +3602,7 @@ if ([theValue isKindOfClass:[NSData class]]) { theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]]; if (theValue == nil) { - [[NSString alloc] initWithData:theValue encoding:NSASCIIStringEncoding]; + theValue = [[NSString alloc] initWithData:theValue encoding:NSASCIIStringEncoding]; } if (theValue) [theValue autorelease]; diff --git a/Source/TableDump.m b/Source/TableDump.m index 98feeedb..de782dd6 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -2709,6 +2709,7 @@ else if ([lineEndingString isEqualToString:@"CRLF"]) [importLinesTerminatedField setStringValue:@"\\r\\n"]; } } + if (fileCheckOutput) [fileCheckOutput release]; [fileTask release]; [filePipe release]; diff --git a/Source/TablesList.m b/Source/TablesList.m index 8ca98f9a..6d60faed 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -63,11 +63,8 @@ NSArray *resultRow; int i; NSString *previousSelectedTable = nil; - NSInteger selectedRowIndex; BOOL previousTableListIsSelectable = tableListIsSelectable; - - selectedRowIndex = [tablesListView selectedRow]; - + if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName]; if (isTableListFiltered) { if (filteredTables) [filteredTables release]; @@ -2050,13 +2047,11 @@ id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]]; + tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; // replace the old name by the new one and drop the old one [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]]; - [tableSyntax release]; - if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't duplicate '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), [copyTableNameField stringValue], [mySQLConnection getLastErrorMessage]]); @@ -2182,7 +2177,7 @@ id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]]; + tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; NSString *tableType; @@ -2203,7 +2198,6 @@ // replace the old name by the new one and drop the old one [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[tableRenameField stringValue] backtickQuotedString]]]; - [tableSyntax release]; if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { if ([mySQLConnection isConnected]) { [mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[self tableName] backtickQuotedString]]]; |