aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-01-25 20:14:11 +0000
committerstuconnolly <stuart02@gmail.com>2013-01-25 20:14:11 +0000
commitb442a9920d8e873c4df7b84799aa49e551922e2d (patch)
tree1b52e6e477419456b11327a6b920b59ca5d80fcd /Source
parentdfd3414cbcfc025caa23285c7d1a8f108b09b5f1 (diff)
downloadsequelpro-b442a9920d8e873c4df7b84799aa49e551922e2d.tar.gz
sequelpro-b442a9920d8e873c4df7b84799aa49e551922e2d.tar.bz2
sequelpro-b442a9920d8e873c4df7b84799aa49e551922e2d.zip
Fix more warnings.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m8
-rw-r--r--Source/SPBundleCommandTextView.m6
-rw-r--r--Source/SPCopyTable.m75
-rw-r--r--Source/SPEditSheetTextView.m8
-rw-r--r--Source/SPExportFile.m2
-rw-r--r--Source/SPNavigatorOutlineView.m2
6 files changed, 52 insertions, 49 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 9737630e..1575e235 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -279,15 +279,15 @@ YY_BUFFER_STATE yy_scan_string (const char *);
*/
- (void)application:(NSApplication *)app openFiles:(NSArray *)filenames
{
-
for (NSString *filename in filenames)
{
// Opens a sql file and insert its content into the Custom Query editor
- if([[[filename pathExtension] lowercaseString] isEqualToString:[SPFileExtensionSQL lowercaseString]]) {
+ if ([[[filename pathExtension] lowercaseString] isEqualToString:[SPFileExtensionSQL lowercaseString]]) {
// Check size and NSFileType
- NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
- if(attr)
+ NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:filename error:nil];
+
+ if (attr)
{
NSNumber *filesize = [attr objectForKey:NSFileSize];
NSString *filetype = [attr objectForKey:NSFileType];
diff --git a/Source/SPBundleCommandTextView.m b/Source/SPBundleCommandTextView.m
index d889c8d8..dc674baa 100644
--- a/Source/SPBundleCommandTextView.m
+++ b/Source/SPBundleCommandTextView.m
@@ -621,14 +621,14 @@
[self setSelectedRange:NSMakeRange(characterIndex,0)];
// Check if user pressed ⌘ while dragging for inserting only the file path
- if([sender draggingSourceOperationMask] == 4)
- {
+ if ([sender draggingSourceOperationMask] == 4) {
[self insertText:filepath];
return YES;
}
// Check size and NSFileType
- NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES];
+ NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:filepath error:nil];
+
if(attr)
{
NSNumber *filesize = [attr objectForKey:NSFileSize];
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index c36ac380..a8a7e9fd 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -954,17 +954,19 @@ static const NSInteger kBlobAsImageFile = 4;
if (!rowIndices || ![rowIndices count]) return;
NSMutableIndexSet *selection = [NSMutableIndexSet indexSet];
-#ifndef SP_REFACTOR
- NSInteger rows = [[self delegate] numberOfRowsInTableView:self];
-#else
+
NSInteger rows = [(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self];
-#endif
+
NSInteger i;
+
if(rows > 0) {
- for(NSString* idx in rowIndices) {
+ for (NSString* idx in rowIndices)
+ {
i = [idx integerValue];
- if(i >= 0 && i < rows)
+
+ if (i >= 0 && i < rows) {
[selection addIndex:i];
+ }
}
[self selectRowIndexes:selection byExtendingSelection:NO];
@@ -1075,14 +1077,13 @@ static const NSInteger kBlobAsImageFile = 4;
[[control window] makeFirstResponder:control];
if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)])
[(SPTableContent*)[self delegate] saveRowToTable];
+
return YES;
-
}
// Trap down arrow key
else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveDown:)] )
{
-
// If enum field is edited ARROW key navigates through the popup list
if([self isCellComplex])
return NO;
@@ -1092,58 +1093,58 @@ static const NSInteger kBlobAsImageFile = 4;
if (NSMaxRange([[textView string] lineRangeForRange:[textView selectedRange]]) < [[textView string] length])
return NO;
- NSInteger newRow = row+1;
-#ifndef SP_REFACTOR
- if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check if we're already at the end of the list
-#else
- if (newRow>=[(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES; //check if we're already at the end of the list
-#endif
+ NSInteger newRow = row + 1;
+
+ // Check if we're already at the end of the list
+ if (newRow >= [(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES;
[[control window] makeFirstResponder:control];
- if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)])
+
+ if ([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) {
[(SPTableContent*)([self delegate]) saveRowToTable];
+ }
-#ifndef SP_REFACTOR
- if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check again. saveRowToTable could reload the table and change the number of rows
-#else
- if (newRow>=[(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES; //check again. saveRowToTable could reload the table and change the number of rows
-#endif
- if (tableStorage && (NSUInteger)column>=[tableStorage columnCount]) return YES; //the column count could change too
+ // Check again. saveRowToTable could reload the table and change the number of rows
+ if (newRow>=[(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES;
+
+ // The column count could change too
+ if (tableStorage && (NSUInteger)column >= [tableStorage columnCount]) return YES;
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
[self editColumn:column row:newRow withEvent:nil select:YES];
+
return YES;
}
-
// Trap up arrow key
else if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(moveUp:)] )
{
-
// If enum field is edited ARROW key navigates through the popup list
- if ([self isCellComplex])
- return NO;
+ if ([self isCellComplex]) return NO;
// Check whether the editor is multiline - if so, allow the arrow up to change selection if it's not
// on the first line
- if ([[textView string] lineRangeForRange:[textView selectedRange]].location > 0)
- return NO;
+ if ([[textView string] lineRangeForRange:[textView selectedRange]].location > 0) return NO;
- if (row==0) return YES; //already at the beginning of the list
- NSInteger newRow = row-1;
+ // Already at the beginning of the list
+ if (row == 0) return YES;
+
+ NSInteger newRow = row - 1;
[[control window] makeFirstResponder:control];
- if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)])
- [(SPTableContent*)([self delegate]) saveRowToTable];
+
+ if ([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)]) {
+ [(SPTableContent *)[self delegate] saveRowToTable];
+ }
-#ifndef SP_REFACTOR
- if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; // saveRowToTable could reload the table and change the number of rows
-#else
- if (newRow>=[(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES; // saveRowToTable could reload the table and change the number of rows
-#endif
- if (tableStorage && (NSUInteger)column>=[tableStorage columnCount]) return YES; //the column count could change too
+ // saveRowToTable could reload the table and change the number of rows
+ if (newRow >= [(id<NSTableViewDataSource>)[self delegate] numberOfRowsInTableView:self]) return YES;
+
+ // The column count could change too
+ if (tableStorage && (NSUInteger)column>=[tableStorage columnCount]) return YES;
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
[self editColumn:column row:newRow withEvent:nil select:YES];
+
return YES;
}
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m
index 8ddbb665..8548271f 100644
--- a/Source/SPEditSheetTextView.m
+++ b/Source/SPEditSheetTextView.m
@@ -197,12 +197,14 @@
}
// Check size and NSFileType
- NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filepath traverseLink:YES];
- if(attr)
+ NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:filepath error:nil];
+
+ if (attr)
{
NSNumber *filesize = [attr objectForKey:NSFileSize];
NSString *filetype = [attr objectForKey:NSFileType];
- if(filetype == NSFileTypeRegular && filesize)
+
+ if (filetype == NSFileTypeRegular && filesize)
{
// Ask for confirmation if file content is larger than 1MB
if([filesize unsignedLongValue] > 1000000)
diff --git a/Source/SPExportFile.m b/Source/SPExportFile.m
index af3e738a..125adf15 100644
--- a/Source/SPExportFile.m
+++ b/Source/SPExportFile.m
@@ -216,7 +216,7 @@
exportFileHandle = [[SPFileHandle fileHandleForWritingAtPath:[self exportFilePath]] retain];
if (!exportFileHandle) {
- [[NSFileManager defaultManager] removeFileAtPath:[self exportFilePath] handler:nil];
+ [[NSFileManager defaultManager] removeItemAtPath:[self exportFilePath] error:nil];
return SPExportFileHandleFailed;
}
diff --git a/Source/SPNavigatorOutlineView.m b/Source/SPNavigatorOutlineView.m
index 17252750..c0772ebd 100644
--- a/Source/SPNavigatorOutlineView.m
+++ b/Source/SPNavigatorOutlineView.m
@@ -44,7 +44,7 @@
{
// Enter or Return selects in active document the chosen item
if ([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) {
- [[self delegate] selectInActiveDocumentItem:[self itemAtRow:[self selectedRow]] fromView:self];
+ [(SPNavigatorController *)[self delegate] selectInActiveDocumentItem:[self itemAtRow:[self selectedRow]] fromView:self];
return;
}