From 64919b03fa59c8d93c81a8e3893934c04a3cac91 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Tue, 1 Mar 2011 21:09:08 +0000 Subject: Fix compiler warnings. --- Frameworks/PSMTabBar/PSMOverflowPopUpButton.m | 2 +- Frameworks/PSMTabBar/PSMTabBarCell.m | 2 +- Source/SPAppController.m | 129 ++++++++++++-------------- Source/SPArrayAdditions.h | 2 +- Source/SPCustomQuery.m | 8 +- Source/SPDataCellFormatter.h | 4 +- Source/SPDataCellFormatter.m | 7 ++ Source/SPDatabaseDocument.m | 8 +- Source/SPPreferenceController.h | 14 +-- Source/SPPreferenceController.m | 4 +- Source/SPTableData.h | 1 - Source/SPTableData.m | 2 + sequel-pro.xcodeproj/project.pbxproj | 6 +- 13 files changed, 98 insertions(+), 91 deletions(-) diff --git a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m index cc96b910..bef8b4ff 100644 --- a/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m +++ b/Frameworks/PSMTabBar/PSMOverflowPopUpButton.m @@ -16,7 +16,7 @@ - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag { - if (self = [super initWithFrame:frameRect pullsDown:YES]) { + if ((self = [super initWithFrame:frameRect pullsDown:YES])) { [self setBezelStyle:NSRegularSquareBezelStyle]; [self setBordered:NO]; [self setTitle:@""]; diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.m b/Frameworks/PSMTabBar/PSMTabBarCell.m index 7ecaa183..5d585359 100644 --- a/Frameworks/PSMTabBar/PSMTabBarCell.m +++ b/Frameworks/PSMTabBar/PSMTabBarCell.m @@ -348,7 +348,7 @@ { if (_isPlaceholder) { if (![_controlView usesSafariStyleDragging]) { - [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; + [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2f] set]; NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop); } return; diff --git a/Source/SPAppController.m b/Source/SPAppController.m index f7514928..c0209fca 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -838,84 +838,77 @@ YY_BUFFER_STATE yy_scan_string (const char *); */ - (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike { + NSMutableString *sqlHTML = [[[NSMutableString alloc] initWithCapacity:[sqlText length]] autorelease]; + + NSString *tokenColor; + NSString *cssId; + size_t token; + NSRange tokenRange; + + // initialise flex + yyuoffset = 0; yyuleng = 0; + yy_switch_to_buffer(yy_scan_string([sqlText UTF8String])); + BOOL skipFontTag; + + while ((token=yylex())) { + skipFontTag = NO; + switch (token) { + case SPT_SINGLE_QUOTED_TEXT: + case SPT_DOUBLE_QUOTED_TEXT: + tokenColor = @"#A7221C"; + cssId = @"sp_sql_quoted"; + break; + case SPT_BACKTICK_QUOTED_TEXT: + tokenColor = @"#001892"; + cssId = @"sp_sql_backtick"; + break; + case SPT_RESERVED_WORD: + tokenColor = @"#0041F6"; + cssId = @"sp_sql_keyword"; + break; + case SPT_NUMERIC: + tokenColor = @"#67350F"; + cssId = @"sp_sql_numeric"; + break; + case SPT_COMMENT: + tokenColor = @"#265C10"; + cssId = @"sp_sql_comment"; + break; + case SPT_VARIABLE: + tokenColor = @"#6C6C6C"; + cssId = @"sp_sql_variable"; + break; + case SPT_WHITESPACE: + skipFontTag = YES; + cssId = @""; + break; + default: + skipFontTag = YES; + cssId = @""; + } - NSMutableString *sqlHTML = [[[NSMutableString alloc] initWithCapacity:[sqlText length]] autorelease]; - - NSRange textRange = NSMakeRange(0, [sqlText length]); - NSString *tokenColor; - NSString *cssId; - size_t token; - NSRange tokenRange; - - // initialise flex - yyuoffset = 0; yyuleng = 0; - yy_switch_to_buffer(yy_scan_string([sqlText UTF8String])); - BOOL skipFontTag; - - while (token=yylex()){ - skipFontTag = NO; - switch (token) { - case SPT_SINGLE_QUOTED_TEXT: - case SPT_DOUBLE_QUOTED_TEXT: - tokenColor = @"#A7221C"; - cssId = @"sp_sql_quoted"; - break; - case SPT_BACKTICK_QUOTED_TEXT: - tokenColor = @"#001892"; - cssId = @"sp_sql_backtick"; - break; - case SPT_RESERVED_WORD: - tokenColor = @"#0041F6"; - cssId = @"sp_sql_keyword"; - break; - case SPT_NUMERIC: - tokenColor = @"#67350F"; - cssId = @"sp_sql_numeric"; - break; - case SPT_COMMENT: - tokenColor = @"#265C10"; - cssId = @"sp_sql_comment"; - break; - case SPT_VARIABLE: - tokenColor = @"#6C6C6C"; - cssId = @"sp_sql_variable"; - break; - case SPT_WHITESPACE: - skipFontTag = YES; - cssId = @""; - break; - default: - skipFontTag = YES; - cssId = @""; - } - - tokenRange = NSMakeRange(yyuoffset, yyuleng); - - if(skipFontTag) - [sqlHTML appendString:[[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; - else { - if(cssLike) - [sqlHTML appendFormat:@"%@", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; - else - [sqlHTML appendFormat:@"%@", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; - } + tokenRange = NSMakeRange(yyuoffset, yyuleng); + if(skipFontTag) + [sqlHTML appendString:[[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; + else { + if(cssLike) + [sqlHTML appendFormat:@"%@", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; + else + [sqlHTML appendFormat:@"%@", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]]; } - // Wrap lines, and replace tabs with spaces - [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"
" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])]; - [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"    " options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])]; + } - if(sqlHTML) - return sqlHTML; - else - return @""; + // Wrap lines, and replace tabs with spaces + [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"
" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])]; + [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"    " options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])]; + return (sqlHTML) ? sqlHTML : @""; } - (IBAction)executeBundleItemForApp:(id)sender { - NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeGeneral]; diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h index 206f15f8..e08bfa33 100644 --- a/Source/SPArrayAdditions.h +++ b/Source/SPArrayAdditions.h @@ -24,7 +24,7 @@ static inline id NSArrayObjectAtIndex(NSArray *self, NSUInteger i) { - return (id)CFArrayGetValueAtIndex((CFArrayRef)self, i); + return (id)CFArrayGetValueAtIndex((CFArrayRef)self, (long)i); } static inline void NSMutableArrayAddObject(NSArray *self, id anObject) diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 26625e8b..c3e83ff4 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -167,7 +167,7 @@ // If carriage returns were found, normalise the queries if ([queryParser containsCarriageReturns]) { NSMutableArray *normalisedQueries = [NSMutableArray arrayWithCapacity:[queries count]]; - for (NSString *query in queries) { + for (query in queries) { [normalisedQueries addObject:[SPSQLParser normaliseQueryForExecution:query]]; } queries = normalisedQueries; @@ -893,7 +893,7 @@ dataLoadingPool = [[NSAutoreleasePool alloc] init]; // Loop through the result rows as they become available - while (tempRow = [theResult fetchNextRowAsArray]) { + while ((tempRow = [theResult fetchNextRowAsArray])) { pthread_mutex_lock(&resultDataLock); SPDataStorageAddRow(resultData, tempRow); @@ -3158,9 +3158,11 @@ // Remove all needless default menu items NSEnumerator *itemEnumerator = [defaultMenuItems objectEnumerator]; NSMenuItem *menuItem = nil; - while (menuItem = [itemEnumerator nextObject]) + + while ((menuItem = [itemEnumerator nextObject])) { NSInteger tag = [menuItem tag]; + switch (tag) { case 2000: // WebMenuItemTagOpenLink diff --git a/Source/SPDataCellFormatter.h b/Source/SPDataCellFormatter.h index a2ba23b1..c5d9cd99 100644 --- a/Source/SPDataCellFormatter.h +++ b/Source/SPDataCellFormatter.h @@ -29,7 +29,7 @@ NSString *fieldType; } -@property NSInteger textLimit; -@property NSString* fieldType; +@property(readwrite, assign) NSInteger textLimit; +@property(readwrite, retain) NSString* fieldType; @end diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m index 515bf2a7..0180227b 100644 --- a/Source/SPDataCellFormatter.m +++ b/Source/SPDataCellFormatter.m @@ -91,4 +91,11 @@ return YES; } +- (void)dealloc +{ + if (fieldType) [fieldType release], fieldType = nil; + + [super dealloc]; +} + @end diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 93db6810..c2974353 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2789,15 +2789,19 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; - return NO; + + return; } NSError *error = nil; + [plist writeToFile:[NSString stringWithFormat:@"%@/info.plist", fileName] options:NSAtomicWrite error:&error]; + if(error != nil){ NSAlert *errorAlert = [NSAlert alertWithError:error]; [errorAlert runModal]; - return NO; + + return; } [[NSApp delegate] setSessionURL:fileName]; diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h index 575881af..eb5968ab 100644 --- a/Source/SPPreferenceController.h +++ b/Source/SPPreferenceController.h @@ -43,13 +43,13 @@ @interface SPPreferenceController : NSWindowController { // Preference pane controllers - IBOutlet SPGeneralPreferencePane *generalPreferencePane; - IBOutlet SPTablesPreferencePane *tablesPreferencePane; - IBOutlet SPFavoritesPreferencePane *favoritesPreferencePane; - IBOutlet SPNotificationsPreferencePane *notificationsPreferencePane; - IBOutlet SPEditorPreferencePane *editorPreferencePane; - IBOutlet SPAutoUpdatePreferencePane *autoUpdatePreferencePane; - IBOutlet SPNetworkPreferencePane *networkPreferencePane; + IBOutlet SPGeneralPreferencePane *generalPreferencePane; + IBOutlet SPTablesPreferencePane *tablesPreferencePane; + IBOutlet SPFavoritesPreferencePane *favoritesPreferencePane; + IBOutlet SPNotificationsPreferencePane *notificationsPreferencePane; + IBOutlet SPEditorPreferencePane *editorPreferencePane; + IBOutlet SPAutoUpdatePreferencePane *autoUpdatePreferencePane; + IBOutlet SPNetworkPreferencePane *networkPreferencePane; NSToolbar *toolbar; NSArray *preferencePanes; diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 3f7955c8..ed0d0ebe 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -90,13 +90,13 @@ - (IBAction)displayPreferencePane:(id)sender { - SPPreferencePane *preferencePane = nil; + SPPreferencePane *preferencePane = nil; if (!sender) { preferencePane = generalPreferencePane; } else { - for (SPPreferencePane *prefPane in preferencePanes) + for (SPPreferencePane *prefPane in preferencePanes) { if ([[prefPane preferencePaneIdentifier] isEqualToString:[sender itemIdentifier]]) { preferencePane = prefPane; diff --git a/Source/SPTableData.h b/Source/SPTableData.h index 4503bd03..1c3fa8f0 100644 --- a/Source/SPTableData.h +++ b/Source/SPTableData.h @@ -46,7 +46,6 @@ BOOL tableHasAutoIncrementField; } -@property (readwrite, assign) BOOL isWorking; @property (readonly, assign) BOOL tableHasAutoIncrementField; - (void) setConnection:(MCPConnection *)theConnection; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 7ae8f563..7180dc6a 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -32,7 +32,9 @@ #import "SPServerSupport.h" @interface SPTableData (PrivateAPI) + - (void)_loopWhileWorking; + @end @implementation SPTableData diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 28d15c47..5f003404 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -3873,7 +3873,7 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IBC_WARNINGS = YES; @@ -4198,7 +4198,7 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IBC_FLATTEN_NIBS = NO; @@ -4251,7 +4251,7 @@ GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_LABEL = YES; - GCC_WARN_UNUSED_PARAMETER = YES; + GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_VALUE = YES; GCC_WARN_UNUSED_VARIABLE = YES; IBC_WARNINGS = YES; -- cgit v1.2.3