diff options
author | stuconnolly <stuart02@gmail.com> | 2012-05-09 15:19:40 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-05-09 15:19:40 +0000 |
commit | afbd3852fa962b3b4399b83ba33295c7621d04a8 (patch) | |
tree | 85644bdcb5091955483e67e88308e5c535bb6248 /Source | |
parent | 9131db394c46f10260fcec1a1df5216b140e2bc2 (diff) | |
download | sequelpro-afbd3852fa962b3b4399b83ba33295c7621d04a8.tar.gz sequelpro-afbd3852fa962b3b4399b83ba33295c7621d04a8.tar.bz2 sequelpro-afbd3852fa962b3b4399b83ba33295c7621d04a8.zip |
Fix more gcc warnings.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPAppController.m | 4 | ||||
-rw-r--r-- | Source/SPCSVExporter.m | 9 | ||||
-rw-r--r-- | Source/SPDotExporter.m | 2 | ||||
-rw-r--r-- | Source/SPFavoritesController.m | 1 | ||||
-rw-r--r-- | Source/SPGrowlController.m | 4 | ||||
-rw-r--r-- | Source/SPNarrowDownCompletion.m | 28 | ||||
-rw-r--r-- | Source/SPPreferenceController.m | 14 | ||||
-rw-r--r-- | Source/SPPreferencesUpgrade.m | 2 | ||||
-rw-r--r-- | Source/SPQueryController.h | 10 | ||||
-rw-r--r-- | Source/SPQueryController.m | 6 | ||||
-rw-r--r-- | Source/SPXMLExporter.m | 13 |
11 files changed, 51 insertions, 42 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 2c03ddf4..87a97f19 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -1671,11 +1671,13 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSData *dData = [NSData dataWithContentsOfFile:duplicatedBundleCommand options:NSUncachedRead error:&readError1]; [dupData setDictionary:[NSPropertyListSerialization propertyListFromData:dData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError1]]; - if(!dupData && ![dupData count] || readError1 != nil || [convError1 length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { + + if ((!dupData && ![dupData count]) || (readError1 != nil || [convError1 length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0))) { NSLog(@"“%@” file couldn't be read.", duplicatedBundleCommand); NSBeep(); continue; } + [dupData setObject:[NSString stringWithNewUUID] forKey:SPBundleFileUUIDKey]; NSString *orgName = [dupData objectForKey:SPBundleFileNameKey]; [dupData setObject:[NSString stringWithFormat:@"%@ (user)", orgName] forKey:SPBundleFileNameKey]; diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m index 4bf6c651..93b80256 100644 --- a/Source/SPCSVExporter.m +++ b/Source/SPCSVExporter.m @@ -83,11 +83,12 @@ BOOL csvCellIsNumeric; BOOL quoteFieldSeparators = [[self csvEnclosingCharacterString] isEqualToString:@""]; - NSUInteger i, totalRows, lastProgressValue, csvCellCount = 0; + double lastProgressValue; + NSUInteger i, totalRows, csvCellCount = 0; // Check to see if we have at least a table name or data array - if ((![self csvTableName]) && (![self csvDataArray]) || - ([[self csvTableName] isEqualToString:@""]) && ([[self csvDataArray] count] == 0)) + if ((![self csvTableName] && ![self csvDataArray]) || + ([[self csvTableName] isEqualToString:@""] && [[self csvDataArray] count] == 0)) { [pool release]; return; @@ -371,7 +372,7 @@ // Update the progress if (totalRows && (currentRowIndex * ([self exportMaxProgress] / totalRows)) > lastProgressValue) { - NSInteger progress = (currentRowIndex * ([self exportMaxProgress] / totalRows)); + double progress = (currentRowIndex * ([self exportMaxProgress] / totalRows)); [self setExportProgressValue:progress]; diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m index cd00b61f..856218d8 100644 --- a/Source/SPDotExporter.m +++ b/Source/SPDotExporter.m @@ -184,7 +184,7 @@ } // Update progress - NSInteger progress = (i * ([self exportMaxProgress] / [[self dotExportTables] count])); + double progress = (i * ([self exportMaxProgress] / [[self dotExportTables] count])); [self setExportProgressValue:progress]; [delegate performSelectorOnMainThread:@selector(dotExportProcessProgressUpdated:) withObject:self waitUntilDone:NO]; diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m index 1dee4a2b..f49749c8 100644 --- a/Source/SPFavoritesController.m +++ b/Source/SPFavoritesController.m @@ -55,6 +55,7 @@ static SPFavoritesController *sharedFavoritesController = nil; @synchronized(self) { return [[self sharedFavoritesController] retain]; } + return nil; } diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index 3fc27f64..7c352b9f 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -53,7 +53,9 @@ static SPGrowlController *sharedGrowlController = nil; { @synchronized(self) { return [[self sharedGrowlController] retain]; - } + } + + return nil; } - (id)init diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index 76336069..ad4be13a 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -318,21 +318,21 @@ { caretPos = aPos; - NSRect mainScreen = [self rectOfMainScreen]; + NSRect screen = [self rectOfMainScreen]; - NSInteger offx = (caretPos.x/mainScreen.size.width) + 1; + NSInteger offx = (caretPos.x/screen.size.width) + 1; - if((caretPos.x + [self frame].size.width) > (mainScreen.size.width*offx)) - caretPos.x = (mainScreen.size.width*offx) - [self frame].size.width - 5; + if((caretPos.x + [self frame].size.width) > (screen.size.width*offx)) + caretPos.x = (screen.size.width*offx) - [self frame].size.width - 5; if(caretPos.y >= 0 && caretPos.y < [self frame].size.height) { - caretPos.y += [self frame].size.height + ([tableFont pointSize]*1.5); + caretPos.y += [self frame].size.height + ([tableFont pointSize]*1.5f); isAbove = YES; } - if(caretPos.y < 0 && (mainScreen.size.height-[self frame].size.height) < (caretPos.y*-1)) + if(caretPos.y < 0 && (screen.size.height-[self frame].size.height) < (caretPos.y*-1)) { - caretPos.y += [self frame].size.height + ([tableFont pointSize]*1.5); + caretPos.y += [self frame].size.height + ([tableFont pointSize]*1.5f); isAbove = YES; } @@ -345,7 +345,7 @@ [self setLevel:NSNormalWindowLevel]; [self setHidesOnDeactivate:YES]; [self setHasShadow:YES]; - [self setAlphaValue:0.9]; + [self setAlphaValue:0.9f]; NSScrollView* scrollView = [[[NSScrollView alloc] initWithFrame:NSZeroRect] autorelease]; [scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; @@ -731,10 +731,10 @@ if(caretPos.y >= 0 && (isAbove || caretPos.y < newHeight)) { isAbove = YES; - old.y = caretPos.y + newHeight + ([tableFont pointSize]*1.5); + old.y = caretPos.y + newHeight + ([tableFont pointSize]*1.5f); } if(caretPos.y < 0 && (isAbove || ([self rectOfMainScreen].size.height-newHeight) < (caretPos.y*-1))) - old.y = caretPos.y + newHeight + ([tableFont pointSize]*1.5); + old.y = caretPos.y + newHeight + ([tableFont pointSize]*1.5f); // newHeight is currently the new height for theTableView, but we need to resize the whole window // so here we use the difference in height to find the new height for the window @@ -759,16 +759,16 @@ - (NSRect)rectOfMainScreen { - NSRect mainScreen = [[NSScreen mainScreen] frame]; + NSRect screen = [[NSScreen mainScreen] frame]; for (NSScreen *candidate in [NSScreen screens]) { if (NSMinX([candidate frame]) == 0.0f && NSMinY([candidate frame]) == 0.0f) { - mainScreen = [candidate frame]; + screen = [candidate frame]; } } - return mainScreen; + return screen; } // ============================= @@ -983,7 +983,7 @@ // Restore the text selection location, and clearly mark the autosuggested text [theView setSelectedRange:NSMakeRange(currentSelectionPosition, 0)]; - NSMutableAttributedStringAddAttributeValueRange([theView textStorage], NSForegroundColorAttributeName, [[theView otherTextColor] colorWithAlphaComponent:0.3], NSMakeRange(currentSelectionPosition, [toInsert length])); + NSMutableAttributedStringAddAttributeValueRange([theView textStorage], NSForegroundColorAttributeName, [[theView otherTextColor] colorWithAlphaComponent:0.3f], NSMakeRange(currentSelectionPosition, [toInsert length])); NSMutableAttributedStringAddAttributeValueRange([theView textStorage], kSPAutoCompletePlaceholderName, kSPAutoCompletePlaceholderVal, NSMakeRange(currentSelectionPosition, [toInsert length])); [self checkSpaceForAllowedCharacter]; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 01d39e25..78cb0b9b 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -71,7 +71,7 @@ { [self _setupToolbar]; - [generalPreferencePane updateDefaultFavoritePopup]; + [(SPGeneralPreferencePane *)generalPreferencePane updateDefaultFavoritePopup]; preferencePanes = [[NSArray alloc] initWithObjects: generalPreferencePane, @@ -121,7 +121,7 @@ [toolbar setSelectedItemIdentifier:[tablesPreferencePane preferencePaneIdentifier]]; - [tablesPreferencePane updateDisplayedTableFontName]; + [(SPTablesPreferencePane *)tablesPreferencePane updateDisplayedTableFontName]; [self _resizeWindowForContentView:[tablesPreferencePane preferencePaneView]]; } @@ -131,15 +131,15 @@ */ - (IBAction)displayEditorPreferences:(id)sender { - [editorPreferencePane updateColorSchemeSelectionMenu]; - [editorPreferencePane updateDisplayColorThemeName]; + [(SPEditorPreferencePane *)editorPreferencePane updateColorSchemeSelectionMenu]; + [(SPEditorPreferencePane *)editorPreferencePane updateDisplayColorThemeName]; [[self window] setMinSize:NSMakeSize(0, 0)]; [[self window] setShowsResizeIndicator:[editorPreferencePane preferencePaneAllowsResizing]]; [toolbar setSelectedItemIdentifier:[editorPreferencePane preferencePaneIdentifier]]; - [editorPreferencePane updateDisplayedEditorFontName]; + [(SPEditorPreferencePane *)editorPreferencePane updateDisplayedEditorFontName]; [self _resizeWindowForContentView:[editorPreferencePane preferencePaneView]]; } @@ -164,14 +164,14 @@ [prefs setObject:[NSArchiver archivedDataWithRootObject:font] forKey:SPGlobalResultTableFont]; - [tablesPreferencePane updateDisplayedTableFontName]; + [(SPTablesPreferencePane *)tablesPreferencePane updateDisplayedTableFontName]; break; case 2: font = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]]; [prefs setObject:[NSArchiver archivedDataWithRootObject:font] forKey:SPCustomQueryEditorFont]; - [editorPreferencePane updateDisplayedEditorFontName]; + [(SPEditorPreferencePane *)editorPreferencePane updateDisplayedEditorFontName]; break; } } diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m index 5eb7409f..ac25b6b3 100644 --- a/Source/SPPreferencesUpgrade.m +++ b/Source/SPPreferencesUpgrade.m @@ -67,7 +67,7 @@ void SPApplyRevisionChanges(void) NSEnumerator *databaseEnumerator, *tableEnumerator, *columnEnumerator; NSString *databaseKey, *tableKey, *columnKey; NSMutableDictionary *newDatabase, *newTable; - CGFloat columnWidth; + double columnWidth; NSMutableDictionary *newTableColumnWidths = [[NSMutableDictionary alloc] init]; databaseEnumerator = [[prefs objectForKey:SPTableColumnWidths] keyEnumerator]; diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h index 8ac4570d..5b248684 100644 --- a/Source/SPQueryController.h +++ b/Source/SPQueryController.h @@ -23,12 +23,10 @@ // // More info at <http://code.google.com/p/sequel-pro/> -#ifndef SP_REFACTOR -static NSString *SPQueryConsoleWindowAutoSaveName = @"QueryConsole"; - -// Table view column identifier constants -static NSString *SPTableViewDateColumnID = @"messageDate"; -static NSString *SPTableViewConnectionColumnID = @"messageConnection"; +#ifndef SP_REFACTOR /* constants */ +extern NSString *SPQueryConsoleWindowAutoSaveName; +extern NSString *SPTableViewDateColumnID; +extern NSString *SPTableViewConnectionColumnID; #endif @interface SPQueryController : NSWindowController diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 8a2a5902..78609dbb 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -30,6 +30,12 @@ #import "pthread.h" +#ifndef SP_REFACTOR +NSString *SPQueryConsoleWindowAutoSaveName = @"QueryConsole"; +NSString *SPTableViewDateColumnID = @"messageDate"; +NSString *SPTableViewConnectionColumnID = @"messageConnection"; +#endif + @interface SPQueryController () - (void)_updateFilterState; diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 1fc29c6f..36f56081 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -81,11 +81,12 @@ NSMutableString *xmlItem = [NSMutableString string]; NSUInteger xmlRowCount = 0; - NSUInteger i, totalRows, currentRowIndex, lastProgressValue, currentPoolDataLength; + double lastProgressValue = 0; + NSUInteger i, totalRows, currentRowIndex, currentPoolDataLength; // Check to see if we have at least a table name or data array - if ((![self xmlTableName]) && (![self xmlDataArray]) || - ([[self xmlTableName] length] == 0) && ([[self xmlDataArray] count] == 0) || + if ((![self xmlTableName] && ![self xmlDataArray]) || + ([[self xmlTableName] length] == 0 && [[self xmlDataArray] count] == 0) || (([self xmlFormat] == SPXMLExportMySQLFormat) && ((![self xmlOutputIncludeStructure]) && (![self xmlOutputIncludeContent]))) || (([self xmlFormat] == SPXMLExportPlainFormat) && (![self xmlNULLString]))) { @@ -98,9 +99,7 @@ // Mark the process as running [self setExportProcessIsRunning:YES]; - - lastProgressValue = 0; - + // Make a streaming request for the data if the data array isn't set if ((![self xmlDataArray]) && [self xmlTableName]) { @@ -307,7 +306,7 @@ // Update the progress if (totalRows && (currentRowIndex * ([self exportMaxProgress] / totalRows)) > lastProgressValue) { - NSInteger progress = (currentRowIndex * ([self exportMaxProgress] / totalRows)); + double progress = (currentRowIndex * ([self exportMaxProgress] / totalRows)); [self setExportProgressValue:progress]; |