From 2baa01621f83df3c81e6b6ed2310d483962dcf48 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 7 Mar 2011 20:36:00 +0000 Subject: Merge in missing commit from trunk. --- Source/SPAppController.h | 1 + Source/SPAppController.m | 71 +++++++++++++-------------- Source/SPCustomQuery.h | 1 + Source/SPCustomQuery.m | 52 +++++++++++--------- Source/SPGrowlController.m | 2 +- Source/SPStringAdditions.h | 2 +- Source/SPStringAdditions.m | 2 +- Source/SPTableContent.h | 7 ++- Source/SPTableContent.m | 120 ++++++++++++++++++++++++--------------------- 9 files changed, 136 insertions(+), 122 deletions(-) (limited to 'Source') diff --git a/Source/SPAppController.h b/Source/SPAppController.h index 569ef2b8..fe80e2d9 100644 --- a/Source/SPAppController.h +++ b/Source/SPAppController.h @@ -111,6 +111,7 @@ - (NSArray*)runningActivities; - (void)handleEventWithURL:(NSURL*)url; +- (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike; - (IBAction)executeBundleItemForApp:(id)sender; - (NSDictionary*)shellEnvironmentForDocument:(NSString*)docUUID; diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 4424e9a9..454e3401 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -333,7 +333,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); SPWindowController *frontController = nil; - for (NSWindow *aWindow in [self orderedWindows]) { + for (NSWindow *aWindow in [NSApp orderedWindows]) { if ([[aWindow windowController] isMemberOfClass:[SPWindowController class]]) { frontController = [aWindow windowController]; break; @@ -568,11 +568,11 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSInteger answer = [alert runModal]; if(answer == NSAlertDefaultReturn) { NSError *error = nil; - NSString *removePath = [[[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"path"] substringToIndex:([[[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"path"] length]-[SPBundleFileName length]-1)]; + NSString *removePath = [[[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"path"] substringToIndex:([(NSString *)[[installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]] objectForKey:@"path"] length]-[SPBundleFileName length]-1)]; NSString *moveToTrashCommand = [NSString stringWithFormat:@"osascript -e 'tell application \"Finder\" to move (POSIX file \"%@\") to the trash'", removePath]; [moveToTrashCommand runBashCommandWithEnvironment:nil atCurrentDirectoryPath:nil error:&error]; if(error != nil) { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while moving “%@” to Trash.", @"Open Files : Bundle : Already-Installed : Delete-Old-Error : Could not delete old bundle before installing new version."), removePath] + alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while moving “%@” to Trash.", @"Open Files : Bundle : Already-Installed : Delete-Old-Error : Could not delete old bundle before installing new version."), removePath] defaultButton:NSLocalizedString(@"OK", @"Open Files : Bundle : Already-Installed : Delete-Old-Error : OK button") alternateButton:nil otherButton:nil @@ -677,7 +677,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); } if(![status writeToFile:statusFileName atomically:YES encoding:NSUTF8StringEncoding error:nil]) { NSBeep(); - SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self parentWindow], self, nil, nil, + SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self frontDocumentWindow], self, nil, nil, NSLocalizedString(@"Status file for sequelpro url scheme command couldn't be written!", @"status file for sequelpro url scheme command couldn't be written error message")); } [result writeToFile:resultFileName atomically:YES encoding:NSUTF8StringEncoding error:nil]; @@ -723,7 +723,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); BOOL succeed = [status writeToFile:statusFileName atomically:YES encoding:NSUTF8StringEncoding error:nil]; if(!succeed) { NSBeep(); - SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self parentWindow], self, nil, nil, + SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self frontDocumentWindow], self, nil, nil, NSLocalizedString(@"Status file for sequelpro url scheme command couldn't be written!", @"status file for sequelpro url scheme command couldn't be written error message")); } return; @@ -911,9 +911,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); { NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeGeneral]; - if(idx >=0 && idx < [bundleItems count]) { - infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; + NSArray *scopeBundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeGeneral]; + if(idx >=0 && idx < (NSInteger)[scopeBundleItems count]) { + infoPath = [[scopeBundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; } else { if([sender tag] == 0 && [[sender toolTip] length]) { infoPath = [sender toolTip]; @@ -941,11 +941,9 @@ YY_BUFFER_STATE yy_scan_string (const char *); if (cmdData) [cmdData release]; return; } else { - if([cmdData objectForKey:SPBundleFileCommandKey] && [[cmdData objectForKey:SPBundleFileCommandKey] length]) { + if([cmdData objectForKey:SPBundleFileCommandKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCommandKey] length]) { NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey]; - NSString *inputAction = @""; - NSString *inputFallBackAction = @""; NSError *err = nil; NSString *uuid = [NSString stringWithNewUUID]; NSString *bundleInputFilePath = [NSString stringWithFormat:@"%@_%@", SPBundleTaskInputFilePath, uuid]; @@ -969,7 +967,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); if(inputFileError != nil) { NSString *errorMessage = [inputFileError localizedDescription]; - SPBeginAlertSheet(NSLocalizedString(@"Bundle Error", @"bundle error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, + SPBeginAlertSheet(NSLocalizedString(@"Bundle Error", @"bundle error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self frontDocumentWindow], self, nil, nil, [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), [cmdData objectForKey:@"name"], errorMessage]); if (cmdData) [cmdData release]; return; @@ -988,7 +986,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); [[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil]; NSString *action = SPBundleOutputActionNone; - if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length]) + if([cmdData objectForKey:SPBundleFileOutputActionKey] && [(NSString *)[cmdData objectForKey:SPBundleFileOutputActionKey] length]) action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString]; // Redirect due exit code @@ -1249,7 +1247,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); { SPWindowController *frontController = nil; - for (NSWindow *aWindow in [self orderedWindows]) { + for (NSWindow *aWindow in [NSApp orderedWindows]) { if ([[aWindow windowController] isMemberOfClass:[SPWindowController class]]) { frontController = [aWindow windowController]; break; @@ -1299,7 +1297,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); */ - (NSWindow *) frontDocumentWindow { - for (NSWindow *aWindow in [self orderedWindows]) { + for (NSWindow *aWindow in [NSApp orderedWindows]) { if ([[aWindow windowController] isMemberOfClass:[SPWindowController class]]) { return aWindow; } @@ -1366,7 +1364,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); */ - (SPDatabaseDocument *) frontDocument { - for (NSWindow *aWindow in [self orderedWindows]) { + for (NSWindow *aWindow in [NSApp orderedWindows]) { if ([[aWindow windowController] isMemberOfClass:[SPWindowController class]]) { return [[aWindow windowController] selectedTableDocument]; } @@ -1596,13 +1594,13 @@ YY_BUFFER_STATE yy_scan_string (const char *); if((![cmdData objectForKey:SPBundleFileDisabledKey] || ![[cmdData objectForKey:SPBundleFileDisabledKey] intValue]) && [cmdData objectForKey:SPBundleFileNameKey] - && [[cmdData objectForKey:SPBundleFileNameKey] length] + && [(NSString *)[cmdData objectForKey:SPBundleFileNameKey] length] && [cmdData objectForKey:SPBundleFileScopeKey]) { BOOL defaultBundleWasUpdated = NO; - if([cmdData objectForKey:SPBundleFileUUIDKey] && [[cmdData objectForKey:SPBundleFileUUIDKey] length]) { + if([cmdData objectForKey:SPBundleFileUUIDKey] && [(NSString *)[cmdData objectForKey:SPBundleFileUUIDKey] length]) { if(processDefaultBundles) { @@ -1625,9 +1623,8 @@ YY_BUFFER_STATE yy_scan_string (const char *); if([installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]]) { NSString *oldPath = [NSString stringWithFormat:@"%@/%@/%@", [bundlePaths objectAtIndex:0], bundle, SPBundleFileName]; - NSError *readError = nil; - NSString *convError = nil; - NSPropertyListFormat format; + readError = nil; + convError = nil; NSDictionary *cmdDataOld = nil; NSData *pDataOld = [NSData dataWithContentsOfFile:oldPath options:NSUncachedRead error:&readError]; @@ -1667,7 +1664,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); [dupData removeObjectForKey:SPBundleFileIsDefaultBundleKey]; [dupData writeToFile:duplicatedBundleCommand atomically:YES]; - NSError *error = nil; + error = nil; NSString *moveToTrashCommand = [NSString stringWithFormat:@"osascript -e 'tell application \"Finder\" to move (POSIX file \"%@\") to the trash'", oldBundle]; [moveToTrashCommand runBashCommandWithEnvironment:nil atCurrentDirectoryPath:nil error:&error]; @@ -1703,7 +1700,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSString *newPath = [NSString stringWithFormat:@"%@/%@", [bundlePaths objectAtIndex:0], bundle]; if([fm fileExistsAtPath:newPath isDirectory:&isDir] && isDir) newPath = [NSString stringWithFormat:@"%@_%ld", newPath, (NSUInteger)(random() % 35000)]; - NSError *error = nil; + error = nil; [fm copyItemAtPath:orgPath toPath:newPath error:&error]; if(error != nil) { NSBeep(); @@ -1740,7 +1737,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); [bundleCategories setObject:[NSMutableArray array] forKey:scope]; [bundleKeyEquivalents setObject:[NSMutableDictionary dictionary] forKey:scope]; } - if([cmdData objectForKey:SPBundleFileCategoryKey] && [[cmdData objectForKey:SPBundleFileCategoryKey] length] && ![[bundleCategories objectForKey:scope] containsObject:[cmdData objectForKey:SPBundleFileCategoryKey]]) + if([cmdData objectForKey:SPBundleFileCategoryKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCategoryKey] length] && ![[bundleCategories objectForKey:scope] containsObject:[cmdData objectForKey:SPBundleFileCategoryKey]]) [[bundleCategories objectForKey:scope] addObject:[cmdData objectForKey:SPBundleFileCategoryKey]]; NSMutableDictionary *aDict = [NSMutableDictionary dictionary]; @@ -1759,7 +1756,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); } // Register key equivalent - if([cmdData objectForKey:SPBundleFileKeyEquivalentKey] && [[cmdData objectForKey:SPBundleFileKeyEquivalentKey] length]) { + if([cmdData objectForKey:SPBundleFileKeyEquivalentKey] && [(NSString *)[cmdData objectForKey:SPBundleFileKeyEquivalentKey] length]) { NSString *theKey = [cmdData objectForKey:SPBundleFileKeyEquivalentKey]; NSString *theChar = [theKey substringFromIndex:[theKey length]-1]; @@ -1784,13 +1781,13 @@ YY_BUFFER_STATE yy_scan_string (const char *); [aDict setObject:[NSArray arrayWithObjects:theChar, [NSNumber numberWithInteger:mask], nil] forKey:SPBundleInternKeyEquivalentKey]; } - if([cmdData objectForKey:SPBundleFileTooltipKey] && [[cmdData objectForKey:SPBundleFileTooltipKey] length]) + if([cmdData objectForKey:SPBundleFileTooltipKey] && [(NSString *)[cmdData objectForKey:SPBundleFileTooltipKey] length]) [aDict setObject:[cmdData objectForKey:SPBundleFileTooltipKey] forKey:SPBundleFileTooltipKey]; - if([cmdData objectForKey:SPBundleFileCategoryKey] && [[cmdData objectForKey:SPBundleFileCategoryKey] length]) + if([cmdData objectForKey:SPBundleFileCategoryKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCategoryKey] length]) [aDict setObject:[cmdData objectForKey:SPBundleFileCategoryKey] forKey:SPBundleFileCategoryKey]; - if([cmdData objectForKey:SPBundleFileKeyEquivalentKey] && [[cmdData objectForKey:SPBundleFileKeyEquivalentKey] length]) + if([cmdData objectForKey:SPBundleFileKeyEquivalentKey] && [(NSString *)[cmdData objectForKey:SPBundleFileKeyEquivalentKey] length]) [aDict setObject:[cmdData objectForKey:SPBundleFileKeyEquivalentKey] forKey:@"key"]; [[bundleItems objectForKey:scope] addObject:aDict]; @@ -1856,10 +1853,10 @@ YY_BUFFER_STATE yy_scan_string (const char *); BOOL bundleOtherThanGeneralFound = NO; for(NSString* scope in scopes) { - NSArray *bundleCategories = [[NSApp delegate] bundleCategoriesForScope:scope]; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:scope]; + NSArray *scopeBundleCategories = [[NSApp delegate] bundleCategoriesForScope:scope]; + NSArray *scopeBundleItems = [[NSApp delegate] bundleItemsForScope:scope]; - if(![bundleItems count]) { + if(![scopeBundleItems count]) { k++; continue; } @@ -1886,8 +1883,8 @@ YY_BUFFER_STATE yy_scan_string (const char *); // Add found Category submenus NSMutableArray *categorySubMenus = [NSMutableArray array]; NSMutableArray *categoryMenus = [NSMutableArray array]; - if([bundleCategories count]) { - for(NSString* title in bundleCategories) { + if([scopeBundleCategories count]) { + for(NSString* title in scopeBundleCategories) { [categorySubMenus addObject:[[[NSMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""] autorelease]]; [categoryMenus addObject:[[[NSMenu alloc] init] autorelease]]; [bundleMenu addItem:[categorySubMenus lastObject]]; @@ -1896,7 +1893,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); } NSInteger i = 0; - for(NSDictionary *item in bundleItems) { + for(NSDictionary *item in scopeBundleItems) { NSString *keyEq; if([item objectForKey:SPBundleFileKeyEquivalentKey]) @@ -1918,7 +1915,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); ([item objectForKey:@"key"])?:@"", @"key", nil]]; if([item objectForKey:SPBundleFileCategoryKey]) { - [[categoryMenus objectAtIndex:[bundleCategories indexOfObject:[item objectForKey:SPBundleFileCategoryKey]]] addItem:mItem]; + [[categoryMenus objectAtIndex:[scopeBundleCategories indexOfObject:[item objectForKey:SPBundleFileCategoryKey]]] addItem:mItem]; } else { [bundleMenu addItem:mItem]; } @@ -1992,7 +1989,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; [aMenuItem setToolTip:[eq objectForKey:@"path"]]; - [[[NSApp mainWindow] firstResponder] executeBundleItemForInputField:aMenuItem]; + [(SPTextView *)[[NSApp mainWindow] firstResponder] executeBundleItemForInputField:aMenuItem]; } } } else { @@ -2011,7 +2008,7 @@ YY_BUFFER_STATE yy_scan_string (const char *); NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; [aMenuItem setToolTip:[eq objectForKey:@"path"]]; - [[[NSApp mainWindow] firstResponder] executeBundleItemForDataTable:aMenuItem]; + [(SPCopyTable *)[[NSApp mainWindow] firstResponder] executeBundleItemForDataTable:aMenuItem]; } } } else { diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h index 26d0a60c..68969a01 100644 --- a/Source/SPCustomQuery.h +++ b/Source/SPCustomQuery.h @@ -256,6 +256,7 @@ - (NSRange)currentQueryRange; - (NSString *)buildHistoryString; - (void)addHistoryEntry:(NSString *)entryString; +- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(id)contextInfo; - (void)historyItemsHaveBeenUpdated:(id)manager; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 7005e690..7228baa3 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -40,6 +40,8 @@ #import "SPAlertSheets.h" #import "SPCopyTable.h" #import "SPGeometryDataView.h" +#import "SPAppController.h" +#import "SPBundleHTMLOutputController.h" #import @@ -633,10 +635,10 @@ } // Record any affected rows - if ( [mySQLConnection affectedRows] >= 0 ) - totalAffectedRows += [mySQLConnection affectedRows]; + if ( [mySQLConnection affectedRows] >= (my_ulonglong)0 ) + totalAffectedRows += (NSUInteger)[mySQLConnection affectedRows]; else if ( [streamingResult numOfRows] ) - totalAffectedRows += [streamingResult numOfRows]; + totalAffectedRows += (NSUInteger)[streamingResult numOfRows]; [streamingResult release]; @@ -677,7 +679,7 @@ @"runAllContinueStopSheet", NSLocalizedString(@"MySQL Error", @"mysql error message"), [mySQLConnection getLastErrorMessage], - runAllContinueStopSheetReturnCode + &runAllContinueStopSheetReturnCode ); [tableDocumentInstance setTaskIndicatorShouldAnimate:YES]; @@ -1066,7 +1068,7 @@ // Check for a valid index anIndex--; - if(anIndex < 0 || anIndex >= [queries count]) + if(anIndex < 0 || anIndex >= (NSInteger)[queries count]) { [queries release]; return NSMakeRange(NSNotFound, 0); @@ -1230,7 +1232,7 @@ // set the error text [errorText setString:[errorsString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]; - [[errorTextScrollView verticalScroller] setFloatValue:1.0]; + [[errorTextScrollView verticalScroller] setFloatValue:1.0f]; // try to select the line x of the first error if error message with ID 1064 contains "at line x" // by capturing the last number of the error string @@ -1350,7 +1352,7 @@ // Check whether a table update is required, based on whether new rows are // available to display. - if (resultDataCount == queryLoadLastRowCount) { + if (resultDataCount == (NSInteger)queryLoadLastRowCount) { return; } @@ -1527,7 +1529,7 @@ if ([columnDefinition objectForKey:@"org_name"] && [(NSString *)[columnDefinition objectForKey:@"org_name"] length]) { NSNumber *colWidth = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:[NSString stringWithFormat:@"%@@%@", [columnDefinition objectForKey:@"db"], [tableDocumentInstance host]]] objectForKey:[columnDefinition objectForKey:@"org_table"]] objectForKey:[columnDefinition objectForKey:@"org_name"]]; if ( colWidth ) { - [theCol setWidth:[colWidth doubleValue]]; + [theCol setWidth:[colWidth floatValue]]; } } @@ -2246,7 +2248,7 @@ // cases. if (isWorking) { pthread_mutex_lock(&resultDataLock); - if (row < resultDataCount && [[aTableColumn identifier] integerValue] < [resultData columnCount]) { + if (row < resultDataCount && [[aTableColumn identifier] unsignedIntegerValue] < [resultData columnCount]) { theValue = [[SPDataStorageObjectAtRowAndColumn(resultData, row, [[aTableColumn identifier] integerValue]) copy] autorelease]; } pthread_mutex_unlock(&resultDataLock); @@ -2414,12 +2416,12 @@ // 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]) { - if([[[[win delegate] class] description] isEqualToString:@"SPBundleHTMLOutputController"]) { - if([[[win delegate] windowUUID] isEqualToString:uuid]) { + for (id win in [NSApp windows]) { + if ([[[[win delegate] class] description] isEqualToString:@"SPBundleHTMLOutputController"]) { + if ([[[win delegate] windowUUID] isEqualToString:uuid]) { correspondingWindowFound = YES; break; } @@ -2683,6 +2685,7 @@ - (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset { if (sender != queryInfoPaneSplitView) return (offset == 0) ? (proposedMax - 100) : (proposedMax - 73); + return proposedMax; } /* @@ -2691,6 +2694,7 @@ - (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset { if (sender != queryInfoPaneSplitView) return proposedMin + 100; + return proposedMin; } /** @@ -3077,8 +3081,8 @@ } } else { // list all found topics - NSInteger i; - NSInteger r = [theResult numOfRows]; + NSUInteger i; + NSUInteger r = (NSUInteger)[theResult numOfRows]; if (r) [theResult dataSeek:0]; // check if HELP 'contents' is called if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING]) @@ -3280,7 +3284,7 @@ if (![favorite isKindOfClass:[NSDictionary class]] || ![favorite objectForKey:@"name"]) continue; NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [paraStyle setTabStops:[NSArray array]]; - [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0] autorelease]]; + [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] @@ -3304,7 +3308,7 @@ if (![favorite isKindOfClass:[NSDictionary class]] || ![favorite objectForKey:@"name"]) continue; NSMutableParagraphStyle *paraStyle = [[[NSMutableParagraphStyle alloc] init] autorelease]; [paraStyle setTabStops:[NSArray array]]; - [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0] autorelease]]; + [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] @@ -3548,9 +3552,9 @@ } if (data && contextInfo) { - BOOL isFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO; + BOOL isResultFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO; - if(isFieldEditable) { + if(isResultFieldEditable) { [self tableView:customQueryView setObjectValue:[[data copy] autorelease] forTableColumn:[customQueryView tableColumnWithIdentifier:[contextInfo objectForKey:@"column"]] row:row]; } } @@ -3673,7 +3677,7 @@ * cancel the fieldEditor, display the field editor sheet instead for editing * and re-enable the fieldEditor after editing. */ -- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor +- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)aFieldEditor { if(![control isKindOfClass:[SPCopyTable class]]) return YES; @@ -3740,7 +3744,7 @@ if (isBlob || [multipleLineEditingButton state] == NSOnState) { - [customQueryView setFieldEditorSelectedRange:[fieldEditor selectedRange]]; + [customQueryView setFieldEditorSelectedRange:[aFieldEditor selectedRange]]; // Cancel editing [control abortEditing]; @@ -3753,7 +3757,7 @@ } // Set editing color to black for NULL values while editing - [fieldEditor setTextColor:[NSColor blackColor]]; + [aFieldEditor setTextColor:[NSColor blackColor]]; return shouldBeginEditing; @@ -3763,7 +3767,7 @@ * Abort editing of the Favorite and History search field editors if user presses ARROW UP or DOWN * to allow to navigate through the menu item list. */ -- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)command +- (BOOL)control:(NSControl*)control textView:(NSTextView*)aTextView doCommandBySelector:(SEL)command { if(control == queryHistorySearchField || control == queryFavoritesSearchField) { @@ -3786,7 +3790,7 @@ else if([control isKindOfClass:[SPCopyTable class]]) { // Check firstly if SPCopyTable can handle command - if([customQueryView control:control textView:textView doCommandBySelector:(SEL)command]) + if([customQueryView control:control textView:aTextView doCommandBySelector:(SEL)command]) return YES; // Trap the escape key diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m index a3d42526..3f98f41a 100644 --- a/Source/SPGrowlController.m +++ b/Source/SPGrowlController.m @@ -139,7 +139,7 @@ static SPGrowlController *sharedGrowlController = nil; description:description notificationName:name iconData:data - priority:priority + priority:(int)priority isSticky:sticky clickContext:clickContext]; } diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h index 16841a34..72967780 100644 --- a/Source/SPStringAdditions.h +++ b/Source/SPStringAdditions.h @@ -58,7 +58,7 @@ static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedS @interface NSString (SPStringAdditions) + (NSString *)stringForByteSize:(long long)byteSize; -+ (NSString *)stringForTimeInterval:(CGFloat)timeInterval; ++ (NSString *)stringForTimeInterval:(double)timeInterval; + (NSString*)stringWithNewUUID; diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index a762fe61..79546f9a 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -101,7 +101,7 @@ /** * Returns a human readable version string of the supplied time interval. */ -+ (NSString *)stringForTimeInterval:(CGFloat)timeInterval ++ (NSString *)stringForTimeInterval:(double)timeInterval { NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease]; diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h index 4510d9be..6c0f2ab7 100644 --- a/Source/SPTableContent.h +++ b/Source/SPTableContent.h @@ -27,11 +27,11 @@ #import -@class SPCopyTable, SPTextAndLinkCell, SPHistoryController, SPTableInfo, SPDataStorage, SPTextView, SPFieldEditorController; +@class SPDatabaseDocument, SPCopyTable, SPTextAndLinkCell, SPHistoryController, SPTableInfo, SPDataStorage, SPTextView, SPFieldEditorController; @interface SPTableContent : NSObject { - IBOutlet id tableDocumentInstance; + IBOutlet SPDatabaseDocument *tableDocumentInstance; IBOutlet id tablesListInstance; IBOutlet id tableDataInstance; IBOutlet id tableSourceInstance; @@ -172,6 +172,7 @@ - (IBAction)addRow:(id)sender; - (IBAction)copyRow:(id)sender; - (IBAction)removeRow:(id)sender; +- (void)removeRowSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo; // Filter Table - (IBAction)tableFilterClear:(id)sender; @@ -198,6 +199,7 @@ - (IBAction)setCompareTypes:(id)sender; - (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(NSUInteger)targetRowCount; - (BOOL)saveRowToTable; +- (void) addRowErrorSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo; - (NSString *)argumentForRow:(NSInteger)row; - (NSString *)argumentForRow:(NSInteger)row excludingLimits:(BOOL)excludeLimits; - (NSString *)argumentForRow:(NSUInteger)rowIndex ofTable:(NSString *)tableForColumn andDatabase:(NSString *)database includeBlobs:(BOOL)includeBlobs; @@ -208,6 +210,7 @@ - (void)autosizeColumns; - (BOOL)saveRowOnDeselect; - (void)sortTableTaskWithColumn:(NSTableColumn *)tableColumn; +- (void)showErrorSheetWith:(id)error; - (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo; // Retrieving and setting table state diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 4e107570..5f5de871 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -48,6 +48,7 @@ #import "SPTextView.h" #import "SPDatabaseViewController.h" #import "SPAppController.h" +#import "SPBundleHTMLOutputController.h" @interface SPTableContent (Private) - (BOOL)cancelRowEditing; @@ -446,7 +447,7 @@ [tableContentView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; // Add the new columns to the table and filterTable - for ( i = 0 ; i < [dataColumns count] ; i++ ) { + for ( i = 0 ; i < (NSInteger)[dataColumns count] ; i++ ) { columnDefinition = NSArrayObjectAtIndex(dataColumns, i); // Set up the column @@ -457,7 +458,7 @@ [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"length"]] : @"", ([columnDefinition objectForKey:@"values"]) ? [NSString stringWithFormat:@"(\n- %@\n)", [[columnDefinition objectForKey:@"values"] componentsJoinedByString:@"\n- "]] : @"", - ([columnDefinition objectForKey:@"comment"] && [[columnDefinition objectForKey:@"comment"] length]) ? [NSString stringWithFormat:@"\n%@", [[columnDefinition objectForKey:@"comment"] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"]] : @"" + ([columnDefinition objectForKey:@"comment"] && [(NSString *)[columnDefinition objectForKey:@"comment"] length]) ? [NSString stringWithFormat:@"\n%@", [[columnDefinition objectForKey:@"comment"] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"]] : @"" ]]; [theCol setEditable:YES]; @@ -532,7 +533,7 @@ // Set the width of this column to saved value if exists colWidth = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:[NSString stringWithFormat:@"%@@%@", [tableDocumentInstance database], [tableDocumentInstance host]]] objectForKey:[tablesListInstance tableName]] objectForKey:[columnDefinition objectForKey:@"name"]]; if ( colWidth ) { - [theCol setWidth:[colWidth doubleValue]]; + [theCol setWidth:[colWidth floatValue]]; } // Set the column to be reselected for sorting if appropriate @@ -693,8 +694,8 @@ // Ensure the page supplied is within the appropriate limits if (contentPage <= 0) contentPage = 1; - else if (contentPage > 1 && (contentPage - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) - contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); + else if (contentPage > 1 && (NSInteger)(contentPage - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) + contentPage = ceilf((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); // If the result set is from a late page, take a copy of the string to allow resetting limit // if no results are found @@ -757,7 +758,7 @@ if ([prefs boolForKey:SPLimitResults] && (contentPage > 1 - || tableRowsCount == [prefs integerForKey:SPLimitResultsValue])) + || (NSInteger)tableRowsCount == [prefs integerForKey:SPLimitResultsValue])) { isLimited = YES; } else { @@ -944,7 +945,7 @@ return nil; } - if(![filter objectForKey:@"Clause"] || ![[filter objectForKey:@"Clause"] length]) { + if(![filter objectForKey:@"Clause"] || ![(NSString *)[filter objectForKey:@"Clause"] length]) { SPBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [tableDocumentInstance parentWindow], self, nil, nil, NSLocalizedString(@"Content Filter clause is empty.", @"content filter clause is empty tooltip.")); @@ -1198,7 +1199,7 @@ if (tableRowsCount < tableLoadTargetRowCount) { [tableDocumentInstance setTaskPercentage:(tableRowsCount*100/tableLoadTargetRowCount)]; } else if (tableRowsCount >= tableLoadTargetRowCount) { - [tableDocumentInstance setTaskPercentage:100.0]; + [tableDocumentInstance setTaskPercentage:100.0f]; [tableDocumentInstance setTaskProgressToIndeterminateAfterDelay:YES]; tableLoadTargetRowCount = NSUIntegerMax; } @@ -1292,7 +1293,7 @@ if(sender == filterTableFilterButton) activeFilter = 1; - else if([sender isKindOfClass:[NSString class]] && [sender length]) { + else if([sender isKindOfClass:[NSString class]] && [(NSString *)sender length]) { if(schemeFilter) [schemeFilter release], schemeFilter = nil; schemeFilter = [sender retain]; activeFilter = 2; @@ -1310,7 +1311,7 @@ if (![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0) contentPage = 1; else if (([paginationPageField integerValue] - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) - contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); + contentPage = ceilf((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); else contentPage = [paginationPageField integerValue]; @@ -1344,7 +1345,7 @@ previousTableRowsCount = 0; [self clearTableValues]; [self loadTableValues]; - [[tableContentView onMainThread] scrollPoint:NSMakePoint(0.0, 0.0)]; + [[tableContentView onMainThread] scrollPoint:NSMakePoint(0.0f, 0.0f)]; [tableDocumentInstance endTask]; [filterPool drain]; @@ -1357,7 +1358,7 @@ { // Check if user called "Edit Filter…" - if([[compareField selectedItem] tag] == [[contentFilters objectForKey:compareType] count]) { + if([[compareField selectedItem] tag] == (NSInteger)[[contentFilters objectForKey:compareType] count]) { [self openContentFilterManager]; return; } @@ -1432,7 +1433,7 @@ [paginationPageField setIntegerValue:(contentPage - 1)]; [self filterTable:sender]; } else if (sender == paginationNextButton) { - if (contentPage * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) return; + if ((NSInteger)contentPage * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) return; [paginationPageField setIntegerValue:(contentPage + 1)]; [self filterTable:sender]; } @@ -1485,7 +1486,7 @@ */ - (void) updatePaginationState { - NSUInteger maxPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); + NSUInteger maxPage = ceilf((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]); if (isFiltered && !isLimited) { maxPage = contentPage; } @@ -1548,7 +1549,7 @@ [database backtickQuotedString], [tableForColumn backtickQuotedString]]]; [theResult setReturnDataAsStrings:YES]; if ([theResult numOfRows]) [theResult dataSeek:0]; - NSInteger i; + NSUInteger i; for ( i = 0 ; i < [theResult numOfRows] ; i++ ) { theRow = [theResult fetchRowAsDictionary]; if ( [[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] ) { @@ -1824,7 +1825,7 @@ if (isEditingRow) { //make sure that only one row is selected. This should never happen if ([selectedRows count]!=1) { - NSLog(@"Expected only one selected row, but found %d",[selectedRows count]); + NSLog(@"Expected only one selected row, but found %lu", (unsigned long)[selectedRows count]); } // Always cancel the edit; if the user is currently editing a new row, we can just discard it; @@ -1849,7 +1850,7 @@ if([selectedRows count] > 10) [[SPQueryController sharedQueryController] setAllowConsoleUpdate:NO]; - NSUInteger index = [selectedRows firstIndex]; + NSUInteger anIndex = [selectedRows firstIndex]; NSArray *primaryKeyFieldNames = [tableDataInstance primaryKeyColumnNames]; @@ -1880,9 +1881,9 @@ if(primaryKeyFieldNames == nil) { // delete row by row - while (index != NSNotFound) { + while (anIndex != NSNotFound) { - wherePart = [NSString stringWithString:[self argumentForRow:index]]; + wherePart = [NSString stringWithString:[self argumentForRow:anIndex]]; //argumentForRow might return empty query, in which case we shouldn't execute the partial query if([wherePart length]) { @@ -1893,17 +1894,17 @@ // If error delete that index from selectedRows for reloading table if // "ReloadAfterRemovingRow" is disbaled if(!reloadAfterRemovingRow) - [selectedRows removeIndex:index]; + [selectedRows removeIndex:anIndex]; errors++; } else { affectedRows++; } } else { if(!reloadAfterRemovingRow) - [selectedRows removeIndex:index]; + [selectedRows removeIndex:anIndex]; errors++; } - index = [selectedRows indexGreaterThanIndex:index]; + anIndex = [selectedRows indexGreaterThanIndex:anIndex]; } } else if ([primaryKeyFieldNames count] == 1) { // if table has only one PRIMARY KEY @@ -1912,9 +1913,9 @@ [deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE %@ IN (", [selectedTable backtickQuotedString], [NSArrayObjectAtIndex(primaryKeyFieldNames,0) backtickQuotedString]]]; - while (index != NSNotFound) { + while (anIndex != NSNotFound) { - id keyValue = [tableValues cellDataAtRow:index column:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(primaryKeyFieldNames,0)] objectForKey:@"datacolumnindex"] integerValue]]; + id keyValue = [tableValues cellDataAtRow:anIndex column:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(primaryKeyFieldNames,0)] objectForKey:@"datacolumnindex"] integerValue]]; if([keyValue isKindOfClass:[NSData class]]) [deleteQuery appendFormat:@"X'%@'", [mySQLConnection prepareBinaryData:keyValue]]; @@ -1925,15 +1926,17 @@ if([deleteQuery length] > 256000) { [deleteQuery appendString:@")"]; [mySQLConnection queryString:deleteQuery]; + // Remember affected rows for error checking - affectedRows += [mySQLConnection affectedRows]; + affectedRows += (NSInteger)[mySQLConnection affectedRows]; + // Reinit a new deletion query [deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE %@ IN (", [selectedTable backtickQuotedString], [NSArrayObjectAtIndex(primaryKeyFieldNames,0) backtickQuotedString]]]; } else { [deleteQuery appendString:@","]; } - index = [selectedRows indexGreaterThanIndex:index]; + anIndex = [selectedRows indexGreaterThanIndex:anIndex]; } // Check if deleteQuery's maximal length was reached for the last index @@ -1942,8 +1945,9 @@ // Replace final , by ) and delete the remaining rows [deleteQuery setString:[NSString stringWithFormat:@"%@)", [deleteQuery substringToIndex:([deleteQuery length]-1)]]]; [mySQLConnection queryString:deleteQuery]; + // Remember affected rows for error checking - affectedRows += [mySQLConnection affectedRows]; + affectedRows += (NSInteger)[mySQLConnection affectedRows]; } errors = (affectedRows > 0) ? [selectedRows count] - affectedRows : [selectedRows count]; @@ -1954,35 +1958,39 @@ [deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE ", [selectedTable backtickQuotedString]]]; - while (index != NSNotFound) { + while (anIndex != NSNotFound) { // Build the AND clause of PRIMARY KEYS [deleteQuery appendString:@"("]; - [deleteQuery appendString:[self argumentForRow:index excludingLimits:YES]]; + [deleteQuery appendString:[self argumentForRow:anIndex excludingLimits:YES]]; [deleteQuery appendString:@")"]; // Split deletion query into 64k chunks if([deleteQuery length] > 64000) { [mySQLConnection queryString:deleteQuery]; + // Remember affected rows for error checking - affectedRows += [mySQLConnection affectedRows]; + affectedRows += (NSInteger)[mySQLConnection affectedRows]; + // Reinit a new deletion query [deleteQuery setString:[NSString stringWithFormat:@"DELETE FROM %@ WHERE ", [selectedTable backtickQuotedString]]]; } else { [deleteQuery appendString:@" OR "]; } - index = [selectedRows indexGreaterThanIndex:index]; + anIndex = [selectedRows indexGreaterThanIndex:anIndex]; } // Check if deleteQuery's maximal length was reached for the last index // if yes omit the empty query if(![deleteQuery hasSuffix:@"WHERE "]) { + // Remove final ' OR ' and delete the remaining rows [deleteQuery setString:[deleteQuery substringToIndex:([deleteQuery length]-4)]]; [mySQLConnection queryString:deleteQuery]; + // Remember affected rows for error checking - affectedRows += [mySQLConnection affectedRows]; + affectedRows += (NSInteger)[mySQLConnection affectedRows]; } errors = (affectedRows > 0) ? [selectedRows count] - affectedRows : [selectedRows count]; @@ -2051,7 +2059,7 @@ NSArray *tableColumns; NSMutableArray *currentResult = [NSMutableArray array]; NSMutableArray *tempRow = [NSMutableArray array]; - NSUInteger i; + NSInteger i; // Load table if not already done if ( ![tableDocumentInstance contentLoaded] ) { @@ -2094,7 +2102,7 @@ @"
", maxSizeValue, (long)imageWidth, - [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0]]; + [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64EncodingWithLineLength:0]]; } [v release]; [tempRow addObject:[NSString stringWithFormat:@"%@%@", [o wktString], imageStr]]; @@ -2107,7 +2115,7 @@ [tempRow addObject:[NSString stringWithFormat: @"", (long)imageWidth, - [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0]]]; + [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64EncodingWithLineLength:0]]]; } else { [tempRow addObject:@"<BLOB>"]; } @@ -2128,7 +2136,7 @@ NSArray *tableColumns; NSMutableArray *currentResult = [NSMutableArray array]; NSMutableArray *tempRow = [NSMutableArray array]; - NSUInteger i; + NSInteger i; // Load the table if not already loaded if ( ![tableDocumentInstance contentLoaded] ) { @@ -2361,7 +2369,7 @@ [item setToolTip:[filter objectForKey:@"Tooltip"]]; else { NSMutableString *tip = [[NSMutableString alloc] init]; - if([filter objectForKey:@"Clause"] && [[filter objectForKey:@"Clause"] length]) { + if([filter objectForKey:@"Clause"] && [(NSString *)[filter objectForKey:@"Clause"] length]) { [tip setString:[[filter objectForKey:@"Clause"] stringByReplacingOccurrencesOfRegex:@"(? 15) while([lastItems count] > 15) - [filterTableSetDefaultOperatorValue removeObjectAtIndex:[lastItems count]-1]; + [filterTableSetDefaultOperatorValue removeItemAtIndex:[lastItems count]-1]; [prefs setObject:lastItems forKey:SPFilterTableDefaultOperatorLastItems]; } [self updateFilterTableClause:nil]; @@ -3418,18 +3426,18 @@ if ([prefs boolForKey:SPLimitResults]) { foundMaxRows = ((contentPage - 1) * [prefs integerForKey:SPLimitResultsValue]) + tableRowsCount; if (foundMaxRows > maxNumRows) { - if (tableRowsCount == [prefs integerForKey:SPLimitResultsValue]) { + if ((NSInteger)tableRowsCount == [prefs integerForKey:SPLimitResultsValue]) { maxNumRows = foundMaxRows + 1; maxNumRowsIsEstimate = YES; } else { maxNumRows = foundMaxRows; maxNumRowsIsEstimate = NO; } - } else if (!isInterruptedLoad && !isFiltered && tableRowsCount < [prefs integerForKey:SPLimitResultsValue]) { + } else if (!isInterruptedLoad && !isFiltered && (NSInteger)tableRowsCount < [prefs integerForKey:SPLimitResultsValue]) { maxNumRows = foundMaxRows; maxNumRowsIsEstimate = NO; } - } else if (tableRowsCount > maxNumRows) { + } else if ((NSInteger)tableRowsCount > maxNumRows) { maxNumRows = tableRowsCount; maxNumRowsIsEstimate = YES; } @@ -3509,7 +3517,7 @@ // cases. if (isWorking) { pthread_mutex_lock(&tableValuesLock); - if (row < tableRowsCount && [[aTableColumn identifier] integerValue] < [tableValues columnCount]) { + if (row < (NSInteger)tableRowsCount && [[aTableColumn identifier] integerValue] < (NSInteger)[tableValues columnCount]) { theValue = [[SPDataStorageObjectAtRowAndColumn(tableValues, row, [[aTableColumn identifier] integerValue]) copy] autorelease]; } pthread_mutex_unlock(&tableValuesLock); @@ -3595,7 +3603,7 @@ // cases. if (isWorking) { pthread_mutex_lock(&tableValuesLock); - if (rowIndex < tableRowsCount && columnIndex < [tableValues columnCount]) { + if (rowIndex < (NSInteger)tableRowsCount && columnIndex < [tableValues columnCount]) { theValue = [[SPDataStorageObjectAtRowAndColumn(tableValues, rowIndex, columnIndex) copy] autorelease]; } pthread_mutex_unlock(&tableValuesLock); @@ -3650,7 +3658,7 @@ // rows or columns may be requested. Use gray to indicate loading in these cases. if (isWorking) { pthread_mutex_lock(&tableValuesLock); - if (rowIndex < tableRowsCount && columnIndex < [tableValues columnCount]) { + if (rowIndex < (NSInteger)tableRowsCount && columnIndex < [tableValues columnCount]) { theValue = SPDataStorageObjectAtRowAndColumn(tableValues, rowIndex, columnIndex); } pthread_mutex_unlock(&tableValuesLock); @@ -3667,7 +3675,7 @@ // writing in gray if value was NULL if ([aTableView editedColumn] != -1 && [aTableView editedRow] == rowIndex - && [[NSArrayObjectAtIndex([aTableView tableColumns], [aTableView editedColumn]) identifier] integerValue] == columnIndex) { + && [[NSArrayObjectAtIndex([aTableView tableColumns], [aTableView editedColumn]) identifier] unsignedIntegerValue] == columnIndex) { [cell setTextColor:blackColor]; return; } @@ -3977,7 +3985,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]) { @@ -4113,7 +4121,7 @@ } NSString *fieldType = nil; - NSUInteger *fieldLength = 0; + NSUInteger fieldLength = 0; NSString *fieldEncoding = nil; BOOL allowNULL = YES; @@ -4373,7 +4381,7 @@ * cancel the fieldEditor, display the field editor sheet instead for editing * and re-enable the fieldEditor after editing. */ -- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)fieldEditor +- (BOOL)control:(NSControl *)control textShouldBeginEditing:(NSText *)aFieldEditor { if(control != tableContentView) return YES; @@ -4425,7 +4433,7 @@ if ((fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column) headerCell] stringValue]] objectForKey:@"typegrouping"]) && ![fieldType isEqualToString:@"enum"] && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"] || [multipleLineEditingButton state] == NSOnState)) { - [tableContentView setFieldEditorSelectedRange:[fieldEditor selectedRange]]; + [tableContentView setFieldEditorSelectedRange:[aFieldEditor selectedRange]]; // Cancel editing [control abortEditing]; @@ -4550,9 +4558,9 @@ for(NSInteger i=0; i