diff options
author | stuconnolly <stuart02@gmail.com> | 2011-03-08 20:41:11 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-03-08 20:41:11 +0000 |
commit | 4a950f357fb29640b2732ca34c80f81c0b23fbe6 (patch) | |
tree | 8dab179aa98c223a9791889846032c0e960636b4 /Source | |
parent | 2baa01621f83df3c81e6b6ed2310d483962dcf48 (diff) | |
download | sequelpro-4a950f357fb29640b2732ca34c80f81c0b23fbe6.tar.gz sequelpro-4a950f357fb29640b2732ca34c80f81c0b23fbe6.tar.bz2 sequelpro-4a950f357fb29640b2732ca34c80f81c0b23fbe6.zip |
Bring outline view branch up to date with trunk (r3227:r3233).
Diffstat (limited to 'Source')
30 files changed, 219 insertions, 184 deletions
diff --git a/Source/NSMutableArray-MultipleSort.m b/Source/NSMutableArray-MultipleSort.m index e76f1409..55a55962 100644 --- a/Source/NSMutableArray-MultipleSort.m +++ b/Source/NSMutableArray-MultipleSort.m @@ -51,7 +51,7 @@ [array1 replaceObjectAtIndex: d withObject: a1]; [a1 release]; va_start(argumentList, array1); - while (eachObject = va_arg(argumentList, id)) { + while ((eachObject = va_arg(argumentList, id))) { id ax = [eachObject objectAtIndex:d+stride]; id bx = [eachObject objectAtIndex:d]; [ax retain]; diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 454e3401..71fcd359 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -653,12 +653,14 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSString *command = [url host]; NSString *passedProcessID = [url user]; NSArray *parameter; - NSArray *pathComponents = [url pathComponents]; - if([pathComponents count] > 1) - parameter = [pathComponents subarrayWithRange:NSMakeRange(1,[[url pathComponents] count]-1)]; + NSArray *pathComponents = [[url absoluteString] pathComponents]; + + if([pathComponents count] > 2) + parameter = [pathComponents subarrayWithRange:NSMakeRange(2, [pathComponents count]-2)]; else parameter = [NSArray array]; + NSFileManager *fm = [NSFileManager defaultManager]; // Handle commands which don't need a connection window @@ -1984,7 +1986,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); idx = [SPChooseMenuItemDialog withItems:assignedKeyEquivalents atPosition:[NSEvent mouseLocation]]; if(idx > -1) { - NSArray *eq = [assignedKeyEquivalents objectAtIndex:idx]; + NSDictionary *eq = [assignedKeyEquivalents objectAtIndex:idx]; if(eq && [eq count]) { NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; @@ -2003,7 +2005,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); idx = [SPChooseMenuItemDialog withItems:assignedKeyEquivalents atPosition:[NSEvent mouseLocation]]; if(idx > -1) { - NSArray *eq = [assignedKeyEquivalents objectAtIndex:idx]; + NSDictionary *eq = [assignedKeyEquivalents objectAtIndex:idx]; if(eq && [eq count]) { NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; @@ -2022,7 +2024,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); idx = [SPChooseMenuItemDialog withItems:assignedKeyEquivalents atPosition:[NSEvent mouseLocation]]; if(idx > -1) { - NSArray *eq = [assignedKeyEquivalents objectAtIndex:idx]; + NSDictionary *eq = [assignedKeyEquivalents objectAtIndex:idx]; if(eq && [eq count]) { NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; diff --git a/Source/SPConnectionDelegate.h b/Source/SPConnectionDelegate.h index c1d3bb5e..777b032a 100644 --- a/Source/SPConnectionDelegate.h +++ b/Source/SPConnectionDelegate.h @@ -31,4 +31,7 @@ - (void) closeAndDisconnect; +- (NSString *)keychainPasswordForConnection:(MCPConnection *)connection; +- (NSString *)keychainPasswordForSSHConnection:(MCPConnection *)connection; + @end diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 7228baa3..2c9e890e 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -635,7 +635,7 @@ } // Record any affected rows - if ( [mySQLConnection affectedRows] >= (my_ulonglong)0 ) + if ( [mySQLConnection affectedRows] != (my_ulonglong)~0 ) totalAffectedRows += (NSUInteger)[mySQLConnection affectedRows]; else if ( [streamingResult numOfRows] ) totalAffectedRows += (NSUInteger)[streamingResult numOfRows]; diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m index 0180227b..29b22cd7 100644 --- a/Source/SPDataCellFormatter.m +++ b/Source/SPDataCellFormatter.m @@ -65,13 +65,13 @@ return YES; // A single character over the length of the string - likely typed. Prevent the change. - if ([partialString length] == textLimit + 1) { + if ((NSInteger)[partialString length] == textLimit + 1) { [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %ld.", @"Maximum text length is set to %ld."), (long)textLimit]]; return NO; } // If the string is considerably longer than the limit, likely pasted. Accept but truncate. - if ([partialString length] > textLimit) { + if ((NSInteger)[partialString length] > textLimit) { [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %ld. Inserted text was truncated.", @"Maximum text length is set to %ld. Inserted text was truncated."), (long)textLimit]]; *newString = [NSString stringWithString:[partialString substringToIndex:textLimit]]; return NO; diff --git a/Source/SPDataImport.h b/Source/SPDataImport.h index a8888ab8..f6e51299 100644 --- a/Source/SPDataImport.h +++ b/Source/SPDataImport.h @@ -38,7 +38,7 @@ IBOutlet id importView; IBOutlet id importTabView; - IBOutlet id importFieldNamesSwitch; + IBOutlet NSButton *importFieldNamesSwitch; IBOutlet id importFieldsTerminatedField; IBOutlet id importFieldsEnclosedField; IBOutlet id importFieldsEscapedField; @@ -117,12 +117,15 @@ // Import methods - (void)importFile; +- (void)importFileSheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo; - (void)importFromClipboard; +- (void)importFromClipboardSheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo; - (void)importSQLFile:(NSString *)filename; - (void)startSQLImportProcessWithFile:(NSString *)filename; - (void)importCSVFile:(NSString *)filename; - (IBAction)changeFormat:(id)sender; - (BOOL)buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)dataIsPreviewData ofSoureFile:(NSString*)filename; +- (void)fieldMapperDidEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (NSString *)mappedValueStringForRowArray:(NSArray *)csvRowArray; - (NSString *)mappedUpdateSetStatementStringForRowArray:(NSArray *)csvRowArray; diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 0667ac07..03a1afb7 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -25,6 +25,7 @@ #import "SPDataImport.h" #import "SPDatabaseDocument.h" +#import "SPDatabaseViewController.h" #import "SPTablesList.h" #import "SPTableStructure.h" #import "SPTableContent.h" @@ -176,7 +177,7 @@ { // clipboard textview with no wrapping - const CGFloat LargeNumberForText = 1.0e7; + const CGFloat LargeNumberForText = 1.0e7f; [[importFromClipboardTextView textContainer] setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)]; [[importFromClipboardTextView textContainer] setWidthTracksTextView:NO]; [[importFromClipboardTextView textContainer] setHeightTracksTextView:NO]; @@ -387,7 +388,7 @@ fileIsCompressed = [sqlFileHandle isCompressed]; // Grab the file length - fileTotalLength = [[[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] objectForKey:NSFileSize] longLongValue]; + fileTotalLength = (NSUInteger)[[[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] objectForKey:NSFileSize] longLongValue]; if (!fileTotalLength) fileTotalLength = 1; // If importing a bzipped file, use indeterminate progress bars as no progress is available @@ -543,7 +544,7 @@ } // Extract and process any complete SQL queries that can be found in the strings parsed so far - while (query = [sqlParser trimAndReturnStringToCharacter:';' trimmingInclusively:YES returningInclusively:NO]) { + while ((query = [sqlParser trimAndReturnStringToCharacter:';' trimmingInclusively:YES returningInclusively:NO])) { if (progressCancelled) break; fileProcessedLength += [query lengthOfBytesUsingEncoding:sqlEncoding] + 1; @@ -708,14 +709,14 @@ NSMutableArray *parsePositions = [[NSMutableArray alloc] init]; NSArray *csvRowArray; NSInteger fileChunkMaxLength = 256 * 1024; - NSInteger csvRowsPerQuery = 50; + NSUInteger csvRowsPerQuery = 50; NSUInteger csvRowsThisQuery; NSUInteger fileTotalLength = 0; NSInteger rowsImported = 0; NSInteger dataBufferLength = 0; NSInteger dataBufferPosition = 0; NSInteger dataBufferLastQueryEndPosition = 0; - NSInteger i; + NSUInteger i; BOOL allDataRead = NO; BOOL insertBaseStringHasEntries; @@ -746,7 +747,7 @@ } // Grab the file length - fileTotalLength = [[[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] objectForKey:NSFileSize] longLongValue]; + fileTotalLength = (NSUInteger)[[[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:NULL] objectForKey:NSFileSize] longLongValue]; if (!fileTotalLength) fileTotalLength = 1; // Reset progress interface @@ -1336,7 +1337,7 @@ [globalVar flushCachedRegexData]; NSRange aRange = [globalVar rangeOfRegex:re capture:0L]; NSInteger colIndex = [[globalVar substringWithRange:[globalVar rangeOfRegex:re capture:1L]] integerValue]; - if(colIndex > 0 && colIndex <= [csvRowArray count]) { + if (colIndex > 0 && colIndex <= (NSInteger)[csvRowArray count]) { id colStr = NSArrayObjectAtIndex(csvRowArray, colIndex-1); if(colStr == [NSNull null]) [globalVar replaceCharactersInRange:aRange withString:@"NULL"]; @@ -1388,7 +1389,7 @@ [globalVar flushCachedRegexData]; NSRange aRange = [globalVar rangeOfRegex:re capture:0L]; NSInteger colIndex = [[globalVar substringWithRange:[globalVar rangeOfRegex:re capture:1L]] integerValue]; - if(colIndex > 0 && colIndex <= [csvRowArray count]) { + if(colIndex > 0 && colIndex <= (NSInteger)[csvRowArray count]) { id colStr = NSArrayObjectAtIndex(csvRowArray, colIndex-1); if(colStr == [NSNull null]) [globalVar replaceCharactersInRange:aRange withString:@"NULL"]; @@ -1462,7 +1463,7 @@ [globalVar flushCachedRegexData]; NSRange aRange = [globalVar rangeOfRegex:re capture:0L]; NSInteger colIndex = [[globalVar substringWithRange:[globalVar rangeOfRegex:re capture:1L]] integerValue]; - if(colIndex > 0 && colIndex <= [csvRowArray count]) { + if(colIndex > 0 && colIndex <= (NSInteger)[csvRowArray count]) { id colStr = NSArrayObjectAtIndex(csvRowArray, colIndex-1); if(colStr == [NSNull null]) [globalVar replaceCharactersInRange:aRange withString:@"NULL"]; diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 21993d95..2aa809b1 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -317,7 +317,7 @@ NSInteger _sortMySQL4CharsetEntry(NSDictionary *itemOne, NSDictionary *itemTwo, if (![connection queryErrored]) { [result dataSeek:0]; - for (NSInteger i = 0; i < [result numOfRows]; i++) + for (NSUInteger i = 0; i < [result numOfRows]; i++) { [array addObject:[result fetchRowAsDictionary]]; } diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index efc3f25e..2b7fb38a 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -40,7 +40,7 @@ /** * The SPDatabaseDocument class controls the primary database view window. */ -@interface SPDatabaseDocument : NSObject <NSUserInterfaceValidations, SPConnectionControllerDelegateProtocol> +@interface SPDatabaseDocument : NSObject <SPConnectionControllerDelegateProtocol> { // IBOutlets IBOutlet id tablesListInstance; @@ -121,12 +121,12 @@ IBOutlet NSWindow *connectionErrorDialog; IBOutlet id saveConnectionAccessory; - IBOutlet id saveConnectionIncludeData; - IBOutlet id saveConnectionIncludeQuery; - IBOutlet id saveConnectionSavePassword; + IBOutlet NSButton *saveConnectionIncludeData; + IBOutlet NSButton *saveConnectionIncludeQuery; + IBOutlet NSButton *saveConnectionSavePassword; IBOutlet id saveConnectionSavePasswordAlert; - IBOutlet id saveConnectionEncrypt; - IBOutlet id saveConnectionAutoConnect; + IBOutlet NSButton *saveConnectionEncrypt; + IBOutlet NSButton *saveConnectionAutoConnect; IBOutlet NSSecureTextField *saveConnectionEncryptString; IBOutlet id inputTextWindow; @@ -145,7 +145,7 @@ NSInteger currentTabIndex; NSString *selectedTableName; - NSInteger selectedTableType; + SPTableType selectedTableType; BOOL structureLoaded; BOOL contentLoaded; @@ -303,6 +303,7 @@ - (IBAction)closePasswordSheet:(id)sender; - (IBAction)backForwardInHistory:(id)sender; - (IBAction)showUserManager:(id)sender; +- (void)userManagerSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void*)context; - (IBAction)copyChecksumFromSheet:(id)sender; - (void)setIsSavedInBundle:(BOOL)savedInBundle; - (void)setFileURL:(NSURL *)fileURL; @@ -366,7 +367,6 @@ - (NSWindow *)parentWindow; // Scripting -- (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike; - (void)handleSchemeCommand:(NSDictionary*)commandDict; - (void)registerActivity:(NSDictionary*)commandDict; - (void)removeRegisteredActivity:(NSInteger)pid; @@ -378,5 +378,6 @@ - (NSDictionary *) stateIncludingDetails:(NSDictionary *)detailsToReturn; - (BOOL)setState:(NSDictionary *)stateDetails; - (void)setStateFromConnectionFile:(NSString *)path; +- (void)restoreSession; @end diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index af639127..d582b836 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -60,6 +60,7 @@ #import "SPBundleHTMLOutputController.h" #import "SPConnectionDelegate.h" #import "SPWindowController.h" +#import "SPFileHandle.h" @interface SPDatabaseDocument (PrivateAPI) @@ -236,16 +237,16 @@ // Set up the progress indicator child window and layer - change indicator color and size [taskProgressIndicator setForeColor:[NSColor whiteColor]]; NSShadow *progressIndicatorShadow = [[NSShadow alloc] init]; - [progressIndicatorShadow setShadowOffset:NSMakeSize(1.0, -1.0)]; - [progressIndicatorShadow setShadowBlurRadius:1.0]; - [progressIndicatorShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.75]]; + [progressIndicatorShadow setShadowOffset:NSMakeSize(1.0f, -1.0f)]; + [progressIndicatorShadow setShadowBlurRadius:1.0f]; + [progressIndicatorShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0f alpha:0.75f]]; [taskProgressIndicator setShadow:progressIndicatorShadow]; [progressIndicatorShadow release]; taskProgressWindow = [[NSWindow alloc] initWithContentRect:[taskProgressLayer bounds] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [taskProgressWindow setReleasedWhenClosed:NO]; [taskProgressWindow setOpaque:NO]; [taskProgressWindow setBackgroundColor:[NSColor clearColor]]; - [taskProgressWindow setAlphaValue:0.0]; + [taskProgressWindow setAlphaValue:0.0f]; [taskProgressWindow setContentView:taskProgressLayer]; [contentViewSplitter setDelegate:self]; @@ -429,7 +430,7 @@ } } - (void *)[self databaseEncoding]; + (void)[self databaseEncoding]; } /** @@ -475,11 +476,11 @@ if (allDatabases) [allDatabases release]; if (allSystemDatabases) [allSystemDatabases release]; - allDatabases = [[NSMutableArray alloc] initWithCapacity:[queryResult numOfRows]]; + allDatabases = [[NSMutableArray alloc] initWithCapacity:(NSUInteger)[queryResult numOfRows]]; allSystemDatabases = [[NSMutableArray alloc] initWithCapacity:2]; - for (NSInteger i = 0 ; i < [queryResult numOfRows] ; i++) + for (NSUInteger i = 0 ; i < [queryResult numOfRows] ; i++) { NSString *database = NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0); @@ -828,7 +829,7 @@ MCPResult *theResult = [mySQLConnection queryString:@"SELECT DATABASE()"]; if (![mySQLConnection queryErrored]) { NSInteger i; - NSInteger r = [theResult numOfRows]; + NSInteger r = (NSInteger)[theResult numOfRows]; if (r) [theResult dataSeek:0]; for ( i = 0 ; i < r ; i++ ) { dbName = NSArrayObjectAtIndex([theResult fetchRowAsArray], 0); @@ -1003,7 +1004,7 @@ */ - (void) fadeInTaskProgressWindow:(NSTimer *)theTimer { - float timeSinceFadeInStart = [[NSDate date] timeIntervalSinceDate:taskFadeInStartDate]; + double timeSinceFadeInStart = [[NSDate date] timeIntervalSinceDate:taskFadeInStartDate]; // Keep the window hidden for the first ~0.5 secs if (timeSinceFadeInStart < 0.5) return; @@ -1014,8 +1015,8 @@ if (alphaValue == 0) [self centerTaskWindow]; // Fade in the task window over 0.6 seconds - alphaValue = (timeSinceFadeInStart - 0.5) / 0.6; - if (alphaValue > 1.0) alphaValue = 1.0; + alphaValue = (float)(timeSinceFadeInStart - 0.5) / 0.6f; + if (alphaValue > 1.0f) alphaValue = 1.0f; [taskProgressWindow setAlphaValue:alphaValue]; // If the window has been fully faded in, clean up the timer. @@ -1031,14 +1032,14 @@ */ - (void) setTaskDescription:(NSString *)description { - NSShadow *shadow = [[NSShadow alloc] init]; - [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.75]]; - [shadow setShadowOffset:NSMakeSize(1.0, -1.0)]; - [shadow setShadowBlurRadius:3.0]; + NSShadow *textShadow = [[NSShadow alloc] init]; + [textShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0f alpha:0.75f]]; + [textShadow setShadowOffset:NSMakeSize(1.0f, -1.0f)]; + [textShadow setShadowBlurRadius:3.0f]; NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys: - [NSFont boldSystemFontOfSize:13.0], NSFontAttributeName, - shadow, NSShadowAttributeName, + [NSFont boldSystemFontOfSize:13.0f], NSFontAttributeName, + textShadow, NSShadowAttributeName, nil]; NSAttributedString *string = [[NSAttributedString alloc] initWithString:description attributes:attributes]; @@ -1046,7 +1047,7 @@ [string release]; [attributes release]; - [shadow release]; + [textShadow release]; } /** @@ -1129,7 +1130,7 @@ // Hide the task interface and reset to indeterminate if (taskDisplayIsIndeterminate) [taskProgressIndicator stopAnimation:self]; - [taskProgressWindow setAlphaValue:0.0]; + [taskProgressWindow setAlphaValue:0.0f]; taskDisplayIsIndeterminate = YES; [taskProgressIndicator setIndeterminate:YES]; @@ -1224,8 +1225,8 @@ NSRect mainWindowRect = [parentWindow frame]; NSRect taskWindowRect = [taskProgressWindow frame]; - newBottomLeftPoint.x = round(mainWindowRect.origin.x + mainWindowRect.size.width/2 - taskWindowRect.size.width/2); - newBottomLeftPoint.y = round(mainWindowRect.origin.y + mainWindowRect.size.height/2 - taskWindowRect.size.height/2); + newBottomLeftPoint.x = roundf(mainWindowRect.origin.x + mainWindowRect.size.width/2 - taskWindowRect.size.width/2); + newBottomLeftPoint.y = roundf(mainWindowRect.origin.y + mainWindowRect.size.height/2 - taskWindowRect.size.height/2); [taskProgressWindow setFrameOrigin:newBottomLeftPoint]; } @@ -1407,7 +1408,7 @@ */ - (IBAction)chooseEncoding:(id)sender { - [self setConnectionEncoding:[self mysqlEncodingFromEncodingTag:[NSNumber numberWithInt:[(NSMenuItem *)sender tag]]] reloadingViews:YES]; + [self setConnectionEncoding:[self mysqlEncodingFromEncodingTag:[NSNumber numberWithInteger:[(NSMenuItem *)sender tag]]] reloadingViews:YES]; } /** @@ -1435,7 +1436,7 @@ NSIndexSet *indexes = [[tablesListInstance valueForKeyPath:@"tablesListView"] selectedRowIndexes]; NSUInteger currentIndex = [indexes firstIndex]; - NSInteger counter = 0; + NSUInteger counter = 0; NSInteger type; NSArray *types = [tablesListInstance selectedTableTypes]; @@ -2794,11 +2795,11 @@ return; } - NSError *error = nil; + error = nil; [plist writeToFile:[NSString stringWithFormat:@"%@/info.plist", fileName] options:NSAtomicWrite error:&error]; - if(error != nil){ + if (error != nil){ NSAlert *errorAlert = [NSAlert alertWithError:error]; [errorAlert runModal]; @@ -2875,7 +2876,7 @@ @"saveDocPrefSheetStatus", [NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")], [NSString stringWithFormat:NSLocalizedString(@"Connection data file “%@” couldn't be read. Please try to save the document under a different name.", @"message error while reading connection data file and suggesting to save it under a differnet name"), [fileName lastPathComponent]], - saveDocPrefSheetStatus + &saveDocPrefSheetStatus ); if (spf) [spf release]; @@ -3137,9 +3138,9 @@ } } else { - for (NSNumber *type in [tablesListInstance selectedTableTypes]) + for (NSNumber *eachType in [tablesListInstance selectedTableTypes]) { - if ([type intValue] == SPTableTypeTable || [type intValue] == SPTableTypeView) return enable; + if ([eachType intValue] == SPTableTypeTable || [eachType intValue] == SPTableTypeView) return enable; } return (enable && (tag == SPSQLExport)); @@ -3327,11 +3328,11 @@ } if ([connectionController isConnecting]) { - windowTitle = NSLocalizedString(@"Connecting…", @"window title string indicating that sp is connecting"); + windowTitle = [NSMutableString stringWithString:NSLocalizedString(@"Connecting…", @"window title string indicating that sp is connecting")]; tabTitle = windowTitle; } else if (!_isConnected) { - windowTitle = [NSString stringWithFormat:@"%@%@", pathName, @"Sequel Pro"]; + windowTitle = [NSMutableString stringWithFormat:@"%@%@", pathName, @"Sequel Pro"]; tabTitle = windowTitle; } else { @@ -4253,6 +4254,8 @@ if ([stateDetails objectForKey:@"auto_connect"] && [[stateDetails valueForKey:@"auto_connect"] boolValue]) { [connectionController initiateConnection:self]; } + + return YES; } /** @@ -4706,7 +4709,7 @@ if([command isEqualToString:@"SelectTableRows"]) { if([params count] > 1 && [[[NSApp mainWindow] firstResponder] respondsToSelector:@selector(selectTableRows:)]) { - [[[NSApp mainWindow] firstResponder] selectTableRows:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]]; + [(SPCopyTable *)[[NSApp mainWindow] firstResponder] selectTableRows:[params subarrayWithRange:NSMakeRange(1, [params count]-1)]]; } return; } @@ -4780,7 +4783,7 @@ NSInteger itemType = SPTableTypeNone; NSString *itemTypeStr = @"TABLE"; - NSInteger i; + NSUInteger i; NSInteger queryCol = 1; // Loop through the unfiltered tables/views to find the desired item @@ -4846,7 +4849,7 @@ return; } if(doSyntaxHighlighting) { - [result appendFormat:@"%@<br>", [self doSQLSyntaxHighlightForString:[syntaxString createViewSyntaxPrettifier] cssLike:doSyntaxHighlightingViaCSS]]; + [result appendFormat:@"%@<br>", [[NSApp delegate] doSQLSyntaxHighlightForString:[syntaxString createViewSyntaxPrettifier] cssLike:doSyntaxHighlightingViaCSS]]; } else { [result appendFormat:@"%@\n", [syntaxString createViewSyntaxPrettifier]]; } @@ -4946,7 +4949,7 @@ } // write data - NSInteger i, j; + NSUInteger i, j; NSArray *theRow; NSMutableString *result = [NSMutableString string]; if(writeAsCsv) { @@ -5277,7 +5280,7 @@ - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - if(statusTableView && aTableView == statusTableView && rowIndex < [statusValues count]) { + if (statusTableView && aTableView == statusTableView && rowIndex < (NSInteger)[statusValues count]) { if ([[aTableColumn identifier] isEqualToString:@"table_name"]) { if([[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"]) return [[statusValues objectAtIndex:rowIndex] objectForKey:@"table_name"]; @@ -5483,7 +5486,7 @@ // If there is an encoding selected other than the default we must specify it in CREATE DATABASE statement if ([databaseEncodingButton indexOfSelectedItem] > 0) { - createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET %@", createStatement, [[self mysqlEncodingFromEncodingTag:[databaseEncodingButton tag]] backtickQuotedString]]; + createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET %@", createStatement, [[self mysqlEncodingFromEncodingTag:[NSNumber numberWithInteger:[databaseEncodingButton tag]]] backtickQuotedString]]; } // Create the database @@ -5649,7 +5652,7 @@ // For HTML output check if corresponding window already exists BOOL stopTrigger = NO; - if([[data objectAtIndex:2] length]) { + if ([(NSString *)[data objectAtIndex:2] length]) { BOOL correspondingWindowFound = NO; NSString *uuid = [data objectAtIndex:2]; for(id win in [NSApp windows]) { diff --git a/Source/SPDatabaseViewController.h b/Source/SPDatabaseViewController.h index f7d795ca..682d6f74 100644 --- a/Source/SPDatabaseViewController.h +++ b/Source/SPDatabaseViewController.h @@ -30,7 +30,7 @@ // Getters - (NSString *)table; -- (NSInteger)tableType; +- (SPTableType)tableType; - (BOOL)structureLoaded; - (BOOL)contentLoaded; - (BOOL)statusLoaded; diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index 88928897..3b6cfc1f 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -66,7 +66,7 @@ /** * Returns the currently selected table type, or -1 if no table or multiple tables are selected */ -- (NSInteger)tableType +- (SPTableType)tableType { return selectedTableType; } diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 6f039659..13e60f92 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -28,9 +28,11 @@ #import "RegexKitLite.h" #import "SPDatabaseData.h" #import "SPDatabaseDocument.h" +#import "SPDatabaseViewController.h" #import "SPTablesList.h" #import "SPAlertSheets.h" #import "SPTableStructure.h" +#import "SPServerSupport.h" @interface SPExtendedTableInfo (PrivateAPI) diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m index a91495ae..d368f602 100644 --- a/Source/SPFavoriteTextFieldCell.m +++ b/Source/SPFavoriteTextFieldCell.m @@ -25,7 +25,7 @@ #import "SPFavoriteTextFieldCell.h" -#define FAVORITE_NAME_FONT_SIZE 12.0 +#define FAVORITE_NAME_FONT_SIZE 12.0f @interface SPFavoriteTextFieldCell (PrivateAPI) @@ -115,21 +115,21 @@ NSAttributedString *mainString = [self attributedStringForFavoriteName]; NSAttributedString *subString = [self constructSubStringAttributedString]; - NSRect subFrame = NSMakeRect(0.0, 0.0, [subString size].width, [subString size].height); + NSRect subFrame = NSMakeRect(0.0f, 0.0f, [subString size].width, [subString size].height); // Total height of both strings with a 2 pixel separation space - CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0; + CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0f; - cellFrame.origin.y += (cellFrame.size.height - totalHeight) / 2.0; - cellFrame.origin.x += 10.0; // Indent main string from image + cellFrame.origin.y += (cellFrame.size.height - totalHeight) / 2.0f; + cellFrame.origin.x += 10.0f; // Indent main string from image // Position the sub text's frame rect - subFrame.origin.y = [mainString size].height + cellFrame.origin.y + 1.0; + subFrame.origin.y = [mainString size].height + cellFrame.origin.y + 1.0f; subFrame.origin.x = cellFrame.origin.x; cellFrame.size.height = totalHeight; - NSInteger i; + NSUInteger i; CGFloat maxWidth = cellFrame.size.width; CGFloat mainStringWidth = [mainString size].width; CGFloat subStringWidth = [subString size].width; @@ -166,10 +166,10 @@ // 15 := indention 10 from image to string plus 5 px padding CGFloat theWidth = MAX([mainString size].width, [subString size].width) + (([self image] != nil) ? [[self image] size].width : 0) + 15; - CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0; + CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0f; cellSize.width = theWidth; - cellSize.height = totalHeight + 13.0; + cellSize.height = totalHeight + 13.0f; return cellSize; } diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h index 7429f75c..e27b63aa 100644 --- a/Source/SPHistoryController.h +++ b/Source/SPHistoryController.h @@ -49,6 +49,8 @@ - (IBAction) historyControlClicked:(NSSegmentedControl *)theControl; - (NSUInteger) currentlySelectedView; - (void) setupInterface; +- (void) startDocumentTask:(NSNotification *)aNotification; +- (void) endDocumentTask:(NSNotification *)aNotification; // Adding or updating history entries - (void) updateHistoryEntries; diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 9b810a00..3bd3b0b3 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -41,7 +41,7 @@ */ - (id) init { - if (self = [super init]) { + if ((self = [super init])) { history = [[NSMutableArray alloc] init]; tableContentStates = [[NSMutableDictionary alloc] init]; historyPosition = NSNotFound; @@ -109,7 +109,7 @@ } if (forwardEnabled) { navMenu = [[NSMenu alloc] init]; - for (i = historyPosition + 1; i < [history count]; i++) { + for (i = historyPosition + 1; i < (NSInteger)[history count]; i++) { [navMenu addItem:[self menuEntryForHistoryEntryAtIndex:i]]; } [historyControl setMenu:navMenu forSegment:1]; @@ -303,7 +303,7 @@ // creating a new entry every time detail is changed. if ([[currentHistoryEntry objectForKey:@"database"] isEqualToString:theDatabase] && [[currentHistoryEntry objectForKey:@"table"] isEqualToString:theTable] - && ([[currentHistoryEntry objectForKey:@"view"] integerValue] != theView + && ([[currentHistoryEntry objectForKey:@"view"] unsignedIntegerValue] != theView || ((![currentHistoryEntry objectForKey:@"contentFilter"] && !contentFilter) || (![currentHistoryEntry objectForKey:@"contentFilter"] && ![(NSString *)[contentFilter objectForKey:@"filterValue"] length] @@ -317,7 +317,7 @@ // position details on the *previous* history item } else if ([[currentHistoryEntry objectForKey:@"database"] isEqualToString:theDatabase] && [[currentHistoryEntry objectForKey:@"table"] isEqualToString:theTable] - && ([[currentHistoryEntry objectForKey:@"view"] integerValue] == theView + && ([[currentHistoryEntry objectForKey:@"view"] unsignedIntegerValue] == theView || ((![currentHistoryEntry objectForKey:@"contentFilter"] && contentFilter) || ![[currentHistoryEntry objectForKey:@"contentFilter"] isEqualToDictionary:contentFilter]))) { @@ -338,7 +338,7 @@ NSMutableDictionary *newEntry = [NSMutableDictionary dictionaryWithObjectsAndKeys: theDatabase, @"database", theTable, @"table", - [NSNumber numberWithInteger:theView], @"view", + [NSNumber numberWithUnsignedInteger:theView], @"view", [NSNumber numberWithBool:contentSortColIsAsc], @"contentSortColIsAsc", [NSNumber numberWithInteger:contentPageNumber], @"contentPageNumber", [NSValue valueWithRect:contentViewport], @"contentViewport", @@ -367,7 +367,7 @@ { // Sanity check the input - if (position == NSNotFound || position < 0 || position >= [history count]) { + if (position == NSNotFound || position >= [history count]) { NSBeep(); return; } @@ -404,7 +404,8 @@ // If the database, table, and view are the same and content - just trigger a table reload (filters) if ([[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]] && [historyEntry objectForKey:@"table"] && [[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]] - && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SPTableViewContent) + && [[historyEntry objectForKey:@"view"] unsignedIntegerValue] == [self currentlySelectedView] + && [[historyEntry objectForKey:@"view"] unsignedIntegerValue] == SPTableViewContent) { [tableContentInstance loadTable:[historyEntry objectForKey:@"table"]]; modifyingState = NO; @@ -433,7 +434,7 @@ } // Check and set the view - if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) { + if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] unsignedIntegerValue]) { switch ([[historyEntry objectForKey:@"view"] integerValue]) { case SPTableViewStructure: [theDocument viewStructure:self]; @@ -454,7 +455,7 @@ [theDocument viewTriggers:self]; break; } - if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) { + if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] unsignedIntegerValue]) { return [self abortEntryLoadWithPool:loadPool]; } } diff --git a/Source/SPLogger.m b/Source/SPLogger.m index 5736fde6..b1e16bba 100644 --- a/Source/SPLogger.m +++ b/Source/SPLogger.m @@ -37,6 +37,7 @@ static SPLogger *logger = nil; - (void)_initLogFile; - (void)_outputTimeString; +int _isSPLeaksLog(struct direct *entry); @end @@ -137,10 +138,9 @@ static SPLogger *logger = nil; if ([self removeOldLeakDumpsOnTermination]) { int cnt, cnt2, i; - int isSPLeaksLog(); struct direct **files; - cnt = scandir("/tmp", &files, isSPLeaksLog, NULL); + cnt = scandir("/tmp", &files, _isSPLeaksLog, NULL); char fpath[32], fpath2[32], fpath3[64]; @@ -158,7 +158,7 @@ static SPLogger *logger = nil; if (hdir) { snprintf(fpath2, sizeof(fpath2), "%s/Desktop", pw->pw_dir); - cnt2 = scandir(fpath2, &files, isSPLeaksLog, NULL); + cnt2 = scandir(fpath2, &files, _isSPLeaksLog, NULL); for (i = 0; i < cnt2; i++) { @@ -181,7 +181,7 @@ static SPLogger *logger = nil; // Write new leaks log if ((fp = popen(cmd, "r")) && (fp2 = fopen(file, "w"))) { - while (len = fread(buf, 1, sizeof(buf), fp)) + while ((len = fread(buf, 1, sizeof(buf), fp))) { fwrite(buf, 1, len, fp2); } @@ -191,11 +191,6 @@ static SPLogger *logger = nil; } } -int isSPLeaksLog(struct direct *entry) -{ - return (strstr(entry->d_name, "sp.leaks") != NULL); -} - #pragma mark - #pragma mark Private API @@ -249,4 +244,9 @@ int isSPLeaksLog(struct direct *entry) [logFileHandle writeData:[[NSString stringWithFormat:@"Launched at %@\n\n", [[NSDate date] description]] dataUsingEncoding:NSUTF8StringEncoding]]; } +int _isSPLeaksLog(struct direct *entry) +{ + return (strstr(entry->d_name, "sp.leaks") != NULL); +} + @end diff --git a/Source/SPNarrowDownCompletion.h b/Source/SPNarrowDownCompletion.h index 192bbf38..08393d4d 100644 --- a/Source/SPNarrowDownCompletion.h +++ b/Source/SPNarrowDownCompletion.h @@ -59,7 +59,7 @@ NSTimer *stateTimer; NSArray *syncArrowImages; - NSInteger currentSyncImage; + NSUInteger currentSyncImage; NSUInteger timeCounter; diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m index ca7f7f7d..b1101704 100644 --- a/Source/SPNarrowDownCompletion.m +++ b/Source/SPNarrowDownCompletion.m @@ -627,13 +627,13 @@ if(fuzzyMode) { // eg filter = "inf" this regexp search will be performed: (?i).*?i.*?n.*?f NSMutableString *fuzzyRegexp = [[NSMutableString alloc] initWithCapacity:3]; - NSInteger i; + NSUInteger i; unichar c; - if(!caseSensitive) + if (!caseSensitive) [fuzzyRegexp setString:@"(?i)"]; - for(i=0; i<[[self filterString] length]; i++) { + for (i=0; i<[[self filterString] length]; i++) { c = [[self filterString] characterAtIndex:i]; if(c != '`') { if(c == '.') @@ -645,8 +645,8 @@ } } - for(id s in suggestions) - if([[s objectForKey:@"display"] isMatchedByRegex:fuzzyRegexp] || [[s objectForKey:@"path"] isMatchedByRegex:fuzzyRegexp]) + for (id s in suggestions) + if ([[s objectForKey:@"display"] isMatchedByRegex:fuzzyRegexp] || [[s objectForKey:@"path"] isMatchedByRegex:fuzzyRegexp]) [newFiltered addObject:s]; diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index f6760468..3dfed305 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -29,6 +29,7 @@ #import "SPTablesList.h" #import "SPFileHandle.h" #import "SPExportUtilities.h" +#import "SPExportFile.h" #import "SPTableData.h" @interface SPSQLExporter (PrivateAPI) @@ -294,7 +295,7 @@ if ([connection queryErrored] || ![rowArray count]) { [errors appendFormat:@"%@\n", [connection getLastErrorMessage]]; - [[self exportOutputFileHandle] writeData:[[NSString stringWithFormat:@"# Error: %@\n\n\n", [connection getLastErrorMessage]] dataUsingEncoding:NSUTF8StringEncoding]]; + [[self exportOutputFile] writeData:[[NSString stringWithFormat:@"# Error: %@\n\n\n", [connection getLastErrorMessage]] dataUsingEncoding:NSUTF8StringEncoding]]; continue; } @@ -329,7 +330,7 @@ // Inform the delegate that we are about to start writing the data to disk [delegate performSelectorOnMainThread:@selector(sqlExportProcessWillBeginWritingData:) withObject:self waitUntilDone:NO]; - while (row = [streamingResult fetchNextRowAsArray]) + while ((row = [streamingResult fetchNextRowAsArray])) { // Check for cancellation flag if ([self isCancelled]) { @@ -348,7 +349,7 @@ [sqlString setString:@""]; // Update the progress - NSUInteger progress = (j * ([self exportMaxProgress] / rowCount)); + NSUInteger progress = (NSUInteger)(j * ([self exportMaxProgress] / rowCount)); if (progress > lastProgressValue) { [self setExportProgressValue:progress]; @@ -773,7 +774,7 @@ */ - (NSString *)_createViewPlaceholderSyntaxForView:(NSString *)viewName { - NSInteger i, j; + NSUInteger i, j; NSMutableString *placeholderSyntax; // Get structured information for the view via the SPTableData parsers diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index 16d0c590..d0464d59 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -245,15 +245,15 @@ // If no local port has yet been chosen, choose one if (!localPort) { - NSInteger tempSocket; + int tempSocket; struct sockaddr_in tempSocketAddress; - NSInteger addressLength = sizeof(tempSocketAddress); + size_t addressLength = sizeof(tempSocketAddress); if((tempSocket = socket(AF_INET, SOCK_STREAM, 0)) > 0) { memset(&tempSocketAddress, 0, sizeof(tempSocketAddress)); tempSocketAddress.sin_family = AF_INET; tempSocketAddress.sin_addr.s_addr = htonl(INADDR_ANY); tempSocketAddress.sin_port = 0; - if (bind(tempSocket, (struct sockaddr *)&tempSocketAddress, addressLength) >= 0) { + if (bind(tempSocket, (struct sockaddr *)&tempSocketAddress, (socklen_t)addressLength) >= 0) { if (getsockname(tempSocket, (struct sockaddr *)&tempSocketAddress, (uint32_t *)&addressLength) >= 0) { localPort = ntohs(tempSocketAddress.sin_port); } @@ -267,7 +267,7 @@ tempSocketAddress.sin_family = AF_INET; tempSocketAddress.sin_addr.s_addr = htonl(INADDR_ANY); tempSocketAddress.sin_port = 0; - if (bind(tempSocket, (struct sockaddr *)&tempSocketAddress, addressLength) >= 0) { + if (bind(tempSocket, (struct sockaddr *)&tempSocketAddress, (socklen_t)addressLength) >= 0) { if (getsockname(tempSocket, (struct sockaddr *)&tempSocketAddress, (uint32_t *)&addressLength) >= 0) { localPortFallback = ntohs(tempSocketAddress.sin_port); } diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 5f5de871..c4eb9f57 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2645,8 +2645,11 @@ return YES; } - // Save any edits which have been made but not saved to the table yet. - [[tableDocumentInstance parentWindow] endEditingFor:nil]; + // Save any edits which have been made but not saved to the table yet; + // but not for any NSSearchFields which could cause a crash for undo, redo. + if([[[tableDocumentInstance parentWindow] firstResponder] respondsToSelector:@selector(delegate)] + && ![[[[tableDocumentInstance parentWindow] firstResponder] delegate] isKindOfClass:[NSSearchField class]]) + [[tableDocumentInstance parentWindow] endEditingFor:nil]; // If no rows are currently being edited, or a save is in progress, return success at once. if (!isEditingRow || isSavingRow) return YES; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 7180dc6a..b69ce816 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -216,7 +216,7 @@ * * @param index The index of the column array. */ -- (NSDictionary *) columnAtIndex:(NSInteger)index +- (NSDictionary *) columnAtIndex:(NSInteger)columnIndex { // If processing is already in action, wait for it to complete [self _loopWhileWorking]; @@ -228,7 +228,7 @@ [self updateInformationForCurrentTable]; } } - return [columns objectAtIndex:index]; + return [columns objectAtIndex:columnIndex]; } /** @@ -401,7 +401,7 @@ [columns addObjectsFromArray:[tableData objectForKey:@"columns"]]; enumerator = [columns objectEnumerator]; - while (columnData = [enumerator nextObject]) { + while ((columnData = [enumerator nextObject])) { [columnNames addObject:[NSString stringWithString:[columnData objectForKey:@"name"]]]; } @@ -440,7 +440,7 @@ [columns addObjectsFromArray:[viewData objectForKey:@"columns"]]; enumerator = [columns objectEnumerator]; - while (columnData = [enumerator nextObject]) { + while ((columnData = [enumerator nextObject])) { [columnNames addObject:[NSString stringWithString:[columnData objectForKey:@"name"]]]; } @@ -642,7 +642,7 @@ [fieldsParser setString:[[parts objectAtIndex:7] stringByTrimmingCharactersInSet:bracketSet]]; [constraintDetails setObject:[fieldsParser unquotedString] forKey:@"ref_columns"]; - NSInteger nextOffs = 12; + NSUInteger nextOffs = 12; if( [parts count] > 8 ) { // NOTE: this won't get SET NULL | NO ACTION | RESTRICT if( [[parts objectAtIndex:9] hasPrefix:@"UPDATE"] ) { @@ -674,7 +674,7 @@ } } } - if( [parts count] > nextOffs - 1 ) { + if ([parts count] > nextOffs - 1) { if( [NSArrayObjectAtIndex(parts, nextOffs) hasPrefix:@"UPDATE"] ) { if( [NSArrayObjectAtIndex(parts, nextOffs+1) hasPrefix:@"SET"] ) { [constraintDetails setObject:@"SET NULL" @@ -1069,7 +1069,7 @@ if (triggers) [triggers release]; triggers = [[NSMutableArray alloc] init]; - for (int i=0; i<[theResult numOfRows]; i++) { + for (NSUInteger i=0; i<[theResult numOfRows]; i++) { [triggers addObject:[theResult fetchRowAsDictionary]]; } @@ -1095,7 +1095,7 @@ NSMutableDictionary *fieldDetails = [[NSMutableDictionary alloc] init]; NSMutableArray *detailParts; NSString *detailString; - NSInteger i, definitionPartsIndex = 0, partsArrayLength; + NSUInteger i, definitionPartsIndex = 0, partsArrayLength; NSCharacterSet *whitespaceCharacterSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; @@ -1306,7 +1306,7 @@ MCPResult *r; NSArray *resultRow; - NSInteger i; + NSUInteger i; NSMutableArray *keyColumns = [NSMutableArray array]; // select all columns that are primary keys diff --git a/Source/SPTableRelations.h b/Source/SPTableRelations.h index 1658861b..3fbef811 100644 --- a/Source/SPTableRelations.h +++ b/Source/SPTableRelations.h @@ -65,11 +65,14 @@ - (IBAction)selectReferenceTable:(id)sender; - (IBAction)refreshRelations:(id)sender; +- (void)tableSelectionChanged:(NSNotification *)notification; + // Task interaction - (void)startDocumentTaskForTab:(NSNotification *)aNotification; - (void)endDocumentTaskForTab:(NSNotification *)aNotification; // Other - (NSArray *)relationDataForPrinting; +- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo; @end diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index b7a4bde6..fb833d94 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -176,7 +176,7 @@ [result dataSeek:0]; - for (NSInteger i = 0; i < [result numOfRows]; i++) + for (NSUInteger i = 0; i < [result numOfRows]; i++) { [refTablePopUpButton addItemWithTitle:[[result fetchRowAsArray] objectAtIndex:0]]; } @@ -358,16 +358,16 @@ [headings release]; // Get the relation data - for (NSDictionary *relation in relationData) + for (NSDictionary *eachRelation in relationData) { NSMutableArray *temp = [[NSMutableArray alloc] init]; - [temp addObject:[relation objectForKey:@"name"]]; - [temp addObject:[relation objectForKey:@"columns"]]; - [temp addObject:[relation objectForKey:@"fk_table"]]; - [temp addObject:[relation objectForKey:@"fk_columns"]]; - [temp addObject:([relation objectForKey:@"on_update"]) ? [relation objectForKey:@"on_update"] : @""]; - [temp addObject:([relation objectForKey:@"on_delete"]) ? [relation objectForKey:@"on_delete"] : @""]; + [temp addObject:[eachRelation objectForKey:@"name"]]; + [temp addObject:[eachRelation objectForKey:@"columns"]]; + [temp addObject:[eachRelation objectForKey:@"fk_table"]]; + [temp addObject:[eachRelation objectForKey:@"fk_columns"]]; + [temp addObject:([eachRelation objectForKey:@"on_update"]) ? [eachRelation objectForKey:@"on_update"] : @""]; + [temp addObject:([eachRelation objectForKey:@"on_delete"]) ? [eachRelation objectForKey:@"on_delete"] : @""]; [data addObject:temp]; diff --git a/Source/SPTableStructure.h b/Source/SPTableStructure.h index c7b47e1a..a08ddd15 100644 --- a/Source/SPTableStructure.h +++ b/Source/SPTableStructure.h @@ -25,13 +25,13 @@ #import <MCPKit/MCPKit.h> -@class SPTableFieldValidation; +@class SPDatabaseDocument, SPTableFieldValidation; @interface SPTableStructure : NSObject { IBOutlet id tablesListInstance; IBOutlet id tableDataInstance; - IBOutlet id tableDocumentInstance; + IBOutlet SPDatabaseDocument *tableDocumentInstance; IBOutlet id tableInfoInstance; IBOutlet id extendedTableInfoInstance; IBOutlet id indexesController; @@ -57,7 +57,7 @@ IBOutlet NSButton *indexesShowButton; IBOutlet id viewColumnsMenu; - IBOutlet id encodingPopupCell; + IBOutlet NSPopUpButtonCell *encodingPopupCell; MCPConnection *mySQLConnection; MCPResult *tableSourceResult; @@ -89,7 +89,9 @@ - (IBAction)addField:(id)sender; - (IBAction)copyField:(id)sender; - (IBAction)removeField:(id)sender; +- (void)removeFieldSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (IBAction)resetAutoIncrement:(id)sender; +- (void)resetAutoincrementSheetDidEnd:(NSWindow *)theSheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (IBAction)showOptimizedFieldType:(id)sender; - (IBAction)toggleColumnView:(id)sender; - (BOOL)cancelRowEditing; @@ -102,6 +104,7 @@ - (NSArray *)fetchResultAsArray:(MCPResult *)theResult; - (BOOL)saveRowOnDeselect; - (BOOL)addRowToDB; +- (void)addRowErrorSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (void)setAutoIncrementTo:(NSString*)valueAsString; // Accessors diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index ebcb2bc6..904e4517 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -25,13 +25,16 @@ #import "SPTableStructure.h" #import "SPDatabaseDocument.h" +#import "SPDatabaseViewController.h" #import "SPTableInfo.h" #import "SPTablesList.h" #import "SPTableData.h" +#import "SPDatabaseData.h" #import "SPSQLParser.h" #import "SPAlertSheets.h" #import "SPIndexesController.h" #import "RegexKitLite.h" +#import "SPTableFieldValidation.h" @interface SPTableStructure (PrivateAPI) @@ -279,7 +282,7 @@ } selectedIndex++; // due to leading @"" in popup list } - [theField setObject:[NSNumber numberWithInt:selectedIndex] forKey:@"encoding"]; + [theField setObject:[NSNumber numberWithInteger:selectedIndex] forKey:@"encoding"]; selectedIndex = 0; if([fieldEncoding length] && [theField objectForKey:@"collation"]) { NSArray *theCollations = [databaseDataInstance getDatabaseCollationsForEncoding:fieldEncoding]; @@ -294,7 +297,7 @@ } selectedIndex++; // due to leading @"" in popup list } - [theField setObject:[NSNumber numberWithInt:selectedIndex] forKey:@"collation"]; + [theField setObject:[NSNumber numberWithInteger:selectedIndex] forKey:@"collation"]; NSString *type = [[theField objectForKey:@"type"] uppercaseString]; @@ -530,7 +533,7 @@ if([[col identifier] isEqualToString:columnIdentifierName]) { [col setHidden:([sender state] == NSOffState) ? NO : YES]; - [sender setState:![sender state]]; + [(NSMenuItem *)sender setState:![sender state]]; break; } @@ -582,9 +585,9 @@ // Check whether a save of the current row is required. if (![self saveRowOnDeselect]) return; - NSInteger index = [tableSourceView selectedRow]; + NSInteger anIndex = [tableSourceView selectedRow]; - if ((index == -1) || (index > ([tableFields count] - 1))) return; + if ((anIndex == -1) || (anIndex > (NSInteger)([tableFields count] - 1))) return; // Check if the user tries to delete the last defined field in table // Note that because of better menu item validation, this check will now never evaluate to true. @@ -601,7 +604,7 @@ } - NSString *field = [[tableFields objectAtIndex:index] objectForKey:@"name"]; + NSString *field = [[tableFields objectAtIndex:anIndex] objectForKey:@"name"]; BOOL hasForeignKey = NO; NSString *referencedTable = @""; @@ -689,7 +692,7 @@ if (returnCode == NSAlertDefaultReturn) { [tableDocumentInstance startTaskWithDescription:NSLocalizedString(@"Removing field...", @"removing field task status message")]; - NSNumber *removeKey = [NSNumber numberWithBool:[contextInfo hasSuffix:@"AndForeignKey"]]; + NSNumber *removeKey = [NSNumber numberWithBool:[(NSString *)contextInfo hasSuffix:@"AndForeignKey"]]; if ([NSThread isMainThread]) { [NSThread detachNewThreadSelector:@selector(_removeFieldAndForeignKey:) toTarget:self withObject:removeKey]; @@ -798,11 +801,11 @@ */ - (NSArray *)fetchResultAsArray:(MCPResult *)theResult { - NSUInteger numOfRows = [theResult numOfRows]; + NSUInteger numOfRows = (NSUInteger)[theResult numOfRows]; NSMutableArray *tempResult = [NSMutableArray arrayWithCapacity:numOfRows]; NSMutableDictionary *tempRow; NSArray *keys; - NSInteger i; + NSUInteger i; id prefsNullValue = [prefs objectForKey:SPNullValue]; // Ensure table information is returned as strings to avoid problems with some server versions @@ -922,7 +925,7 @@ [queryString appendString:@"\n DEFAULT NULL "]; } } - else if (![[theRow objectForKey:@"default"] length]) { + else if (![(NSString *)[theRow objectForKey:@"default"] length]) { ; } // Otherwise, use the provided default @@ -1003,12 +1006,12 @@ } // If the field is of type BIT, permit the use of single qoutes and also don't quote the default value. // For example, use DEFAULT b'1' as opposed to DEFAULT 'b\'1\'' which results in an error. - else if ([[theRow objectForKey:@"default"] length] && [theRowType isEqualToString:@"BIT"]) { + else if ([(NSString *)[theRow objectForKey:@"default"] length] && [theRowType isEqualToString:@"BIT"]) { [queryString appendFormat:@"\n DEFAULT %@", [theRow objectForKey:@"default"]]; } // Suppress appending DEFAULT clause for any numerics, date, time fields if default is empty to avoid error messages; // also don't specify a default for TEXT/BLOB or geometry fields to avoid strict mode errors - else if (![[theRow objectForKey:@"default"] length] && ([fieldValidation isFieldTypeNumeric:theRowType] || [fieldValidation isFieldTypeDate:theRowType] || [theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeGeometry:theRowType])) { + else if (![(NSString *)[theRow objectForKey:@"default"] length] && ([fieldValidation isFieldTypeNumeric:theRowType] || [fieldValidation isFieldTypeDate:theRowType] || [theRowType hasSuffix:@"TEXT"] || [theRowType hasSuffix:@"BLOB"] || [fieldValidation isFieldTypeGeometry:theRowType])) { ; } // Otherwise, use the provided default @@ -1023,14 +1026,14 @@ } // Any column comments - if ([[theRow objectForKey:@"comment"] length]) { + if ([(NSString *)[theRow objectForKey:@"comment"] length]) { [queryString appendFormat:@"\n COMMENT '%@'", [mySQLConnection prepareString:[theRow objectForKey:@"comment"]]]; } if (!isEditingNewRow) { // Unparsed details - column formats, storage, reference definitions - if ([[theRow objectForKey:@"unparsed"] length]) { + if ([(NSString *)[theRow objectForKey:@"unparsed"] length]) { [queryString appendFormat:@"\n %@", [theRow objectForKey:@"unparsed"]]; } } @@ -1048,16 +1051,16 @@ // UNSIGNED keyword. NSRange range = [queryString rangeOfString:[NSString stringWithFormat:@"%@ %@", [[theRow objectForKey:@"name"] backtickQuotedString], theRowType] options:NSLiteralSearch]; - NSInteger index = (range.location + range.length); + NSInteger insertionIndex = (range.location + range.length); // If the field definition's data type includes the length then we must take this into // account when inserting the UNSIGNED keyword. Add 2 to the index to accommodate the // parentheses used. if (fieldDefIncludesLen) { - index += ([[theRow objectForKey:@"length"] length] + 2); + insertionIndex += ([(NSString *)[theRow objectForKey:@"length"] length] + 2); } - [queryString insertString:@" UNSIGNED" atIndex:index]; + [queryString insertString:@" UNSIGNED" atIndex:insertionIndex]; } // Add AFTER ... only if the user added a new field @@ -1099,7 +1102,7 @@ [tableDocumentInstance setContentRequiresReload:YES]; // Query the structure of all databases in the background - [NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:mySQLConnection withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", selectedTable, @"affectedItem", [NSNumber numberWithInt:[tablesListInstance tableType]], @"affectedItemType", nil]]; + [NSThread detachNewThreadSelector:@selector(queryDbStructureWithUserInfo:) toTarget:mySQLConnection withObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", selectedTable, @"affectedItem", [NSNumber numberWithInteger:[tablesListInstance tableType]], @"affectedItemType", nil]]; return YES; } @@ -1353,7 +1356,7 @@ */ - (NSDictionary *)tableSourceForPrinting { - NSInteger i, j; + NSUInteger i, j; NSMutableArray *tempResult = [NSMutableArray array]; NSMutableArray *tempResult2 = [NSMutableArray array]; @@ -1397,22 +1400,22 @@ } for (i = 0; i < [indexesQueryResult numOfRows]; i++) { - NSMutableArray *index = [[indexesQueryResult fetchRowAsArray] mutableCopy]; + NSMutableArray *eachIndex = [[indexesQueryResult fetchRowAsArray] mutableCopy]; // Remove the 'table' column values - [index removeObjectAtIndex:0]; + [eachIndex removeObjectAtIndex:0]; // For every NULL value replace it with the user's NULL value placeholder so we can actually print it - for (j = 0; j < [index count]; j++) + for (j = 0; j < [eachIndex count]; j++) { - if ([[index objectAtIndex:j] isNSNull]) { - [index replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; + if ([[eachIndex objectAtIndex:j] isNSNull]) { + [eachIndex replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; } } - [tempResult2 addObject:index]; + [tempResult2 addObject:eachIndex]; - [index release]; + [eachIndex release]; } CFRelease(escapedNullValue); diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h index e82903b2..7d486525 100644 --- a/Source/SPTablesList.h +++ b/Source/SPTablesList.h @@ -96,7 +96,7 @@ NSMutableArray *filteredTables; NSMutableArray *tableTypes; NSMutableArray *filteredTableTypes; - NSInteger selectedTableType; + SPTableType selectedTableType; NSString *selectedTableName; BOOL isTableListFiltered; BOOL tableListIsSelectable; @@ -124,7 +124,6 @@ // Additional methods - (void)setConnection:(MCPConnection *)theConnection; -- (void)doPerformQueryService:(NSString *)query; - (void)setSelectionState:(NSDictionary *)selectionDetails; - (void)selectTableAtIndex:(NSNumber *)row; - (void)makeTableListFilterHaveFocus; @@ -134,7 +133,7 @@ - (NSArray *)selectedTableItems; - (NSArray *)selectedTableTypes; - (NSString *)tableName; -- (NSInteger)tableType; +- (SPTableType)tableType; - (NSArray *)tables; - (NSArray *)tableTypes; - (NSArray *)allTableAndViewNames; @@ -147,8 +146,6 @@ - (NSString *)selectedDatabase; // Setters -- (void)setContentRequiresReload:(BOOL)reload; -- (void)setStatusRequiresReload:(BOOL)reload; - (BOOL)selectItemWithName:(NSString *)theName; - (BOOL)selectItemsWithNames:(NSArray *)theNames; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index cc840e30..3d87fcc7 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -38,6 +38,8 @@ #import "SPNavigatorController.h" #import "SPHistoryController.h" #import "SPServerSupport.h" +#import "SPWindowController.h" +#import "SPAppController.h" @interface SPTablesList (PrivateAPI) @@ -252,7 +254,7 @@ tableListIsSelectable = previousTableListIsSelectable; if (selectedTableName) [selectedTableName release]; selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemToReselect]]; - selectedTableType = [[tableTypes objectAtIndex:itemToReselect] integerValue]; + selectedTableType = (SPTableType)[[tableTypes objectAtIndex:itemToReselect] integerValue]; } else { if (selectedTableName) [selectedTableName release]; @@ -829,7 +831,7 @@ // If a new selection has been provided, store variables and update the interface to match NSString *selectedItemName = [selectionDetails objectForKey:@"name"]; - NSInteger selectedItemType = [[selectionDetails objectForKey:@"type"] integerValue]; + SPTableType selectedItemType = (SPTableType)[[selectionDetails objectForKey:@"type"] integerValue]; // Update the selected table name and type if (selectedTableName) [selectedTableName release]; @@ -837,7 +839,7 @@ selectedTableType = selectedItemType; // Remove the "current selection" item for filtered lists if appropriate - if (isTableListFiltered && [tablesListView selectedRow] < [filteredTables count] - 2 && [filteredTables count] > 2 + if (isTableListFiltered && [tablesListView selectedRow] < (NSInteger)[filteredTables count] - 2 && [filteredTables count] > 2 && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] integerValue] == SPTableTypeNone && [[filteredTables objectAtIndex:[filteredTables count]-2] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")]) { @@ -1066,7 +1068,7 @@ /** * Returns the currently selected table type, or -1 if no table or multiple tables are selected */ -- (NSInteger) tableType +- (SPTableType) tableType { return selectedTableType; } @@ -1179,8 +1181,8 @@ */ - (BOOL)selectItemWithName:(NSString *)theName { - NSInteger i, tableType; - NSInteger itemIndex = NSNotFound; + NSUInteger i; + NSInteger tableType, itemIndex = NSNotFound; NSInteger caseInsensitiveItemIndex = NSNotFound; // Loop through the unfiltered tables/views to find the desired item @@ -1212,7 +1214,7 @@ [tablesListView deselectAll:nil]; if (selectedTableName) [selectedTableName release]; selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemIndex]]; - selectedTableType = [[tableTypes objectAtIndex:itemIndex] integerValue]; + selectedTableType = (SPTableType)[[tableTypes objectAtIndex:itemIndex] integerValue]; [self updateFilter:self]; [tableDocumentInstance loadTable:selectedTableName ofType:selectedTableType]; } @@ -1229,7 +1231,8 @@ */ - (BOOL)selectItemsWithNames:(NSArray *)theNames { - NSInteger i, tableType; + NSUInteger i; + NSInteger tableType; NSMutableIndexSet *selectionIndexSet = [NSMutableIndexSet indexSet]; // Loop through the unfiltered tables/views to find the desired item @@ -1282,7 +1285,7 @@ // During imports the table view sometimes appears to request items beyond the end of the array. // Using a hinted noteNumberOfRowsChanged after dropping tables fixes this but then seems to stick // even after override, so check here for the time being and display empty rows during import. - if (rowIndex >= [filteredTables count]) return @""; + if (rowIndex >= (NSInteger)[filteredTables count]) return @""; return [filteredTables objectAtIndex:rowIndex]; } @@ -1427,7 +1430,7 @@ // Perform no action if the selected table hasn't actually changed - reselection etc NSString *newName = [filteredTables objectAtIndex:selectedRowIndex]; - NSInteger newType = [[filteredTableTypes objectAtIndex:selectedRowIndex] integerValue]; + SPTableType newType = (SPTableType)[[filteredTableTypes objectAtIndex:selectedRowIndex] integerValue]; if ([selectedTableName isEqualToString:newName] && selectedTableType == newType) { return; } @@ -1479,7 +1482,7 @@ - (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(NSInteger)rowIndex { // For empty tables - title still present - or while lists are being altered - if (rowIndex >= [filteredTableTypes count]) return (rowIndex == 0 ); + if (rowIndex >= (NSInteger)[filteredTableTypes count]) return (rowIndex == 0 ); return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone ); } @@ -1489,7 +1492,7 @@ */ - (void)tableView:(NSTableView *)aTableView willDisplayCell:(ImageAndTextCell*)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - if (rowIndex > 0 && rowIndex < [filteredTableTypes count] && [[aTableColumn identifier] isEqualToString:@"tables"]) { + if (rowIndex > 0 && rowIndex < (NSInteger)[filteredTableTypes count] && [[aTableColumn identifier] isEqualToString:@"tables"]) { id item = NSArrayObjectAtIndex(filteredTables, rowIndex); @@ -1669,7 +1672,8 @@ filteredTables = [[NSMutableArray alloc] init]; filteredTableTypes = [[NSMutableArray alloc] init]; - NSInteger i, lastTableType = NSNotFound, tableType; + NSUInteger i; + NSInteger lastTableType = NSNotFound, tableType; NSRange substringRange; for (i = 0; i < [tables count]; i++) { tableType = [[tableTypes objectAtIndex:i] integerValue]; @@ -1723,7 +1727,7 @@ } // Reselect correct row and reload the table view display - if ([tablesListView numberOfRows] < [filteredTables count]) [tablesListView noteNumberOfRowsChanged]; + if ([tablesListView numberOfRows] < (NSInteger)[filteredTables count]) [tablesListView noteNumberOfRowsChanged]; if (selectedTableName) [tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[filteredTables indexOfObject:selectedTableName]] byExtendingSelection:NO]; [tablesListView reloadData]; } @@ -1734,7 +1738,7 @@ */ - (void) selectTableAtIndex:(NSNumber *)row { - NSInteger rowIndex = [row integerValue]; + NSUInteger rowIndex = [row unsignedIntegerValue]; if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone) return; @@ -2048,12 +2052,12 @@ // Table creation was successful - insert the new item into the tables list and select it. NSInteger addItemAtIndex = NSNotFound; - for (NSInteger i = 0; i < [tables count]; i++) + for (NSUInteger i = 0; i < [tables count]; i++) { - NSInteger tableType = [[tableTypes objectAtIndex:i] integerValue]; + NSInteger eachTableType = [[tableTypes objectAtIndex:i] integerValue]; - if (tableType == SPTableTypeNone) continue; - if (tableType == SPTableTypeProc || tableType == SPTableTypeFunc) { + if (eachTableType == SPTableTypeNone) continue; + if (eachTableType == SPTableTypeProc || eachTableType == SPTableTypeFunc) { addItemAtIndex = (i - 1); break; } @@ -2119,7 +2123,7 @@ BOOL copyTableContent = ([copyTableContentSwitch state] == NSOnState); - NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue]; + SPTableType tblType = (SPTableType)[[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue]; // Set up the table type and whether content can be duplicated. The table type is used // in queries and should not be localized. @@ -2140,6 +2144,8 @@ tableType = @"function"; [copyTableContentSwitch setEnabled:NO]; break; + default: + break; } // Get table/view structure @@ -2247,7 +2253,7 @@ // Insert the new item into the tables list and select it. NSInteger addItemAtIndex = NSNotFound; - for (NSInteger i = 0; i < [tables count]; i++) { + for (NSUInteger i = 0; i < [tables count]; i++) { NSInteger theTableType = [[tableTypes objectAtIndex:i] integerValue]; if (theTableType == SPTableTypeNone) continue; if ((theTableType == SPTableTypeView || theTableType == SPTableTypeTable) @@ -2339,6 +2345,7 @@ switch (tableType){ case SPTableTypeProc: stringTableType = @"PROCEDURE"; break; case SPTableTypeFunc: stringTableType = @"FUNCTION"; break; + default: break; } MCPResult *theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE %@ %@", stringTableType, [oldTableName backtickQuotedString] ] ]; diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m index 5a0a2a2e..30f73cc8 100644 --- a/Source/SPTooltip.m +++ b/Source/SPTooltip.m @@ -208,7 +208,7 @@ static CGFloat slow_in_out (CGFloat t) [webPreferences setJavaScriptEnabled:YES]; NSString *fontName = ([displayOptions objectForKey:@"fontname"]) ? [displayOptions objectForKey:@"fontname"] : @"Lucida Grande"; - NSInteger fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] integerValue] : 10; + int fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] integerValue] : 10; if(fontSize < 5) fontSize = 5; NSFont* font = [NSFont fontWithName:fontName size:fontSize]; |