aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-07 20:12:52 +0000
commit1e5288e9840e201a00bcb5ca3035d7aa807f1f8d (patch)
tree0c1a47953f57b71c41cc7a63e156629c6c9d645b /Source
parent915a3831525bf3a9350648d82f86dd54ae366292 (diff)
downloadsequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.gz
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.tar.bz2
sequelpro-1e5288e9840e201a00bcb5ca3035d7aa807f1f8d.zip
Bring outline view branch up to date with trunk (r3203:r3224).
Diffstat (limited to 'Source')
-rw-r--r--Source/DMLocalizedNib.m1
-rw-r--r--Source/DMLocalizedNibBundle.m6
-rw-r--r--Source/GeneratePreviewForURL.m14
-rw-r--r--Source/GenerateThumbnailForURL.m9
-rw-r--r--Source/ICUTemplateMatcher.m2
-rw-r--r--Source/MGTemplateEngine.m4
-rw-r--r--Source/MGTemplateStandardMarkers.m2
-rw-r--r--Source/NSNotificationAdditions.m47
-rw-r--r--Source/NoodleLineNumberView.m10
-rw-r--r--Source/SPActivityTextFieldCell.m19
-rw-r--r--Source/SPAlertSheets.m6
-rw-r--r--Source/SPAppController.m138
-rw-r--r--Source/SPAppleScriptSupport.m3
-rw-r--r--Source/SPArrayAdditions.h2
-rw-r--r--Source/SPBundleCommandTextView.h4
-rw-r--r--Source/SPBundleCommandTextView.m27
-rw-r--r--Source/SPBundleEditorController.m5
-rw-r--r--Source/SPBundleHTMLOutputController.m5
-rw-r--r--Source/SPCSVExporter.m3
-rw-r--r--Source/SPCSVParser.m8
-rw-r--r--Source/SPChooseMenuItemDialog.m10
-rw-r--r--Source/SPColorWellCell.m4
-rw-r--r--Source/SPConnectionController.m19
-rw-r--r--Source/SPConnectionControllerDataSource.m4
-rw-r--r--Source/SPConnectionControllerDelegate.m1
-rw-r--r--Source/SPConnectionDelegate.h2
-rw-r--r--Source/SPConstants.m2
-rw-r--r--Source/SPContentFilterManager.m1
-rw-r--r--Source/SPCopyTable.m8
-rw-r--r--Source/SPCustomQuery.h5
-rw-r--r--Source/SPCustomQuery.m32
-rw-r--r--Source/SPDataAdditions.m18
-rw-r--r--Source/SPDataCellFormatter.h4
-rw-r--r--Source/SPDataCellFormatter.m7
-rw-r--r--Source/SPDataImport.m2
-rw-r--r--Source/SPDataStorage.m2
-rw-r--r--Source/SPDatabaseCopy.m3
-rw-r--r--Source/SPDatabaseDocument.h6
-rw-r--r--Source/SPDatabaseDocument.m19
-rw-r--r--Source/SPDatabaseRename.m4
-rw-r--r--Source/SPDatabaseViewController.h3
-rw-r--r--Source/SPDatabaseViewController.m11
-rw-r--r--Source/SPEditSheetTextView.m3
-rw-r--r--Source/SPEditorPreferencePane.h1
-rw-r--r--Source/SPEditorPreferencePane.m26
-rw-r--r--Source/SPEditorTokens.l3
-rw-r--r--Source/SPExportController.m4
-rw-r--r--Source/SPExportControllerDelegate.m9
-rw-r--r--Source/SPExportFile.m1
-rw-r--r--Source/SPExportFileUtilities.m16
-rw-r--r--Source/SPExportFilenameUtilities.m2
-rw-r--r--Source/SPExportInitializer.m7
-rw-r--r--Source/SPExporter.m1
-rw-r--r--Source/SPFieldEditorController.h6
-rw-r--r--Source/SPFieldMapperController.m19
-rw-r--r--Source/SPFileManagerAdditions.m2
-rw-r--r--Source/SPFontPreviewTextField.m2
-rw-r--r--Source/SPGeometryDataView.m4
-rw-r--r--Source/SPGrowlController.m2
-rw-r--r--Source/SPHistoryController.m1
-rw-r--r--Source/SPIndexesController.m4
-rw-r--r--Source/SPKeychain.m56
-rw-r--r--Source/SPMainThreadTrampoline.m4
-rw-r--r--Source/SPMenuAdditions.m2
-rw-r--r--Source/SPNarrowDownCompletion.m4
-rw-r--r--Source/SPNavigatorController.m4
-rw-r--r--Source/SPNotLoaded.m2
-rw-r--r--Source/SPOutlineView.m3
-rw-r--r--Source/SPPreferenceController.h12
-rw-r--r--Source/SPPreferenceController.m7
-rw-r--r--Source/SPPreferencesUpgrade.m8
-rw-r--r--Source/SPProcessListController.m5
-rw-r--r--Source/SPQueryController.m6
-rw-r--r--Source/SPSQLExporter.m2
-rw-r--r--Source/SPSQLTokenizer.l5
-rw-r--r--Source/SPSSHTunnel.h8
-rw-r--r--Source/SPSSHTunnel.m6
-rw-r--r--Source/SPServerSupport.m2
-rw-r--r--Source/SPServerVariablesController.m3
-rw-r--r--Source/SPStringAdditions.h4
-rw-r--r--Source/SPStringAdditions.m45
-rw-r--r--Source/SPTableContent.h4
-rw-r--r--Source/SPTableContent.m58
-rw-r--r--Source/SPTableData.h1
-rw-r--r--Source/SPTableData.m2
-rw-r--r--Source/SPTableInfo.m2
-rw-r--r--Source/SPTableStructure.m3
-rw-r--r--Source/SPTableStructureDelegate.m8
-rw-r--r--Source/SPTableView.m1
-rw-r--r--Source/SPTablesList.h5
-rw-r--r--Source/SPTablesList.m24
-rw-r--r--Source/SPTextView.m5
-rw-r--r--Source/SPTextViewAdditions.m3
-rw-r--r--Source/SPTooltip.m7
-rw-r--r--Source/SPUserManager.m4
-rw-r--r--Source/SPWindow.m4
-rw-r--r--Source/SPWindowAdditions.m1
-rw-r--r--Source/SPWindowController.m4
-rw-r--r--Source/xibLocalizationPostprocessor.m4
99 files changed, 528 insertions, 395 deletions
diff --git a/Source/DMLocalizedNib.m b/Source/DMLocalizedNib.m
index 93c37bd5..c675e110 100644
--- a/Source/DMLocalizedNib.m
+++ b/Source/DMLocalizedNib.m
@@ -8,7 +8,6 @@
#import <Cocoa/Cocoa.h>
#import <objc/runtime.h>
-
@interface NSNib (DMLocalizedNib)
- (id)deliciousInitWithNibNamed:(NSString *)nibName bundle:(NSBundle *)bundle;
- (id)deliciousInitWithContentsOfURL:(NSURL *)nibFileURL;
diff --git a/Source/DMLocalizedNibBundle.m b/Source/DMLocalizedNibBundle.m
index f4922be6..b9cbec28 100644
--- a/Source/DMLocalizedNibBundle.m
+++ b/Source/DMLocalizedNibBundle.m
@@ -177,13 +177,13 @@ static NSMutableArray *deliciousBindingKeys = nil;
}
} else if ([view isKindOfClass:[NSTableView class]]) {
- for (NSTableColumn *column in [view tableColumns]) {
+ for (NSTableColumn *column in [(NSTableView*)view tableColumns]) {
[self _localizeStringValueOfObject:[column headerCell] table:table];
}
} else if ([view isKindOfClass:[NSTextField class]]) {
NSDictionary *vb;
- if (vb = [view infoForBinding:@"value"]) {
+ if ((vb = [view infoForBinding:@"value"])) {
NSMutableDictionary *lvb = [NSMutableDictionary dictionaryWithDictionary:[vb objectForKey:NSOptionsKey]];
for (NSString *bindingKey in deliciousBindingKeys) {
if ([lvb objectForKey:bindingKey] == [NSNull null]) continue;
@@ -255,4 +255,4 @@ DM_DEFINE_LOCALIZE_BLAH_OF_OBJECT(placeholderString, PlaceholderString)
DM_DEFINE_LOCALIZE_BLAH_OF_OBJECT(toolTip, ToolTip)
DM_DEFINE_LOCALIZE_BLAH_OF_OBJECT(label, Label)
-@end \ No newline at end of file
+@end
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m
index 349837ff..6c779859 100644
--- a/Source/GeneratePreviewForURL.m
+++ b/Source/GeneratePreviewForURL.m
@@ -30,6 +30,11 @@
#import "SPDataAdditions.h"
#import "SPEditorTokens.h"
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
+OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
+void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview);
+
+
/* -----------------------------------------------------------------------------
Generate a preview for file
@@ -256,7 +261,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
// Get info.plist data as dictionary
NSDictionary *sessionSpf;
- NSData *pData = [NSData dataWithContentsOfFile:spfPath options:NSUncachedRead error:&readError];
+ pData = [NSData dataWithContentsOfFile:spfPath options:NSUncachedRead error:&readError];
sessionSpf = [[NSPropertyListSerialization propertyListFromData:pData
mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain];
@@ -338,7 +343,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
{
NSNumber *filesize = [fileAttributes objectForKey:NSFileSize];
- NSUInteger kMaxSQLFileSize = (0.7 * 1024 * 1024);
+ NSUInteger kMaxSQLFileSize = (0.7f * 1024 * 1024);
// compose the html and perform syntax highlighting
@@ -372,7 +377,6 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
truncatedString = [[NSString alloc] initWithString:@"\n ✂ ..."];
}
- NSRange textRange = NSMakeRange(0, [sqlText length]);
NSString *tokenColor;
size_t token;
NSRange tokenRange;
@@ -385,7 +389,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
// now loop through all the tokens
NSUInteger poolCount = 0;
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
- while (token=yylex()){
+ while ((token=yylex())){
skipFontTag = NO;
switch (token) {
case SPT_SINGLE_QUOTED_TEXT:
@@ -490,7 +494,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
props = [[NSMutableDictionary alloc] initWithCapacity:6];
imgProps = [[NSMutableDictionary alloc] initWithCapacity:2];
- [props setObject:[NSNumber numberWithInt:previewHeight] forKey:(NSString *)kQLPreviewPropertyHeightKey];
+ [props setObject:[NSNumber numberWithInteger:previewHeight] forKey:(NSString *)kQLPreviewPropertyHeightKey];
[props setObject:[NSNumber numberWithInt:600] forKey:(NSString *)kQLPreviewPropertyWidthKey];
if(image) {
diff --git a/Source/GenerateThumbnailForURL.m b/Source/GenerateThumbnailForURL.m
index dbc1f42c..8251cb5e 100644
--- a/Source/GenerateThumbnailForURL.m
+++ b/Source/GenerateThumbnailForURL.m
@@ -26,6 +26,9 @@
#include <CoreServices/CoreServices.h>
#include <QuickLook/QuickLook.h>
+void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail);
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maximumSize);
+
/* -----------------------------------------------------------------------------
Generate a thumbnail for file
@@ -38,7 +41,7 @@ void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbn
// implement only if supported
}
-OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize)
+OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maximumSize)
{
return noErr;
@@ -54,7 +57,7 @@ OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thum
// return noErr;
// }
//
- // NSSize canvasSize = NSMakeSize((NSInteger)(maxSize.height/1.3f), maxSize.height);
+ // NSSize canvasSize = NSMakeSize((NSInteger)(maximumSize.height/1.3f), maximumSize.height);
//
// // Thumbnail will be drawn with maximum resolution for desired thumbnail request
// // Here we create a graphics context to draw the Quick Look Thumbnail in.
@@ -85,4 +88,4 @@ OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thum
// [pool release];
// return noErr;
-} \ No newline at end of file
+}
diff --git a/Source/ICUTemplateMatcher.m b/Source/ICUTemplateMatcher.m
index 8fcdb73c..84b8259a 100644
--- a/Source/ICUTemplateMatcher.m
+++ b/Source/ICUTemplateMatcher.m
@@ -20,7 +20,7 @@
- (id)initWithTemplateEngine:(MGTemplateEngine *)theEngine
{
- if (self = [super init]) {
+ if ((self = [super init])) {
self.engine = theEngine; // weak ref
}
diff --git a/Source/MGTemplateEngine.m b/Source/MGTemplateEngine.m
index 89ea3a1d..17acae65 100644
--- a/Source/MGTemplateEngine.m
+++ b/Source/MGTemplateEngine.m
@@ -60,7 +60,7 @@
- (id)init
{
- if (self = [super init]) {
+ if ((self = [super init])) {
_openBlocksStack = [[NSMutableArray alloc] init];
_globals = [[NSMutableDictionary alloc] init];
_markers = [[NSMutableDictionary alloc] init];
@@ -249,7 +249,7 @@
// Attempt to find firstVar in stack variables.
NSEnumerator *stack = [_openBlocksStack reverseObjectEnumerator];
NSDictionary *stackFrame = nil;
- while (stackFrame = [stack nextObject]) {
+ while ((stackFrame = [stack nextObject])) {
NSDictionary *vars = [stackFrame objectForKey:BLOCK_VARIABLES_KEY];
if (vars && [vars objectForKey:firstVar]) {
currObj = vars;
diff --git a/Source/MGTemplateStandardMarkers.m b/Source/MGTemplateStandardMarkers.m
index 0cbc8c66..184dab48 100644
--- a/Source/MGTemplateStandardMarkers.m
+++ b/Source/MGTemplateStandardMarkers.m
@@ -76,7 +76,7 @@
- (id)initWithTemplateEngine:(MGTemplateEngine *)theEngine
{
- if (self = [super init]) {
+ if ((self = [super init])) {
engine = theEngine;
forStack = [[NSMutableArray alloc] init];
sectionStack = [[NSMutableArray alloc] init];
diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m
index 53917dae..ae949347 100644
--- a/Source/NSNotificationAdditions.m
+++ b/Source/NSNotificationAdditions.m
@@ -24,7 +24,13 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "NSNotificationAdditions.h"
-#import <pthread.h>
+#import "pthread.h"
+
+@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
++ (void)_postNotification:(NSNotification *)notification;
++ (void)_postNotificationName:(NSDictionary *)info;
++ (void)_postNotificationForwarder:(NSDictionary *)info;
+@end
@implementation NSNotificationCenter (NSNotificationCenterAdditions)
@@ -35,16 +41,11 @@
[self postNotificationOnMainThread:notification waitUntilDone:NO];
}
-- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait
+- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone
{
if (pthread_main_np()) return [self postNotification:notification];
- [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait];
-}
-
-+ (void)_postNotification:(NSNotification *)notification
-{
- [[self defaultCenter] postNotification:notification];
+ [self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone];
}
- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object
@@ -61,21 +62,30 @@
[self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO];
}
-- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait
+- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone
{
if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];
-
+
NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3];
if (name) [info setObject:name forKey:@"name"];
if (object) [info setObject:object forKey:@"object"];
if (userInfo) [info setObject:userInfo forKey:@"userInfo"];
-
- [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait];
-
+
+ [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone];
+
[info release];
}
+@end
+
+@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI)
+
++ (void)_postNotification:(NSNotification *)notification
+{
+ [[self defaultCenter] postNotification:notification];
+}
+
+ (void)_postNotificationName:(NSDictionary *)info
{
NSString *name = [info objectForKey:@"name"];
@@ -83,7 +93,18 @@
id object = [info objectForKey:@"object"];
NSDictionary *userInfo = [info objectForKey:@"userInfo"];
+
+ [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
+}
+
++ (void)_postNotificationForwarder:(NSDictionary *)info
+{
+ NSString *name = [info objectForKey:@"name"];
+ id object = [info objectForKey:@"object"];
+
+ NSDictionary *userInfo = [info objectForKey:@"userInfo"];
+
[[self defaultCenter] postNotificationName:name object:object userInfo:userInfo];
}
diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m
index 1d44c939..15296c8e 100644
--- a/Source/NoodleLineNumberView.m
+++ b/Source/NoodleLineNumberView.m
@@ -175,8 +175,8 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
if ((aView != nil) && [aView isKindOfClass:[NSTextView class]])
{
- layoutManager = [aView layoutManager];
- container = [aView textContainer];
+ layoutManager = [(NSTextView*)aView layoutManager];
+ container = [(NSTextView*)aView textContainer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:NSTextStorageDidProcessEditingNotification object:[(NSTextView *)aView textStorage]];
[self invalidateLineIndices];
@@ -204,7 +204,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
- (NSUInteger)lineNumberForLocation:(CGFloat)location
{
- NSUInteger line, count, rectCount, i;
+ NSUInteger line, count, rectCount;
NSRectArray rects;
NSRect visibleRect;
NSRange nullRange;
@@ -252,7 +252,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index
{
NSUInteger left, right, mid, lineStart;
- NSMutableArray *lines;
+ NSArray *lines;
lines = [self lineIndices];
@@ -302,7 +302,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
NSString *labelText;
NSUInteger rectCount, index, line, count;
NSRectArray rects;
- CGFloat ypos, yinset;
+ CGFloat yinset;
NSSize stringSize;
NSArray *lines;
diff --git a/Source/SPActivityTextFieldCell.m b/Source/SPActivityTextFieldCell.m
index f97101b4..10194466 100644
--- a/Source/SPActivityTextFieldCell.m
+++ b/Source/SPActivityTextFieldCell.m
@@ -24,8 +24,9 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPActivityTextFieldCell.h"
+#import "SPTableInfo.h"
-#define FAVORITE_NAME_FONT_SIZE 12.0
+#define FAVORITE_NAME_FONT_SIZE 12.0f
@interface SPActivityTextFieldCell (PrivateAPI)
@@ -120,21 +121,21 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
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 - 30;
CGFloat mainStringWidth = [mainString size].width;
CGFloat subStringWidth = [subString size].width;
@@ -288,10 +289,10 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
// 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/SPAlertSheets.m b/Source/SPAlertSheets.m
index 3299c351..b9ac1136 100644
--- a/Source/SPAlertSheets.m
+++ b/Source/SPAlertSheets.m
@@ -22,6 +22,8 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+#import "SPAlertSheets.h"
+
/**
* Provide a simple alias of NSBeginAlertSheet, with a few differences:
* - printf-type format strings are no longer supported within the "msg"
@@ -101,7 +103,7 @@ void SPBeginWaitingAlertSheet(
// Initialize returnCode with a value which can't be returned as
// returnCode in the didEndSelector method
NSInteger initialReturnCode = -5;
- returnCode = initialReturnCode;
+ returnCode = &initialReturnCode;
// Set up an NSAlert with the supplied details
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
@@ -141,7 +143,7 @@ void SPBeginWaitingAlertSheet(
// Since the returnCode can only be -1, 0, or 1
// run the session until returnCode was changed in
// the didEndSelector method of the calling class
- if(returnCode != initialReturnCode)
+ if(returnCode != &initialReturnCode)
break;
// Execute code on DefaultRunLoop
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index ba65df6f..4424e9a9 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -695,7 +695,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
NSString *statusFileName = [NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, anUUID];
NSError *inError = nil;
- NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:inError];
+ NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:&inError];
NSString *result = @"";
NSString *status = @"0";
@@ -838,84 +838,77 @@ YY_BUFFER_STATE yy_scan_string (const char *);
*/
- (NSString*)doSQLSyntaxHighlightForString:(NSString*)sqlText cssLike:(BOOL)cssLike
{
+ NSMutableString *sqlHTML = [[[NSMutableString alloc] initWithCapacity:[sqlText length]] autorelease];
+
+ NSString *tokenColor;
+ NSString *cssId;
+ size_t token;
+ NSRange tokenRange;
+
+ // initialise flex
+ yyuoffset = 0; yyuleng = 0;
+ yy_switch_to_buffer(yy_scan_string([sqlText UTF8String]));
+ BOOL skipFontTag;
+
+ while ((token=yylex())) {
+ skipFontTag = NO;
+ switch (token) {
+ case SPT_SINGLE_QUOTED_TEXT:
+ case SPT_DOUBLE_QUOTED_TEXT:
+ tokenColor = @"#A7221C";
+ cssId = @"sp_sql_quoted";
+ break;
+ case SPT_BACKTICK_QUOTED_TEXT:
+ tokenColor = @"#001892";
+ cssId = @"sp_sql_backtick";
+ break;
+ case SPT_RESERVED_WORD:
+ tokenColor = @"#0041F6";
+ cssId = @"sp_sql_keyword";
+ break;
+ case SPT_NUMERIC:
+ tokenColor = @"#67350F";
+ cssId = @"sp_sql_numeric";
+ break;
+ case SPT_COMMENT:
+ tokenColor = @"#265C10";
+ cssId = @"sp_sql_comment";
+ break;
+ case SPT_VARIABLE:
+ tokenColor = @"#6C6C6C";
+ cssId = @"sp_sql_variable";
+ break;
+ case SPT_WHITESPACE:
+ skipFontTag = YES;
+ cssId = @"";
+ break;
+ default:
+ skipFontTag = YES;
+ cssId = @"";
+ }
- NSMutableString *sqlHTML = [[[NSMutableString alloc] initWithCapacity:[sqlText length]] autorelease];
-
- NSRange textRange = NSMakeRange(0, [sqlText length]);
- NSString *tokenColor;
- NSString *cssId;
- size_t token;
- NSRange tokenRange;
-
- // initialise flex
- yyuoffset = 0; yyuleng = 0;
- yy_switch_to_buffer(yy_scan_string([sqlText UTF8String]));
- BOOL skipFontTag;
-
- while (token=yylex()){
- skipFontTag = NO;
- switch (token) {
- case SPT_SINGLE_QUOTED_TEXT:
- case SPT_DOUBLE_QUOTED_TEXT:
- tokenColor = @"#A7221C";
- cssId = @"sp_sql_quoted";
- break;
- case SPT_BACKTICK_QUOTED_TEXT:
- tokenColor = @"#001892";
- cssId = @"sp_sql_backtick";
- break;
- case SPT_RESERVED_WORD:
- tokenColor = @"#0041F6";
- cssId = @"sp_sql_keyword";
- break;
- case SPT_NUMERIC:
- tokenColor = @"#67350F";
- cssId = @"sp_sql_numeric";
- break;
- case SPT_COMMENT:
- tokenColor = @"#265C10";
- cssId = @"sp_sql_comment";
- break;
- case SPT_VARIABLE:
- tokenColor = @"#6C6C6C";
- cssId = @"sp_sql_variable";
- break;
- case SPT_WHITESPACE:
- skipFontTag = YES;
- cssId = @"";
- break;
- default:
- skipFontTag = YES;
- cssId = @"";
- }
-
- tokenRange = NSMakeRange(yyuoffset, yyuleng);
-
- if(skipFontTag)
- [sqlHTML appendString:[[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
- else {
- if(cssLike)
- [sqlHTML appendFormat:@"<span class=\"%@\">%@</span>", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
- else
- [sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
- }
+ tokenRange = NSMakeRange(yyuoffset, yyuleng);
+ if(skipFontTag)
+ [sqlHTML appendString:[[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
+ else {
+ if(cssLike)
+ [sqlHTML appendFormat:@"<span class=\"%@\">%@</span>", cssId, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
+ else
+ [sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
}
- // Wrap lines, and replace tabs with spaces
- [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"<br>" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
- [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
+ }
- if(sqlHTML)
- return sqlHTML;
- else
- return @"";
+ // Wrap lines, and replace tabs with spaces
+ [sqlHTML replaceOccurrencesOfString:@"\n" withString:@"<br>" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
+ [sqlHTML replaceOccurrencesOfString:@"\t" withString:@"&nbsp;&nbsp;&nbsp;&nbsp;" options:NSLiteralSearch range:NSMakeRange(0, [sqlHTML length])];
+ return (sqlHTML) ? sqlHTML : @"";
}
- (IBAction)executeBundleItemForApp:(id)sender
{
-
NSInteger idx = [sender tag] - 1000000;
NSString *infoPath = nil;
NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeGeneral];
@@ -1859,11 +1852,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
NSLocalizedString(@"Data Table", @"data table menu item label"),
NSLocalizedString(@"General", @"general menu item label"),nil];
- NSArray *scopeSelector = [NSArray arrayWithObjects:@"executeBundleItemForInputField:",
- @"executeBundleItemForDataTable:",
- @"executeBundleItemForApp:", nil];
-
- NSInteger k = 0;
+ NSUInteger k = 0;
BOOL bundleOtherThanGeneralFound = NO;
for(NSString* scope in scopes) {
@@ -2084,7 +2073,6 @@ YY_BUFFER_STATE yy_scan_string (const char *);
*/
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
-
// Manually open a table document
[self newWindow:self];
diff --git a/Source/SPAppleScriptSupport.m b/Source/SPAppleScriptSupport.m
index ea390ab9..44d99352 100644
--- a/Source/SPAppleScriptSupport.m
+++ b/Source/SPAppleScriptSupport.m
@@ -25,6 +25,9 @@
#import "SPAppleScriptSupport.h"
#import "SPWindowController.h"
+#import "SPAppController.h"
+#import "SPPrintController.h"
+#import "SPDatabaseDocument.h"
@implementation SPAppController (SPAppleScriptSupport)
diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h
index 5e22ac42..a8f55c8a 100644
--- a/Source/SPArrayAdditions.h
+++ b/Source/SPArrayAdditions.h
@@ -24,7 +24,7 @@
static inline id NSArrayObjectAtIndex(NSArray *self, NSUInteger i)
{
- return (id)CFArrayGetValueAtIndex((CFArrayRef)self, i);
+ return (id)CFArrayGetValueAtIndex((CFArrayRef)self, (long)i);
}
static inline void NSMutableArrayAddObject(NSArray *self, id anObject)
diff --git a/Source/SPBundleCommandTextView.h b/Source/SPBundleCommandTextView.h
index 119121da..4b16a3fc 100644
--- a/Source/SPBundleCommandTextView.h
+++ b/Source/SPBundleCommandTextView.h
@@ -45,4 +45,8 @@
- (void)commentOut;
- (BOOL)wrapSelectionWithPrefix:(unichar)prefix;
+- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+
+- (void)boundsDidChangeNotification:(NSNotification *)notification;
+
@end
diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m
index d9aae0f7..59bebadc 100644
--- a/Source/SPBundleCommandTextView.m
+++ b/Source/SPBundleCommandTextView.m
@@ -35,6 +35,7 @@
[prefs removeObserver:self forKeyPath:SPCustomQueryEditorTabStopWidth];
[prefs release];
[lineNumberView release];
+ [super dealloc];
}
- (void)awakeFromNib
@@ -373,7 +374,7 @@
paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[paragraphStyle setTabStops:myArrayOfTabs];
// Soft wrapped lines are indented slightly
- [paragraphStyle setHeadIndent:4.0];
+ [paragraphStyle setHeadIndent:4.0f];
NSMutableDictionary *textAttributes = [[[NSMutableDictionary alloc] initWithCapacity:1] autorelease];
[textAttributes setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
@@ -668,14 +669,14 @@
{
NSUInteger glyphIndex;
NSLayoutManager *layoutManager = [self layoutManager];
- CGFloat fraction;
+ CGFloat partialFraction;
NSRange range;
range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
glyphIndex = [layoutManager glyphIndexForPoint:aPoint
inTextContainer:[self textContainer]
- fractionOfDistanceThroughGlyph:&fraction];
- if( fraction > 0.5 ) glyphIndex++;
+ fractionOfDistanceThroughGlyph:&partialFraction];
+ if( partialFraction > 0.5 ) glyphIndex++;
if( glyphIndex == NSMaxRange(range) )
return [[self textStorage] length];
@@ -697,20 +698,20 @@
// Make usage of the UNIX command "file" to get an info
// about file type and encoding.
- NSTask *task=[[NSTask alloc] init];
- NSPipe *pipe=[[NSPipe alloc] init];
+ NSTask *aTask=[[NSTask alloc] init];
+ NSPipe *aPipe=[[NSPipe alloc] init];
NSFileHandle *handle;
NSString *result;
- [task setLaunchPath:@"/usr/bin/file"];
- [task setArguments:[NSArray arrayWithObjects:aPath, @"-Ib", nil]];
- [task setStandardOutput:pipe];
- handle=[pipe fileHandleForReading];
- [task launch];
+ [aTask setLaunchPath:@"/usr/bin/file"];
+ [aTask setArguments:[NSArray arrayWithObjects:aPath, @"-Ib", nil]];
+ [aTask setStandardOutput:aPipe];
+ handle=[aPipe fileHandleForReading];
+ [aTask launch];
result=[[NSString alloc] initWithData:[handle readDataToEndOfFile]
encoding:NSASCIIStringEncoding];
- [pipe release];
- [task release];
+ [aPipe release];
+ [aTask release];
// UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
if( [result hasPrefix:@"text/plain"]
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 279002f4..8f1f6bab 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -480,7 +480,6 @@
}
if(selectedTag != kDisabledScopeTag && ![[currentDict objectForKey:SPBundleFileScopeKey] isEqualToString:oldScope]) {
- NSString *newScope = [currentDict objectForKey:SPBundleFileScopeKey];
NSUInteger newScopeIndex = [self _arrangedScopeIndexForScopeIndex:selectedTag];
NSString *currentCategory = [currentDict objectForKey:SPBundleFileCategoryKey];
if(!currentCategory) currentCategory = @"";
@@ -578,7 +577,6 @@
- (IBAction)addCommandBundle:(id)sender
{
NSMutableDictionary *bundle;
- NSUInteger insertIndex;
// Store pending changes in Query
[[self window] makeFirstResponder:nameTextField];
@@ -1015,7 +1013,6 @@
NSString *thePath = [NSString stringWithFormat:@"%@/%@.%@", bundlePath, bundleName, SPUserBundleFileExtension];
if([[NSFileManager defaultManager] fileExistsAtPath:thePath isDirectory:nil]) {
NSError *error = nil;
- NSString *trashDir = [NSHomeDirectory() stringByAppendingPathComponent:@".Trash"];
// Use a AppleScript script since NSWorkspace performFileOperation or NSFileManager moveItemAtPath
// have problems probably due access rights.
@@ -1148,8 +1145,6 @@
draggedFilePath = nil;
}
if(oldBundleName) [oldBundleName release], oldBundleName = nil;
-
- return YES;
}
#pragma mark -
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index 4b1567bb..6e5ffedd 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -25,6 +25,7 @@
#import "SPBundleHTMLOutputController.h"
#import "SPAlertSheets.h"
#import "SPPrintAccessory.h"
+#import "SPAppController.h"
@class WebScriptCallFrame;
@@ -42,7 +43,7 @@
- (id)init
{
- if (self = [super initWithWindowNibName:@"BundleHTMLOutput"]) {
+ if ((self = [super initWithWindowNibName:@"BundleHTMLOutput"])) {
[[self window] setReleasedWhenClosed:YES];
@@ -113,9 +114,7 @@
- (void)keyDown:(NSEvent *)theEvent
{
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
- NSString *characters = [theEvent characters];
NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers];
- unichar insertedCharacter = [characters characterAtIndex:0];
long curFlags = ([theEvent modifierFlags] & allFlags);
if(curFlags & NSCommandKeyMask) {
diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m
index c874e9aa..e5d945c3 100644
--- a/Source/SPCSVExporter.m
+++ b/Source/SPCSVExporter.m
@@ -29,6 +29,7 @@
#import "SPFileHandle.h"
#import "SPTableData.h"
#import "SPExportUtilities.h"
+#import "SPExportFile.h"
@implementation SPCSVExporter
@@ -394,7 +395,7 @@
}
// Write data to disk
- [[[self exportOutputFile] exportFileHandle] synchronizeFile];
+ [[(SPExportFile*)[self exportOutputFile] exportFileHandle] synchronizeFile];
// Mark the process as not running
[self setExportProcessIsRunning:NO];
diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m
index f1e63c72..f19c2d55 100644
--- a/Source/SPCSVParser.m
+++ b/Source/SPCSVParser.m
@@ -48,7 +48,7 @@
totalLengthParsed = 0;
// Loop through the results fetching process
- while (csvRowArray = [self getRowAsArrayAndTrimString:NO stringIsComplete:YES])
+ while ((csvRowArray = [self getRowAsArrayAndTrimString:NO stringIsComplete:YES]))
{
CFArrayAppendValue((CFMutableArrayRef)csvArray, csvRowArray);
}
@@ -603,7 +603,7 @@
#pragma mark -
- (id) init {
- if (self = [super init]) {
+ if ((self = [super init])) {
csvString = [[NSMutableString alloc] init];
[self _initialiseCSVParserDefaults];
}
@@ -611,14 +611,14 @@
}
- (id) initWithString:(NSString *)aString
{
- if (self = [super init]) {
+ if ((self = [super init])) {
csvString = [[NSMutableString alloc] initWithString:aString];
[self _initialiseCSVParserDefaults];
}
return self;
}
- (id) initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)encoding error:(NSError **)error {
- if (self = [super init]) {
+ if ((self = [super init])) {
csvString = [[NSMutableString alloc] initWithContentsOfFile:path encoding:encoding error:error];
[self _initialiseCSVParserDefaults];
}
diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m
index 8be639e3..d57abe94 100644
--- a/Source/SPChooseMenuItemDialog.m
+++ b/Source/SPChooseMenuItemDialog.m
@@ -37,7 +37,7 @@
}
- (id)init;
{
- if(self = [super initWithFrame:NSMakeRect(1,1,2,2)])
+ if((self = [super initWithFrame:NSMakeRect(1,1,2,2)]))
{
;
}
@@ -65,8 +65,8 @@
- (id)init;
{
- if(self = [super initWithContentRect:NSMakeRect(1,1,2,2)
- styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
+ if((self = [super initWithContentRect:NSMakeRect(1,1,2,2)
+ styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]))
{
waitForChoice = YES;
selectedItemIndex = -1;
@@ -86,7 +86,7 @@
[self setLevel:NSNormalWindowLevel];
[self setHidesOnDeactivate:YES];
[self setHasShadow:YES];
- [self setAlphaValue:0.0];
+ [self setAlphaValue:0.0f];
dummyTextView = [[SPChooseMenuItemDialogTextView alloc] init];
[dummyTextView setDelegate:self];
@@ -138,7 +138,7 @@
context:[NSGraphicsContext currentContext]
eventNumber:0
clickCount:1
- pressure:0.0];
+ pressure:0.0f];
[[NSApplication sharedApplication] sendEvent:theEvent];
diff --git a/Source/SPColorWellCell.m b/Source/SPColorWellCell.m
index ce47ef83..ca466e98 100644
--- a/Source/SPColorWellCell.m
+++ b/Source/SPColorWellCell.m
@@ -29,7 +29,7 @@
- (void) drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
// Set initial inset from cellFrame
- NSRect rect = NSInsetRect (cellFrame, 0.5, 0.5);
+ NSRect rect = NSInsetRect (cellFrame, 0.5f, 0.5f);
// General inset for colored rect shown inside rect
CGFloat insetFactor = 2.0f;
@@ -38,7 +38,7 @@
[[NSColor darkGrayColor] set];
[NSBezierPath strokeRect: rect];
[[NSColor grayColor] set];
- [NSBezierPath fillRect: NSInsetRect (rect, 1.0, 1.0)];
+ [NSBezierPath fillRect: NSInsetRect (rect, 1.0f, 1.0f)];
// The following rectangle and triangle are needed for displaying color with alpha values
// Draw black rectangle
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index d3c75e16..b5ab8010 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -35,6 +35,9 @@
#import "SPTableTextFieldCell.h"
#import "SPFavoritesController.h"
#import "SPFavoriteNode.h"
+#import "SPGeneralPreferencePane.h"
+#import "SPDatabaseViewController.h"
+#import "SPTreeNode.h"
// Constants
static const NSString *SPRemoveNode = @"RemoveNode";
@@ -101,7 +104,7 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
*/
- (id)initWithDocument:(SPDatabaseDocument *)document
{
- if (self = [super init]) {
+ if ((self = [super init])) {
// Weak reference
dbDocument = document;
@@ -533,7 +536,7 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
// Perform re-sorting
[self _sortFavorites];
- [sender setState:reverseFavoritesSort];
+ [(NSMenuItem *)sender setState:reverseFavoritesSort];
}
/**
@@ -1039,8 +1042,6 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
NSString *favoriteSSHHost = [favorite objectForKey:SPFavoriteSSHHostKey];
NSString *favoriteID = [favorite objectForKey:SPFavoriteIDKey];
- NSInteger favoriteType = [[favorite objectForKey:SPFavoriteTypeKey] integerValue];
-
// Remove passwords from the Keychain
[keychain deletePasswordForName:[keychain nameForFavoriteName:favoriteName id:favoriteID]
account:[keychain accountForUser:favoriteUser host:((type == SPSocketConnection) ? @"localhost" : favoriteHost) database:favoriteDatabase]];
@@ -1351,16 +1352,18 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
*/
- (SPTreeNode *)_favoriteNodeForFavoriteID:(NSInteger)favoriteID
{
- SPTreeNode *node = nil;
+ SPTreeNode *favoriteNode = nil;
- if (!favoritesRoot) return;
+ if (!favoritesRoot) return favoriteNode;
- for (node in [favoritesRoot allChildLeafs])
+ for (SPTreeNode *node in [favoritesRoot allChildLeafs])
{
if ([[[[node representedObject] nodeFavorite] objectForKey:SPFavoriteIDKey] integerValue] == favoriteID) {
- return node;
+ favoriteNode = node;
}
}
+
+ return favoriteNode;
}
/**
diff --git a/Source/SPConnectionControllerDataSource.m b/Source/SPConnectionControllerDataSource.m
index 9249d65d..766b04f0 100644
--- a/Source/SPConnectionControllerDataSource.m
+++ b/Source/SPConnectionControllerDataSource.m
@@ -24,6 +24,10 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPConnectionControllerDataSource.h"
+#import "SPFavoritesController.h"
+#import "SPFavoriteNode.h"
+#import "SPGroupNode.h"
+#import "SPTreeNode.h"
@implementation SPConnectionController (SPConnectionControllerDataSource)
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 4bff297a..31ec4099 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -27,6 +27,7 @@
#import "SPTableTextFieldCell.h"
#import "SPFavoriteNode.h"
#import "SPGroupNode.h"
+#import "SPTreeNode.h"
#define CELL(cell) (SPTableTextFieldCell *)cell
diff --git a/Source/SPConnectionDelegate.h b/Source/SPConnectionDelegate.h
index deb28e68..c1d3bb5e 100644
--- a/Source/SPConnectionDelegate.h
+++ b/Source/SPConnectionDelegate.h
@@ -29,4 +29,6 @@
@interface SPDatabaseDocument (SPConnectionDelegate) <MCPConnectionDelegate>
+- (void) closeAndDisconnect;
+
@end
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index df1d71dc..6e8f8b2d 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -26,7 +26,7 @@
#import "SPConstants.h"
// Long running notification time for Growl messages
-const CGFloat SPLongRunningNotificationTime = 3.0;
+const CGFloat SPLongRunningNotificationTime = 3.0f;
// Narrow down completion max rows
const NSUInteger SPNarrowDownCompletionMaxRows = 15;
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index cf71b741..d08bb241 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -29,6 +29,7 @@
#import "SPQueryController.h"
#import "SPTableContent.h"
#import "SPConnectionController.h"
+#import <BWToolkitFramework/BWToolkitFramework.h>
#define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]")
#define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]")
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index 3b84d867..b69f23a1 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -23,6 +23,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#import <MCPKit/MCPKit.h>
+#import "MCPGeometryData.h"
#import "SPCopyTable.h"
#import "SPTableContent.h"
@@ -35,6 +36,8 @@
#import "SPAlertSheets.h"
#import "SPBundleHTMLOutputController.h"
#import "SPGeometryDataView.h"
+#import "SPBundleEditorController.h"
+#import "SPAppController.h"
NSInteger MENU_EDIT_COPY = 2001;
NSInteger MENU_EDIT_COPY_WITH_COLUMN = 2002;
@@ -157,7 +160,6 @@ NSInteger kBlobAsImageFile = 4;
// Loop through the rows, adding their descriptive contents
NSUInteger rowIndex = [selectedRows firstIndex];
NSString *nullString = [prefs objectForKey:SPNullValue];
- NSStringEncoding connectionEncoding = [mySQLConnection encoding];
Class mcpGeometryData = [MCPGeometryData class];
NSUInteger rowCounter = 0;
@@ -296,7 +298,6 @@ NSInteger kBlobAsImageFile = 4;
// Loop through the rows, adding their descriptive contents
NSUInteger rowIndex = [selectedRows firstIndex];
NSString *nullString = [prefs objectForKey:SPNullValue];
- NSStringEncoding connectionEncoding = [mySQLConnection encoding];
Class mcpGeometryData = [MCPGeometryData class];
NSUInteger rowCounter = 0;
@@ -699,7 +700,7 @@ NSInteger kBlobAsImageFile = 4;
NSUInteger allColumnWidths = 0;
// Determine the available size
- NSScrollView *parentScrollView = [[self superview] superview];
+ NSScrollView *parentScrollView = (NSScrollView*)[[self superview] superview];
CGFloat visibleTableWidth = [parentScrollView bounds].size.width - [NSScroller scrollerWidth] - [columnDefinitions count] * 3.5;
for (NSDictionary *columnDefinition in columnDefinitions) {
@@ -1147,7 +1148,6 @@ NSInteger kBlobAsImageFile = 4;
NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey];
NSString *inputAction = @"";
NSString *inputFallBackAction = @"";
- NSString *withBlobHandling = @"";
NSError *err = nil;
NSString *uuid = [NSString stringWithNewUUID];
NSString *bundleInputFilePath = [NSString stringWithFormat:@"%@_%@", SPBundleTaskInputFilePath, uuid];
diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h
index 317db0c9..26d0a60c 100644
--- a/Source/SPCustomQuery.h
+++ b/Source/SPCustomQuery.h
@@ -63,7 +63,7 @@
IBOutlet NSWindow *queryFavoritesSheet;
IBOutlet NSButton *saveQueryFavoriteButton;
IBOutlet NSTextField *queryFavoriteNameTextField;
- IBOutlet id saveQueryFavoriteGlobal;
+ IBOutlet NSButton *saveQueryFavoriteGlobal;
IBOutlet id queryHistoryButton;
IBOutlet NSMenuItem *queryHistorySearchMenuItem;
@@ -239,6 +239,9 @@
- (void) startDocumentTaskForTab:(NSNotification *)aNotification;
- (void) endDocumentTaskForTab:(NSNotification *)aNotification;
+// Tableview interaction
+- (void)tableSortCallback;
+
// Other
- (void)setConnection:(MCPConnection *)theConnection;
- (void)doPerformQueryService:(NSString *)query;
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index c43df1cd..7005e690 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -167,7 +167,7 @@
// If carriage returns were found, normalise the queries
if ([queryParser containsCarriageReturns]) {
NSMutableArray *normalisedQueries = [NSMutableArray arrayWithCapacity:[queries count]];
- for (NSString *query in queries) {
+ for (query in queries) {
[normalisedQueries addObject:[SPSQLParser normaliseQueryForExecution:query]];
}
queries = normalisedQueries;
@@ -534,7 +534,7 @@
SEL callbackMethod = NULL;
NSString *taskButtonString;
- NSInteger i, totalQueriesRun = 0, totalAffectedRows = 0;
+ NSUInteger i, totalQueriesRun = 0, totalAffectedRows = 0;
double executionTime = 0;
NSInteger firstErrorOccuredInQuery = -1;
BOOL suppressErrorSheet = NO;
@@ -633,7 +633,7 @@
}
// Record any affected rows
- if ( [mySQLConnection affectedRows] != -1 )
+ if ( [mySQLConnection affectedRows] >= 0 )
totalAffectedRows += [mySQLConnection affectedRows];
else if ( [streamingResult numOfRows] )
totalAffectedRows += [streamingResult numOfRows];
@@ -893,7 +893,7 @@
dataLoadingPool = [[NSAutoreleasePool alloc] init];
// Loop through the result rows as they become available
- while (tempRow = [theResult fetchNextRowAsArray]) {
+ while ((tempRow = [theResult fetchNextRowAsArray])) {
pthread_mutex_lock(&resultDataLock);
SPDataStorageAddRow(resultData, tempRow);
@@ -937,8 +937,8 @@
NSCharacterSet *whitespaceAndNewlineSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet];
- // If the supplied position is negative or beyond the end of the string, return nil.
- if (position < 0 || position > [[textView string] length])
+ // If the supplied position is beyond the end of the string, return nil.
+ if (position > [[textView string] length])
return NSMakeRange(NSNotFound, 0);
// Split the current text into ranges of queries
@@ -1054,8 +1054,8 @@
SPSQLParser *customQueryParser;
NSArray *queries;
- // If the supplied position is negative or beyond the end of the string, return nil.
- if (position < 0 || position > [[textView string] length])
+ // If the supplied position beyond the end of the string, return nil.
+ if (position > [[textView string] length])
return NSMakeRange(NSNotFound,0);
// Split the current text into ranges of queries
@@ -1314,7 +1314,7 @@
*/
- (void) initQueryLoadTimer
{
- if (queryLoadTimer) [self clearTableLoadTimer];
+ if (queryLoadTimer) [self clearQueryLoadTimer];
queryLoadInterfaceUpdateInterval = 1;
queryLoadLastRowCount = 0;
queryLoadTimerTicksSinceLastUpdate = 0;
@@ -1750,7 +1750,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"] ) {
@@ -2056,7 +2056,7 @@
// Remove all quoted strings as a temp string to match the correct clauses
NSRange matchedRange;
- NSInteger i;
+ NSUInteger i;
NSMutableString *tmpString = [NSMutableString stringWithString:queryString];
NSMutableString *qq = [NSMutableString string];
matchedRange = [tmpString rangeOfRegex:@"\"(?:[^\"\\\\]*+|\\\\.)*\""];
@@ -2333,7 +2333,7 @@
isFieldEditable = ([[editStatus objectAtIndex:0] integerValue] == 1) ? YES : NO;
NSString *fieldType = nil;
- NSUInteger *fieldLength = 0;
+ NSUInteger fieldLength = 0;
NSString *fieldEncoding = nil;
BOOL allowNULL = YES;
@@ -3158,9 +3158,11 @@
// Remove all needless default menu items
NSEnumerator *itemEnumerator = [defaultMenuItems objectEnumerator];
NSMenuItem *menuItem = nil;
- while (menuItem = [itemEnumerator nextObject])
+
+ while ((menuItem = [itemEnumerator nextObject]))
{
NSInteger tag = [menuItem tag];
+
switch (tag)
{
case 2000: // WebMenuItemTagOpenLink
@@ -3639,7 +3641,7 @@
*/
- (IBAction)filterQueryFavorites:(id)sender
{
- NSUInteger i;
+ NSInteger i;
NSMenu *menu = [queryFavoritesButton menu];
NSString *searchPattern = [queryFavoritesSearchField stringValue];
@@ -3723,8 +3725,6 @@
shouldBeginEditing = NO;
}
- NSString *fieldType;
-
BOOL isBlob = NO;
// Check if current field is a blob
diff --git a/Source/SPDataAdditions.m b/Source/SPDataAdditions.m
index b0a4e6d2..805692c6 100644
--- a/Source/SPDataAdditions.m
+++ b/Source/SPDataAdditions.m
@@ -57,8 +57,8 @@ static char base64encodingTable[64] = {
NSUInteger lentext = [self length];
NSInteger ctremaining = 0;
unsigned char inbuf[3], outbuf[4];
- short i = 0;
- short charsonline = 0, ctcopy = 0;
+ NSUInteger i = 0;
+ NSUInteger charsonline = 0, ctcopy = 0;
NSUInteger ix = 0;
NSMutableString *base64 = [NSMutableString stringWithCapacity:lentext];
@@ -111,7 +111,7 @@ static char base64encodingTable[64] = {
- (NSData *)dataEncryptedWithPassword:(NSString *)password
{
// Create a random 128-bit initialization vector
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
NSInteger ivIndex;
unsigned char iv[16];
for (ivIndex = 0; ivIndex < 16; ivIndex++)
@@ -131,7 +131,7 @@ static char base64encodingTable[64] = {
memcpy(paddedBytes, [self bytes], dataLength);
// The last 32-bit chunk is the size of the plaintext, which is encrypted with the plaintext
- NSInteger bigIntDataLength = NSSwapHostIntToBig(dataLength);
+ NSInteger bigIntDataLength = NSSwapHostIntToBig((unsigned int)dataLength);
memcpy(paddedBytes + (paddedLength - 4), &bigIntDataLength, 4);
// Create the key from first 128-bits of the 160-bit password hash
@@ -180,7 +180,7 @@ static char base64encodingTable[64] = {
// Get the size of the data from the last 32-bit chunk
NSInteger bigIntDataLength = *((UInt32*)decryptedBytes + ((encryptedLength / 4) - 1));
- NSInteger dataLength = NSSwapBigIntToHost(bigIntDataLength);
+ NSInteger dataLength = NSSwapBigIntToHost((unsigned int)bigIntDataLength);
return [NSData dataWithBytesNoCopy:decryptedBytes length:dataLength];
}
@@ -198,7 +198,7 @@ static char base64encodingTable[64] = {
z_stream zlibStream;
zlibStream.next_in = (Bytef *)[self bytes];
- zlibStream.avail_in = [self length];
+ zlibStream.avail_in = (uInt)[self length];
zlibStream.total_out = 0;
zlibStream.zalloc = Z_NULL;
zlibStream.zfree = Z_NULL;
@@ -210,7 +210,7 @@ static char base64encodingTable[64] = {
if (zlibStream.total_out >= [unzipData length])
[unzipData increaseLengthBy: half_length];
zlibStream.next_out = [unzipData mutableBytes] + zlibStream.total_out;
- zlibStream.avail_out = [unzipData length] - zlibStream.total_out;
+ zlibStream.avail_out = (uInt)([unzipData length] - zlibStream.total_out);
status = inflate (&zlibStream, Z_SYNC_FLUSH);
if (status == Z_STREAM_END) done = YES;
@@ -238,7 +238,7 @@ static char base64encodingTable[64] = {
zlibStream.opaque = Z_NULL;
zlibStream.total_out = 0;
zlibStream.next_in=(Bytef *)[self bytes];
- zlibStream.avail_in = [self length];
+ zlibStream.avail_in = (uInt)[self length];
if (deflateInit(&zlibStream, Z_DEFAULT_COMPRESSION) != Z_OK) return nil;
@@ -251,7 +251,7 @@ static char base64encodingTable[64] = {
[zipData increaseLengthBy: 16384];
zlibStream.next_out = [zipData mutableBytes] + zlibStream.total_out;
- zlibStream.avail_out = [zipData length] - zlibStream.total_out;
+ zlibStream.avail_out = (uInt)([zipData length] - zlibStream.total_out);
deflate(&zlibStream, Z_FINISH);
diff --git a/Source/SPDataCellFormatter.h b/Source/SPDataCellFormatter.h
index a2ba23b1..c5d9cd99 100644
--- a/Source/SPDataCellFormatter.h
+++ b/Source/SPDataCellFormatter.h
@@ -29,7 +29,7 @@
NSString *fieldType;
}
-@property NSInteger textLimit;
-@property NSString* fieldType;
+@property(readwrite, assign) NSInteger textLimit;
+@property(readwrite, retain) NSString* fieldType;
@end
diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m
index 515bf2a7..0180227b 100644
--- a/Source/SPDataCellFormatter.m
+++ b/Source/SPDataCellFormatter.m
@@ -91,4 +91,11 @@
return YES;
}
+- (void)dealloc
+{
+ if (fieldType) [fieldType release], fieldType = nil;
+
+ [super dealloc];
+}
+
@end
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m
index bfde3a26..0667ac07 100644
--- a/Source/SPDataImport.m
+++ b/Source/SPDataImport.m
@@ -39,6 +39,7 @@
#import "SPFileHandle.h"
#import "SPEncodingPopupAccessory.h"
+#import <MCPKit/MCPKit.h>
#import <UniversalDetector/UniversalDetector.h>
#define SP_FILE_READ_ERROR_STRING NSLocalizedString(@"File read error", @"File read error title (Import Dialog)")
@@ -363,7 +364,6 @@
NSInteger dataBufferPosition = 0;
NSInteger dataBufferLastQueryEndPosition = 0;
BOOL fileIsCompressed;
- BOOL importSQLAsUTF8 = YES;
BOOL allDataRead = NO;
BOOL ignoreSQLErrors = ([importSQLErrorHandlingPopup selectedTag] == SPSQLImportIgnoreErrors);
NSStringEncoding sqlEncoding = NSUTF8StringEncoding;
diff --git a/Source/SPDataStorage.m b/Source/SPDataStorage.m
index f03fbd7a..26bcc79e 100644
--- a/Source/SPDataStorage.m
+++ b/Source/SPDataStorage.m
@@ -379,7 +379,7 @@ static inline void SPDataStorageEnsureCapacityForAdditionalRowCount(SPDataStorag
#pragma mark -
- (id) init {
- if (self = [super init]) {
+ if ((self = [super init])) {
numColumns = 0;
columnPointerByteSize = 0;
numRows = 0;
diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m
index 40192156..66b6ba1b 100644
--- a/Source/SPDatabaseCopy.m
+++ b/Source/SPDatabaseCopy.m
@@ -99,6 +99,7 @@
- (void)dealloc
{
[dbInfo release], dbInfo = nil;
+ [super dealloc];
}
-@end \ No newline at end of file
+@end
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 3459b9b8..efc3f25e 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -35,7 +35,7 @@
SPWindowController,
SPServerSupport;
-@protocol SPConnectionControllerDelegateProtocol;
+#import "SPConnectionControllerDelegateProtocol.h"
/**
* The SPDatabaseDocument class controls the primary database view window.
@@ -305,6 +305,8 @@
- (IBAction)showUserManager:(id)sender;
- (IBAction)copyChecksumFromSheet:(id)sender;
- (void)setIsSavedInBundle:(BOOL)savedInBundle;
+- (void)setFileURL:(NSURL *)fileURL;
+- (void)connect;
- (void)showConsole:(id)sender;
- (IBAction)showNavigator:(id)sender;
@@ -321,6 +323,8 @@
- (NSString *)connectionID;
- (NSString *)tabTitleForTooltip;
- (BOOL)isSaveInBundle;
+- (NSURL *)fileURL;
+- (NSString *)displayName;
// Notification center methods
- (void)willPerformQuery:(NSNotification *)notification;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 4bc82a21..af639127 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -56,7 +56,10 @@
#import "SPDatabaseRename.h"
#import "SPServerSupport.h"
#import "SPTooltip.h"
-
+#import "SPDatabaseViewController.h"
+#import "SPBundleHTMLOutputController.h"
+#import "SPConnectionDelegate.h"
+#import "SPWindowController.h"
@interface SPDatabaseDocument (PrivateAPI)
@@ -2787,15 +2790,19 @@
[alert setAlertStyle:NSCriticalAlertStyle];
[alert runModal];
- return NO;
+
+ return;
}
NSError *error = nil;
+
[plist writeToFile:[NSString stringWithFormat:@"%@/info.plist", fileName] options:NSAtomicWrite error:&error];
+
if(error != nil){
NSAlert *errorAlert = [NSAlert alertWithError:error];
[errorAlert runModal];
- return NO;
+
+ return;
}
[[NSApp delegate] setSessionURL:fileName];
@@ -3306,7 +3313,6 @@
*/
- (void) updateWindowTitle:(id)sender
{
-
// Ensure a call on the main thread
if (![NSThread isMainThread]) return [[self onMainThread] updateWindowTitle:sender];
@@ -4721,7 +4727,7 @@
BOOL isDir;
if([fm fileExistsAtPath:queryFileName isDirectory:&isDir] && !isDir) {
NSError *inError = nil;
- NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:inError];
+ NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:&inError];
[fm removeItemAtPath:queryFileName error:nil];
if(inError == nil && query && [query length]) {
[tableContentInstance filterTable:query];
@@ -4741,7 +4747,6 @@
NSString *statusFileName = [NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, docProcessID];
NSFileManager *fm = [NSFileManager defaultManager];
NSString *status = @"0";
- BOOL isDir;
BOOL userTerminated = NO;
BOOL doSyntaxHighlighting = NO;
BOOL doSyntaxHighlightingViaCSS = NO;
@@ -4890,7 +4895,7 @@
if([fm fileExistsAtPath:queryFileName isDirectory:&isDir] && !isDir) {
NSError *inError = nil;
- NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:inError];
+ NSString *query = [NSString stringWithContentsOfFile:queryFileName encoding:NSUTF8StringEncoding error:&inError];
[fm removeItemAtPath:queryFileName error:nil];
[fm removeItemAtPath:resultFileName error:nil];
diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m
index dc5a8967..b7aa3f73 100644
--- a/Source/SPDatabaseRename.m
+++ b/Source/SPDatabaseRename.m
@@ -25,6 +25,7 @@
#import "SPDBActionCommons.h"
#import "SPDatabaseRename.h"
#import "SPTableCopy.h"
+#import "SPDatabaseInfo.h"
@implementation SPDatabaseRename
@@ -111,6 +112,7 @@
- (void)dealloc
{
[dbInfo release], dbInfo = nil;
+ [super dealloc];
}
-@end \ No newline at end of file
+@end
diff --git a/Source/SPDatabaseViewController.h b/Source/SPDatabaseViewController.h
index 14dd5e88..f7d795ca 100644
--- a/Source/SPDatabaseViewController.h
+++ b/Source/SPDatabaseViewController.h
@@ -29,7 +29,6 @@
@interface SPDatabaseDocument (SPDatabaseViewController)
// Getters
-- (NSView *)parentView;
- (NSString *)table;
- (NSInteger)tableType;
- (BOOL)structureLoaded;
@@ -50,4 +49,6 @@
// Table control
- (void)loadTable:(NSString *)aTable ofType:(NSInteger)aTableType;
+- (NSView *)databaseView;
+
@end
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m
index a6600d3f..88928897 100644
--- a/Source/SPDatabaseViewController.m
+++ b/Source/SPDatabaseViewController.m
@@ -23,8 +23,15 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+#import "SPAppController.h"
+#import "SPBundleHTMLOutputController.h"
+#import "SPCopyTable.h"
#import "SPDatabaseViewController.h"
+#import "SPHistoryController.h"
+#import "SPTableContent.h"
#import "SPTableData.h"
+#import "SPTablesList.h"
+#import "SPTableTriggers.h"
@interface SPDatabaseDocument (SPDatabaseViewControllerPrivateAPI)
@@ -490,7 +497,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]) {
@@ -522,4 +529,4 @@
[loadPool drain];
}
-@end \ No newline at end of file
+@end
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m
index 95fcd51d..7a4fb37c 100644
--- a/Source/SPEditSheetTextView.m
+++ b/Source/SPEditSheetTextView.m
@@ -30,9 +30,8 @@
- (id)init
{
- if(self = [super init])
+ if((self = [super init]))
{
- ;
}
return self;
}
diff --git a/Source/SPEditorPreferencePane.h b/Source/SPEditorPreferencePane.h
index d7cb1eb4..6e94d9eb 100644
--- a/Source/SPEditorPreferencePane.h
+++ b/Source/SPEditorPreferencePane.h
@@ -63,7 +63,6 @@
}
- (IBAction)showCustomQueryFontPanel:(id)sender;
-- (IBAction)showGlobalResultTableFontPanel:(id)sender;
- (IBAction)setDefaultColors:(id)sender;
- (IBAction)exportColorScheme:(id)sender;
- (IBAction)importColorScheme:(id)sender;
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index 50388e8a..0cae1217 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -30,14 +30,14 @@
#import "SPCategoryAdditions.h"
// Constants
-static const NSString *SPImportColorScheme = @"ImportColorScheme";
-static const NSString *SPExportColorScheme = @"ExportColorScheme";
-static const NSString *SPSaveColorScheme = @"SaveColorScheme";
-static const NSString *SPDefaultColorSchemeName = @"Default";
-static const NSString *SPDefaultColorSchemeNameLC = @"default";
-static const NSString *SPCustomColorSchemeName = @"User-defined";
-static const NSString *SPCustomColorSchemeNameLC = @"user-defined";
-static const NSString *SPDefaultExportColourSchemeName = @"MyTheme";
+static NSString *SPImportColorScheme = @"ImportColorScheme";
+static NSString *SPExportColorScheme = @"ExportColorScheme";
+static NSString *SPSaveColorScheme = @"SaveColorScheme";
+static NSString *SPDefaultColorSchemeName = @"Default";
+static NSString *SPDefaultColorSchemeNameLC = @"default";
+static NSString *SPCustomColorSchemeName = @"User-defined";
+static NSString *SPCustomColorSchemeNameLC = @"user-defined";
+static NSString *SPDefaultExportColourSchemeName = @"MyTheme";
@interface SPEditorPreferencePane (PrivateAPI)
@@ -517,7 +517,7 @@ static const NSString *SPDefaultExportColourSchemeName = @"MyTheme";
}
}
-- (void)panelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
+- (void)panelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if ([contextInfo isEqualToString:SPExportColorScheme]) {
if (returnCode == NSOKButton) {
@@ -546,7 +546,7 @@ static const NSString *SPDefaultExportColourSchemeName = @"MyTheme";
return [editThemeListItems count];
}
- return nil;
+ return 0;
}
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
@@ -806,11 +806,7 @@ static const NSString *SPDefaultExportColourSchemeName = @"MyTheme";
NSMutableDictionary *scheme = [NSMutableDictionary dictionary];
NSMutableDictionary *mainsettings = [NSMutableDictionary dictionary];
NSMutableArray *settings = [NSMutableArray array];
-
- CGFloat red, green, blue, alpha;
- NSInteger redInt, greenInt, blueInt, alphaInt;
- NSString *redHexValue, *greenHexValue, *blueHexValue, *alphaHexValue;
-
+
[prefs synchronize];
NSColor *aColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]];
diff --git a/Source/SPEditorTokens.l b/Source/SPEditorTokens.l
index 7b19804a..67491351 100644
--- a/Source/SPEditorTokens.l
+++ b/Source/SPEditorTokens.l
@@ -41,12 +41,11 @@
size_t utf8strlen(const char * _s);
size_t yyuoffset, yyuleng;
-#define YY_NO_UNPUT
-
//keep track of the current utf-8 character (not byte) offset and token length
#define YY_USER_ACTION { yyuoffset += yyuleng; yyuleng = utf8strlen(yytext); }
%}
%option noyywrap
+%option nounput
%option case-insensitive
s [ \t\n\r]+
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 9081b942..04138c75 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -33,6 +33,8 @@
#import "SPGrowlController.h"
#import "SPExportFile.h"
#import "SPAlertSheets.h"
+#import "SPExportFilenameUtilities.h"
+#import "SPDatabaseDocument.h"
// Constants
static const NSUInteger SPExportUIPadding = 20;
@@ -775,7 +777,6 @@ static const NSString *SPTableViewDropColumnID = @"drop";
NSUInteger padding = (2 * SPExportUIPadding);
CGFloat width = (!display) ? (windowFrame.size.width - (padding + 2)) : (windowFrame.size.width - ([exportOptionsTabBar frame].size.width + (padding + 4)));
- CGFloat width2 = (!display) ? (windowFrame.size.width - (padding + 2)) : (windowFrame.size.width - ([exportTableListButtonBar frame].size.width + (padding + 4)));
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:0.3];
@@ -803,7 +804,6 @@ static const NSString *SPTableViewDropColumnID = @"drop";
BOOL isXML = (exportType == SPXMLExport);
BOOL isHTML = (exportType == SPHTMLExport);
BOOL isPDF = (exportType == SPPDFExport);
- BOOL isDot = (exportType == SPDotExport);
BOOL structureEnabled = [[uiStateDict objectForKey:@"SQLExportStructureEnabled"] integerValue];
BOOL contentEnabled = [[uiStateDict objectForKey:@"SQLExportContentEnabled"] integerValue];
diff --git a/Source/SPExportControllerDelegate.m b/Source/SPExportControllerDelegate.m
index 575bb0f9..8f4977a6 100644
--- a/Source/SPExportControllerDelegate.m
+++ b/Source/SPExportControllerDelegate.m
@@ -24,6 +24,15 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPExportControllerDelegate.h"
+#import "SPExportFilenameUtilities.h"
+
+// Defined to suppress warnings
+@interface SPExportController (SPExportControllerPrivateAPI)
+
+- (void)_toggleExportButtonOnBackgroundThread;
+- (void)_switchTab;
+
+@end
@implementation SPExportController (SPExportControllerDelegate)
diff --git a/Source/SPExportFile.m b/Source/SPExportFile.m
index 7e77d5de..4ccfa16c 100644
--- a/Source/SPExportFile.m
+++ b/Source/SPExportFile.m
@@ -24,6 +24,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPExportFile.h"
+#import "SPFileHandle.h"
@interface SPExportFile (PrivateAPI)
diff --git a/Source/SPExportFileUtilities.m b/Source/SPExportFileUtilities.m
index 5a9d16ee..d39aee17 100644
--- a/Source/SPExportFileUtilities.m
+++ b/Source/SPExportFileUtilities.m
@@ -26,6 +26,9 @@
#import "SPExportFileUtilities.h"
#import "SPExporter.h"
#import "SPAlertSheets.h"
+#import "SPExportFile.h"
+#import "SPDatabaseDocument.h"
+#import "SPCustomQuery.h"
@implementation SPExportController (SPExportFileUtilities)
@@ -135,8 +138,17 @@
}
}
}
-
-
+
+ // Compare the count of exported files to the count of failed files
+ NSUInteger totalFilesExported = [exportFiles count];
+
+ // If all the files failed, show a simplified export dialog
+
+
+ // If only some of the files failed, show an export dialog with the option to ignore the failed files.
+
+
+ // For single files, show a dialog very close to the OS dialog
if (i > 0) {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error creating export files", @"export file handle creation error message")
diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m
index 0695d29e..7ce7b3a2 100644
--- a/Source/SPExportFilenameUtilities.m
+++ b/Source/SPExportFilenameUtilities.m
@@ -78,7 +78,7 @@
filename = @"query_result";
break;
case SPTableExport:
- filename = [tableDocumentInstance database];
+ filename = [NSString stringWithFormat:@"%@_%@", [tableDocumentInstance database], [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]];
break;
}
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m
index db951b5f..f1868210 100644
--- a/Source/SPExportInitializer.m
+++ b/Source/SPExportInitializer.m
@@ -38,6 +38,10 @@
#import "SPSQLExporter.h"
#import "SPXMLExporter.h"
#import "SPDotExporter.h"
+#import "SPConnectionControllerDelegateProtocol.h"
+#import "SPExportFile.h"
+#import "SPExportFileUtilities.h"
+#import "SPExportFilenameUtilities.h"
@implementation SPExportController (SPExportInitializer)
@@ -174,7 +178,6 @@
*/
- (void)exportTables:(NSArray *)exportTables orDataArray:(NSArray *)dataArray
{
- NSUInteger i;
BOOL singleFileHandleSet = NO;
SPExportFile *singleExportFile = nil, *file = nil;
@@ -277,7 +280,7 @@
[sqlExporter setSqlExportTables:exportTables];
// Create custom filename if required
- [exportFilename setString:(createCustomFilename) ? [self expandCustomFilenameFormatFromString:[exportCustomFilenameTokenField stringValue] usingTableName:nil] : [NSString stringWithFormat:@"%@_%@", [tableDocumentInstance database], [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]]];
+ [exportFilename setString:(createCustomFilename) ? [self expandCustomFilenameFormatFromString:[exportCustomFilenameTokenField stringValue] usingTableName:nil] : [self generateDefaultExportFilename]];
[exportFilename setString:[exportFilename stringByAppendingPathExtension:[self currentDefaultExportFileExtension]]];
diff --git a/Source/SPExporter.m b/Source/SPExporter.m
index e0e862fa..3be120b0 100644
--- a/Source/SPExporter.m
+++ b/Source/SPExporter.m
@@ -24,6 +24,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPExporter.h"
+#import "SPExportFile.h"
@implementation SPExporter
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index 568ba629..b7e499cf 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -183,9 +183,9 @@
- (IBAction)setToNull:(id)sender;
- (void)updateBitSheet;
-- (id)editWithObject:(id)data fieldName:(NSString*)fieldName usingEncoding:(NSStringEncoding)anEncoding
- isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)theWindow
- withSender:(id)sender contextInfo:(NSDictionary*)theContextInfo;
+- (void)editWithObject:(id)data fieldName:(NSString*)fieldName usingEncoding:(NSStringEncoding)anEncoding
+ isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)theWindow
+ sender:(id)sender contextInfo:(NSDictionary*)theContextInfo;
- (void)setTextMaxLength:(NSUInteger)length;
- (void)setFieldType:(NSString*)aType;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index b77ca98e..7079cc13 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -30,17 +30,18 @@
#import "SPTableView.h"
#import "SPCategoryAdditions.h"
#import "RegexKitLite.h"
+#import "SPDatabaseData.h"
#define SP_NUMBER_OF_RECORDS_STRING NSLocalizedString(@"%ld of %@%lu records", @"Label showing the index of the selected CSV row")
// Constants
-static const NSString *SPTableViewImportValueColumnID = @"import_value";
-static const NSString *SPTableViewTypeColumnID = @"type";
-static const NSString *SPTableViewTargetFieldColumnID = @"target_field";
-static const NSString *SPTableViewOperatorColumnID = @"operator";
-static const NSString *SPTableViewValueIndexColumnID = @"value_index";
-static const NSString *SPTableViewGlobalValueColumnID = @"global_value";
-static const NSString *SPTableViewSqlColumnID = @"sql";
+static NSString *SPTableViewImportValueColumnID = @"import_value";
+static NSString *SPTableViewTypeColumnID = @"type";
+static NSString *SPTableViewTargetFieldColumnID = @"target_field";
+static NSString *SPTableViewOperatorColumnID = @"operator";
+static NSString *SPTableViewValueIndexColumnID = @"value_index";
+static NSString *SPTableViewGlobalValueColumnID = @"global_value";
+static NSString *SPTableViewSqlColumnID = @"sql";
@implementation SPFieldMapperController
@@ -55,7 +56,7 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
*/
- (id)initWithDelegate:(id)managerDelegate
{
- if (self = [super initWithWindowNibName:@"DataMigrationDialog"]) {
+ if ((self = [super initWithWindowNibName:@"DataMigrationDialog"])) {
fieldMappingCurrentRow = 0;
if(managerDelegate == nil) {
@@ -1388,8 +1389,6 @@ static const NSString *SPTableViewSqlColumnID = @"sql";
NSInteger i,j;
NSMutableArray *distMatrix = [NSMutableArray array];
for(i=0; i < [tableHeaderNames count]; i++) {
- CGFloat minDist = 1e6;
- NSInteger minIndex = 0;
CGFloat dist = 1e6;
for(j=0; j < [fileHeaderNames count]; j++) {
id fileHeaderName = NSArrayObjectAtIndex(fileHeaderNames,j);
diff --git a/Source/SPFileManagerAdditions.m b/Source/SPFileManagerAdditions.m
index 2ea9fb71..22becf92 100644
--- a/Source/SPFileManagerAdditions.m
+++ b/Source/SPFileManagerAdditions.m
@@ -120,7 +120,7 @@ NSString* const DirectoryLocationDomain = @"DirectoryLocationDomain";
if(create) {
// Create the path if it doesn't exist
- NSError *error = nil;
+ error = nil;
BOOL success = [self createDirectoryAtPath:resolvedPath withIntermediateDirectories:YES attributes:nil error:&error];
if (!success) {
if (errorOut) {
diff --git a/Source/SPFontPreviewTextField.m b/Source/SPFontPreviewTextField.m
index 1c4e4b02..90e9f93f 100644
--- a/Source/SPFontPreviewTextField.m
+++ b/Source/SPFontPreviewTextField.m
@@ -35,7 +35,7 @@
_actualFont = [font retain];
- [super setFont:[[NSFontManager sharedFontManager] convertFont:font toSize:11.]];
+ [super setFont:[[NSFontManager sharedFontManager] convertFont:font toSize:11.0f]];
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:[_actualFont displayName]];
NSMutableParagraphStyle *paraStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
diff --git a/Source/SPGeometryDataView.m b/Source/SPGeometryDataView.m
index 10cf5b4a..d68bb57b 100644
--- a/Source/SPGeometryDataView.m
+++ b/Source/SPGeometryDataView.m
@@ -79,9 +79,8 @@
x_min*=zoom_factor;
y_min*=zoom_factor;
- if ( self = [super initWithFrame:NSMakeRect(0,0,width+margin_offset*2,height+margin_offset*2)] )
+ if ( (self = [super initWithFrame:NSMakeRect(0,0,width+margin_offset*2,height+margin_offset*2)]) )
{
- ;
}
lineColor = [NSColor blackColor];
@@ -263,7 +262,6 @@
{
if(!type || ![type length] || !coordinates || ![coordinates count]) return nil;
- NSSize mySize = self.bounds.size;
NSRect myBounds = [self bounds];
return [self dataWithPDFInsideRect:myBounds];
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 71f93053..a3d42526 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -24,6 +24,8 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPGrowlController.h"
+#import "SPDatabaseDocument.h"
+#import "SPWindowController.h"
#include <mach/mach_time.h>
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 107c24cb..9b810a00 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -26,6 +26,7 @@
#import "SPTableContent.h"
#import "SPTablesList.h"
#import "SPHistoryController.h"
+#import "SPDatabaseViewController.h"
@implementation SPHistoryController
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index 49ac8594..f1cce967 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -26,6 +26,10 @@
#import "SPIndexesController.h"
#import "SPAlertSheets.h"
#import "SPServerSupport.h"
+#import "SPTableContent.h"
+#import "SPTableData.h"
+#import <MCPKit/MCPKit.h>
+#import "SPDatabaseDocument.h"
// Constants
static const NSString *SPNewIndexIndexName = @"IndexName";
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index 335c0a0b..bb010d3b 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -66,7 +66,7 @@
NSArray *trustedApps = [NSArray arrayWithObjects:(id)sequelProRef, (id)sequelProHelperRef, nil];
status = SecAccessCreate((CFStringRef)name, (CFArrayRef)trustedApps, &passwordAccessRef);
if (status != noErr) {
- NSLog(@"Error (%i) while trying to create access list for name: %@ account: %@", status, name, account);
+ NSLog(@"Error (%i) while trying to create access list for name: %@ account: %@", (int)status, name, account);
passwordAccessRef = NULL;
}
}
@@ -77,13 +77,13 @@
attributes[0].length = 20;
attributes[1].tag = kSecLabelItemAttr;
attributes[1].data = (unichar *)[label UTF8String];
- attributes[1].length = strlen([label UTF8String]);
+ attributes[1].length = (UInt32)strlen([label UTF8String]);
attributes[2].tag = kSecAccountItemAttr;
attributes[2].data = (unichar *)[account UTF8String];
- attributes[2].length = strlen([account UTF8String]);
+ attributes[2].length = (UInt32)strlen([account UTF8String]);
attributes[3].tag = kSecServiceItemAttr;
attributes[3].data = (unichar *)[name UTF8String];
- attributes[3].length = strlen([name UTF8String]);
+ attributes[3].length = (UInt32)strlen([name UTF8String]);
attList.count = 4;
attList.attr = attributes;
@@ -91,7 +91,7 @@
status = SecKeychainItemCreateFromContent(
kSecGenericPasswordItemClass, // Generic password type
&attList, // The attribute list created for the keychain item
- strlen([password UTF8String]), // Length of password
+ (UInt32)strlen([password UTF8String]), // Length of password
[password UTF8String], // Password data
NULL, // Default keychain
passwordAccessRef, // Access list for this keychain
@@ -100,7 +100,7 @@
if (passwordAccessRef) CFRelease(passwordAccessRef);
if (status != noErr) {
- NSLog(@"Error (%i) while trying to add password for name: %@ account: %@", status, name, account);
+ NSLog(@"Error (%i) while trying to add password for name: %@ account: %@", (int)status, name, account);
SPBeginAlertSheet(NSLocalizedString(@"Error adding password to Keychain", @"error adding password to keychain message"),
NSLocalizedString(@"OK", @"OK button"),
@@ -127,15 +127,15 @@
if (!account) account = @"";
status = SecKeychainFindGenericPassword(
- NULL, // default keychain
- strlen([name UTF8String]), // length of service name (bytes)
- [name UTF8String], // service name
-
- strlen([account UTF8String]), // length of account name (bytes)
- [account UTF8String], // account name
- &passwordLength, // length of password
- &passwordData, // pointer to password data
- &itemRef // the item reference
+ NULL, // default keychain
+ (UInt32)strlen([name UTF8String]), // length of service name (bytes)
+ [name UTF8String], // service name
+
+ (UInt32)strlen([account UTF8String]), // length of account name (bytes)
+ [account UTF8String], // account name
+ &passwordLength, // length of password
+ &passwordData, // pointer to password data
+ &itemRef // the item reference
);
if (status == noErr) {
@@ -171,21 +171,21 @@
// Check if password already exists before deleting
if ([self passwordExistsForName:name account:account]) {
status = SecKeychainFindGenericPassword(
- NULL, // default keychain
- strlen([name UTF8String]), // length of service name
- [name UTF8String], // service name
- strlen([account UTF8String]), // length of account name
- [account UTF8String], // account name
- nil, // length of password
- nil, // pointer to password data
- &itemRef // the item reference
+ NULL, // default keychain
+ (UInt32)strlen([name UTF8String]), // length of service name
+ [name UTF8String], // service name
+ (UInt32)strlen([account UTF8String]), // length of account name
+ [account UTF8String], // account name
+ nil, // length of password
+ nil, // pointer to password data
+ &itemRef // the item reference
);
if (status == noErr) {
status = SecKeychainItemDelete(itemRef);
if (status != noErr) {
- NSLog(@"Error (%i) while trying to delete password for name: %@ account: %@", status, name, account);
+ NSLog(@"Error (%i) while trying to delete password for name: %@ account: %@", (int)status, name, account);
}
}
@@ -209,12 +209,12 @@
if (!account) account = @"";
attributes[0].tag = kSecAccountItemAttr;
- attributes[0].data = (void *)[account UTF8String]; // Account name
- attributes[0].length = strlen([account UTF8String]); // Length of account name (bytes)
+ attributes[0].data = (void *)[account UTF8String]; // Account name
+ attributes[0].length = (UInt32)strlen([account UTF8String]); // Length of account name (bytes)
attributes[1].tag = kSecServiceItemAttr;
- attributes[1].data = (void *)[name UTF8String]; // Service name
- attributes[1].length = strlen([name UTF8String]); // Length of service name (bytes)
+ attributes[1].data = (void *)[name UTF8String]; // Service name
+ attributes[1].length = (UInt32)strlen([name UTF8String]); // Length of service name (bytes)
list.count = 2;
list.attr = attributes;
diff --git a/Source/SPMainThreadTrampoline.m b/Source/SPMainThreadTrampoline.m
index 5f25e174..1277c760 100644
--- a/Source/SPMainThreadTrampoline.m
+++ b/Source/SPMainThreadTrampoline.m
@@ -58,7 +58,7 @@
*/
- (id) initWithObject:(id)theObject
{
- if (self = [super init]) {
+ if ((self = [super init])) {
trampolineObject = theObject;
}
return self;
@@ -149,4 +149,4 @@
return self;
}
-@end \ No newline at end of file
+@end
diff --git a/Source/SPMenuAdditions.m b/Source/SPMenuAdditions.m
index 45bde232..d653f71a 100644
--- a/Source/SPMenuAdditions.m
+++ b/Source/SPMenuAdditions.m
@@ -31,7 +31,7 @@
- (void)compatibleRemoveAllItems
{
if ([self respondsToSelector:@selector(removeAllItems)]) {
- [self removeAllItems];
+ [(id)self removeAllItems];
} else {
while ([self numberOfItems]) [self removeItemAtIndex:0];
}
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index abc00d9a..ca7f7f7d 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -112,7 +112,7 @@
maxWindowWidth = 450;
- if(self = [super initWithContentRect:NSMakeRect(0,0,maxWindowWidth,0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES])
+ if((self = [super initWithContentRect:NSMakeRect(0,0,maxWindowWidth,0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]))
{
mutablePrefix = [NSMutableString new];
originalFilterString = [NSMutableString new];
@@ -217,7 +217,7 @@
selectedDb:(NSString*)selectedDb caretMovedLeft:(BOOL)caretMovedLeft autoComplete:(BOOL)autoComplete oneColumn:(BOOL)oneColumn
alias:(NSString*)anAlias isQueryingDBStructure:(BOOL)isQueryingDBStructure
{
- if(self = [self init])
+ if((self = [self init]))
{
// Set filter string
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index aeb5af8c..25eccbc8 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -30,8 +30,10 @@
#import "SPTablesList.h"
#import "SPLogger.h"
#import "SPTooltip.h"
+#import "SPAppController.h"
+#import "SPDatabaseViewController.h"
-#import <objc/runtime.h>
+#import <objc/message.h>
static SPNavigatorController *sharedNavigatorController = nil;
diff --git a/Source/SPNotLoaded.m b/Source/SPNotLoaded.m
index 9ce0fec2..4e2925a7 100644
--- a/Source/SPNotLoaded.m
+++ b/Source/SPNotLoaded.m
@@ -52,7 +52,7 @@ static SPNotLoaded *notLoaded = nil;
Class notLoadedClass = [self class];
@synchronized(notLoadedClass) {
if (notLoaded == nil) {
- if (self = [super init]) {
+ if ((self = [super init])) {
notLoaded = self;
}
}
diff --git a/Source/SPOutlineView.m b/Source/SPOutlineView.m
index 256090e2..4e8f0f0a 100644
--- a/Source/SPOutlineView.m
+++ b/Source/SPOutlineView.m
@@ -28,8 +28,7 @@
- (id)init
{
- if(self = [super init]){
- ;
+ if((self = [super init])){
}
return self;
}
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 7b0e0cc3..2af3271e 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -42,12 +42,12 @@
@interface SPPreferenceController : NSWindowController
{
// Preference pane controllers
- IBOutlet SPGeneralPreferencePane *generalPreferencePane;
- IBOutlet SPTablesPreferencePane *tablesPreferencePane;
- IBOutlet SPNotificationsPreferencePane *notificationsPreferencePane;
- IBOutlet SPEditorPreferencePane *editorPreferencePane;
- IBOutlet SPAutoUpdatePreferencePane *autoUpdatePreferencePane;
- IBOutlet SPNetworkPreferencePane *networkPreferencePane;
+ IBOutlet SPGeneralPreferencePane <SPPreferencePaneProtocol> *generalPreferencePane;
+ IBOutlet SPTablesPreferencePane <SPPreferencePaneProtocol> *tablesPreferencePane;
+ IBOutlet SPNotificationsPreferencePane <SPPreferencePaneProtocol> *notificationsPreferencePane;
+ IBOutlet SPEditorPreferencePane <SPPreferencePaneProtocol> *editorPreferencePane;
+ IBOutlet SPAutoUpdatePreferencePane <SPPreferencePaneProtocol> *autoUpdatePreferencePane;
+ IBOutlet SPNetworkPreferencePane <SPPreferencePaneProtocol> *networkPreferencePane;
NSToolbar *toolbar;
NSArray *preferencePanes;
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index 7592319a..01d39e25 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -25,6 +25,9 @@
#import "SPPreferenceController.h"
#import "SPPreferencesUpgrade.h"
+#import "SPTablesPreferencePane.h"
+#import "SPEditorPreferencePane.h"
+#import "SPGeneralPreferencePane.h"
@interface SPPreferenceController (PrivateAPI)
@@ -85,13 +88,13 @@
- (IBAction)displayPreferencePane:(id)sender
{
- SPPreferencePane *preferencePane = nil;
+ SPPreferencePane <SPPreferencePaneProtocol> *preferencePane = nil;
if (!sender) {
preferencePane = generalPreferencePane;
}
else {
- for (SPPreferencePane *prefPane in preferencePanes)
+ for (SPPreferencePane <SPPreferencePaneProtocol> *prefPane in preferencePanes)
{
if ([[prefPane preferencePaneIdentifier] isEqualToString:[sender itemIdentifier]]) {
preferencePane = prefPane;
diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m
index 51bcd1b4..5894e397 100644
--- a/Source/SPPreferencesUpgrade.m
+++ b/Source/SPPreferencesUpgrade.m
@@ -72,17 +72,17 @@ void SPApplyRevisionChanges(void)
databaseEnumerator = [[prefs objectForKey:SPTableColumnWidths] keyEnumerator];
- while (databaseKey = [databaseEnumerator nextObject])
+ while ((databaseKey = [databaseEnumerator nextObject]))
{
newDatabase = [[NSMutableDictionary alloc] init];
tableEnumerator = [[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] keyEnumerator];
- while (tableKey = [tableEnumerator nextObject])
+ while ((tableKey = [tableEnumerator nextObject]))
{
newTable = [[NSMutableDictionary alloc] init];
columnEnumerator = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] objectForKey:tableKey] keyEnumerator];
- while (columnKey = [columnEnumerator nextObject])
+ while ((columnKey = [columnEnumerator nextObject]))
{
columnWidth = [[[[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] objectForKey:tableKey] objectForKey:columnKey] doubleValue];
@@ -132,7 +132,7 @@ void SPApplyRevisionChanges(void)
keyEnumerator = [keysToUpgrade keyEnumerator];
- while (newKey = [keyEnumerator nextObject])
+ while ((newKey = [keyEnumerator nextObject]))
{
oldKey = [keysToUpgrade objectForKey:newKey];
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index d6b5c186..fdef96bb 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -26,6 +26,7 @@
#import "SPProcessListController.h"
#import "SPDatabaseDocument.h"
#import "SPAlertSheets.h"
+#import "SPAppController.h"
// Constants
static const NSString *SPKillProcessQueryMode = @"SPKillProcessQueryMode";
@@ -77,7 +78,7 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id";
*/
- (void)awakeFromNib
{
- [[self window] setTitle:[NSString stringWithFormat:@"%@ %@", [[[NSApp delegate] frontDocument] name], NSLocalizedString(@"Server Processes", @"server processes window title")]];
+ [[self window] setTitle:[NSString stringWithFormat:@"%@ %@", [[(SPAppController*)[NSApp delegate] frontDocument] name], NSLocalizedString(@"Server Processes", @"server processes window title")]];
[self setWindowFrameAutosaveName:@"ProcessList"];
@@ -647,7 +648,7 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id";
}
// If a match wasn't found then a custom value is set
- if (!found) [[items objectAtIndex:([items count] - 1)] setState:NSOnState];
+ if (!found) [(NSMenuItem*)[items objectAtIndex:([items count] - 1)] setState:NSOnState];
}
/**
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 480d3e9e..ad9653ce 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -32,9 +32,9 @@
#define MESSAGE_TRUNCATE_CHARACTER_LENGTH 256
// Table view column identifier constants
-static const NSString *SPTableViewMessageColumnID = @"message";
-static const NSString *SPTableViewDateColumnID = @"messageDate";
-static const NSString *SPTableViewConnectionColumnID = @"messageConnection";
+static NSString *SPTableViewMessageColumnID = @"message";
+static NSString *SPTableViewDateColumnID = @"messageDate";
+static NSString *SPTableViewConnectionColumnID = @"messageConnection";
@interface SPQueryController (PrivateAPI)
diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m
index d999cc2b..f6760468 100644
--- a/Source/SPSQLExporter.m
+++ b/Source/SPSQLExporter.m
@@ -95,7 +95,7 @@
SPTableType tableType = SPTableTypeTable;
id createTableSyntax = nil;
- NSUInteger i, j, k, t, s, rowCount, queryLength, lastProgressValue;
+ NSUInteger j, k, t, s, rowCount, queryLength, lastProgressValue;
BOOL sqlOutputIncludeStructure;
BOOL sqlOutputIncludeContent;
diff --git a/Source/SPSQLTokenizer.l b/Source/SPSQLTokenizer.l
index 61fb3b8a..1964c94d 100644
--- a/Source/SPSQLTokenizer.l
+++ b/Source/SPSQLTokenizer.l
@@ -29,8 +29,6 @@
int utf8strlenfortoken(const char * _s);
int yyuoffset, yyuleng;
-#define YY_NO_UNPUT
-
//keep track of the current utf-8 character (not byte) offset and token length
#define YY_USER_ACTION { yyuoffset += yyuleng; yyuleng = utf8strlenfortoken(yytext); }
//ignore the output of unmatched characters
@@ -38,6 +36,7 @@ int yyuoffset, yyuleng;
%}
%option prefix="to"
%option noyywrap
+%option nounput
%option case-insensitive
%option nostdinit
@@ -135,5 +134,5 @@ int utf8strlenfortoken(const char * _s)
}
done:
- return ((s - _s) - count);
+ return (int)((s - _s) - count);
}
diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h
index 4afec738..bf7fd8a4 100644
--- a/Source/SPSSHTunnel.h
+++ b/Source/SPSSHTunnel.h
@@ -48,8 +48,8 @@
NSLock *debugMessagesLock;
NSInteger sshPort;
NSInteger remotePort;
- NSInteger localPort;
- NSInteger localPortFallback;
+ NSUInteger localPort;
+ NSUInteger localPortFallback;
NSInteger connectionState;
NSLock *answerAvailableLock;
@@ -81,8 +81,8 @@
- (NSInteger)state;
- (NSString *)lastError;
- (NSString *)debugMessages;
-- (NSInteger)localPort;
-- (NSInteger)localPortFallback;
+- (NSUInteger)localPort;
+- (NSUInteger)localPortFallback;
- (void)connect;
- (void)launchTask:(id)dummy;
- (void)disconnect;
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index e112e624..16d0c590 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -425,7 +425,7 @@
if ([notificationText length]) {
messages = [notificationText componentsSeparatedByString:@"\n"];
enumerator = [messages objectEnumerator];
- while (message = [[enumerator nextObject] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]) {
+ while ((message = [[enumerator nextObject] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]])) {
if (![message length]) continue;
[debugMessagesLock lock];
[debugMessages addObject:[NSString stringWithString:message]];
@@ -488,7 +488,7 @@
/*
* Returns the local port assigned for use by the tunnel
*/
-- (NSInteger)localPort
+- (NSUInteger)localPort
{
return localPort;
}
@@ -496,7 +496,7 @@
/*
* Returns the local port assigned for fallback use by the tunnel, if any
*/
-- (NSInteger)localPortFallback
+- (NSUInteger)localPortFallback
{
if (!useHostFallback) return 0;
diff --git a/Source/SPServerSupport.m b/Source/SPServerSupport.m
index 6f8213d6..1aebc0d4 100644
--- a/Source/SPServerSupport.m
+++ b/Source/SPServerSupport.m
@@ -205,7 +205,7 @@
- (NSString *)description
{
unsigned int i;
- NSString *description = [NSMutableString stringWithFormat:@"<%@: Server is MySQL version %d.%d.%d. Supports:\n", [self className], serverMajorVersion, serverMinorVersion, serverReleaseVersion];
+ NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: Server is MySQL version %d.%d.%d. Supports:\n", [self className], serverMajorVersion, serverMinorVersion, serverReleaseVersion];
Ivar *vars = class_copyIvarList([self class], &i);
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m
index e0796454..dedda57b 100644
--- a/Source/SPServerVariablesController.m
+++ b/Source/SPServerVariablesController.m
@@ -25,6 +25,7 @@
#import "SPServerVariablesController.h"
#import "SPDatabaseDocument.h"
+#import "SPAppController.h"
@interface SPServerVariablesController (PrivateAPI)
@@ -166,7 +167,7 @@
{
if (returnCode == NSOKButton) {
if ([variablesFiltered count] > 0) {
- NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[[NSApp delegate] frontDocument] host]];
+ NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[(SPAppController*)[NSApp delegate] frontDocument] host]];
for (NSDictionary *variable in variablesFiltered)
{
diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h
index 042e69f0..16841a34 100644
--- a/Source/SPStringAdditions.h
+++ b/Source/SPStringAdditions.h
@@ -46,12 +46,12 @@ static inline void NSMutableAttributedStringAddAttributeValueRange (NSMutableAtt
return;
}
-static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedString* self, NSString* aStr, NSUInteger index, NSRangePointer range)
+static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedString* self, NSString* aStr, NSUInteger anIndex, NSRangePointer aRange)
{
typedef id (*SPMutableAttributedStringAttributeAtIndexMethodPtr)(NSMutableAttributedString*, SEL, NSString*, NSUInteger, NSRangePointer);
static SPMutableAttributedStringAttributeAtIndexMethodPtr SPMutableAttributedStringAttributeAtIndex;
if (!SPMutableAttributedStringAttributeAtIndex) SPMutableAttributedStringAttributeAtIndex = (SPMutableAttributedStringAttributeAtIndexMethodPtr)[self methodForSelector:@selector(attribute:atIndex:effectiveRange:)];
- id r = SPMutableAttributedStringAttributeAtIndex(self, @selector(attribute:atIndex:effectiveRange:), aStr, index, range);
+ id r = SPMutableAttributedStringAttributeAtIndex(self, @selector(attribute:atIndex:effectiveRange:), aStr, anIndex, aRange);
return r;
}
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index a8346399..a762fe61 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -25,6 +25,22 @@
#import "SPStringAdditions.h"
#import "RegexKitLite.h"
+#import "SPDatabaseDocument.h"
+
+// Defined to suppress warnings
+@interface NSObject (SPBundleMethods)
+
+- (NSString *)lastBundleBlobFilesDirectory;
+- (void)setLastBundleBlobFilesDirectory:(NSString *)path;
+
+@end
+
+// Defined to suppress warnings
+@interface NSObject (SPWindowControllerTabMethods)
+
+- (id)selectedTableDocument;
+
+@end
@interface NSString (PrivateAPI)
@@ -39,7 +55,7 @@
*/
+ (NSString *)stringForByteSize:(long long)byteSize
{
- CGFloat size = byteSize;
+ double size = byteSize;
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
@@ -48,7 +64,7 @@
if (size < 1023) {
[numberFormatter setFormat:@"#,##0 B"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithInteger:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:size]];
}
size = (size / 1024);
@@ -163,7 +179,7 @@
{
NSMutableString *holder = [[NSMutableString alloc] init];
unichar theChar;
- int i;
+ NSUInteger i;
for(i = 0; i < [self length]; i++) {
theChar = [self characterAtIndex:i];
@@ -406,7 +422,7 @@
return distance;
}
- return 0.0;
+ return 0.0f;
}
/**
@@ -491,7 +507,7 @@
if([scriptPath hasPrefix:@"/"] && [fm fileExistsAtPath:scriptPath isDirectory:&isDir] && !isDir) {
NSString *script = [self substringWithRange:NSMakeRange(NSMaxRange(firstLineRange), [self length] - NSMaxRange(firstLineRange))];
NSError *writeError = nil;
- [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError];
+ [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError];
if(writeError == nil) {
redirectForScript = YES;
[scriptHeaderArguments addObject:scriptFilePath];
@@ -503,7 +519,7 @@
} else {
[scriptHeaderArguments addObject:@"/bin/sh"];
NSError *writeError = nil;
- [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError];
+ [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError];
if(writeError == nil) {
redirectForScript = YES;
[scriptHeaderArguments addObject:scriptFilePath];
@@ -672,12 +688,12 @@
// Read STDOUT saved to file
if([fm fileExistsAtPath:stdoutFilePath isDirectory:nil]) {
- NSString *stdout = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil];
- if(bashTask) [bashTask release];
+ NSString *stdoutContent = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil];
+ if(bashTask) [bashTask release], bashTask = nil;
[fm removeItemAtPath:stdoutFilePath error:nil];
- if(stdout != nil) {
+ if(stdoutContent != nil) {
if (status == 0) {
- return stdout;
+ return stdoutContent;
} else {
if(theError != NULL) {
if(status == 9 || userTerminated) return @"";
@@ -693,7 +709,7 @@
NSBeep();
}
if(status > SPBundleRedirectActionNone && status <= SPBundleRedirectActionLastCode)
- return stdout;
+ return stdoutContent;
else
return @"";
}
@@ -701,12 +717,11 @@
NSLog(@"Couldn't read return string from “%@” by using UTF-8 encoding.", self);
NSBeep();
}
- } else {
- if(bashTask) [bashTask release];
- [fm removeItemAtPath:stdoutFilePath error:nil];
- return @"";
}
+ if (bashTask) [bashTask release];
+ [fm removeItemAtPath:stdoutFilePath error:nil];
+ return @"";
}
/**
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index 0b33146b..4510d9be 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -70,9 +70,9 @@
IBOutlet NSButton *filterTableFilterButton;
IBOutlet NSButton *filterTableClearButton;
IBOutlet SPTextView *filterTableWhereClause;
- IBOutlet id filterTableNegateCheckbox;
+ IBOutlet NSButton *filterTableNegateCheckbox;
IBOutlet NSMenuItem *filterTableDistinctMenuItem;
- IBOutlet id filterTableLiveSearchCheckbox;
+ IBOutlet NSButton *filterTableLiveSearchCheckbox;
IBOutlet NSMenuItem *filterTableGearLookAllFields;
IBOutlet NSPanel *filterTableSetDefaultOperatorSheet;
IBOutlet NSComboBox* filterTableSetDefaultOperatorValue;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index a0b184dd..4e107570 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -45,6 +45,13 @@
#import "SPAlertSheets.h"
#import "SPHistoryController.h"
#import "SPGeometryDataView.h"
+#import "SPTextView.h"
+#import "SPDatabaseViewController.h"
+#import "SPAppController.h"
+
+@interface SPTableContent (Private)
+- (BOOL)cancelRowEditing;
+@end
@implementation SPTableContent
@@ -826,7 +833,7 @@
// Loop through the result rows as they become available
tableRowsCount = 0;
- while (tempRow = [theResult fetchNextRowAsArray]) {
+ while ((tempRow = [theResult fetchNextRowAsArray])) {
pthread_mutex_lock(&tableValuesLock);
if (tableRowsCount < previousTableRowsCount) {
@@ -1764,9 +1771,8 @@
/**
* Perform the requested row deletion action.
*/
-- (void)removeRowSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+- (void)removeRowSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
-
NSMutableIndexSet *selectedRows = [NSMutableIndexSet indexSet];
NSString *wherePart;
NSInteger i, errors;
@@ -1776,8 +1782,8 @@
// Order out current sheet to suppress overlapping of sheets
[[alert window] orderOut:nil];
- if ( [contextInfo isEqualToString:@"removeallrows"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ if ([contextInfo isEqualToString:@"removeallrows"]) {
+ if (returnCode == NSAlertDefaultReturn) {
// Check if the user is currently editing a row, and revert to ensure a somewhat
// consistent state if deletion fails.
@@ -1809,8 +1815,9 @@
afterDelay:0.3];
}
}
- } else if ( [contextInfo isEqualToString:@"removerow"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ }
+ else if ([contextInfo isEqualToString:@"removerow"]) {
+ if (returnCode == NSAlertDefaultReturn) {
[selectedRows addIndexes:[tableContentView selectedRowIndexes]];
//check if the user is currently editing a row
@@ -2382,9 +2389,12 @@
[menu addItem:item];
[item release];
- // Attempt to reselect the previously selected title, falling back to the first item
- [compareField selectItemWithTitle:titleToRestore];
- if (![compareField selectedItem]) [compareField selectItemAtIndex:0];
+ // Attempt to reselect the previously selected title, falling back to the first
+ // item on failure, as long as there is no filter selection to be restored.
+ if (!filterFieldToRestore) {
+ [compareField selectItemWithTitle:titleToRestore];
+ if (![compareField selectedItem]) [compareField selectItemAtIndex:0];
+ }
// Update the argumentField enabled state
[self performSelectorOnMainThread:@selector(toggleFilterField:) withObject:self waitUntilDone:YES];
@@ -3471,11 +3481,10 @@
*/
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(id)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation
{
-
- if(aTableView == filterTableView) {
+ if (aTableView == filterTableView) {
return nil;
}
- else if(aTableView == tableContentView) {
+ else if (aTableView == tableContentView) {
if([[aCell stringValue] length] < 2 || [tableDocumentInstance isWorking]) return nil;
@@ -3542,26 +3551,29 @@
return nil;
}
+
+ return nil;
}
- (NSInteger)numberOfRowsInTableView:(SPCopyTable *)aTableView
{
- if(aTableView == filterTableView) {
- if(filterTableIsSwapped)
+ if (aTableView == filterTableView) {
+ if (filterTableIsSwapped)
return [filterTableData count];
else
return [[[filterTableData objectForKey:[NSNumber numberWithInteger:0]] objectForKey:@"filter"] count];
}
- else if(aTableView == tableContentView) {
+ else if (aTableView == tableContentView) {
return tableRowsCount;
}
+
+ return 0;
}
- (id)tableView:(SPCopyTable *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
-
- if(aTableView == filterTableView) {
- if(filterTableIsSwapped)
+ if (aTableView == filterTableView) {
+ if (filterTableIsSwapped)
// First column shows the field names
if([[aTableColumn identifier] integerValue] == 0) {
NSTableHeaderCell *c = [[[NSTableHeaderCell alloc] initTextCell:[[filterTableData objectForKey:[NSNumber numberWithInteger:rowIndex]] objectForKey:@"name"]] autorelease];
@@ -3572,7 +3584,7 @@
return NSArrayObjectAtIndex([[filterTableData objectForKey:[aTableColumn identifier]] objectForKey:@"filter"], rowIndex);
}
}
- else if(aTableView == tableContentView) {
+ else if (aTableView == tableContentView) {
NSUInteger columnIndex = [[aTableColumn identifier] integerValue];
id theValue = nil;
@@ -3607,6 +3619,8 @@
return theValue;
}
+
+ return nil;
}
/**
@@ -4441,9 +4455,6 @@
// Trap the escape key
if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(cancelOperation:)] )
{
-
- NSUInteger row = [control editedRow];
-
// Abort editing
[control abortEditing];
if(control == tableContentView)
@@ -4527,7 +4538,6 @@
NSString *re1 = @"^\\s*(<[=>]?|>=?|!?=|≠|≤|≥)\\s*(.*?)\\s*$";
NSString *re2 = @"^\\s*(.*)\\s+(.*?)\\s*$";
- NSCharacterSet *whiteSpaceCharSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSInteger editedRow = [filterTableView editedRow];
diff --git a/Source/SPTableData.h b/Source/SPTableData.h
index 4503bd03..1c3fa8f0 100644
--- a/Source/SPTableData.h
+++ b/Source/SPTableData.h
@@ -46,7 +46,6 @@
BOOL tableHasAutoIncrementField;
}
-@property (readwrite, assign) BOOL isWorking;
@property (readonly, assign) BOOL tableHasAutoIncrementField;
- (void) setConnection:(MCPConnection *)theConnection;
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 7ae8f563..7180dc6a 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -32,7 +32,9 @@
#import "SPServerSupport.h"
@interface SPTableData (PrivateAPI)
+
- (void)_loopWhileWorking;
+
@end
@implementation SPTableData
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index af5d4474..6c7c216d 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -319,7 +319,7 @@
[aTableColumn setDataCell:c];
return NSLocalizedString(@"ACTIVITIES", @"header for activities pane");
}
- else if(!_activitiesWillBeUpdated && rowIndex > 0 && rowIndex < [activities count]) {
+ else if(!_activitiesWillBeUpdated && rowIndex > 0 && rowIndex < (NSInteger)[activities count]) {
NSDictionary *dict = NSArrayObjectAtIndex(activities,rowIndex);
SPActivityTextFieldCell *c = [[[SPActivityTextFieldCell alloc] init] autorelease];
[c setActivityName:[[dict objectForKey:@"contextInfo"] objectForKey:@"name"]];
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 1cd5ca4e..ebcb2bc6 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -189,7 +189,6 @@
{
NSArray *theTableIndexes;
NSMutableDictionary *theTableEnumLists = [NSMutableDictionary dictionary];
- NSInteger i;
// Check whether a save of the current row is required.
if ( ![[self onMainThread] saveRowOnDeselect] ) return;
@@ -252,7 +251,6 @@
// Set up the encoding PopUpButtonCell
NSArray *encodings = [databaseDataInstance getDatabaseCharacterSetEncodings];
if ([encodings count]) {
- NSString *selectedTitle = @"";
[encodingPopupCell removeAllItems];
[encodingPopupCell addItemWithTitle:@""];
@@ -874,7 +872,6 @@
if (alertSheetOpened) return NO;
- NSInteger code;
NSMutableString *queryString;
BOOL fieldDefIncludesLen = NO;
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index 729091d6..3a46b763 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -25,6 +25,10 @@
#import "SPTableStructureDelegate.h"
#import "SPAlertSheets.h"
+#import "SPDatabaseData.h"
+#import "SPDatabaseViewController.h"
+#import "SPTableData.h"
+#import "SPTableFieldValidation.h"
@implementation SPTableStructure (SPTableStructureDelegate)
@@ -94,7 +98,7 @@
currentlyEditingRow = rowIndex;
}
- NSDictionary *currentRow = [tableFields objectAtIndex:rowIndex];
+ NSMutableArray *currentRow = [tableFields objectAtIndex:rowIndex];
// Reset collation if encoding was changed
if([[aTableColumn identifier] isEqualToString:@"encoding"]) {
@@ -498,7 +502,7 @@
// validate cell against current field type
NSDictionary *theRow = NSArrayObjectAtIndex(tableFields, rowIndex);
NSString *theRowType = @"";
- if(theRowType = [theRow objectForKey:@"type"])
+ if((theRowType = [theRow objectForKey:@"type"]))
theRowType = [[theRowType stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// Only string fields allow encoding settings
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index 6e19c335..f1fccb09 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -25,6 +25,7 @@
#import "SPTableView.h"
#import "SPQueryFavoriteManager.h"
#import "SPDatabaseDocument.h"
+#import "SPWindowController.h"
@implementation SPTableView
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index 7729ed1d..e82903b2 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -55,7 +55,7 @@
IBOutlet id copyTableButton;
IBOutlet id copyTableNameField;
IBOutlet id copyTableMessageField;
- IBOutlet id copyTableContentSwitch;
+ IBOutlet NSButton *copyTableContentSwitch;
IBOutlet id tableSheet;
IBOutlet id tableNameField;
IBOutlet id tableEncodingButton;
@@ -119,6 +119,9 @@
- (IBAction)openTableInNewTab:(id)sender;
- (IBAction)togglePaneCollapse:(id)sender;
+// Alert sheet callbacks
+- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
+
// Additional methods
- (void)setConnection:(MCPConnection *)theConnection;
- (void)doPerformQueryService:(NSString *)query;
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index a0a9bf92..cc840e30 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -25,6 +25,7 @@
#import "SPTablesList.h"
#import "SPDatabaseDocument.h"
+#import "SPDatabaseViewController.h"
#import "SPTableStructure.h"
#import "SPTableContent.h"
#import "SPTableData.h"
@@ -62,18 +63,21 @@
{
MCPResult *theResult;
NSArray *resultRow;
- NSInteger i;
+ NSUInteger i;
NSString *previousSelectedTable = nil;
+ NSString *previousFilterString = nil;
BOOL previousTableListIsSelectable = tableListIsSelectable;
BOOL changeEncoding = ![[mySQLConnection encoding] isEqualToString:@"utf8"];
if (selectedTableName) previousSelectedTable = [[NSString alloc] initWithString:selectedTableName];
if (isTableListFiltered) {
+ previousFilterString = [[NSString alloc] initWithString:[listFilterField stringValue]];
if (filteredTables) [filteredTables release];
filteredTables = tables;
if (filteredTableTypes) [filteredTableTypes release];
filteredTableTypes = tableTypes;
isTableListFiltered = NO;
+ [[self onMainThread] clearFilter];
}
tableListContainsViews = NO;
@@ -256,11 +260,17 @@
selectedTableType = SPTableTypeNone;
}
- // Determine whether or not to show the list filter based on the number of tables, and clear it
- [[self onMainThread] clearFilter];
-
- if ([tables count] > 20) [self showFilter];
- else [self hideFilter];
+ // Determine whether or not to preserve the existing filter, and whether to
+ // show or hide the list filter based on the number of tables
+ if ([tables count] > 20) {
+ [self showFilter];
+ if (previousFilterString) {
+ [[listFilterField onMainThread] setStringValue:previousFilterString];
+ [[self onMainThread] updateFilter:self];
+ }
+ } else {
+ [self hideFilter];
+ }
// Set the filter placeholder text
if ([tableDocumentInstance database]) {
@@ -268,6 +278,7 @@
}
if (previousSelectedTable) [previousSelectedTable release];
+ if (previousFilterString) [previousFilterString release];
// Query the structure of all databases in the background
if (sender == self)
@@ -1219,7 +1230,6 @@
- (BOOL)selectItemsWithNames:(NSArray *)theNames
{
NSInteger i, tableType;
- NSInteger itemIndex = NSNotFound;
NSMutableIndexSet *selectionIndexSet = [NSMutableIndexSet indexSet];
// Loop through the unfiltered tables/views to find the desired item
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index 705f2a8a..769d4be8 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -33,6 +33,7 @@
#import "SPAlertSheets.h"
#import "RegexKitLite.h"
#import "SPBundleHTMLOutputController.h"
+#import "SPDatabaseViewController.h"
#pragma mark -
#pragma mark lex init
@@ -415,8 +416,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
continue;
}
- NSString *dbpath = [db substringFromIndex:[db rangeOfString:SPUniqueSchemaDelimiter].location];
-
NSMutableArray *sortedTables = [NSMutableArray array];
if(aTableNameExists) {
[sortedTables addObject:aTableName_id];
@@ -2675,7 +2674,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
BOOL allowToCheckForUpperCase;
// now loop through all the tokens
- while (token=yylex()){
+ while ((token=yylex())){
allowToCheckForUpperCase = YES;
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 9cefa758..e3f8b714 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -26,6 +26,7 @@
#import "SPTooltip.h"
#import "SPBundleHTMLOutputController.h"
#import "SPCustomQuery.h"
+#import "SPAppController.h"
@implementation NSTextView (SPTextViewAdditions)
@@ -635,7 +636,7 @@
NSString *output = [cmd runBashCommandWithEnvironment:env
atCurrentDirectoryPath:nil
- callerInstance:[[NSApp delegate] frontDocument]
+ callerInstance:[(SPAppController*)[NSApp delegate] frontDocument]
contextInfo:[NSDictionary dictionaryWithObjectsAndKeys:
([cmdData objectForKey:SPBundleFileNameKey])?:@"-", @"name",
NSLocalizedString(@"Input Field", @"input field menu item label"), @"scope",
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index b0344d52..5a0a2a2e 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -229,10 +229,9 @@ static CGFloat slow_in_out (CGFloat t)
- (id)init;
{
- if(self = [self initWithContentRect:NSMakeRect(1,1,1,1)
- styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO])
+ if((self = [self initWithContentRect:NSMakeRect(1,1,1,1)
+ styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]))
{
- ;
}
return self;
}
@@ -393,7 +392,7 @@ static CGFloat slow_in_out (CGFloat t)
[keyWindow setAcceptsMouseMovedEvents:YES];
NSEvent* event = nil;
NSInteger eventType;
- while(event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES])
+ while((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]))
{
eventType = [event type];
if(eventType == NSKeyDown || eventType == NSLeftMouseDown || eventType == NSRightMouseDown || eventType == NSOtherMouseDown || eventType == NSScrollWheel)
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 9118d8a9..5a673389 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -173,7 +173,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
}
if (result && [result numOfRows]) {
- while (privRow = [result fetchRowAsArray])
+ while ((privRow = [result fetchRowAsArray]))
{
privKey = [NSMutableString stringWithString:[[privRow objectAtIndex:0] lowercaseString]];
@@ -192,7 +192,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
[result setReturnDataAsStrings:YES];
- while (privRow = [result fetchRowAsArray])
+ while ((privRow = [result fetchRowAsArray]))
{
privKey = [NSMutableString stringWithString:[privRow objectAtIndex:0]];
diff --git a/Source/SPWindow.m b/Source/SPWindow.m
index 8f2354db..22a096c3 100644
--- a/Source/SPWindow.m
+++ b/Source/SPWindow.m
@@ -23,7 +23,7 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPWindow.h"
-
+#import "SPWindowController.h"
@implementation SPWindow
@@ -62,7 +62,7 @@
context:[NSGraphicsContext currentContext]
eventNumber:0
clickCount:1
- pressure:0.0];
+ pressure:0.0f];
[NSMenu popUpContextMenu:[firstResponder menuForEvent:theEvent] withEvent:anEvent forView:firstResponder];
diff --git a/Source/SPWindowAdditions.m b/Source/SPWindowAdditions.m
index 9d99de4f..676019ee 100644
--- a/Source/SPWindowAdditions.m
+++ b/Source/SPWindowAdditions.m
@@ -25,6 +25,7 @@
#import "SPWindowAdditions.h"
#import "SPDatabaseDocument.h"
+#import "SPWindowController.h"
@implementation NSWindow (SPWindowAdditions)
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index b22248fe..7fdb76e6 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -25,6 +25,8 @@
#import "SPWindowController.h"
#import "SPDatabaseDocument.h"
#import "PSMTabDragAssistant.h"
+#import "SPDatabaseViewController.h"
+#import "SPAppController.h"
#import <PSMTabBar/PSMTabBarControl.h>
#import <PSMTabBar/PSMTabStyle.h>
@@ -160,7 +162,7 @@
{
// Return if the selected tab shouldn't be closed
- if (![selectedTableDocument parentTabShouldClose]) return NO;
+ if (![selectedTableDocument parentTabShouldClose]) return;
// If there are multiple tabs, close the front tab.
if ([tabView numberOfTabViewItems] > 1) {
diff --git a/Source/xibLocalizationPostprocessor.m b/Source/xibLocalizationPostprocessor.m
index a6379aa7..ad2e152d 100644
--- a/Source/xibLocalizationPostprocessor.m
+++ b/Source/xibLocalizationPostprocessor.m
@@ -51,7 +51,7 @@ int main(int argc, const char *argv[])
}
}
- NSLog(@"Warning: skipped garbage input line %d, contents: \"%@\"", lineCount, line);
+ NSLog(@"Warning: skipped garbage input line %lu, contents: \"%@\"", (unsigned long)lineCount, line);
}
if (outputStrings.length && ![outputStrings writeToFile:[NSString stringWithUTF8String:argv[2]] atomically:NO encoding:usedEncoding error:&error]) {
@@ -59,4 +59,4 @@ int main(int argc, const char *argv[])
exit (-1);
}
} [autoreleasePool release];
-} \ No newline at end of file
+}