aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-01 21:09:08 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-01 21:09:08 +0000
commit64919b03fa59c8d93c81a8e3893934c04a3cac91 (patch)
treea73f3db993975d4fb6963730450bae0655b12a09 /Source
parentcd09dcd69813400b098b9f019a558efb11e6c8b2 (diff)
downloadsequelpro-64919b03fa59c8d93c81a8e3893934c04a3cac91.tar.gz
sequelpro-64919b03fa59c8d93c81a8e3893934c04a3cac91.tar.bz2
sequelpro-64919b03fa59c8d93c81a8e3893934c04a3cac91.zip
Fix compiler warnings.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m129
-rw-r--r--Source/SPArrayAdditions.h2
-rw-r--r--Source/SPCustomQuery.m8
-rw-r--r--Source/SPDataCellFormatter.h4
-rw-r--r--Source/SPDataCellFormatter.m7
-rw-r--r--Source/SPDatabaseDocument.m8
-rw-r--r--Source/SPPreferenceController.h14
-rw-r--r--Source/SPPreferenceController.m4
-rw-r--r--Source/SPTableData.h1
-rw-r--r--Source/SPTableData.m2
10 files changed, 93 insertions, 86 deletions
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:@"<span class=\"%@\">%@</span>", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
- else
- [sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
- }
+ tokenRange = NSMakeRange(yyuoffset, yyuleng);
+ if(skipFontTag)
+ [sqlHTML appendString:[[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
+ else {
+ if(cssLike)
+ [sqlHTML appendFormat:@"<span class=\"%@\">%@</span>", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
+ else
+ [sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
}
- // Wrap lines, and replace tabs with spaces
- [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"<br>" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
- [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
+ }
- if(sqlHTML)
- return sqlHTML;
- else
- return @"";
+ // Wrap lines, and replace tabs with spaces
+ [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"<br>" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
+ [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;" 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 <SPPreferencePaneProtocol> *generalPreferencePane;
+ IBOutlet SPTablesPreferencePane <SPPreferencePaneProtocol> *tablesPreferencePane;
+ IBOutlet SPFavoritesPreferencePane <SPPreferencePaneProtocol> *favoritesPreferencePane;
+ IBOutlet SPNotificationsPreferencePane <SPPreferencePaneProtocol> *notificationsPreferencePane;
+ IBOutlet SPEditorPreferencePane <SPPreferencePaneProtocol> *editorPreferencePane;
+ IBOutlet SPAutoUpdatePreferencePane <SPPreferencePaneProtocol> *autoUpdatePreferencePane;
+ IBOutlet SPNetworkPreferencePane <SPPreferencePaneProtocol> *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 <SPPreferencePaneProtocol> *preferencePane = nil;
if (!sender) {
preferencePane = generalPreferencePane;
}
else {
- for (SPPreferencePane *prefPane in preferencePanes)
+ for (SPPreferencePane <SPPreferencePaneProtocol> *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