aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-03-15 16:40:48 +0000
committerstuconnolly <stuart02@gmail.com>2010-03-15 16:40:48 +0000
commit4645fcac921c8ec01b1a07e460fdb538ed4c671b (patch)
tree36ebd96cbae83e5e4a6a09d443b6b50e031b5a6f
parent5a6d0f17bbf6b09463b908182dc2cbb112a0c6cb (diff)
downloadsequelpro-4645fcac921c8ec01b1a07e460fdb538ed4c671b.tar.gz
sequelpro-4645fcac921c8ec01b1a07e460fdb538ed4c671b.tar.bz2
sequelpro-4645fcac921c8ec01b1a07e460fdb538ed4c671b.zip
Fix some potential issues found during static analysis.
-rw-r--r--Source/SPExportController.m2
-rw-r--r--Source/SPPrintController.m26
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/TableDocument.m2
-rw-r--r--Source/TablesList.m2
5 files changed, 24 insertions, 10 deletions
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 4a0e78ee..c1e72b8a 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -352,7 +352,7 @@
NSMutableString *errors = [NSMutableString string];
- NSDictionary *tableDetails;
+ NSDictionary *tableDetails = nil;
//NSStringEncoding encoding = [[self connection] encoding];
// Reset the interface
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index f842aa04..f83f3625 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -155,6 +155,7 @@
NSString *heading = @"";
NSArray *rows, *indexes, *indexColumns = nil;
+
NSArray *columns = [self columnNames];
NSMutableDictionary *printData = [NSMutableDictionary dictionary];
@@ -178,10 +179,12 @@
indexColumns = [[tableSource objectForKey:@"indexes"] objectAtIndex:0];
+ [printData setObject:rows forKey:@"rows"];
[printData setObject:indexes forKey:@"indexes"];
[printData setObject:indexColumns forKey:@"indexColumns"];
- if (indexes) [indexes release];
+ [rows release];
+ [indexes release];
}
// Table content view
else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1) {
@@ -195,7 +198,10 @@
[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, [data count] - 1)]]
];
+ [printData setObject:rows forKey:@"rows"];
[connection setValue:[tableContentInstance usedQuery] forKey:@"query"];
+
+ [rows release];
}
// Custom query view
else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2) {
@@ -209,7 +215,10 @@
[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, [data count] - 1)]]
];
+ [printData setObject:rows forKey:@"rows"];
[connection setValue:[customQueryInstance usedQuery] forKey:@"query"];
+
+ [rows release];
}
// Table relations view
else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 4) {
@@ -222,6 +231,10 @@
[data objectsAtIndexes:
[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, ([data count] - 1))]]
];
+
+ [printData setObject:rows forKey:@"rows"];
+
+ [rows release];
}
// Table triggers view
else if ([tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 5) {
@@ -233,18 +246,19 @@
rows = [[NSArray alloc] initWithArray:
[data objectsAtIndexes:
[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(1, ([data count] - 1))]]
- ];
- }
+ ];
+
+ [printData setObject:rows forKey:@"rows"];
+ [rows release];
+ }
+
[engine setObject:connection forKey:@"c"];
[printData setObject:heading forKey:@"heading"];
[printData setObject:columns forKey:@"columns"];
- [printData setObject:rows forKey:@"rows"];
[printData setObject:([prefs boolForKey:SPUseMonospacedFonts]) ? SPDefaultMonospacedFontName : @"Lucida Grande" forKey:@"font"];
[printData setObject:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? @"1px solid #CCCCCC" : @"none" forKey:@"gridlines"];
-
- if (rows) [rows release];
NSString *HTMLString = [engine processTemplateInFileAtPath:[[NSBundle mainBundle] pathForResource:SPHTMLPrintTemplate ofType:@"html"] withVariables:printData];
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 459406fc..f7450e62 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -797,7 +797,7 @@
NSMutableString *escapedTableName = [NSMutableString stringWithString:[tableListInstance tableName]];
[escapedTableName replaceOccurrencesOfString:@"'" withString:@"\\\'" options:0 range:NSMakeRange(0, [escapedTableName length])];
- MCPResult *tableStatusResult;
+ MCPResult *tableStatusResult = nil;
if ([tableListInstance tableType] == SP_TABLETYPE_PROC) {
NSMutableString *escapedDatabaseName = [NSMutableString stringWithString:[tableDocumentInstance database]];
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 2d75a8d9..36ad7be8 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1067,7 +1067,7 @@
*/
- (void)refreshCurrentDatabase
{
- NSString *dbName;
+ NSString *dbName = nil;
// Notify listeners that a query has started
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 9162c69b..fdd1b029 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -2025,7 +2025,7 @@
*/
- (void)copyTable
{
- NSString *tableType;
+ NSString *tableType = @"";
if ([[copyTableNameField stringValue] isEqualToString:@""]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));