aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-03-19 15:05:23 +0000
committerstuconnolly <stuart02@gmail.com>2011-03-19 15:05:23 +0000
commit6d3f21336846d7745e795202c99390832c4220c8 (patch)
tree6195dafeeb1871afc5e41f6f17a917dc8047d44a /Source
parentb2a0af91eae18b6490ddeafd2708d256b0d53cb3 (diff)
downloadsequelpro-6d3f21336846d7745e795202c99390832c4220c8.tar.gz
sequelpro-6d3f21336846d7745e795202c99390832c4220c8.tar.bz2
sequelpro-6d3f21336846d7745e795202c99390832c4220c8.zip
Bring outline view branch up to date with trunk (r3235:r3245), which should resolve all warnings.
Diffstat (limited to 'Source')
-rw-r--r--Source/DMLocalizedNib.m5
-rw-r--r--Source/MGTemplateEngine.m6
-rw-r--r--Source/MGTemplateStandardMarkers.m2
-rw-r--r--Source/NoodleLineNumberView.m52
-rw-r--r--Source/SPActivityTextFieldCell.m2
-rw-r--r--Source/SPAppController.m6
-rw-r--r--Source/SPAppleScriptSupport.h6
-rw-r--r--Source/SPAppleScriptSupport.m2
-rw-r--r--Source/SPBundleEditorController.m36
-rw-r--r--Source/SPBundleHTMLOutputController.h4
-rw-r--r--Source/SPBundleHTMLOutputController.m31
-rw-r--r--Source/SPCSVExporterDelegate.m2
-rw-r--r--Source/SPCSVParser.m6
-rw-r--r--Source/SPColorAdditions.m6
-rw-r--r--Source/SPConnectionController.h2
-rw-r--r--Source/SPContentFilterManager.m4
-rw-r--r--Source/SPCopyTable.m37
-rw-r--r--Source/SPDatabaseDocument.m1
-rw-r--r--Source/SPDotExporter.m3
-rw-r--r--Source/SPEditorPreferencePane.m2
-rw-r--r--Source/SPEditorTokens.l1
-rw-r--r--Source/SPExportController.h2
-rw-r--r--Source/SPExportController.m22
-rw-r--r--Source/SPExportFile.m6
-rw-r--r--Source/SPExportFileUtilities.h2
-rw-r--r--Source/SPExportFileUtilities.m5
-rw-r--r--Source/SPExportFilenameUtilities.m2
-rw-r--r--Source/SPExportUtilities.m3
-rw-r--r--Source/SPExporter.m1
-rw-r--r--Source/SPFavoriteNode.m8
-rw-r--r--Source/SPFieldEditorController.h4
-rw-r--r--Source/SPFieldEditorController.m87
-rw-r--r--Source/SPFieldMapperController.h4
-rw-r--r--Source/SPFieldMapperController.m87
-rw-r--r--Source/SPFileHandle.m14
-rw-r--r--Source/SPGeometryDataView.h2
-rw-r--r--Source/SPGroupNode.m6
-rw-r--r--Source/SPIndexesController.m17
-rw-r--r--Source/SPNavigatorController.h2
-rw-r--r--Source/SPNavigatorController.m19
-rw-r--r--Source/SPPreferenceController.h9
-rw-r--r--Source/SPPreferencesUpgrade.m8
-rw-r--r--Source/SPPrintController.m3
-rw-r--r--Source/SPProcessListController.m10
-rw-r--r--Source/SPQueryController.m2
-rw-r--r--Source/SPQueryFavoriteManager.h4
-rw-r--r--Source/SPQueryFavoriteManager.m7
-rw-r--r--Source/SPSQLParser.h2
-rw-r--r--Source/SPSQLParser.m98
-rw-r--r--Source/SPSQLTokenizer.l1
-rw-r--r--Source/SPTableContent.m2
-rw-r--r--Source/SPTableStructureDelegate.m6
-rw-r--r--Source/SPTableTextFieldCell.m2
-rw-r--r--Source/SPTableTriggers.m16
-rw-r--r--Source/SPTableView.m7
-rw-r--r--Source/SPTablesList.h4
-rw-r--r--Source/SPTablesList.m128
-rw-r--r--Source/SPTextView.h3
-rw-r--r--Source/SPTextView.m103
-rw-r--r--Source/SPTextViewAdditions.m41
-rw-r--r--Source/SPTooltip.h2
-rw-r--r--Source/SPTooltip.m22
-rw-r--r--Source/SPUserManager.h1
-rw-r--r--Source/SPUserManager.m16
-rw-r--r--Source/SPWindowController.h2
-rw-r--r--Source/SPWindowController.m11
-rw-r--r--Source/SPXMLExporter.m1
-rw-r--r--Source/SPXMLExporterDelegate.m2
-rw-r--r--Source/YRKSpinningProgressIndicator.m30
69 files changed, 569 insertions, 483 deletions
diff --git a/Source/DMLocalizedNib.m b/Source/DMLocalizedNib.m
index c675e110..55e51e35 100644
--- a/Source/DMLocalizedNib.m
+++ b/Source/DMLocalizedNib.m
@@ -17,6 +17,11 @@
- (void)deliciousDealloc;
@end
+// Private methods from DMLocalizedNib used here
+@interface NSBundle ()
++ (void)_localizeStringsInObject:(id)object table:(NSString *)table;
+@end
+
static NSMutableDictionary *deliciousNibNames = nil;
@implementation NSNib (DMLocalizedNib)
diff --git a/Source/MGTemplateEngine.m b/Source/MGTemplateEngine.m
index 17acae65..1cf483f8 100644
--- a/Source/MGTemplateEngine.m
+++ b/Source/MGTemplateEngine.m
@@ -312,9 +312,9 @@
NSString *digits;
BOOL scanned = [scanner scanCharactersFromSet:numbersSet intoString:&digits];
if (scanned && digits && [digits length] > 0) {
- NSInteger index = [digits integerValue];
- if (index >= 0 && index < [((NSArray *)currObj) count]) {
- newObj = [((NSArray *)currObj) objectAtIndex:index];
+ NSInteger indexValue = [digits integerValue];
+ if (indexValue >= 0 && indexValue < (NSInteger)[((NSArray *)currObj) count]) {
+ newObj = [((NSArray *)currObj) objectAtIndex:indexValue];
}
}
}
diff --git a/Source/MGTemplateStandardMarkers.m b/Source/MGTemplateStandardMarkers.m
index 184dab48..fd845ac7 100644
--- a/Source/MGTemplateStandardMarkers.m
+++ b/Source/MGTemplateStandardMarkers.m
@@ -515,7 +515,7 @@
NSArray *vals = [cycle objectForKey:CYCLE_VALUES];
NSInteger currIndex = [[cycle objectForKey:CYCLE_INDEX] integerValue];
currIndex++;
- if (currIndex >= [vals count]) {
+ if (currIndex >= (NSInteger)[vals count]) {
currIndex = 0;
}
[cycle setObject:[NSNumber numberWithInteger:currIndex] forKey:CYCLE_INDEX];
diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m
index 15296c8e..0213c151 100644
--- a/Source/NoodleLineNumberView.m
+++ b/Source/NoodleLineNumberView.m
@@ -44,8 +44,8 @@
#pragma mark -
-#define DEFAULT_THICKNESS 22.0
-#define RULER_MARGIN 5.0
+#define DEFAULT_THICKNESS 22.0f
+#define RULER_MARGIN 5.0f
#define RULER_MARGIN2 RULER_MARGIN * 2
typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
@@ -159,7 +159,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
- (NSColor *)textColor
{
if (textColor == nil)
- return [NSColor colorWithCalibratedWhite:0.42 alpha:1.0];
+ return [NSColor colorWithCalibratedWhite:0.42f alpha:1.0f];
return textColor;
}
@@ -249,7 +249,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
return NSNotFound;
}
-- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index
+- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)charIndex
{
NSUInteger left, right, mid, lineStart;
NSArray *lines;
@@ -266,9 +266,9 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
mid = (right + left) >> 1;
lineStart = [NSArrayObjectAtIndex(lines, mid) unsignedIntegerValue];
- if (index < lineStart)
+ if (charIndex < lineStart)
right = mid;
- else if (index > lineStart)
+ else if (charIndex > lineStart)
left = mid;
else
return mid;
@@ -300,7 +300,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
NSRect visibleRect;
NSRange range, nullRange;
NSString *labelText;
- NSUInteger rectCount, index, line, count;
+ NSUInteger rectCount, lineIndex, line, count;
NSRectArray rects;
CGFloat yinset;
NSSize stringSize;
@@ -330,11 +330,11 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
for (line = (NSUInteger)(*lineNumberForCharacterIndexIMP)(self, lineNumberForCharacterIndexSel, range.location); line < count; line++)
{
- index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
+ lineIndex = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
- if (NSLocationInRange(index, range))
+ if (NSLocationInRange(lineIndex, range))
{
- rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
+ rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(lineIndex, 0)
withinSelectedCharacterRange:nullRange
inTextContainer:container
rectCount:&rectCount];
@@ -359,7 +359,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
}
}
- if (index > NSMaxRange(range))
+ if (lineIndex > NSMaxRange(range))
break;
}
@@ -499,7 +499,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
if ([view isKindOfClass:[NSTextView class]])
{
- NSUInteger index, stringLength, lineEnd, contentEnd, lastLine;
+ NSUInteger anIndex, stringLength, lineEnd, contentEnd, lastLine;
NSString *textString;
CGFloat newThickness;
@@ -516,7 +516,7 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
// Init lineIndices with text length / 16 + 1
lineIndices = [[NSMutableArray alloc] initWithCapacity:((NSUInteger)stringLength>>4)+1];
- index = 0;
+ anIndex = 0;
// Cache loop methods for speed
RangeOfLineIMP rangeOfLineIMP = (RangeOfLineIMP)[textString methodForSelector:lineRangeForRangeSel];
@@ -524,16 +524,16 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
do
{
- (void*)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)([NSNumber class], numberWithUnsignedIntegerSel, index));
- lastLine = index;
- index = NSMaxRange((*rangeOfLineIMP)(textString, lineRangeForRangeSel, NSMakeRange(index, 0)));
+ (void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)([NSNumber class], numberWithUnsignedIntegerSel, anIndex));
+ lastLine = anIndex;
+ anIndex = NSMaxRange((*rangeOfLineIMP)(textString, lineRangeForRangeSel, NSMakeRange(anIndex, 0)));
}
- while (index < stringLength);
+ while (anIndex < stringLength);
// Check if text ends with a new line.
[textString getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange(lastLine, 0)];
if (contentEnd < lineEnd)
- (void*)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)([NSNumber class], numberWithUnsignedIntegerSel, index));
+ (void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)([NSNumber class], numberWithUnsignedIntegerSel, anIndex));
NSUInteger lineCount = [lineIndices count];
if(lineCount < 10)
@@ -574,14 +574,14 @@ typedef NSRange (*RangeOfLineIMP)(id object, SEL selector, NSRange range);
- (void)updateGutterThicknessConstants
{
- maxWidthOfGlyph1 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph + RULER_MARGIN2));
- maxWidthOfGlyph2 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 2 + RULER_MARGIN2));
- maxWidthOfGlyph3 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 3 + RULER_MARGIN2));
- maxWidthOfGlyph4 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 4 + RULER_MARGIN2));
- maxWidthOfGlyph5 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 5 + RULER_MARGIN2));
- maxWidthOfGlyph6 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 6 + RULER_MARGIN2));
- maxWidthOfGlyph7 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 7 + RULER_MARGIN2));
- maxWidthOfGlyph8 = ceil(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 8 + RULER_MARGIN2));
+ maxWidthOfGlyph1 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph + RULER_MARGIN2));
+ maxWidthOfGlyph2 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 2 + RULER_MARGIN2));
+ maxWidthOfGlyph3 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 3 + RULER_MARGIN2));
+ maxWidthOfGlyph4 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 4 + RULER_MARGIN2));
+ maxWidthOfGlyph5 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 5 + RULER_MARGIN2));
+ maxWidthOfGlyph6 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 6 + RULER_MARGIN2));
+ maxWidthOfGlyph7 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 7 + RULER_MARGIN2));
+ maxWidthOfGlyph8 = ceilf(MAX(DEFAULT_THICKNESS, maxWidthOfGlyph * 8 + RULER_MARGIN2));
}
@end
diff --git a/Source/SPActivityTextFieldCell.m b/Source/SPActivityTextFieldCell.m
index 10194466..1ccb7207 100644
--- a/Source/SPActivityTextFieldCell.m
+++ b/Source/SPActivityTextFieldCell.m
@@ -259,7 +259,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
// Remove it from the list directly since the list will be updated in the background
// to avoid to cancel a command which is already cancelled
if(status == 0)
- [[[controlView delegate] onMainThread] removeActivity:[[contextInfo objectForKey:@"pid"] intValue]];
+ [[[(id)controlView delegate] onMainThread] removeActivity:[[contextInfo objectForKey:@"pid"] intValue]];
return YES;
}
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 71fcd359..8ea656c5 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -653,7 +653,11 @@ YY_BUFFER_STATE yy_scan_string (const char *);
NSString *command = [url host];
NSString *passedProcessID = [url user];
NSArray *parameter;
- NSArray *pathComponents = [[url absoluteString] pathComponents];
+ NSArray *pathComponents;
+ if([[url absoluteString] hasSuffix:@"/"])
+ pathComponents = [[[url absoluteString] substringToIndex:[[url absoluteString] length]-1] pathComponents];
+ else
+ pathComponents = [[url absoluteString] pathComponents];
if([pathComponents count] > 2)
parameter = [pathComponents subarrayWithRange:NSMakeRange(2, [pathComponents count]-2)];
diff --git a/Source/SPAppleScriptSupport.h b/Source/SPAppleScriptSupport.h
index 4878dc4b..2aae1c68 100644
--- a/Source/SPAppleScriptSupport.h
+++ b/Source/SPAppleScriptSupport.h
@@ -27,4 +27,10 @@
@interface SPAppController (SPAppleScriptSupport)
+- (NSArray *)orderedDocuments;
+- (void)insertInOrderedDocuments:(SPDatabaseDocument *)doc;
+- (NSArray *)orderedWindows;
+- (id)handleQuitScriptCommand:(NSScriptCommand *)command;
+- (id)handleOpenScriptCommand:(NSScriptCommand *)command;
+
@end
diff --git a/Source/SPAppleScriptSupport.m b/Source/SPAppleScriptSupport.m
index 44d99352..90ab240e 100644
--- a/Source/SPAppleScriptSupport.m
+++ b/Source/SPAppleScriptSupport.m
@@ -132,6 +132,8 @@
if (frontDoc && ![frontDoc isWorking] && ![[frontDoc connectionID] isEqualToString:@"_"]) {
[frontDoc startPrintDocumentOperation];
}
+
+ return nil;
}
@end
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 8f1f6bab..5d3555fa 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -484,7 +484,7 @@
NSString *currentCategory = [currentDict objectForKey:SPBundleFileCategoryKey];
if(!currentCategory) currentCategory = @"";
if([currentCategory length]) {
- NSUInteger *newIndexPath[4];
+ NSUInteger newIndexPath[4];
newIndexPath[0] = 0;
newIndexPath[1] = newScopeIndex;
newIndexPath[2] = [self _arrangedCategoryIndexForScopeIndex:selectedTag andCategory:currentCategory];
@@ -494,7 +494,7 @@
[commandsOutlineView reloadData];
} else {
// Move current Bundle command to according new scope without category
- NSUInteger *newIndexPath[3];
+ NSUInteger newIndexPath[3];
newIndexPath[0] = 0;
newIndexPath[1] = newScopeIndex;
newIndexPath[2] = 0;
@@ -640,8 +640,8 @@
[self saveBundle:bundle atPath:nil];
// Insert duplicate below selected one
- NSUInteger *currentPath[[currentIndexPath length]];
- [currentIndexPath getIndexes:&currentPath];
+ NSUInteger currentPath[[currentIndexPath length]];
+ [currentIndexPath getIndexes:currentPath];
currentPath[[currentIndexPath length]-1] = (NSUInteger)currentPath[[currentIndexPath length]-1] + 1;
currentIndexPath = [NSIndexPath indexPathWithIndexes:currentPath length:[currentIndexPath length]];
@@ -656,24 +656,24 @@
// If selected item is one of the main scopes go one item deeper
if([currentIndexPath length] == 2) {
- NSUInteger *newPath[3];
- [currentIndexPath getIndexes:&newPath];
+ NSUInteger newPath[3];
+ [currentIndexPath getIndexes:newPath];
newPath[2] = 0;
currentIndexPath = [NSIndexPath indexPathWithIndexes:newPath length:3];
lastIndexWasAlreadyFixed = YES;
}
// If selected item is a category go one item deeper
else if([currentIndexPath length] == 3 && [currentObject objectForKey:kChildrenKey]) {
- NSUInteger *newPath[4];
- [currentIndexPath getIndexes:&newPath];
+ NSUInteger newPath[4];
+ [currentIndexPath getIndexes:newPath];
newPath[3] = 0;
currentIndexPath = [NSIndexPath indexPathWithIndexes:newPath length:4];
lastIndexWasAlreadyFixed = YES;
category = [currentObject objectForKey:kBundleNameKey];
}
- NSUInteger *currentPath[[currentIndexPath length]];
- [currentIndexPath getIndexes:&currentPath];
+ NSUInteger currentPath[[currentIndexPath length]];
+ [currentIndexPath getIndexes:currentPath];
// Last index plus 1 to insert bundle under the current selection
if(!lastIndexWasAlreadyFixed) {
@@ -854,7 +854,7 @@
// Get all Bundles out of commandBundleTree which were touched
NSMutableArray *allBundles = [NSMutableArray array];
- for(NSInteger k = 0; k < [[commandBundleTree objectForKey:kChildrenKey] count]; k++) {
+ for (NSUInteger k = 0; k < [[commandBundleTree objectForKey:kChildrenKey] count]; k++) {
for(id item in [[[commandBundleTree objectForKey:kChildrenKey] objectAtIndex:k] objectForKey:kChildrenKey]) {
if([item objectForKey:kChildrenKey]) {
for(id b in [item objectForKey:kChildrenKey]) {
@@ -1094,7 +1094,7 @@
if(![selectedRows count]) return;
- NSInteger rowIndex;
+ NSUInteger rowIndex;
NSMutableArray *stillUndeletedBundles = [NSMutableArray array];
for(rowIndex = 0; rowIndex < [deletedDefaultBundles count]; rowIndex++) {
if(![selectedRows containsIndex:rowIndex])
@@ -1460,8 +1460,8 @@
NSIndexPath *currentIndexPath = [commandBundleTreeController selectionIndexPath];
NSUInteger newIndexPathLength = 4;
- NSUInteger *newIndexPath[newIndexPathLength];
- [currentIndexPath getIndexes:&newIndexPath];
+ NSUInteger newIndexPath[newIndexPathLength];
+ [currentIndexPath getIndexes:newIndexPath];
newIndexPath[3] = 0;
// Set the category index
@@ -1804,10 +1804,10 @@
[removeButton setEnabled:([[commandBundleTreeController selectedObjects] count] == 1 && ![[[commandBundleTreeController selectedObjects] objectAtIndex:0] objectForKey:kChildrenKey])];
[addButton setEnabled:([[commandBundleTreeController selectionIndexPath] length] > 1)];
- NSUInteger *selPath[2];
+ NSUInteger selPath[2];
selPath[0] = 0;
selPath[1] = 0;
- [commandBundleTreeController setSelectionIndexPath:[NSIndexPath indexPathWithIndexes:&selPath length:2]];
+ [commandBundleTreeController setSelectionIndexPath:[NSIndexPath indexPathWithIndexes:selPath length:2]];
[commandBundleTreeController rearrangeObjects];
[commandsOutlineView reloadData];
@@ -2091,10 +2091,6 @@
NSMutableDictionary *newCat = [NSMutableDictionary dictionary];
[newCat setObject:category forKey:kBundleNameKey];
[newCat setObject:[NSMutableArray array] forKey:kChildrenKey];
- NSUInteger *newPath[3];
- newPath[0] = 0;
- newPath[1] = k;
- newPath[2] = 0;
// Add it
[[[j representedObject] objectForKey:kChildrenKey] addObject:newCat];
diff --git a/Source/SPBundleHTMLOutputController.h b/Source/SPBundleHTMLOutputController.h
index 3665fc8e..de67799c 100644
--- a/Source/SPBundleHTMLOutputController.h
+++ b/Source/SPBundleHTMLOutputController.h
@@ -33,7 +33,7 @@
NSString *initHTMLSourceString;
NSString *windowUUID;
NSString *docUUID;
- BOOL suppressExceptionAlert;
+ BOOL suppressExceptionAlerting;
WebPreferences *webPreferences;
}
@@ -42,7 +42,7 @@
@property(readwrite,retain) NSString *initHTMLSourceString;
@property(readwrite,retain) NSString *windowUUID;
@property(readwrite,retain) NSString *docUUID;
-@property(assign) BOOL suppressExceptionAlert;
+@property(assign) BOOL suppressExceptionAlerting;
- (IBAction)printDocument:(id)sender;
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index 6e5ffedd..1995cfcb 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -29,13 +29,28 @@
@class WebScriptCallFrame;
+#pragma mark -
+
+@interface WebView (WebViewPrivate)
+- (void) setScriptDebugDelegate:(id) delegate;
+@end
+
+@interface WebScriptCallFrame : NSObject
+- (id)userInfo;
+- (WebScriptCallFrame *)caller;
+- (NSString *)functionName;
+- (id)exception;
+@end
+
+#pragma mark -
+
@implementation SPBundleHTMLOutputController
@synthesize docTitle;
@synthesize initHTMLSourceString;
@synthesize windowUUID;
@synthesize docUUID;
-@synthesize suppressExceptionAlert;
+@synthesize suppressExceptionAlerting;
/**
* Initialisation
@@ -52,8 +67,10 @@
[webView setDrawsBackground:YES];
[webView setEditable:NO];
[webView setShouldCloseWithWindow:YES];
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
[webView setShouldUpdateWhileOffscreen:NO];
- suppressExceptionAlert = NO;
+#endif
+ suppressExceptionAlerting = NO;
}
@@ -311,7 +328,7 @@
[newWebView showWindows];
}
-- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
+- (void)webView:(WebView *)aWebView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
{
NSInteger navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] integerValue];
@@ -335,11 +352,11 @@
switch(navigationType) {
case WebNavigationTypeLinkClicked:
- [[webView mainFrame] loadRequest:request];
+ [[aWebView mainFrame] loadRequest:request];
[listener use];
break;
case WebNavigationTypeReload:
- [[webView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil];
+ [[aWebView mainFrame] loadHTMLString:[self initHTMLSourceString] baseURL:nil];
break;
default:
[listener use];
@@ -506,7 +523,7 @@
NSString *mes = [NSString stringWithFormat:@"Exception:\nline = %ld\nfunction = %@\ncaller = %@\nexception = %@", lineno, [frame functionName], [frame caller], [frame userInfo], [frame exception]];
- if([self suppressExceptionAlert]) {
+ if([self suppressExceptionAlerting]) {
NSLog(@"%@", mes);
return;
}
@@ -599,7 +616,7 @@
*/
- (void)suppressExceptionAlert
{
- [self setSuppressExceptionAlert:YES];
+ [self setSuppressExceptionAlerting:YES];
}
/**
diff --git a/Source/SPCSVExporterDelegate.m b/Source/SPCSVExporterDelegate.m
index 226dea8d..6f8e06f6 100644
--- a/Source/SPCSVExporterDelegate.m
+++ b/Source/SPCSVExporterDelegate.m
@@ -28,7 +28,7 @@
#import "SPCSVExporter.h"
#import "SPCSVExporterDelegate.h"
#import "SPDatabaseDocument.h"
-#import "SPFileHandle.h"
+#import "SPExportFile.h"
@implementation SPExportController (SPCSVExporterDelegate)
diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m
index f19c2d55..5429896e 100644
--- a/Source/SPCSVParser.m
+++ b/Source/SPCSVParser.m
@@ -121,7 +121,7 @@
j = 1;
isEscaped = NO;
if (!escapeStringIsFieldQuoteString) {
- while (j * escapeLength <= nextQuoteDistance
+ while (j * escapeLength <= (NSInteger)nextQuoteDistance
&& ([[csvString substringWithRange:NSMakeRange((parserPosition + nextQuoteDistance - (j*escapeLength)), escapeLength)] isEqualToString:escapeString]))
{
isEscaped = !isEscaped;
@@ -203,7 +203,7 @@
if (escapeLength) {
j = 1;
isEscaped = NO;
- while (j * escapeLength <= nextFieldEndDistance
+ while (j * escapeLength <= (NSInteger)nextFieldEndDistance
&& ([[csvString substringWithRange:NSMakeRange((parserPosition + nextFieldEndDistance - (j*escapeLength)), escapeLength)] isEqualToString:escapeString]))
{
isEscaped = !isEscaped;
@@ -298,7 +298,7 @@
// to allow to replace these by the table column's DEFAULT value)
if (fieldCount == NSNotFound) {
fieldCount = [csvRowArray count];
- } else if ([csvRowArray count] < fieldCount) {
+ } else if ([csvRowArray count] < (NSUInteger)fieldCount) {
for (j = [csvRowArray count]; j < fieldCount; j++) [csvRowArray addObject:[SPNotLoaded notLoaded]];
}
diff --git a/Source/SPColorAdditions.m b/Source/SPColorAdditions.m
index d6dc8056..b9353921 100644
--- a/Source/SPColorAdditions.m
+++ b/Source/SPColorAdditions.m
@@ -68,19 +68,19 @@
[scanner scanCharactersFromSet:hexCharSet intoString:&code];
if( [code length] == 8 ) { // decode colors like #ffee33aa
- NSUInteger color = 0;
+ unsigned int color = 0;
scanner = [NSScanner scannerWithString:code];
if( ! [scanner scanHexInt:&color] ) return nil;
return [self colorWithCalibratedRed:( ( ( color >> 24 ) & 0xff ) / 255. ) green:( ( ( color >> 16 ) & 0xff ) / 255. ) blue:( ( ( color >> 8) & 0xff ) / 255. ) alpha:( ( color & 0xff ) / 255. )];
}
else if( [code length] == 6 ) { // decode colors like #ffee33
- NSUInteger color = 0;
+ unsigned int color = 0;
scanner = [NSScanner scannerWithString:code];
if( ! [scanner scanHexInt:&color] ) return nil;
return [self colorWithCalibratedRed:( ( ( color >> 16 ) & 0xff ) / 255. ) green:( ( ( color >> 8 ) & 0xff ) / 255. ) blue:( ( color & 0xff ) / 255. ) alpha:1.];
}
else if( [code length] == 3 ) { // decode short-hand colors like #fe3
- NSUInteger color = 0;
+ unsigned int color = 0;
scanner = [NSScanner scannerWithString:code];
if( ! [scanner scanHexInt:&color] ) return nil;
return [self colorWithCalibratedRed:( ( ( ( ( color >> 8 ) & 0xf ) << 4 ) | ( ( color >> 8 ) & 0xf ) ) / 255. ) green:( ( ( ( ( color >> 4 ) & 0xf ) << 4 ) | ( ( color >> 4 ) & 0xf ) ) / 255. ) blue:( ( ( ( color & 0xf ) << 4 ) | ( color & 0xf ) ) / 255. ) alpha:1.];
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index de9063f9..a5b79d80 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -44,7 +44,7 @@
@interface SPConnectionController : NSObject
{
- NSObject <SPConnectionControllerDelegateProtocol> *delegate;
+ id <SPConnectionControllerDelegateProtocol, NSObject> delegate;
SPDatabaseDocument *dbDocument;
SPSSHTunnel *sshTunnel;
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index d08bb241..edbed353 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -171,7 +171,7 @@
// Take all content filters until the next header or end of all content filters
NSUInteger numOfArgs;
- for(i; i<[contentFilters count]; i++) {
+ for ( ; i<[contentFilters count]; i++) {
if(![[contentFilters objectAtIndex:i] objectForKey:@"headerOfFileURL"]) {
NSMutableDictionary *d = [[NSMutableDictionary alloc] init];
@@ -609,7 +609,7 @@
originalRow += offset;
// For safety reasons
- if(originalRow > [contentFilters count]-1) originalRow = [contentFilters count] - 1;
+ if(originalRow > (NSInteger)[contentFilters count]-1) originalRow = [contentFilters count] - 1;
NSMutableDictionary *draggedRow = [NSMutableDictionary dictionaryWithDictionary:[contentFilters objectAtIndex:originalRow]];
[contentFilters removeObjectAtIndex:originalRow];
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index b69f23a1..b44ba920 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -38,6 +38,7 @@
#import "SPGeometryDataView.h"
#import "SPBundleEditorController.h"
#import "SPAppController.h"
+#import "SPTablesList.h"
NSInteger MENU_EDIT_COPY = 2001;
NSInteger MENU_EDIT_COPY_WITH_COLUMN = 2002;
@@ -205,7 +206,7 @@ NSInteger kBlobAsImageFile = 4;
[image release];
} else {
NSString *noData = @"";
- [noData writeToFile:fp atomically:NO];
+ [noData writeToFile:fp atomically:NO encoding:NSUTF8StringEncoding error:NULL];
}
[result appendFormat:@"%@\t", fp];
}
@@ -344,7 +345,7 @@ NSInteger kBlobAsImageFile = 4;
[image release];
} else {
NSString *noData = @"";
- [noData writeToFile:fp atomically:NO];
+ [noData writeToFile:fp atomically:NO encoding:NSUTF8StringEncoding error:NULL];
}
[result appendFormat:@"\"%@\",", fp];
}
@@ -792,7 +793,7 @@ NSInteger kBlobAsImageFile = 4;
// Otherwise, ensure the cell is represented as a short string
if ([contentString isKindOfClass:[NSData class]]) {
contentString = [contentString shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
- } else if ([contentString length] > 500) {
+ } else if ([(NSString *)contentString length] > 500) {
contentString = [contentString substringToIndex:500];
}
@@ -914,10 +915,10 @@ NSInteger kBlobAsImageFile = 4;
NSMutableIndexSet *selection = [NSMutableIndexSet indexSet];
NSInteger rows = [[self delegate] numberOfRowsInTableView:self];
- NSUInteger i;
+ NSInteger i;
if(rows > 0) {
for(NSString* idx in rowIndices) {
- i = [idx longLongValue];
+ i = [idx integerValue];
if(i >= 0 && i < rows)
[selection addIndex:i];
}
@@ -969,7 +970,7 @@ NSInteger kBlobAsImageFile = 4;
- (BOOL) control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
- NSUInteger row, column;
+ NSInteger row, column;
row = [self editedRow];
column = [self editedColumn];
@@ -1033,7 +1034,7 @@ NSInteger kBlobAsImageFile = 4;
if([self isCellComplex])
return NO;
- NSUInteger newRow = row+1;
+ NSInteger newRow = row+1;
if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check if we're already at the end of the list
[[control window] makeFirstResponder:control];
@@ -1041,7 +1042,7 @@ NSInteger kBlobAsImageFile = 4;
[[self delegate] saveRowToTable];
if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; //check again. saveRowToTable could reload the table and change the number of rows
- if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too
+ if (tableStorage && column >= (NSInteger)[tableStorage columnCount]) return YES; //the column count could change too
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
[self editColumn:column row:newRow withEvent:nil select:YES];
@@ -1057,14 +1058,14 @@ NSInteger kBlobAsImageFile = 4;
return NO;
if (row==0) return YES; //already at the beginning of the list
- NSUInteger newRow = row-1;
+ NSInteger newRow = row-1;
[[control window] makeFirstResponder:control];
if([[self delegate] isKindOfClass:[SPTableContent class]] && ![self isCellEditingMode] && [[self delegate] respondsToSelector:@selector(saveRowToTable)])
[[self delegate] saveRowToTable];
if (newRow>=[[self delegate] numberOfRowsInTableView:self]) return YES; // saveRowToTable could reload the table and change the number of rows
- if (tableStorage && column>=[tableStorage columnCount]) return YES; //the column count could change too
+ if (tableStorage && column >= (NSInteger)[tableStorage columnCount]) return YES; //the column count could change too
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:newRow] byExtendingSelection:NO];
[self editColumn:column row:newRow withEvent:nil select:YES];
@@ -1115,7 +1116,7 @@ NSInteger kBlobAsImageFile = 4;
NSInteger idx = [sender tag] - 1000000;
NSString *infoPath = nil;
NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeDataTable];
- if(idx >=0 && idx < [bundleItems count]) {
+ if(idx >=0 && idx < (NSInteger)[bundleItems count]) {
infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey];
} else {
if([sender tag] == 0 && [[sender toolTip] length]) {
@@ -1143,7 +1144,7 @@ NSInteger kBlobAsImageFile = 4;
if (cmdData) [cmdData release];
return;
} else {
- if([cmdData objectForKey:SPBundleFileCommandKey] && [[cmdData objectForKey:SPBundleFileCommandKey] length]) {
+ if([cmdData objectForKey:SPBundleFileCommandKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCommandKey] length]) {
NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey];
NSString *inputAction = @"";
@@ -1241,7 +1242,7 @@ NSInteger kBlobAsImageFile = 4;
NSArray *columns = [self tableColumns];
NSUInteger numColumns = [columns count];
NSUInteger *columnMappings = malloc(numColumns * sizeof(NSUInteger));
- NSInteger c;
+ NSUInteger c;
for ( c = 0; c < numColumns; c++ )
columnMappings[c] = [[NSArrayObjectAtIndex(columns, c) identifier] unsignedIntValue];
@@ -1306,7 +1307,7 @@ NSInteger kBlobAsImageFile = 4;
[[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil];
NSString *action = SPBundleOutputActionNone;
- if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length])
+ if([cmdData objectForKey:SPBundleFileOutputActionKey] && [(NSString *)[cmdData objectForKey:SPBundleFileOutputActionKey] length])
action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString];
// Redirect due exit code
@@ -1370,10 +1371,10 @@ NSInteger kBlobAsImageFile = 4;
}
}
if(!correspondingWindowFound) {
- SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init];
- [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]];
- [c displayHTMLContent:output withOptions:nil];
- [[NSApp delegate] addHTMLOutputController:c];
+ SPBundleHTMLOutputController *bundleController = [[SPBundleHTMLOutputController alloc] init];
+ [bundleController setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]];
+ [bundleController displayHTMLContent:output withOptions:nil];
+ [[NSApp delegate] addHTMLOutputController:bundleController];
}
}
}
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index d582b836..02b59ebd 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -61,6 +61,7 @@
#import "SPConnectionDelegate.h"
#import "SPWindowController.h"
#import "SPFileHandle.h"
+#import "SPConnectionHandler.h"
@interface SPDatabaseDocument (PrivateAPI)
diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m
index 55ab645b..e0c1a294 100644
--- a/Source/SPDotExporter.m
+++ b/Source/SPDotExporter.m
@@ -27,6 +27,7 @@
#import "SPFileHandle.h"
#import "SPTableData.h"
#import "SPExportUtilities.h"
+#import "SPExportFile.h"
@implementation SPDotExporter
@@ -105,7 +106,7 @@
NSMutableArray *fkInfo = [[NSMutableArray alloc] init];
// Process the tables
- for (NSInteger i = 0; i < [[self dotExportTables] count]; i++)
+ for (NSUInteger i = 0; i < [[self dotExportTables] count]; i++)
{
// Check for cancellation flag
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index 0cae1217..51ffacf6 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -757,7 +757,7 @@ static NSString *SPDefaultExportColourSchemeName = @"MyTheme";
nil,
NSLocalizedString(@"Unsaved Theme", @"unsaved theme message"),
NSLocalizedString(@"The current color theme is unsaved. Do you want to proceed without saving it?", @"unsaved theme informative message"),
- checkForUnsavedThemeSheetStatus
+ &checkForUnsavedThemeSheetStatus
);
return (checkForUnsavedThemeSheetStatus == NSAlertDefaultReturn);
diff --git a/Source/SPEditorTokens.l b/Source/SPEditorTokens.l
index 67491351..33c70149 100644
--- a/Source/SPEditorTokens.l
+++ b/Source/SPEditorTokens.l
@@ -46,6 +46,7 @@ size_t yyuoffset, yyuleng;
%}
%option noyywrap
%option nounput
+%option noinput
%option case-insensitive
s [ \t\n\r]+
diff --git a/Source/SPExportController.h b/Source/SPExportController.h
index ff5c65ba..f6503cb2 100644
--- a/Source/SPExportController.h
+++ b/Source/SPExportController.h
@@ -255,4 +255,6 @@
- (IBAction)toggleSQLIncludeContent:(id)sender;
- (IBAction)toggleSQLIncludeDropSyntax:(id)sender;
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+
@end
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 04138c75..2780df54 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -246,29 +246,29 @@ static const NSString *SPTableViewDropColumnID = @"drop";
*/
- (IBAction)export:(id)sender
{
- SPExportType exportType = SPSQLExport;
- SPExportSource exportSource = SPTableExport;
+ SPExportType selectedExportType = SPSQLExport;
+ SPExportSource selectedExportSource = SPTableExport;
- NSArray *tables = [tablesListInstance selectedTableItems];
+ NSArray *selectedTables = [tablesListInstance selectedTableItems];
BOOL isCustomQuerySelected = ([tableDocumentInstance isCustomQuerySelected] && ([[customQueryInstance currentResult] count] > 1));
BOOL isContentSelected = ([[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableContent] && ([[tableContentInstance currentResult] count] > 1));
if (isContentSelected) {
- tables = nil;
- exportType = SPCSVExport;
- exportSource = SPFilteredExport;
+ selectedTables = nil;
+ selectedExportType = SPCSVExport;
+ selectedExportSource = SPFilteredExport;
}
else if (isCustomQuerySelected) {
- tables = nil;
- exportType = SPCSVExport;
- exportSource = SPQueryExport;
+ selectedTables = nil;
+ selectedExportType = SPCSVExport;
+ selectedExportSource = SPQueryExport;
}
else {
- tables = ([tables count]) ? tables : nil;
+ selectedTables = ([selectedTables count]) ? selectedTables : nil;
}
- [self exportTables:tables asFormat:exportType usingSource:exportSource];
+ [self exportTables:selectedTables asFormat:selectedExportType usingSource:selectedExportSource];
// Ensure UI validation
[self switchInput:exportInputPopUpButton];
diff --git a/Source/SPExportFile.m b/Source/SPExportFile.m
index 4ccfa16c..10570a71 100644
--- a/Source/SPExportFile.m
+++ b/Source/SPExportFile.m
@@ -104,6 +104,7 @@
if ([fileManager fileExistsAtPath:[self exportFilePath]]) {
return [[NSFileManager defaultManager] removeItemAtPath:[self exportFilePath] error:nil];
}
+ return NO;
}
/**
@@ -136,10 +137,9 @@
// The file path must be set before attempting to create the file handle
if ((![self exportFilePath]) || ([[self exportFilePath] length] == 0)) {
[NSException raise:NSInternalInconsistencyException
- format:@"Attempting to create an export filehandle for a path that is either not set or has zero length: %@."
- arguments:[self exportFilePath]];
+ format:@"Attempting to create an export filehandle for a path that is either not set or has zero length: %@." , [self exportFilePath]];
- return;
+ return SPExportFileHandleFailed;
}
NSFileManager *fileManager = [NSFileManager defaultManager];
diff --git a/Source/SPExportFileUtilities.h b/Source/SPExportFileUtilities.h
index f0a2c054..156fbcb1 100644
--- a/Source/SPExportFileUtilities.h
+++ b/Source/SPExportFileUtilities.h
@@ -37,7 +37,7 @@
@interface SPExportController (SPExportFileUtilities)
- (void)writeCSVHeaderToExportFile:(SPExportFile *)file;
-- (void)writeXMLHeaderToexportFile:(SPExportFile *)file;
+- (void)writeXMLHeaderToExportFile:(SPExportFile *)file;
- (void)errorCreatingExportFileHandles:(NSArray *)files;
diff --git a/Source/SPExportFileUtilities.m b/Source/SPExportFileUtilities.m
index d39aee17..efa824f8 100644
--- a/Source/SPExportFileUtilities.m
+++ b/Source/SPExportFileUtilities.m
@@ -139,15 +139,10 @@
}
}
- // 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) {
diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m
index 7ce7b3a2..a485eb6b 100644
--- a/Source/SPExportFilenameUtilities.m
+++ b/Source/SPExportFilenameUtilities.m
@@ -24,6 +24,8 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPExportFilenameUtilities.h"
+#import "SPTablesList.h"
+#import "SPDatabaseViewController.h"
@implementation SPExportController (SPExportFilenameUtilities)
diff --git a/Source/SPExportUtilities.m b/Source/SPExportUtilities.m
index 543beb67..447d4948 100644
--- a/Source/SPExportUtilities.m
+++ b/Source/SPExportUtilities.m
@@ -38,8 +38,7 @@ void SPExportDelegateConformsToProtocol(NSObject *delegate, Protocol *protocol)
// Check that the the supplied delegate conforms to the supplied protocol, if not throw an exception
if (![delegate conformsToProtocol:protocol]) {
[NSException raise:@"Protocol Conformance"
- format:@"The supplied delegate does not conform to the protocol '%@'."
- arguments:NSStringFromProtocol(protocol)];
+ format:@"The supplied delegate does not conform to the protocol '%@'.", NSStringFromProtocol(protocol)];
}
}
diff --git a/Source/SPExporter.m b/Source/SPExporter.m
index 3be120b0..27cabf87 100644
--- a/Source/SPExporter.m
+++ b/Source/SPExporter.m
@@ -25,6 +25,7 @@
#import "SPExporter.h"
#import "SPExportFile.h"
+#import "SPFileHandle.h"
@implementation SPExporter
diff --git a/Source/SPFavoriteNode.m b/Source/SPFavoriteNode.m
index a70823f7..2d124756 100644
--- a/Source/SPFavoriteNode.m
+++ b/Source/SPFavoriteNode.m
@@ -76,17 +76,13 @@ static NSString *SPFavoriteNodeKey = @"SPFavoriteNode";
- (id)initWithCoder:(NSCoder *)coder
{
- if ((self = [super initWithCoder:coder])) {
- [self setNodeFavorite:[coder decodeObjectForKey:SPFavoriteNodeKey]];
- }
+ [self setNodeFavorite:[coder decodeObjectForKey:SPFavoriteNodeKey]];
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
-{
- [super encodeWithCoder:coder];
-
+{
[coder encodeObject:[self nodeFavorite] forKey:SPFavoriteNodeKey];
}
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index b7e499cf..1f3b6ea8 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -171,7 +171,10 @@
- (IBAction)closeEditSheet:(id)sender;
- (IBAction)openEditSheet:(id)sender;
+- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (IBAction)saveEditSheet:(id)sender;
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (IBAction)dropImage:(id)sender;
- (IBAction)segmentControllerChanged:(id)sender;
- (IBAction)quickLookFormatButton:(id)sender;
@@ -201,6 +204,7 @@
- (void)textViewDidChangeSelection:(NSNotification *)notification;
- (void)setWasCutPaste;
+- (void)setAllowedUndo;
- (void)setDoGroupDueToChars;
@end
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 5075ffaf..73fafe39 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -32,6 +32,13 @@
#import "SPCopyTable.h"
#include <objc/objc-runtime.h>
+@interface SPFieldEditorController (SPFieldEditorControllerDelegate)
+
+- (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo;
+
+@end
+
+
@implementation SPFieldEditorController
@synthesize editedFieldInfo;
@@ -72,11 +79,11 @@
NSMenu *menu = [editSheetQuickLookButton menu];
[menu setAutoenablesItems:NO];
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Interpret data as:", @"Interpret data as:") action:NULL keyEquivalent:@""];
- [item setTag:1];
- [item setEnabled:NO];
- [menu addItem:item];
- [item release];
+ NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Interpret data as:", @"Interpret data as:") action:NULL keyEquivalent:@""];
+ [menuItem setTag:1];
+ [menuItem setEnabled:NO];
+ [menu addItem:menuItem];
+ [menuItem release];
NSUInteger tag = 2;
// Load default QL types
@@ -94,11 +101,11 @@
NSLog(@"Error while reading 'EditorQuickLookTypes.plist':\n%@\n%@", [readError localizedDescription], convError);
if(defaultQLTypes != nil && [defaultQLTypes objectForKey:@"QuickLookTypes"]) {
for(id type in [defaultQLTypes objectForKey:@"QuickLookTypes"]) {
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""];
- [item setTag:tag];
- [item setAction:@selector(quickLookFormatButton:)];
- [menu addItem:item];
- [item release];
+ NSMenuItem *aMenuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""];
+ [aMenuItem setTag:tag];
+ [aMenuItem setAction:@selector(quickLookFormatButton:)];
+ [menu addItem:aMenuItem];
+ [aMenuItem release];
tag++;
[qlTypesItems addObject:type];
}
@@ -106,11 +113,11 @@
// Load user-defined QL types
if([prefs objectForKey:SPQuickLookTypes]) {
for(id type in [prefs objectForKey:SPQuickLookTypes]) {
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""];
- [item setTag:tag];
- [item setAction:@selector(quickLookFormatButton:)];
- [menu addItem:item];
- [item release];
+ NSMenuItem *aMenuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""];
+ [aMenuItem setTag:tag];
+ [aMenuItem setAction:@selector(quickLookFormatButton:)];
+ [menu addItem:aMenuItem];
+ [aMenuItem release];
tag++;
[qlTypesItems addObject:type];
}
@@ -212,8 +219,8 @@
[bitSheetFieldName setStringValue:label];
// Init according bit check boxes
- NSInteger i = 0;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i = 0;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
if([bitSheetNULLButton state] == NSOffState)
for( i = 0; i<maxBit; i++ )
[[self valueForKeyPath:[NSString stringWithFormat:@"bitSheetBitButton%ld", i]]
@@ -315,7 +322,7 @@
[editTextScrollView setHidden:YES];
[editSheetSegmentControl setSelectedSegment:2];
} else if ([sheetEditData isKindOfClass:[MCPGeometryData class]]) {
- SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0] autorelease];
+ SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0f] autorelease];
image = [v thumbnailImage];
stringValue = [[sheetEditData wktString] retain];
[hexTextView setString:@""];
@@ -544,7 +551,7 @@
// and suppress closing the sheet
if(sender == editSheetOkButton) {
if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:SPNullValue]]) {
- [editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
+ [editTextView setSelectedRange:NSMakeRange((NSUInteger)maxTextLength, [[editTextView textStorage] length] - (NSUInteger)maxTextLength)];
[editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)];
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %llu.", @"Text is too long. Maximum text length is set to %llu."), maxTextLength]];
return;
@@ -670,7 +677,7 @@
} else if (editImage != nil){
- SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0] autorelease];
+ SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0f] autorelease];
NSData *pdf = [v pdfData];
if(pdf)
[pdf writeToFile:fileName atomically:YES];
@@ -715,7 +722,7 @@
*/
- (IBAction)quickLookFormatButton:(id)sender
{
- if(qlTypes != nil && [[qlTypes objectForKey:@"QuickLookTypes"] count] > [sender tag] - 2) {
+ if(qlTypes != nil && [[qlTypes objectForKey:@"QuickLookTypes"] count] > (NSUInteger)[sender tag] - 2) {
NSDictionary *type = [[qlTypes objectForKey:@"QuickLookTypes"] objectAtIndex:[sender tag] - 2];
[self invokeQuickLookOfType:[type objectForKey:@"Extension"] treatAsText:([[type objectForKey:@"treatAsText"] integerValue])];
}
@@ -915,7 +922,7 @@
*
* @return It returns as NSURL the temporarily created file.
*/
-- (id)previewPanel:(id)panel previewItemAtIndex:(NSInteger)index
+- (id)previewPanel:(id)panel previewItemAtIndex:(NSInteger)anIndex
{
if(tmpFileName)
return [NSURL fileURLWithPath:tmpFileName];
@@ -1047,8 +1054,8 @@
*/
- (void)updateBitSheet
{
- NSInteger i = 0;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i = 0;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
if([bitSheetNULLButton state] == NSOnState) {
if ( sheetEditData != nil ) {
@@ -1074,7 +1081,7 @@
for(i=0; i<maxBit; i++) {
if([[self valueForKeyPath:[NSString stringWithFormat:@"bitSheetBitButton%ld", i]] state] == NSOnState) {
intValue += bitValue;
- [bitString replaceCharactersInRange:NSMakeRange(maxTextLength-i-1, 1) withString:@"1"];
+ [bitString replaceCharactersInRange:NSMakeRange((NSUInteger)maxTextLength-i-1, 1) withString:@"1"];
}
bitValue <<= 1;
}
@@ -1097,9 +1104,9 @@
- (IBAction)bitSheetOperatorButtonWasClicked:(id)sender
{
- NSInteger i = 0;
- NSInteger aBit;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i = 0;
+ NSUInteger aBit;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
switch([sender tag]) {
case 0: // all to 1
@@ -1159,8 +1166,8 @@
- (IBAction)setToNull:(id)sender
{
- NSInteger i;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
if([sender state] == NSOnState) {
for(i=0; i<maxBit; i++)
@@ -1202,10 +1209,10 @@
if (object == bitSheetIntegerTextField) {
- NSInteger i = 0;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i = 0;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
- NSUInteger intValue = strtoull([[bitSheetIntegerTextField stringValue] UTF8String], NULL, 0);
+ NSUInteger intValue = (NSUInteger)strtoull([[bitSheetIntegerTextField stringValue] UTF8String], NULL, 0);
for(i=0; i<maxBit; i++)
[[self valueForKeyPath:[NSString stringWithFormat:@"bitSheetBitButton%ld", i]] setState:NSOffState];
@@ -1224,10 +1231,10 @@
}
else if (object == bitSheetHexTextField) {
- NSInteger i = 0;
- NSInteger maxBit = (maxTextLength > 64) ? 64 : maxTextLength;
+ NSUInteger i = 0;
+ NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength);
- NSUInteger intValue;
+ unsigned long long intValue;
[[NSScanner scannerWithString:[bitSheetHexTextField stringValue]] scanHexLongLong: &intValue];
@@ -1273,7 +1280,8 @@
if (r.location==NSNotFound) return NO;
// Length checking while using the Input Manager (eg for Japanese)
- if ([textView hasMarkedText] && (maxTextLength > 0) && (r.location < maxTextLength))
+ if ([textView hasMarkedText] && (maxTextLength > 0) && (r.location < maxTextLength)) {
+
// User tries to insert a new char but max text length was already reached - return NO
if( !r.length && ([[textView textStorage] length] >= maxTextLength) ) {
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %llu.", @"Maximum text length is set to %llu."), maxTextLength]];
@@ -1288,20 +1296,21 @@
// that part which won't be saved will be hilited if user pressed the OK button.
else if (r.location < maxTextLength)
return YES;
+ }
// Calculate the length of the text after the change.
newLength=[[[textView textStorage] string] length]+[replacementString length]-r.length;
// If it's too long, disallow the change but try
// to insert a text chunk partially to maxTextLength.
- if (newLength > maxTextLength) {
+ if ((NSUInteger)newLength > maxTextLength) {
if((maxTextLength-[[textView textStorage] length]+[textView selectedRange].length) <= [replacementString length]) {
if(maxTextLength-[[textView textStorage] length]+[textView selectedRange].length)
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %llu. Inserted text was truncated.", @"Maximum text length is set to %llu. Inserted text was truncated."), maxTextLength]];
else
[SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %llu.", @"Maximum text length is set to %llu."), maxTextLength]];
- [textView insertText:[replacementString substringToIndex:maxTextLength-[[textView textStorage] length]+[textView selectedRange].length]];
+ [textView insertText:[replacementString substringToIndex:(NSUInteger)maxTextLength-[[textView textStorage] length]+[textView selectedRange].length]];
}
return NO;
}
diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h
index 813a3b3e..69e9fac4 100644
--- a/Source/SPFieldMapperController.h
+++ b/Source/SPFieldMapperController.h
@@ -24,7 +24,7 @@
#import <MCPKit/MCPKit.h>
-@class SPTextView, SPTableView;
+@class SPTextView, SPTableView, SPTablesList;
@interface SPFieldMapperController : NSWindowController
{
@@ -89,7 +89,7 @@
id theDelegate;
id customQueryInstance;
id fieldMappingImportArray;
- id tablesListInstance;
+ SPTablesList *tablesListInstance;
id databaseDataInstance;
NSInteger fieldMappingCurrentRow;
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 7079cc13..de22b485 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -289,7 +289,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
- (NSArray*)fieldMappingGlobalValueArray
{
NSMutableArray *globals = [NSMutableArray array];
- for(NSInteger i=0; i < [fieldMappingGlobalValues count]; i++) {
+ for(NSUInteger i=0; i < [fieldMappingGlobalValues count]; i++) {
id glob = NSArrayObjectAtIndex(fieldMappingGlobalValues, i);
if([NSArrayObjectAtIndex(fieldMappingGlobalValuesSQLMarked, i) boolValue] || glob == [NSNull null])
[globals addObject:glob];
@@ -490,7 +490,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
{
NSArray *allTableNames = [tablesListInstance allTableNames];
- NSInteger i;
+ NSUInteger i;
// Remove all indexes for new columns
[toBeEditedRowIndexes removeAllIndexes];
@@ -605,7 +605,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
// Set the first n operators to doImport
if([fieldMappingImportArray count]) {
- NSInteger possibleImports = ([NSArrayObjectAtIndex(fieldMappingImportArray, 0) count] > [fieldMappingTableColumnNames count]) ? [fieldMappingTableColumnNames count] : [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count];
+ NSUInteger possibleImports = ([NSArrayObjectAtIndex(fieldMappingImportArray, 0) count] > [fieldMappingTableColumnNames count]) ? [fieldMappingTableColumnNames count] : [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count];
for(i=0; i < possibleImports; i++)
[fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doImport];
}
@@ -632,7 +632,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
- (IBAction)changeImportMethod:(id)sender
{
- NSInteger i;
+ NSUInteger i;
[onupdateTextView setBackgroundColor:[NSColor lightGrayColor]];
[onupdateTextView setEditable:NO];
@@ -697,7 +697,8 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if(![fieldMappingImportArray count]) return;
- NSInteger i;
+ NSUInteger i;
+ NSInteger j;
NSInteger possibleImports = ([NSArrayObjectAtIndex(fieldMappingImportArray, 0) count] > [fieldMappingTableColumnNames count]) ? [fieldMappingTableColumnNames count] : [NSArrayObjectAtIndex(fieldMappingImportArray, 0) count];
if(possibleImports < 1) return;
@@ -709,16 +710,16 @@ static NSString *SPTableViewSqlColumnID = @"sql";
switch([[alignByPopup selectedItem] tag]) {
case 0: // file order
- for(i=0; i<possibleImports; i++) {
- [fieldMappingArray replaceObjectAtIndex:i withObject:[NSNumber numberWithInteger:i]];
- [fieldMappingOperatorArray replaceObjectAtIndex:i withObject:doImport];
+ for(j=0; j<possibleImports; j++) {
+ [fieldMappingArray replaceObjectAtIndex:j withObject:[NSNumber numberWithInteger:j]];
+ [fieldMappingOperatorArray replaceObjectAtIndex:j withObject:doImport];
}
break;
case 1: // reversed file order
possibleImports--;
- for(i=possibleImports; i>=0; i--) {
- [fieldMappingArray replaceObjectAtIndex:possibleImports-i withObject:[NSNumber numberWithInteger:i]];
- [fieldMappingOperatorArray replaceObjectAtIndex:possibleImports-i withObject:doImport];
+ for(j=possibleImports; j>=0; j--) {
+ [fieldMappingArray replaceObjectAtIndex:possibleImports-j withObject:[NSNumber numberWithInteger:j]];
+ [fieldMappingOperatorArray replaceObjectAtIndex:possibleImports-j withObject:doImport];
}
break;
case 2: // try to align header and table target field names via Levenshtein distance
@@ -750,7 +751,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
// enable/disable buttons
[rowDownButton setEnabled:(fieldMappingCurrentRow != 0)];
- [rowUpButton setEnabled:(fieldMappingCurrentRow != ([fieldMappingImportArray count]-1))];
+ [rowUpButton setEnabled:(fieldMappingCurrentRow != (NSInteger)([fieldMappingImportArray count]-1))];
}
- (IBAction)changeHasHeaderCheckbox:(id)sender
@@ -833,7 +834,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
columnCounter = 0;
for(id col in row) {
if(col && col != [NSNull null]) {
- if([col isKindOfClass:[NSString class]] && maxLengthOfSourceColumns[columnCounter] < [col length]) {
+ if([col isKindOfClass:[NSString class]] && maxLengthOfSourceColumns[columnCounter] < (NSInteger)[col length]) {
maxLengthOfSourceColumns[columnCounter] = [col length];
}
if(typeOfSourceColumns[columnCounter] == 1) {
@@ -908,7 +909,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
}
// Update the table view
- NSInteger i;
+ NSUInteger i;
fieldMappingCurrentRow = 0;
if (fieldMappingArray) [fieldMappingArray release], fieldMappingArray = nil;
[self setupFieldMappingArray];
@@ -999,13 +1000,13 @@ static NSString *SPTableViewSqlColumnID = @"sql";
- (IBAction)setAllTypesTo:(id)sender
{
NSInteger row = [fieldMapperTableView selectedRow];
- if(row<0 || row>=[fieldMappingTableColumnNames count]) {
+ if(row<0 || row>=(NSInteger)([fieldMappingTableColumnNames count])) {
NSBeep();
return;
}
NSString *type = [[fieldMappingTableTypes objectAtIndex:row] retain];
[fieldMappingTableTypes removeAllObjects];
- NSInteger i;
+ NSUInteger i;
for(i=0; i<[fieldMappingTableColumnNames count]; i++)
[fieldMappingTableTypes addObject:type];
[fieldMapperTableView reloadData];
@@ -1287,9 +1288,9 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if([globalValuesTableView numberOfSelectedRows] != 1 || [globalValuesTableView editedRow] < 0) return;
- NSInteger index = [sender indexOfItem:[sender selectedItem]] - 4;
+ NSInteger selectedIndex = [sender indexOfItem:[sender selectedItem]] - 4;
if([[[NSApp keyWindow] firstResponder] respondsToSelector:@selector(insertText:)])
- [[[NSApp keyWindow] firstResponder] insertText:[NSString stringWithFormat:@"$%ld", index]];
+ [[[NSApp keyWindow] firstResponder] insertText:[NSString stringWithFormat:@"$%ld", selectedIndex]];
}
@@ -1386,10 +1387,10 @@ static NSString *SPTableViewSqlColumnID = @"sql";
// Create a distance matrix for each file-table name
// distance will be calculated by using Levenshtein distance minus common prefix and suffix length
// and minus the length of a fuzzy regex search for a common sequence of characters
- NSInteger i,j;
+ NSUInteger i,j;
NSMutableArray *distMatrix = [NSMutableArray array];
for(i=0; i < [tableHeaderNames count]; i++) {
- CGFloat dist = 1e6;
+ CGFloat dist = 1e6f;
for(j=0; j < [fileHeaderNames count]; j++) {
id fileHeaderName = NSArrayObjectAtIndex(fileHeaderNames,j);
if([fileHeaderName isKindOfClass:[NSNull class]] || [fileHeaderName isSPNotLoaded]) continue;
@@ -1403,7 +1404,6 @@ static NSString *SPTableViewSqlColumnID = @"sql";
dist -= [[tableHeadName commonPrefixWithString:headerName options:NSCaseInsensitiveSearch|NSBackwardsSearch] length];
NSMutableString *fuzzyRegexp = [[NSMutableString alloc] initWithCapacity:3];
- NSInteger i;
unichar c;
for(i=0; i<[headerName length]; i++) {
@@ -1419,7 +1419,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
} else {
// Levenshtein distance == 0 means that both names are equal set dist to
// a large negative number since dist can be negative due to search for in common chars
- dist = -1e6;
+ dist = -1e6f;
}
[distMatrix addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@@ -1439,7 +1439,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
NSMutableArray *matchedFile = [NSMutableArray array];
NSMutableArray *matchedTable = [NSMutableArray array];
- NSInteger cnt = 0;
+ NSUInteger cnt = 0;
for(NSDictionary* m in distMatrix) {
if(![matchedFile containsObject:[m objectForKey:@"file"]] && ![matchedTable containsObject:[m objectForKey:@"table"]]) {
@@ -1466,7 +1466,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
*/
- (void)setupFieldMappingArray
{
- NSInteger i, value;
+ NSUInteger i, value;
if (!fieldMappingArray) {
fieldMappingArray = [[NSMutableArray alloc] init];
@@ -1478,7 +1478,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
value = 0;
}
- [fieldMappingArray addObject:[NSNumber numberWithInteger:value]];
+ [fieldMappingArray addObject:[NSNumber numberWithUnsignedInteger:value]];
}
}
@@ -1490,7 +1490,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
*/
- (void)updateFieldMappingButtonCell
{
- NSInteger i;
+ NSUInteger i;
if([fieldMappingImportArray count] == 0) return;
[fieldMappingButtonOptions setArray:[fieldMappingImportArray objectAtIndex:fieldMappingCurrentRow]];
for (i = 0; i < [fieldMappingButtonOptions count]; i++) {
@@ -1503,8 +1503,8 @@ static NSString *SPTableViewSqlColumnID = @"sql";
}
// Add global values if any
- if([fieldMappingGlobalValues count]>numberOfImportColumns)
- for(i; i < [fieldMappingGlobalValues count]; i++) {
+ if((NSInteger)[fieldMappingGlobalValues count]>numberOfImportColumns)
+ for( ; i < [fieldMappingGlobalValues count]; i++) {
if ([NSArrayObjectAtIndex(fieldMappingGlobalValues, i) isNSNull])
[fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]];
else
@@ -1637,6 +1637,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
return [fieldMappingTableColumnNames count];
else if(aTableView == globalValuesTableView)
return [fieldMappingGlobalValues count] - numberOfImportColumns;
+ return 0;
}
- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
@@ -1653,7 +1654,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
&& [self numberOfRowsInTableView:aTableView]
&& [fieldMappingOperatorArray count]
&& [fieldMappingTableColumnNames count]) {
- NSInteger i;
+ NSUInteger i;
NSNumber *globalValue = doImport;
if([fieldMappingOperatorArray objectAtIndex:0] == doImport)
globalValue = doNotImport;
@@ -1675,7 +1676,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOnState) {
- if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
+ if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
return [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"User-defined value", @"user-defined value"), NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue])];
if(fieldMappingCurrentRow)
@@ -1688,7 +1689,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
}
else if([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID] && [importFieldNamesHeaderSwitch state] == NSOffState) {
- if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
+ if([NSArrayObjectAtIndex(fieldMappingArray, rowIndex) unsignedIntegerValue]>=[NSArrayObjectAtIndex(fieldMappingImportArray, 0) count])
return NSArrayObjectAtIndex(fieldMappingGlobalValues, [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
else
return NSArrayObjectAtIndex(NSArrayObjectAtIndex(fieldMappingImportArray, fieldMappingCurrentRow), [NSArrayObjectAtIndex(fieldMappingArray, rowIndex) integerValue]);
@@ -1766,7 +1767,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
else if ([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID]) {
// Check if all global value was deleted, if so set assigned field as doNotImport
- if([[fieldMappingArray objectAtIndex:rowIndex] intValue] >= [fieldMappingButtonOptions count]) {
+ if([[fieldMappingArray objectAtIndex:rowIndex] unsignedIntegerValue] >= [fieldMappingButtonOptions count]) {
[fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport];
}
@@ -1844,16 +1845,16 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if(aTableView == fieldMapperTableView) {
if ([[aTableColumn identifier] isEqualToString:SPTableViewImportValueColumnID]) {
- if([anObject integerValue] > [fieldMappingButtonOptions count]) {
+ if([anObject integerValue] > (NSInteger)[fieldMappingButtonOptions count]) {
// Ignore field - set operator to doNotImport
- if([anObject integerValue] == [fieldMappingButtonOptions count]+1) {
+ if([anObject integerValue] == (NSInteger)[fieldMappingButtonOptions count]+1) {
lastDisabledCSVFieldcolumn = [fieldMappingArray objectAtIndex:rowIndex];
[fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:doNotImport];
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
}
// Ignore all field - set all operator to doNotImport
- else if([anObject integerValue] == [fieldMappingButtonOptions count]+2) {
- NSInteger i;
+ else if([anObject integerValue] == (NSInteger)[fieldMappingButtonOptions count]+2) {
+ NSUInteger i;
NSNumber *globalValue = doNotImport;
[fieldMappingOperatorArray removeAllObjects];
for(i=0; i < [fieldMappingTableColumnNames count]; i++)
@@ -1861,15 +1862,15 @@ static NSString *SPTableViewSqlColumnID = @"sql";
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
}
// Import all field - set all operator to doImport
- else if([anObject integerValue] == [fieldMappingButtonOptions count]+3) {
- NSInteger i;
+ else if([anObject integerValue] == (NSInteger)[fieldMappingButtonOptions count]+3) {
+ NSUInteger i;
NSNumber *globalValue = doImport;
[fieldMappingOperatorArray removeAllObjects];
for(i=0; i < [fieldMappingTableColumnNames count]; i++)
[fieldMappingOperatorArray addObject:globalValue];
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
}
- else if([[self selectedImportMethod] isEqualToString:@"UPDATE"] && [anObject integerValue] == [fieldMappingButtonOptions count]+4) {
+ else if([[self selectedImportMethod] isEqualToString:@"UPDATE"] && [anObject integerValue] == (NSInteger)[fieldMappingButtonOptions count]+4) {
[fieldMappingOperatorArray replaceObjectAtIndex:rowIndex withObject:isEqual];
[aTableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.0];
}
@@ -1981,7 +1982,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if((!newTableMode || addGlobalSheetIsOpen) && ![toBeEditedRowIndexes containsIndex:[fieldMapperTableView selectedRow]]) return NO;
- NSUInteger row, column;
+ NSInteger row, column;
row = [fieldMapperTableView editedRow];
column = [fieldMapperTableView editedColumn];
@@ -2047,7 +2048,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
if(isCellComplex) return NO;
- NSUInteger newRow = row+1;
+ NSInteger newRow = row+1;
if (newRow>=[self numberOfRowsInTableView:fieldMapperTableView]) return YES; //check if we're already at the end of the list
[[control window] makeFirstResponder:control];
@@ -2112,9 +2113,9 @@ static NSString *SPTableViewSqlColumnID = @"sql";
#pragma mark -
#pragma mark NSComboBox delegates
-- (id)comboBoxCell:(NSComboBoxCell *)aComboBoxCell objectValueForItemAtIndex:(NSInteger)index
+- (id)comboBoxCell:(NSComboBoxCell *)aComboBoxCell objectValueForItemAtIndex:(NSInteger)anIndex
{
- return [defaultFieldTypesForComboBox objectAtIndex:index];
+ return [defaultFieldTypesForComboBox objectAtIndex:anIndex];
}
- (NSInteger)numberOfItemsInComboBoxCell:(NSComboBoxCell *)aComboBoxCell
diff --git a/Source/SPFileHandle.m b/Source/SPFileHandle.m
index ff583ddc..3701fc8c 100644
--- a/Source/SPFileHandle.m
+++ b/Source/SPFileHandle.m
@@ -55,7 +55,7 @@
*/
- (id)initWithFile:(void *)theFile fromPath:(const char *)path mode:(int)mode
{
- if (self = [super init]) {
+ if ((self = [super init])) {
dataWritten = NO;
allDataWritten = YES;
fileIsClosed = NO;
@@ -215,10 +215,10 @@
if (useCompression) {
if (compressionFormat == SPGzipCompression) {
- theDataLength = gzread(wrappedFile, theData, length);
+ theDataLength = gzread(wrappedFile, theData, (unsigned)length);
}
else if (compressionFormat == SPBzip2Compression) {
- theDataLength = BZ2_bzread(wrappedFile, theData, length);
+ theDataLength = BZ2_bzread(wrappedFile, theData, (int)length);
}
}
else {
@@ -426,10 +426,12 @@
switch (compressionFormat)
{
case SPGzipCompression:
- bufferLengthWrittenOut = gzwrite(wrappedFile, [dataToBeWritten bytes], [dataToBeWritten length]);
+ bufferLengthWrittenOut = gzwrite(wrappedFile, [dataToBeWritten bytes], (unsigned)[dataToBeWritten length]);
break;
case SPBzip2Compression:
- bufferLengthWrittenOut = BZ2_bzwrite(wrappedFile, [dataToBeWritten bytes], [dataToBeWritten length]);
+ bufferLengthWrittenOut = BZ2_bzwrite(wrappedFile, (void *)[dataToBeWritten bytes], (int)[dataToBeWritten length]);
+ break;
+ default:
break;
}
}
@@ -439,7 +441,7 @@
// Restore data to the buffer if it wasn't written out
pthread_mutex_lock(&bufferLock);
- if (bufferLengthWrittenOut < [dataToBeWritten length]) {
+ if (bufferLengthWrittenOut < (NSInteger)[dataToBeWritten length]) {
if ([buffer length]) {
long dataLengthToRestore = [dataToBeWritten length] - bufferLengthWrittenOut;
[buffer replaceBytesInRange:NSMakeRange(0, 0) withBytes:[[dataToBeWritten subdataWithRange:NSMakeRange(bufferLengthWrittenOut, dataLengthToRestore)] bytes] length:dataLengthToRestore];
diff --git a/Source/SPGeometryDataView.h b/Source/SPGeometryDataView.h
index 0fac2874..a5505e46 100644
--- a/Source/SPGeometryDataView.h
+++ b/Source/SPGeometryDataView.h
@@ -51,8 +51,6 @@
- (id)initWithCoordinates:(NSDictionary*)coord targetDimension:(CGFloat)targetDimension;
- (id)initWithCoordinates:(NSDictionary*)coord;
-- (void)setMax:(NSArray*)bbox;
-- (NSPoint)normalizePoint:(NSPoint)aPoint;
- (NSImage*)thumbnailImage;
- (NSData*)pdfData;
diff --git a/Source/SPGroupNode.m b/Source/SPGroupNode.m
index 5479397b..7bf1124b 100644
--- a/Source/SPGroupNode.m
+++ b/Source/SPGroupNode.m
@@ -75,17 +75,13 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName";
- (id)initWithCoder:(NSCoder *)coder
{
- if ((self = [super initWithCoder:coder])) {
- [self setNodeName:[coder decodeObjectForKey:SPGroupNodeNameKey]];
- }
+ [self setNodeName:[coder decodeObjectForKey:SPGroupNodeNameKey]];
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
- [super encodeWithCoder:coder];
-
[coder encodeObject:[self nodeName] forKey:SPGroupNodeNameKey];
}
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index f1cce967..12aa58e1 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -28,8 +28,9 @@
#import "SPServerSupport.h"
#import "SPTableContent.h"
#import "SPTableData.h"
+#import "SPTablesList.h"
#import <MCPKit/MCPKit.h>
-#import "SPDatabaseDocument.h"
+#import "SPDatabaseViewController.h"
// Constants
static const NSString *SPNewIndexIndexName = @"IndexName";
@@ -152,7 +153,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
for (NSDictionary *field in fields)
{
BOOL hasCompositePrimaryKey = NO;
- BOOL isPrimaryKey = [field objectForKey:@"isprimarykey"];
+ BOOL isPrimaryKey = [[field objectForKey:@"isprimarykey"] boolValue];
// The 'isprimarykey' key of a field is only present for single column primary keys, not composite keys,
// so we need to check the indexes manually.
@@ -245,7 +246,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
NSInteger index = [indexesTableView selectedRow];
- if ((index == -1) || (index > ([indexes count] - 1))) return;
+ if ((index == -1) || (index > ((NSInteger)[indexes count] - 1))) return;
NSString *keyName = [[indexes objectAtIndex:index] objectForKey:@"Key_name"];
NSString *columnName = [[indexes objectAtIndex:index] objectForKey:@"Column_name"];
@@ -290,7 +291,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
*/
- (IBAction)chooseIndexType:(id)sender
{
- NSInteger *indexType = [[indexTypePopUpButton selectedItem] tag];
+ NSInteger indexType = [[indexTypePopUpButton selectedItem] tag];
if (indexType == SPPrimaryKeyMenuTag) {
[indexNameTextField setEnabled:NO];
@@ -531,7 +532,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
for (i = ([copy count] - 1); i > 0; i--)
{
- NSDictionary *field = [[copy objectAtIndex:i] objectForKey:@"name"];
+ NSString *field = [[copy objectAtIndex:i] objectForKey:@"name"];
for (j = 0; j < i; j++)
{
@@ -602,7 +603,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
NSMutableDictionary *indexDetails = [NSMutableDictionary dictionary];
[indexDetails setObject:[indexes objectAtIndex:[indexesTableView selectedRow]] forKey:@"Index"];
- [indexDetails setObject:[NSNumber numberWithBool:[contextInfo hasSuffix:@"AndForeignKey"]] forKey:@"RemoveForeignKey"];
+ [indexDetails setObject:[NSNumber numberWithBool:[(NSString *)contextInfo hasSuffix:@"AndForeignKey"]] forKey:@"RemoveForeignKey"];
if ([NSThread isMainThread]) {
[NSThread detachNewThreadSelector:@selector(_removeIndexUsingDetails:) toTarget:self withObject:indexDetails];
@@ -684,7 +685,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
if ([requiresLength containsObject:[[field objectForKey:@"type"] uppercaseString]]) {
sizeRequired++;
sizeRequiredFieldAndNotYetSet++;
- if([field objectForKey:@"Size"] && [[field objectForKey:@"Size"] length])
+ if([field objectForKey:@"Size"] && [(NSString *)[field objectForKey:@"Size"] length])
sizeRequiredFieldAndNotYetSet--;
}
}
@@ -740,7 +741,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
// If this field type requires a length and one hasn't been specified (interface validation
// should ensure this doesn't happen), then skip it.
- if ([requiresLength containsObject:[columnType uppercaseString]] && (![[column objectForKey:@"Size"] length])) continue;
+ if ([requiresLength containsObject:[columnType uppercaseString]] && (![(NSString *)[column objectForKey:@"Size"] length])) continue;
if ([column objectForKey:@"Size"] && [supportsLength containsObject:columnType]) {
diff --git a/Source/SPNavigatorController.h b/Source/SPNavigatorController.h
index 045e5eb4..cdac2706 100644
--- a/Source/SPNavigatorController.h
+++ b/Source/SPNavigatorController.h
@@ -30,7 +30,7 @@
IBOutlet id navigatorWindow;
IBOutlet id infoTable;
IBOutlet id searchField;
- IBOutlet id syncButton;
+ IBOutlet NSButton *syncButton;
IBOutlet id schemaStatusSplitView;
IBOutlet id schema12SplitView;
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 25eccbc8..36dddf39 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -218,7 +218,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
if(!pathArray || [pathArray count] == 0) return;
NSMutableString *aKey = [NSMutableString string];
[outlineSchema2 collapseItem:[item objectForKey:[pathArray objectAtIndex:0]] collapseChildren:YES];
- for(NSInteger i=0; i < [pathArray count]; i++) {
+ for(NSUInteger i=0; i < [pathArray count]; i++) {
[aKey appendString:[pathArray objectAtIndex:i]];
if(!item || ![item isKindOfClass:NSDictionaryClass] || ![item objectForKey:aKey]) break;
item = [item objectForKey:aKey];
@@ -231,13 +231,14 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
[outlineSchema2 selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
if([outlineSchema2 numberOfSelectedRows] != 1) return;
[outlineSchema2 scrollRowToVisible:[outlineSchema2 selectedRow]];
- id item = [outlineSchema2 selectedItem];
+ id selectedItem = [outlineSchema2 selectedItem];
// Try to scroll the view that all children of schemaPath are visible if possible
NSInteger cnt = 1;
- if([item isKindOfClass:NSDictionaryClass] || [item isKindOfClass:[NSArray class]])
- cnt = [item count]+1;
+ if([selectedItem isKindOfClass:NSDictionaryClass] || [selectedItem isKindOfClass:[NSArray class]])
+ cnt = [selectedItem count]+1;
NSRange r = [outlineSchema2 rowsInRect:[outlineSchema2 visibleRect]];
- NSInteger offset = (cnt > r.length) ? (r.length-2) : cnt;
+ NSInteger rangeLength = r.length;
+ NSInteger offset = (cnt > rangeLength) ? (rangeLength-2) : cnt;
offset += [outlineSchema2 selectedRow];
if(offset >= [outlineSchema2 numberOfRows])
offset = [outlineSchema2 numberOfRows] - 1;
@@ -259,7 +260,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
id item = schemaData;
NSArray *pathArray = [selectedKey2 componentsSeparatedByString:SPUniqueSchemaDelimiter];
NSMutableString *aKey = [NSMutableString string];
- for(NSInteger i=0; i < [pathArray count]; i++) {
+ for(NSUInteger i=0; i < [pathArray count]; i++) {
[aKey appendString:[pathArray objectAtIndex:i]];
if(![item objectForKey:aKey]) break;
item = [item objectForKey:aKey];
@@ -513,8 +514,6 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
- (NSArray *)getUniqueDbIdentifierFor:(NSString*)term andConnection:(NSString*)connectionID ignoreFields:(BOOL)ignoreFields
{
- NSString *SPUniqueSchemaDelimiter = @"￸";
-
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH[c] %@", [NSString stringWithFormat:@"%@%@", SPUniqueSchemaDelimiter, [term lowercaseString]]];
NSMutableArray *result = [NSMutableArray arrayWithCapacity:5];
@@ -1050,7 +1049,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
// selected item is a field
if([selectedItem isKindOfClass:[NSArray class]]) {
- NSInteger i = 0;
+ NSUInteger i = 0;
for(i=0; i<[selectedItem count]-2; i++) {
NSString *item = NSArrayObjectAtIndex(selectedItem, i);
if(![item length]) continue;
@@ -1180,7 +1179,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- if(aTableView == infoTable && infoArray && rowIndex < [infoArray count]) {
+ if(aTableView == infoTable && infoArray && (NSUInteger)rowIndex < [infoArray count]) {
return [infoArray objectAtIndex:rowIndex];
}
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 2af3271e..464a2f0c 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -78,4 +78,13 @@
*/
@property (readwrite, assign) NSUInteger fontChangeTarget;
+
+// Toolbar item IBAction methods
+- (IBAction)displayPreferencePane:(id)sender;
+- (IBAction)displayTablePreferences:(id)sender;
+- (IBAction)displayEditorPreferences:(id)sender;
+
+// Other
+- (void)changeFont:(id)sender;
+
@end
diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m
index 1762d6d1..bfdd0f47 100644
--- a/Source/SPPreferencesUpgrade.m
+++ b/Source/SPPreferencesUpgrade.m
@@ -37,8 +37,8 @@ static NSString *SPOldDefaultEncodingKey = @"DefaultEncoding";
*/
void SPApplyRevisionChanges(void)
{
- NSInteger i;
- NSInteger currentVersionNumber, recordedVersionNumber = 0;
+ NSUInteger i;
+ NSUInteger currentVersionNumber, recordedVersionNumber = 0;
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
@@ -321,11 +321,11 @@ void SPMigrateConnectionFavoritesData(void)
NSInteger lastFavoriteIndex = [prefs integerForKey:@"LastFavoriteIndex"];
NSInteger defaultFavoriteIndex = [prefs integerForKey:SPDefaultFavorite];
- if ((lastFavoriteIndex >= 0) && (lastFavoriteIndex <= [favorites count])) {
+ if ((lastFavoriteIndex >= (NSInteger)0) && ((NSUInteger)lastFavoriteIndex <= [favorites count])) {
[prefs setInteger:[[[favorites objectAtIndex:lastFavoriteIndex] objectForKey:SPFavoriteIDKey] integerValue] forKey:SPLastFavoriteID];
}
- if ((defaultFavoriteIndex >= 0) && (defaultFavoriteIndex <= [favorites count])) {
+ if ((defaultFavoriteIndex >= (NSInteger)0) && ((NSUInteger)defaultFavoriteIndex <= [favorites count])) {
[prefs setInteger:[[[favorites objectAtIndex:defaultFavoriteIndex] objectForKey:SPFavoriteIDKey] integerValue] forKey:SPDefaultFavorite];
}
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index 6f6a4ce8..199513f8 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -34,6 +34,7 @@
#import "SPConnectionController.h"
#import "SPExtendedTableInfo.h"
#import "SPTableTriggers.h"
+#import "SPDatabaseViewController.h"
@implementation SPDatabaseDocument (SPPrintController)
@@ -107,7 +108,7 @@
NSInteger rowLimit = [prefs integerForKey:SPPrintWarningRowLimit];
// Result count minus one because the first element is the column names
- NSUInteger resultRows = ([[tableContentInstance currentResult] count] - 1);
+ NSInteger resultRows = ([[tableContentInstance currentResult] count] - 1);
if (resultRows > rowLimit) {
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index fdef96bb..e3323666 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -29,9 +29,9 @@
#import "SPAppController.h"
// Constants
-static const NSString *SPKillProcessQueryMode = @"SPKillProcessQueryMode";
-static const NSString *SPKillProcessConnectionMode = @"SPKillProcessConnectionMode";
-static const NSString *SPTableViewIDColumnIdentifier = @"Id";
+static NSString *SPKillProcessQueryMode = @"SPKillProcessQueryMode";
+static NSString *SPKillProcessConnectionMode = @"SPKillProcessConnectionMode";
+static NSString *SPTableViewIDColumnIdentifier = @"Id";
@interface SPProcessListController (PrivateAPI)
@@ -471,7 +471,7 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id";
*/
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
- id object = (row < [processesFiltered count]) ? [[processesFiltered objectAtIndex:row] valueForKey:[tableColumn identifier]] : @"";
+ id object = ((NSUInteger)row < [processesFiltered count]) ? [[processesFiltered objectAtIndex:row] valueForKey:[tableColumn identifier]] : @"";
return (![object isNSNull]) ? object : [prefs stringForKey:SPNullValue];
}
@@ -627,7 +627,7 @@ static const NSString *SPTableViewIDColumnIdentifier = @"Id";
- (void)_updateSelectedAutoRefreshIntervalInterface
{
BOOL found = NO;
- NSUInteger interval = [prefs integerForKey:SPProcessListAutoRrefreshInterval];
+ NSInteger interval = [prefs integerForKey:SPProcessListAutoRrefreshInterval];
NSArray *items = [[autoRefreshIntervalMenuItem submenu] itemArray];
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index ad9653ce..721c27e9 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -665,7 +665,7 @@ static SPQueryController *sharedQueryController = nil;
- (void)addHistory:(NSString *)history forFileURL:(NSURL *)fileURL
{
- NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] integerValue];
+ NSInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] integerValue];
// Save each history item due to its document source
if([historyContainer objectForKey:[fileURL absoluteString]]) {
diff --git a/Source/SPQueryFavoriteManager.h b/Source/SPQueryFavoriteManager.h
index 4da1dd22..6698ae61 100644
--- a/Source/SPQueryFavoriteManager.h
+++ b/Source/SPQueryFavoriteManager.h
@@ -71,4 +71,8 @@
- (IBAction)insertPlaceholder:(id)sender;
- (IBAction)showHelp:(id)sender;
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
+- (void)importPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
+
@end
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m
index 5e270a07..9316c5ec 100644
--- a/Source/SPQueryFavoriteManager.m
+++ b/Source/SPQueryFavoriteManager.m
@@ -30,6 +30,7 @@
#import "SPConnectionController.h"
#import "RegexKitLite.h"
#import "SPTextView.h"
+#import <BWToolkitFramework/BWAnchoredButtonBar.h>
#define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]")
#define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]")
@@ -164,7 +165,7 @@
}
// Take all favorites until the next header or end of favorites
- for(i; i<[favorites count]; i++) {
+ for( ; i<[favorites count]; i++) {
if(![[favorites objectAtIndex:i] objectForKey:@"headerOfFileURL"])
[favs addObject:[favorites objectAtIndex:i]];
@@ -654,7 +655,7 @@
NSMutableArray *draggedRows = [[NSMutableArray alloc] initWithCapacity:1];
NSUInteger rowIndex = [draggedIndexes firstIndex];
while ( rowIndex != NSNotFound ) {
- [draggedRows addObject:[NSNumber numberWithInteger:rowIndex]];
+ [draggedRows addObject:[NSNumber numberWithUnsignedInteger:rowIndex]];
rowIndex = [draggedIndexes indexGreaterThanIndex: rowIndex];
}
@@ -672,7 +673,7 @@
originalRow += offset;
// For safety reasons
- if(originalRow > [favorites count]-1) originalRow = [favorites count] - 1;
+ if(originalRow > (NSInteger)[favorites count]-1) originalRow = [favorites count] - 1;
NSMutableDictionary *draggedRow = [NSMutableDictionary dictionaryWithDictionary:[favorites objectAtIndex:originalRow]];
[favorites removeObjectAtIndex:originalRow];
diff --git a/Source/SPSQLParser.h b/Source/SPSQLParser.h
index e425a75c..5746029e 100644
--- a/Source/SPSQLParser.h
+++ b/Source/SPSQLParser.h
@@ -56,7 +56,7 @@
@interface SPSQLParser : NSMutableString
{
- id string;
+ NSMutableString *string;
unichar *stringCharCache;
unichar parsedToChar;
NSInteger parsedToPosition;
diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m
index 1650b2c2..6485fc85 100644
--- a/Source/SPSQLParser.m
+++ b/Source/SPSQLParser.m
@@ -100,7 +100,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Walk along the string, processing characters.
for (currentStringIndex = 0; currentStringIndex < stringLength; currentStringIndex++) {
- currentCharacter = CFStringGetCharacterAtIndex(string ,currentStringIndex);
+ currentCharacter = CFStringGetCharacterAtIndex((CFStringRef)string ,currentStringIndex);
switch (currentCharacter) {
// When quote characters are encountered walk to the end of the quoted string.
@@ -117,8 +117,8 @@ TO_BUFFER_STATE to_scan_string (const char *);
// For comments starting "--[\s]", ensure the start syntax is valid before proceeding.
case '-':
if (stringLength < currentStringIndex + 2) break;
- if (CFStringGetCharacterAtIndex(string, currentStringIndex+1) != '-') break;
- if (![[NSCharacterSet whitespaceCharacterSet] characterIsMember:CFStringGetCharacterAtIndex(string, currentStringIndex+2)]) break;
+ if (CFStringGetCharacterAtIndex((CFStringRef)string, currentStringIndex+1) != '-') break;
+ if (![[NSCharacterSet whitespaceCharacterSet] characterIsMember:CFStringGetCharacterAtIndex((CFStringRef)string, currentStringIndex+2)]) break;
commentEndIndex = [self endIndexOfCommentOfType:SPDoubleDashComment startingAtIndex:currentStringIndex];
// Remove the comment
@@ -139,7 +139,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// For comments starting "/*", ensure the start syntax is valid before proceeding.
case '/':
if (stringLength < currentStringIndex + 1) break;
- if (CFStringGetCharacterAtIndex(string, currentStringIndex+1) != '*') break;
+ if (CFStringGetCharacterAtIndex((CFStringRef)string, currentStringIndex+1) != '*') break;
commentEndIndex = [self endIndexOfCommentOfType:SPCStyleComment startingAtIndex:currentStringIndex];
// Remove the comment
@@ -163,7 +163,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
if (![string length]) return nil;
// If the first character is not a quote character, return the entire string.
- quoteCharacter = CFStringGetCharacterAtIndex(string, 0);
+ quoteCharacter = CFStringGetCharacterAtIndex((CFStringRef)string, 0);
if (quoteCharacter != '`' && quoteCharacter != '"' && quoteCharacter != '\'') {
return [NSString stringWithString:string];
}
@@ -204,9 +204,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Check the ends of the string for whitespace, to determine if it needs removing
NSUInteger whitespaceCharsAtStart = 0;
NSUInteger whitespaceCharsAtEnd = 0;
- while (whitespaceCharsAtStart < stringLength && [trimCharset characterIsMember:CFStringGetCharacterAtIndex(queryString, whitespaceCharsAtStart)])
+ while (whitespaceCharsAtStart < stringLength && [trimCharset characterIsMember:CFStringGetCharacterAtIndex((CFStringRef)queryString, whitespaceCharsAtStart)])
whitespaceCharsAtStart++;
- while (whitespaceCharsAtEnd < stringLength && [trimCharset characterIsMember:CFStringGetCharacterAtIndex(queryString, stringLength - whitespaceCharsAtEnd - 1)])
+ while (whitespaceCharsAtEnd < stringLength && [trimCharset characterIsMember:CFStringGetCharacterAtIndex((CFStringRef)queryString, stringLength - whitespaceCharsAtEnd - 1)])
whitespaceCharsAtEnd++;
// Trim if necessary
@@ -221,7 +221,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
unichar currentCharacter, innerCharacter;
BOOL characterIsEscaped;
for (currentStringIndex = 0; currentStringIndex < stringLength; currentStringIndex++) {
- currentCharacter = CFStringGetCharacterAtIndex(queryString, currentStringIndex);
+ currentCharacter = CFStringGetCharacterAtIndex((CFStringRef)queryString, currentStringIndex);
switch (currentCharacter) {
// When quote characters are encountered walk to the end of the quoted string.
@@ -229,13 +229,13 @@ TO_BUFFER_STATE to_scan_string (const char *);
case '"':
case '`':
for (innerStringIndex = currentStringIndex+1; innerStringIndex < stringLength; innerStringIndex++) {
- innerCharacter = CFStringGetCharacterAtIndex(queryString, innerStringIndex);
+ innerCharacter = CFStringGetCharacterAtIndex((CFStringRef)queryString, innerStringIndex);
// If the string end is a backtick and one has been encountered, treat it as end of string
if (innerCharacter == '`' && currentCharacter == '`') {
// ...as long as the next character isn't also a backtick, in which case it's being quoted. Skip both.
- if ((innerStringIndex + 1) < stringLength && CFStringGetCharacterAtIndex(queryString, innerStringIndex+1) == '`') {
+ if ((innerStringIndex + 1) < stringLength && CFStringGetCharacterAtIndex((CFStringRef)queryString, innerStringIndex+1) == '`') {
innerStringIndex++;
continue;
}
@@ -250,7 +250,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
characterIsEscaped = NO;
i = 1;
quotedStringLength = innerStringIndex - 1;
- while ((quotedStringLength - i) > 0 && CFStringGetCharacterAtIndex(queryString, innerStringIndex - i) == '\\') {
+ while ((quotedStringLength - i) > 0 && CFStringGetCharacterAtIndex((CFStringRef)queryString, innerStringIndex - i) == '\\') {
characterIsEscaped = !characterIsEscaped;
i++;
}
@@ -258,7 +258,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// If an even number have been found, it may be the end of the string - as long as the subsequent character
// isn't also the same character, in which case it's another form of escaping.
if (!characterIsEscaped) {
- if ((innerStringIndex + 1) < stringLength && CFStringGetCharacterAtIndex(queryString, innerStringIndex+1) == currentCharacter) {
+ if ((innerStringIndex + 1) < stringLength && CFStringGetCharacterAtIndex((CFStringRef)queryString, innerStringIndex+1) == currentCharacter) {
innerStringIndex++;
continue;
}
@@ -289,7 +289,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Check whether it's a CRLF or just a CR
isCRLF = NO;
- if ([normalisedString length] > CRLocation + 1 && CFStringGetCharacterAtIndex(normalisedString, CRLocation + 1) == '\n') isCRLF = YES;
+ if ([normalisedString length] > CRLocation + 1 && CFStringGetCharacterAtIndex((CFStringRef)normalisedString, CRLocation + 1) == '\n') isCRLF = YES;
// Normalise the line endings
if (isCRLF) {
@@ -572,7 +572,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
}
// Add the end of the string after the previously matched character where appropriate.
- if (stringIndex + 1 < [string length]) {
+ if ((NSUInteger)(stringIndex + 1) < [string length]) {
NSString *finalQuery = [[string substringFromIndex:stringIndex + 1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (supportDelimiters && [finalQuery isMatchedByRegex:@"(?i)^\\s*delimiter\\s+\\S+"])
finalQuery = nil;
@@ -616,7 +616,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Add the end of the string after the previously matched character where appropriate.
stringIndex++;
- if (stringIndex < [string length]) {
+ if ((NSUInteger)stringIndex < [string length]) {
NSString *finalQuery = [[string substringFromIndex:stringIndex] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if (supportDelimiters && [finalQuery isMatchedByRegex:@"(?i)^\\s*delimiter\\s+\\S+"])
finalQuery = nil;
@@ -811,10 +811,10 @@ TO_BUFFER_STATE to_scan_string (const char *);
* into account the various forms of SQL escaping.
* A method intended for use by the functions above.
*/
-- (NSUInteger) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(NSInteger)index
+- (NSUInteger) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(NSInteger)startIndex
{
- NSInteger currentStringIndex;
- NSUInteger stringLength, i, quotedStringLength;
+ NSInteger currentStringIndex, stringLength;
+ NSUInteger i, quotedStringLength;
BOOL characterIsEscaped;
unichar currentCharacter;
@@ -825,7 +825,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
stringLength = [string length];
// Walk the string looking for the string end
- for ( currentStringIndex = index; currentStringIndex < stringLength; currentStringIndex++) {
+ for ( currentStringIndex = startIndex; currentStringIndex < stringLength; currentStringIndex++) {
currentCharacter = (unichar)(long)(*charAtIndex)(self, charAtIndexSEL, currentStringIndex);
// If the string end is a backtick and one has been encountered, treat it as end of string
@@ -871,9 +871,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
/**
* A method intended for use by the functions above.
*/
-- (NSUInteger) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(NSInteger)index
+- (NSUInteger) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(NSInteger)anIndex
{
- NSUInteger stringLength = [string length];
+ NSInteger stringLength = [string length];
unichar currentCharacter;
// Cache the charAtIndex selector, avoiding dynamic binding overhead
@@ -885,16 +885,16 @@ TO_BUFFER_STATE to_scan_string (const char *);
// For comments of type "--[\s]", start the comment processing two characters in to match the start syntax,
// then flow into the Hash comment handling (looking for first newline).
case SPDoubleDashComment:
- index = index+2;
+ anIndex = anIndex+2;
// For comments starting "--[\s]" and "#", continue until the first newline.
case SPHashComment:
- index++;
- for ( ; index < stringLength; index++ ) {
- currentCharacter = (unichar)(long)(*charAtIndex)(self, charAtIndexSEL, index);
+ anIndex++;
+ for ( ; anIndex < stringLength; anIndex++ ) {
+ currentCharacter = (unichar)(long)(*charAtIndex)(self, charAtIndexSEL, anIndex);
if (currentCharacter == '\r') containsCRs = YES;
if (currentCharacter == '\r' || currentCharacter == '\n') {
- return index-1;
+ return anIndex-1;
}
}
break;
@@ -902,11 +902,11 @@ TO_BUFFER_STATE to_scan_string (const char *);
// For comments starting "/*", start the comment processing one character in to match the start syntax, then
// continue until the first matching "*/".
case SPCStyleComment:
- index = index+2;
- for ( ; index < stringLength; index++ ) {
- if ((unichar)(long)(*charAtIndex)(self, charAtIndexSEL, index) == '*') {
- if ((stringLength > index + 1) && (unichar)(long)(*charAtIndex)(self, charAtIndexSEL, index+1) == '/') {
- return (index+1);
+ anIndex = anIndex+2;
+ for ( ; anIndex < stringLength; anIndex++ ) {
+ if ((unichar)(long)(*charAtIndex)(self, charAtIndexSEL, anIndex) == '*') {
+ if ((stringLength > anIndex + 1) && (unichar)(long)(*charAtIndex)(self, charAtIndexSEL, anIndex+1) == '/') {
+ return (anIndex+1);
}
}
}
@@ -921,35 +921,35 @@ TO_BUFFER_STATE to_scan_string (const char *);
- (id) init {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString string] retain];
}
[self initSQLExtensions];
return self;
}
- (id) initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithBytes:bytes length:length encoding:encoding];
}
[self initSQLExtensions];
return self;
}
- (id) initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithBytesNoCopy:bytes length:length encoding:encoding freeWhenDone:flag];
}
[self initSQLExtensions];
return self;
}
- (id) initWithCapacity:(NSUInteger)capacity {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString stringWithCapacity:capacity] retain];
}
[self initSQLExtensions];
return self;
}
- (id) initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)flag {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithCharactersNoCopy:characters length:length freeWhenDone:flag];
}
[self initSQLExtensions];
@@ -959,14 +959,14 @@ TO_BUFFER_STATE to_scan_string (const char *);
return [self initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
}
- (id) initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)encoding error:(NSError **)error {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithContentsOfFile:path encoding:encoding error:error];
}
[self initSQLExtensions];
return self;
}
- (id) initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithCString:nullTerminatedCString encoding:encoding];
}
[self initSQLExtensions];
@@ -981,7 +981,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
return str;
}
- (id) initWithFormat:(NSString *)format arguments:(va_list)argList {
- if (self = [super init]) {
+ if ((self = [super init])) {
string = [[NSMutableString alloc] initWithFormat:format arguments:argList];
}
[self initSQLExtensions];
@@ -1001,8 +1001,8 @@ TO_BUFFER_STATE to_scan_string (const char *);
- (NSUInteger) length {
return [string length];
}
-- (unichar) characterAtIndex:(NSUInteger)index {
- return CFStringGetCharacterAtIndex(string, index);
+- (unichar) characterAtIndex:(NSUInteger)anIndex {
+ return CFStringGetCharacterAtIndex((CFStringRef)string, anIndex);
}
- (id) description {
return [string description];
@@ -1048,22 +1048,22 @@ TO_BUFFER_STATE to_scan_string (const char *);
* Does no bounds checking on the underlying string, and so is kept
* separate from characterAtIndex:.
*/
-- (unichar) _charAtIndex:(NSInteger)index
+- (unichar) _charAtIndex:(NSInteger)anIndex
{
// If the current cache doesn't include the current character, update it.
- if (index > charCacheEnd || index < charCacheStart) {
+ if (anIndex > charCacheEnd || anIndex < charCacheStart) {
if (charCacheEnd > -1) {
free(stringCharCache);
}
- NSUInteger remainingStringLength = [string length] - index;
+ NSUInteger remainingStringLength = [string length] - anIndex;
NSUInteger newcachelength = (CHARACTER_CACHE_LENGTH < remainingStringLength)?CHARACTER_CACHE_LENGTH:remainingStringLength;
stringCharCache = (unichar *)calloc(newcachelength, sizeof(unichar));
- CFStringGetCharacters(string, CFRangeMake(index, newcachelength), stringCharCache);
- charCacheEnd = index + newcachelength - 1;
- charCacheStart = index;
+ CFStringGetCharacters((CFStringRef)string, CFRangeMake(anIndex, newcachelength), stringCharCache);
+ charCacheEnd = anIndex + newcachelength - 1;
+ charCacheStart = anIndex;
}
- return stringCharCache[index - charCacheStart];
+ return stringCharCache[anIndex - charCacheStart];
}
/**
@@ -1081,4 +1081,4 @@ TO_BUFFER_STATE to_scan_string (const char *);
parsedToPosition = -1;
}
-@end \ No newline at end of file
+@end
diff --git a/Source/SPSQLTokenizer.l b/Source/SPSQLTokenizer.l
index 1964c94d..4a076013 100644
--- a/Source/SPSQLTokenizer.l
+++ b/Source/SPSQLTokenizer.l
@@ -37,6 +37,7 @@ int yyuoffset, yyuleng;
%option prefix="to"
%option noyywrap
%option nounput
+%option noinput
%option case-insensitive
%option nostdinit
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index c4eb9f57..9cf2e72f 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2648,7 +2648,7 @@
// Save any edits which have been made but not saved to the table yet;
// but not for any NSSearchFields which could cause a crash for undo, redo.
if([[[tableDocumentInstance parentWindow] firstResponder] respondsToSelector:@selector(delegate)]
- && ![[[[tableDocumentInstance parentWindow] firstResponder] delegate] isKindOfClass:[NSSearchField class]])
+ && ![[(id)[[tableDocumentInstance parentWindow] firstResponder] delegate] isKindOfClass:[NSSearchField class]])
[[tableDocumentInstance parentWindow] endEditingFor:nil];
// If no rows are currently being edited, or a save is in progress, return success at once.
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index 3a46b763..0cabda4c 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -43,7 +43,7 @@
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
// Return a placeholder if the table is reloading
- if (rowIndex >= [tableFields count]) return @"...";
+ if ((NSUInteger)rowIndex >= [tableFields count]) return @"...";
if([[tableColumn identifier] isEqualToString:@"collation"]) {
NSInteger idx = 0;
@@ -98,7 +98,7 @@
currentlyEditingRow = rowIndex;
}
- NSMutableArray *currentRow = [tableFields objectAtIndex:rowIndex];
+ NSMutableDictionary *currentRow = [tableFields objectAtIndex:rowIndex];
// Reset collation if encoding was changed
if([[aTableColumn identifier] isEqualToString:@"encoding"]) {
@@ -323,7 +323,7 @@
}
// Any column comments
- if ([[originalRow objectForKey:@"comment"] length]) {
+ if ([(NSString *)[originalRow objectForKey:@"comment"] length]) {
[queryString appendFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalRow objectForKey:@"comment"]]];
}
diff --git a/Source/SPTableTextFieldCell.m b/Source/SPTableTextFieldCell.m
index bcfa0138..799cb4c0 100644
--- a/Source/SPTableTextFieldCell.m
+++ b/Source/SPTableTextFieldCell.m
@@ -35,7 +35,7 @@
// Construct and get the sub text attributed string
NSAttributedString *string = [self attributedStringValue];
- NSInteger i;
+ NSUInteger i;
CGFloat maxWidth = cellFrame.size.width;
CGFloat stringWidth = [string size].width;
diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m
index f5c15db0..bc5fc4f6 100644
--- a/Source/SPTableTriggers.m
+++ b/Source/SPTableTriggers.m
@@ -231,12 +231,12 @@ static const NSString *SPTriggerSQLMode = @"TriggerSQLMode";
if (isEdit) {
[triggerStatementTextView setString:editTriggerStatement];
- NSString *query = [NSString stringWithFormat:createTriggerStatementTemplate,
- [editTriggerName backtickQuotedString],
- editTriggerActionTime,
- editTriggerEvent,
- [editTriggerTableName backtickQuotedString],
- editTriggerStatement];
+ query = [NSString stringWithFormat:createTriggerStatementTemplate,
+ [editTriggerName backtickQuotedString],
+ editTriggerActionTime,
+ editTriggerEvent,
+ [editTriggerTableName backtickQuotedString],
+ editTriggerStatement];
// If this attempt to re-create the trigger failed, then we're screwed as we've just lost the user's
// data, but they had a backup and everything's cool, right? Should we be displaying an error here
@@ -339,12 +339,12 @@ static const NSString *SPTriggerSQLMode = @"TriggerSQLMode";
/**
* Double-click action on table cells - for the time being, return NO to disable editing.
*/
-- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
+- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSUInteger)rowIndex
{
if ([tableDocumentInstance isWorking]) return NO;
// Start Edit panel
- if (([triggerData count] > rowIndex) && ([triggerData objectAtIndex:rowIndex] != NSNotFound)) {
+ if (([triggerData count] > rowIndex) && [triggerData objectAtIndex:rowIndex]) {
[self _editTriggerAtIndex:rowIndex];
}
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index f1fccb09..226bfe6c 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -26,6 +26,13 @@
#import "SPQueryFavoriteManager.h"
#import "SPDatabaseDocument.h"
#import "SPWindowController.h"
+#import "SPFieldMapperController.h"
+
+@interface SPTableView (SPTableViewDelegate)
+
+- (BOOL)cancelRowEditing;
+
+@end
@implementation SPTableView
diff --git a/Source/SPTablesList.h b/Source/SPTablesList.h
index 7d486525..d4623f40 100644
--- a/Source/SPTablesList.h
+++ b/Source/SPTablesList.h
@@ -149,6 +149,10 @@
- (BOOL)selectItemWithName:(NSString *)theName;
- (BOOL)selectItemsWithNames:(NSArray *)theNames;
+// Data validation
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType;
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
+
// Table list filter interaction
- (void) showFilter;
- (void) hideFilter;
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 3d87fcc7..9c1a1d0c 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -48,8 +48,6 @@
- (void)addTable;
- (void)copyTable;
- (void)renameTableOfType:(SPTableType)tableType from:(NSString *)oldTableName to:(NSString *)newTableName;
-- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType;
-- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable;
@end
@@ -1266,6 +1264,70 @@
}
#pragma mark -
+#pragma mark Data validation
+
+/**
+ * Check tableName for length and if the tableName doesn't match
+ * against current database table/view names (case-insensitive).
+ */
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType
+{
+ return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO];
+}
+
+/**
+ * Check tableName for length and if the tableName doesn't match
+ * against current database table/view names (case-insensitive).
+ */
+- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable
+{
+ BOOL isValid = YES;
+
+ // delete trailing whitespaces since 'foo ' or ' ' are not valid table names
+ NSString *fieldStr = [tableName stringByMatching:@"(.*?)\\s*$" capture:1];
+ NSString *lowercaseFieldStr = [fieldStr lowercaseString];
+
+ // If table name has trailing whitespaces return 'no valid'
+ if([fieldStr length] != [tableName length]) return NO;
+
+ // empty table names are invalid
+ if([fieldStr length] == 0) return NO;
+
+
+ NSArray *similarTables;
+ switch (tableType) {
+ case SPTableTypeView:
+ case SPTableTypeTable:
+ similarTables = [self allTableAndViewNames];
+ break;
+ case SPTableTypeProc:
+ similarTables = [self allProcedureNames];
+ break;
+ case SPTableTypeFunc:
+ similarTables = [self allFunctionNames];
+ break;
+ default:
+ // if some other table type is given, just return yes
+ // better a mysql error than not being able to change something at all
+ return YES;
+ }
+
+ for(id table in similarTables) {
+ //compare case insensitive here
+ if([lowercaseFieldStr isEqualToString:[table lowercaseString]]) {
+ if (ignoreSelectedTable) {
+ // if table is the selectedTable, ignore it
+ // we must compare CASE SENSITIVE here!
+ if ([table isEqualToString:selectedTableName]) continue;
+ }
+ isValid = NO;
+ break;
+ }
+ }
+ return isValid;
+}
+
+#pragma mark -
#pragma mark Datasource methods
/**
@@ -2377,66 +2439,4 @@
[NSException raise:@"Object of unknown type" format:NSLocalizedString(@"An error occured while renaming. '%@' is of an unknown type.", @"rename error - don't know what type the renamed thing is"), oldTableName];
}
-
-/**
- * Check tableName for length and if the tableName doesn't match
- * against current database table/view names (case-insensitive).
- */
-- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType
-{
- return [self isTableNameValid:tableName forType:tableType ignoringSelectedTable:NO];
-}
-
-/**
- * Check tableName for length and if the tableName doesn't match
- * against current database table/view names (case-insensitive).
- */
-- (BOOL)isTableNameValid:(NSString *)tableName forType:(SPTableType)tableType ignoringSelectedTable:(BOOL)ignoreSelectedTable
-{
- BOOL isValid = YES;
-
- // delete trailing whitespaces since 'foo ' or ' ' are not valid table names
- NSString *fieldStr = [tableName stringByMatching:@"(.*?)\\s*$" capture:1];
- NSString *lowercaseFieldStr = [fieldStr lowercaseString];
-
- // If table name has trailing whitespaces return 'no valid'
- if([fieldStr length] != [tableName length]) return NO;
-
- // empty table names are invalid
- if([fieldStr length] == 0) return NO;
-
-
- NSArray *similarTables;
- switch (tableType) {
- case SPTableTypeView:
- case SPTableTypeTable:
- similarTables = [self allTableAndViewNames];
- break;
- case SPTableTypeProc:
- similarTables = [self allProcedureNames];
- break;
- case SPTableTypeFunc:
- similarTables = [self allFunctionNames];
- break;
- default:
- // if some other table type is given, just return yes
- // better a mysql error than not being able to change something at all
- return YES;
- }
-
- for(id table in similarTables) {
- //compare case insensitive here
- if([lowercaseFieldStr isEqualToString:[table lowercaseString]]) {
- if (ignoreSelectedTable) {
- // if table is the selectedTable, ignore it
- // we must compare CASE SENSITIVE here!
- if ([table isEqualToString:selectedTableName]) continue;
- }
- isValid = NO;
- break;
- }
- }
- return isValid;
-}
-
@end
diff --git a/Source/SPTextView.h b/Source/SPTextView.h
index b15030b4..3954c941 100644
--- a/Source/SPTextView.h
+++ b/Source/SPTextView.h
@@ -145,4 +145,7 @@
- (BOOL)isSnippetMode;
+- (void)boundsDidChangeNotification:(NSNotification *)notification;
+- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
+
@end
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index 769d4be8..4fef6ee3 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -34,6 +34,7 @@
#import "RegexKitLite.h"
#import "SPBundleHTMLOutputController.h"
#import "SPDatabaseViewController.h"
+#import "SPAppController.h"
#pragma mark -
#pragma mark lex init
@@ -74,14 +75,16 @@ YY_BUFFER_STATE yy_scan_string (const char *);
#pragma mark -
+NSInteger _alphabeticSort(id string1, id string2, void *reverse);
+
// some helper functions for handling rectangles and points
// needed in roundedBezierPathAroundRange:
static inline CGFloat SPRectTop(NSRect rectangle) { return rectangle.origin.y; }
static inline CGFloat SPRectBottom(NSRect rectangle) { return rectangle.origin.y+rectangle.size.height; }
static inline CGFloat SPRectLeft(NSRect rectangle) { return rectangle.origin.x; }
static inline CGFloat SPRectRight(NSRect rectangle) { return rectangle.origin.x+rectangle.size.width; }
-static inline CGFloat SPPointDistance(NSPoint a, NSPoint b) { return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }
-static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NSMakePoint(a.x*(1.-t) + b.x*t, a.y*(1.-t) + b.y*t); }
+static inline CGFloat SPPointDistance(NSPoint a, NSPoint b) { return sqrtf( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) ); }
+static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NSMakePoint(a.x*(1.0f-t) + b.x*t, a.y*(1.0f-t) + b.y*t); }
@implementation SPTextView
@@ -102,7 +105,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS
/**
* Sort function (mainly used to sort the words in the textView)
*/
-NSInteger alphabeticSort(id string1, id string2, void *reverse)
+NSInteger _alphabeticSort(id string1, id string2, void *reverse)
{
return [string1 localizedCaseInsensitiveCompare:string2];
}
@@ -284,7 +287,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSInteger reverseSort = NO;
- for(id w in [[uniqueArray allObjects] sortedArrayUsingFunction:alphabeticSort context:&reverseSort])
+ for(id w in [[uniqueArray allObjects] sortedArrayUsingFunction:_alphabeticSort context:&reverseSort])
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"dummy-small", @"image", nil]];
}
@@ -849,7 +852,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSRect boundingRect = [[self layoutManager] boundingRectForGlyphRange:glyphRange inTextContainer:[self textContainer]];
boundingRect = [self convertRect:boundingRect toView:nil];
NSPoint pos = [[self window] convertBaseToScreen:NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)];
- pos.y -= [[self font] pointSize]*1.25;
+ pos.y -= [[self font] pointSize]*1.25f;
[completionPopup setCaretPos:pos];
[completionPopup orderFront:self];
@@ -915,7 +918,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
} @catch(id ae) { }
- return (leftIsAlphanum ^ rightIsAlphanum || leftIsAlphanum && rightIsAlphanum);
+ return (leftIsAlphanum ^ rightIsAlphanum || (leftIsAlphanum && rightIsAlphanum));
}
/**
@@ -1135,7 +1138,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(numberOfSpaces < 1) numberOfSpaces = 1;
if(numberOfSpaces > 32) numberOfSpaces = 32;
NSMutableString *spaces = [NSMutableString string];
- for(NSInteger i = 0; i < numberOfSpaces; i++)
+ for(NSUInteger i = 0; i < numberOfSpaces; i++)
[spaces appendString:@" "];
indentString = [NSString stringWithString:spaces];
}
@@ -1260,7 +1263,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(indentStringLength < 1) indentStringLength = 1;
if(indentStringLength > 32) indentStringLength = 32;
NSMutableString *spaces = [NSMutableString string];
- for(NSInteger i = 0; i < indentStringLength; i++)
+ for(NSUInteger i = 0; i < indentStringLength; i++)
[spaces appendString:@" "];
indentString = [NSString stringWithString:spaces];
}
@@ -1471,7 +1474,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
boundingRect = [self convertRect: boundingRect toView: NULL];
NSPoint pos = [[self window] convertBaseToScreen: NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)];
// Adjust list location to be under the current word or insertion point
- pos.y -= [[self font] pointSize]*1.25;
+ pos.y -= [[self font] pointSize]*1.25f;
[completionPopup setCaretPos:pos];
[completionPopup orderFront:self];
@@ -1517,7 +1520,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// If a completion list is open adjust the theCharRange and theParseRange if a mirrored snippet
// was updated which is located before the initial position
- if(completionIsOpen && snippetMirroredControlArray[i][1] < completionParseRangeLocation)
+ if(completionIsOpen && snippetMirroredControlArray[i][1] < (NSInteger)completionParseRangeLocation)
[completionPopup adjustWorkingRangeByDelta:deltaLength];
// Adjust all other snippets accordingly
@@ -1628,7 +1631,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
boundingRect = [self convertRect: boundingRect toView: NULL];
NSPoint pos = [[self window] convertBaseToScreen: NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)];
// Adjust list location to be under the current word or insertion point
- pos.y -= [[self font] pointSize]*1.25;
+ pos.y -= [[self font] pointSize]*1.25f;
[completionPopup setCaretPos:pos];
[completionPopup orderFront:self];
}
@@ -1876,7 +1879,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
while([snip isMatchedByRegex:ure]) {
NSRange escapeRange = [snip rangeOfRegex:ure capture:0L];
[snip replaceCharactersInRange:escapeRange withString:[snip substringWithRange:NSMakeRange(escapeRange.location+1,escapeRange.length-1)]];
- NSUInteger loc = escapeRange.location + targetRange.location;
+ NSInteger loc = escapeRange.location + targetRange.location;
[snip flushCachedRegexData];
for(i=0; i<=snippetControlMax; i++)
if(snippetControlArray[i][0] > -1 && snippetControlArray[i][0] > loc)
@@ -1896,8 +1899,14 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self insertText:snip];
// If autopair is enabled check whether snip begins with ( and ends with ), if so mark ) as pair-linked
- if([prefs boolForKey:SPCustomQueryAutoPairCharacters] && ([snip hasPrefix:@"("] && [snip hasSuffix:@")"] || ([snip hasPrefix:@"`"] && [snip hasSuffix:@"`"]) || ([snip hasPrefix:@"'"] && [snip hasSuffix:@"'"]) || ([snip hasPrefix:@"\""] && [snip hasSuffix:@"\""])))
+ if ([prefs boolForKey:SPCustomQueryAutoPairCharacters]
+ && (([snip hasPrefix:@"("] && [snip hasSuffix:@")"])
+ || ([snip hasPrefix:@"`"] && [snip hasSuffix:@"`"])
+ || ([snip hasPrefix:@"'"] && [snip hasSuffix:@"'"])
+ || ([snip hasPrefix:@"\""] && [snip hasSuffix:@"\""])))
+ {
[[self textStorage] addAttribute:kAPlinked value:kAPval range:NSMakeRange([self selectedRange].location - 1, 1)];
+ }
// Any snippets defined?
if(snippetControlCounter > -1) {
@@ -1937,7 +1946,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
[[self textStorage] ensureAttributesAreFixedInRange:[self selectedRange]];
- NSUInteger caretPos = [self selectedRange].location;
+ NSInteger caretPos = [self selectedRange].location;
NSInteger i, j;
NSInteger foundSnippetIndices[20]; // array to hold nested snippets
@@ -1966,24 +1975,24 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(!isCaretInsideASnippet && foundSnippetIndices[currentSnippetIndex] == 1) {
isCaretInsideASnippet = YES;
} else if(![self selectedRange].length) {
- NSInteger index = -1;
+ NSInteger curIndex = -1;
NSInteger smallestLength = -1;
for(i=0; i<snippetControlMax; i++) {
if(foundSnippetIndices[i] == 1) {
- if(index == -1) {
- index = i;
+ if(curIndex == -1) {
+ curIndex = i;
smallestLength = snippetControlArray[i][1];
} else {
if(smallestLength > snippetControlArray[i][1]) {
- index = i;
+ curIndex = i;
smallestLength = snippetControlArray[i][1];
}
}
}
}
// Reset the active snippet
- if(index > -1 && smallestLength > -1) {
- currentSnippetIndex = index;
+ if(curIndex > -1 && smallestLength > -1) {
+ currentSnippetIndex = curIndex;
isCaretInsideASnippet = YES;
}
}
@@ -2803,7 +2812,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
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];
@@ -2851,15 +2860,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(snippetControlCounter > -1) {
// Is the caret still inside a snippet
if([self checkForCaretInsideSnippet]) {
- for(NSUInteger i=0; i<snippetControlMax; i++) {
+ for(NSInteger i=0; i<snippetControlMax; i++) {
if(snippetControlArray[i][0] > -1) {
// choose the colors for the snippet parts
if(i == currentSnippetIndex) {
- [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.4] setFill];
- [[NSColor colorWithCalibratedRed:1.0 green:0.6 blue:0.0 alpha:0.8] setStroke];
+ [[NSColor colorWithCalibratedRed:1.0f green:0.6f blue:0.0f alpha:0.4f] setFill];
+ [[NSColor colorWithCalibratedRed:1.0f green:0.6f blue:0.0f alpha:0.8f] setStroke];
} else {
- [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.2] setFill];
- [[NSColor colorWithCalibratedRed:1.0 green:0.8 blue:0.2 alpha:0.5] setStroke];
+ [[NSColor colorWithCalibratedRed:1.0f green:0.8f blue:0.2f alpha:0.2f] setFill];
+ [[NSColor colorWithCalibratedRed:1.0f green:0.8f blue:0.2f alpha:0.5f] setStroke];
}
NSBezierPath *snippetPath = [self roundedBezierPathAroundRange: NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) ];
[snippetPath fill];
@@ -2880,10 +2889,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
- (NSBezierPath*)roundedBezierPathAroundRange:(NSRange)aRange
{
// parameters for snippet highlighting
- CGFloat kappa = 0.5522847498; // magic number from http://www.whizkidtech.redprince.net/bezier/circle/
+ CGFloat kappa = 0.5522847498f; // magic number from http://www.whizkidtech.redprince.net/bezier/circle/
CGFloat radius = 6;
CGFloat horzInset = -3;
- CGFloat vertInset = 0.3;
+ CGFloat vertInset = 0.3f;
BOOL connectDisconnectedPartsWithLine = NO;
NSBezierPath *funkyPath = [NSBezierPath bezierPath];
@@ -2916,15 +2925,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSPoint next = vertices[(j+1)%8];
CGFloat s = radius/SPPointDistance(prev, curr);
- if (s>0.5) s = 0.5;
+ if (s>0.5) s = 0.5f;
CGFloat t = radius/SPPointDistance(curr, next);
- if (t>0.5) t = 0.5;
+ if (t>0.5) t = 0.5f;
- NSPoint a = SPPointOnLine(curr, prev, 0.5);
+ NSPoint a = SPPointOnLine(curr, prev, 0.5f);
NSPoint b = SPPointOnLine(curr, prev, s);
NSPoint c = curr;
NSPoint d = SPPointOnLine(curr, next, t);
- NSPoint e = SPPointOnLine(curr, next, 0.5);
+ NSPoint e = SPPointOnLine(curr, next, 0.5f);
if (j==0) [funkyPath moveToPoint:a];
[funkyPath lineToPoint: b];
@@ -3168,8 +3177,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Re-calculate snippet ranges if snippet session is active
if(snippetControlCounter > -1 && !snippetWasJustInserted && !isProcessingMirroredSnippets) {
// Remove any fully nested snippets relative to the current snippet which was edited
- NSUInteger currentSnippetLocation = snippetControlArray[currentSnippetIndex][0];
- NSUInteger currentSnippetMaxRange = snippetControlArray[currentSnippetIndex][0] + snippetControlArray[currentSnippetIndex][1];
+ NSInteger currentSnippetLocation = snippetControlArray[currentSnippetIndex][0];
+ NSInteger currentSnippetMaxRange = snippetControlArray[currentSnippetIndex][0] + snippetControlArray[currentSnippetIndex][1];
NSInteger i;
for(i=0; i<snippetControlMax; i++) {
if(snippetControlArray[i][0] > -1
@@ -3185,7 +3194,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
}
- NSUInteger editStartPosition = [textStore editedRange].location;
+ NSInteger editStartPosition = [textStore editedRange].location;
NSUInteger changeInLength = [textStore changeInLength];
// Adjust length change to current snippet
@@ -3379,14 +3388,14 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
{
NSUInteger glyphIndex;
NSLayoutManager *layoutManager = [self layoutManager];
- CGFloat fraction;
+ CGFloat fractionalDistance;
NSRange range;
range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
glyphIndex = [layoutManager glyphIndexForPoint:aPoint
inTextContainer:[self textContainer]
- fractionOfDistanceThroughGlyph:&fraction];
- if( fraction > 0.5 ) glyphIndex++;
+ fractionOfDistanceThroughGlyph:&fractionalDistance];
+ if( fractionalDistance > 0.5 ) glyphIndex++;
if( glyphIndex == NSMaxRange(range) )
return [[self textStorage] length];
@@ -3408,20 +3417,20 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// 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/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index e3f8b714..0d3b4b8e 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -27,6 +27,10 @@
#import "SPBundleHTMLOutputController.h"
#import "SPCustomQuery.h"
#import "SPAppController.h"
+#import "SPFieldEditorController.h"
+#import "SPTextView.h"
+#import "SPWindowController.h"
+#import "SPDatabaseDocument.h"
@implementation NSTextView (SPTextViewAdditions)
@@ -42,34 +46,33 @@
if (curRange.length)
return curRange;
- NSInteger curLocation = curRange.location;
+ NSUInteger curLocation = curRange.location;
NSInteger start = curLocation;
- NSInteger end = curLocation;
+ NSUInteger end = curLocation;
NSUInteger strLen = [[self string] length];
NSMutableCharacterSet *wordCharSet = [NSMutableCharacterSet alphanumericCharacterSet];
[wordCharSet addCharactersInString:@"_."];
[wordCharSet removeCharactersInString:@"`"];
- if(start) {
+ if (start) {
start--;
- while([wordCharSet characterIsMember:[[self string] characterAtIndex:start]]) {
+ while ([wordCharSet characterIsMember:[[self string] characterAtIndex:start]]) {
start--;
if(start < 0) break;
}
start++;
}
- while(end < strLen && [wordCharSet characterIsMember:[[self string] characterAtIndex:end]]) {
+ while (end < strLen && [wordCharSet characterIsMember:[[self string] characterAtIndex:end]]) {
end++;
}
NSRange wordRange = NSMakeRange(start, end-start);
- if(wordRange.length && [[self string] characterAtIndex:NSMaxRange(wordRange)-1] == '.')
+ if (wordRange.length && [[self string] characterAtIndex:NSMaxRange(wordRange)-1] == '.')
wordRange.length--;
- return(wordRange);
-
+ return wordRange;
}
/*
@@ -109,10 +112,8 @@
NSInteger bcnt = 0;
NSInteger scnt = 0;
- NSInteger i;
-
// look for the first non-balanced closing bracket
- for(i=caretPosition; i<stringLength; i++) {
+ for(NSUInteger i=caretPosition; i<stringLength; i++) {
switch([[self string] characterAtIndex:i]) {
case ')':
if(!pcnt) {
@@ -147,7 +148,7 @@
if([[self string] characterAtIndex:caretPosition] == co)
bracketCounter++;
- for(i=caretPosition; i>=0; i--) {
+ for(NSInteger i=caretPosition; i>=0; i--) {
if([[self string] characterAtIndex:i] == co) {
if(!bracketCounter) {
start = i;
@@ -162,7 +163,7 @@
if(start < 0 ) return;
bracketCounter = 0;
- for(i=caretPosition; i<stringLength; i++) {
+ for(NSUInteger i=caretPosition; i<stringLength; i++) {
if([[self string] characterAtIndex:i] == co) {
bracketCounter++;
}
@@ -390,12 +391,12 @@
{
id prefs = [NSUserDefaults standardUserDefaults];
- if([self respondsToSelector:@selector(insertText:)])
- if([prefs objectForKey:SPNullValue] && [[prefs objectForKey:SPNullValue] length])
+ if ([self respondsToSelector:@selector(insertText:)]) {
+ if([prefs stringForKey:SPNullValue] && [[prefs stringForKey:SPNullValue] length])
[self insertText:[prefs objectForKey:SPNullValue]];
else
[self insertText:@"NULL"];
-
+ }
}
/**
@@ -487,7 +488,7 @@
NSInteger idx = [sender tag] - 1000000;
NSString *infoPath = nil;
NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeInputField];
- if(idx >=0 && idx < [bundleItems count]) {
+ if(idx >=0 && idx < (NSInteger)[bundleItems count]) {
infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey];
} else {
if([sender tag] == 0 && [[sender toolTip] length]) {
@@ -515,7 +516,7 @@
if (cmdData) [cmdData release];
return;
} else {
- if([cmdData objectForKey:SPBundleFileCommandKey] && [[cmdData objectForKey:SPBundleFileCommandKey] length]) {
+ if([cmdData objectForKey:SPBundleFileCommandKey] && [(NSString *)[cmdData objectForKey:SPBundleFileCommandKey] length]) {
NSString *cmd = [cmdData objectForKey:SPBundleFileCommandKey];
NSString *inputAction = @"";
@@ -647,7 +648,7 @@
[[NSFileManager defaultManager] removeItemAtPath:bundleInputFilePath error:nil];
NSString *action = SPBundleOutputActionNone;
- if([cmdData objectForKey:SPBundleFileOutputActionKey] && [[cmdData objectForKey:SPBundleFileOutputActionKey] length])
+ if([cmdData objectForKey:SPBundleFileOutputActionKey] && [(NSString *)[cmdData objectForKey:SPBundleFileOutputActionKey] length])
action = [[cmdData objectForKey:SPBundleFileOutputActionKey] lowercaseString];
// Redirect due exit code
@@ -724,7 +725,7 @@
else if([action isEqualToString:SPBundleOutputActionInsertAsSnippet]) {
if([self respondsToSelector:@selector(insertAsSnippet:atRange:)])
- [self insertAsSnippet:output atRange:replaceRange];
+ [(SPTextView *)self insertAsSnippet:output atRange:replaceRange];
else
[SPTooltip showWithObject:NSLocalizedString(@"Input Field doesn't support insertion of snippets.", @"input field doesn't support insertion of snippets.")];
}
diff --git a/Source/SPTooltip.h b/Source/SPTooltip.h
index 23cf9e88..840cd3c8 100644
--- a/Source/SPTooltip.h
+++ b/Source/SPTooltip.h
@@ -50,4 +50,6 @@
+ (void)showWithObject:(id)content ofType:(NSString *)type;
+ (void)showWithObject:(id)content;
+- (void)animationTick:(id)sender;
+
@end
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index 30f73cc8..e9906e74 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -208,7 +208,7 @@ static CGFloat slow_in_out (CGFloat t)
[webPreferences setJavaScriptEnabled:YES];
NSString *fontName = ([displayOptions objectForKey:@"fontname"]) ? [displayOptions objectForKey:@"fontname"] : @"Lucida Grande";
- int fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] integerValue] : 10;
+ int fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] intValue] : 10;
if(fontSize < 5) fontSize = 5;
NSFont* font = [NSFont fontWithName:fontName size:fontSize];
@@ -263,7 +263,7 @@ static CGFloat slow_in_out (CGFloat t)
boundingRect = [fr convertRect: boundingRect toView:NULL];
pos = [[fr window] convertBaseToScreen: NSMakePoint(boundingRect.origin.x + boundingRect.size.width,boundingRect.origin.y + boundingRect.size.height)];
NSFont* font = [fr font];
- if(font) pos.y -= [font pointSize]*1.3;
+ if(font) pos.y -= [font pointSize]*1.3f;
return pos;
// Otherwise return mouse location
} else {
@@ -297,10 +297,10 @@ static CGFloat slow_in_out (CGFloat t)
@"</html>";
NSString *bgColor = ([displayOptions objectForKey:@"backgroundcolor"]) ? [displayOptions objectForKey:@"backgroundcolor"] : @"#F9FBC5";
- BOOL transparent = ([displayOptions objectForKey:@"transparent"]) ? YES : NO;
+ BOOL isTransparent = ([displayOptions objectForKey:@"transparent"]) ? YES : NO;
- fullContent = [NSString stringWithFormat:fullContent, transparent ? @"transparent" : bgColor, content];
+ fullContent = [NSString stringWithFormat:fullContent, isTransparent ? @"transparent" : bgColor, content];
[[webView mainFrame] loadHTMLString:fullContent baseURL:nil];
}
@@ -387,9 +387,9 @@ static CGFloat slow_in_out (CGFloat t)
[self setValue:[NSDate date] forKey:@"didOpenAtDate"];
mousePositionWhenOpened = NSZeroPoint;
- NSWindow* keyWindow = [[NSApp keyWindow] retain];
- BOOL didAcceptMouseMovedEvents = [keyWindow acceptsMouseMovedEvents];
- [keyWindow setAcceptsMouseMovedEvents:YES];
+ NSWindow* appKeyWindow = [[NSApp keyWindow] retain];
+ BOOL didAcceptMouseMovedEvents = [appKeyWindow acceptsMouseMovedEvents];
+ [appKeyWindow setAcceptsMouseMovedEvents:YES];
NSEvent* event = nil;
NSInteger eventType;
while((event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES]))
@@ -401,7 +401,7 @@ static CGFloat slow_in_out (CGFloat t)
if(eventType == NSMouseMoved && [self shouldCloseForMousePosition:[NSEvent mouseLocation]])
break;
- if(keyWindow != [NSApp keyWindow] || ![NSApp isActive])
+ if(appKeyWindow != [NSApp keyWindow] || ![NSApp isActive])
break;
if(spTooltipCounter > 1)
@@ -410,8 +410,8 @@ static CGFloat slow_in_out (CGFloat t)
}
- [keyWindow setAcceptsMouseMovedEvents:didAcceptMouseMovedEvents];
- [keyWindow release];
+ [appKeyWindow setAcceptsMouseMovedEvents:didAcceptMouseMovedEvents];
+ [appKeyWindow release];
[self orderOut:self];
@@ -434,7 +434,7 @@ static CGFloat slow_in_out (CGFloat t)
- (void)animationTick:(id)sender
{
- CGFloat alpha = 0.97f * (1.0f - 40*slow_in_out(-2.2 * [animationStart timeIntervalSinceNow]));
+ CGFloat alpha = 0.97f * (1.0f - 40*slow_in_out(-2.2f * (float)[animationStart timeIntervalSinceNow]));
if(alpha > 0.0f && spTooltipCounter==1)
{
diff --git a/Source/SPUserManager.h b/Source/SPUserManager.h
index 8bb4e4d2..3df63a6f 100644
--- a/Source/SPUserManager.h
+++ b/Source/SPUserManager.h
@@ -100,6 +100,7 @@
- (IBAction)checkAllPrivileges:(id)sender;
- (IBAction)uncheckAllPrivileges:(id)sender;
- (IBAction)closeErrorsSheet:(id)sender;
+- (IBAction)doubleClickSchemaPriv:(id)sender;
// Schema Privieges
- (IBAction)addSchemaPriv:(id)sender;
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 5a673389..565cfc6f 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -29,6 +29,7 @@
#import "SPConnectionController.h"
#import "SPServerSupport.h"
#import "SPAlertSheets.h"
+#import <BWToolkitFramework/BWAnchoredButtonBar.h>
static const NSString *SPTableViewNameColumnID = @"NameColumn";
@@ -146,11 +147,11 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
// Select users from the mysql.user table
MCPResult *result = [self.mySqlConnection queryString:@"SELECT * FROM mysql.user ORDER BY user"];
- NSInteger rows = [result numOfRows];
+ NSUInteger rows = (NSUInteger)[result numOfRows];
if (rows > 0) [result dataSeek:0];
- for (NSInteger i = 0; i < rows; i++)
+ for (NSUInteger i = 0; i < rows; i++)
{
[resultAsArray addObject:[result fetchRowAsDictionary]];
}
@@ -217,7 +218,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
{
// Go through each item that contains a dictionary of key-value pairs
// for each user currently in the database.
- for (NSInteger i = 0; i < [items count]; i++)
+ for (NSUInteger i = 0; i < [items count]; i++)
{
NSString *username = [[items objectAtIndex:i] objectForKey:@"User"];
NSArray *parentResults = [[self _fetchUserWithUserName:username] retain];
@@ -312,7 +313,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
if ([results numOfRows]) [results dataSeek:0];
- for (NSInteger i = 0; i < [results numOfRows]; i++)
+ for (NSUInteger i = 0; i < [results numOfRows]; i++)
{
[schemas addObject:[results fetchRowAsDictionary]];
}
@@ -383,7 +384,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
[queryResults dataSeek:0];
}
- for (NSInteger i = 0; i < [queryResults numOfRows]; i++)
+ for (NSUInteger i = 0; i < [queryResults numOfRows]; i++)
{
NSDictionary *rowDict = [queryResults fetchRowAsDictionary];
NSManagedObject *dbPriv = [NSEntityDescription insertNewObjectForEntityForName:@"Privileges"
@@ -844,7 +845,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
for (NSPersistentStore* store in stores)
{
NSError *error = nil;
- [[self.managedObjectContext persistentStoreCoordinator] removePersistentStore:store error:error];
+ [[self.managedObjectContext persistentStoreCoordinator] removePersistentStore:store error:&error];
}
// Add a new store
@@ -1209,7 +1210,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
MCPResult *result = [self.mySqlConnection queryString:statement];
- NSUInteger rows = [result numOfRows];
+ NSUInteger rows = (NSUInteger)[result numOfRows];
BOOL userExists = YES;
if (rows == 0) userExists = NO;
@@ -1257,6 +1258,7 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn";
[self.mySqlConnection queryString:updateResourcesStatement];
[self _checkAndDisplayMySqlError];
}
+ return YES;
}
/**
diff --git a/Source/SPWindowController.h b/Source/SPWindowController.h
index e118e035..5626c580 100644
--- a/Source/SPWindowController.h
+++ b/Source/SPWindowController.h
@@ -24,7 +24,7 @@
@class PSMTabBarControl, SPDatabaseDocument;
-@interface SPWindowController : NSWindowController <NSUserInterfaceValidations>
+@interface SPWindowController : NSWindowController
{
IBOutlet PSMTabBarControl *tabBar;
IBOutlet NSTabView *tabView;
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index 7fdb76e6..e9b73491 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -255,7 +255,8 @@
[[control tabView] addTabViewItem:selectedTabViewItem];
- [control update:NO]; //make sure the new tab is set in the correct position
+ // Make sure the new tab is set in the correct position by forcing an update
+ [tabBar update:NO];
// Update tabBar of the new window
[newWindowController tabView:[tabBar tabView] didDropTabViewItem:[selectedCell representedObject] inTabBar:control];
@@ -318,7 +319,7 @@
*/
- (void)selectTabAtIndex:(NSInteger)index
{
- if([[tabBar cells] count] > 0 && [[tabBar cells] count] > index) {
+ if([[tabBar cells] count] > 0 && [[tabBar cells] count] > (NSUInteger)index) {
[tabView selectTabViewItemAtIndex:index];
} else if([[tabBar cells] count]) {
[tabView selectTabViewItemAtIndex:0];
@@ -438,7 +439,7 @@
NSInteger tabIndex = [tabView indexOfTabViewItem:tabViewItem];
- if([[tabBar cells] count] < tabIndex) return @"";
+ if([[tabBar cells] count] < (NSUInteger)tabIndex) return @"";
PSMTabBarCell *theCell = [[tabBar cells] objectAtIndex:tabIndex];
@@ -539,7 +540,7 @@
NSImage *viewImage = [[NSImage alloc] init];
// Capture an image of the entire window
- CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [[self window] windowNumber], kCGWindowImageBoundsIgnoreFraming);
+ CGImageRef windowImage = CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, (unsigned int)[[self window] windowNumber], kCGWindowImageBoundsIgnoreFraming);
NSBitmapImageRep *viewRep = [[NSBitmapImageRep alloc] initWithCGImage:windowImage];
[viewImage addRepresentation:viewRep];
@@ -750,7 +751,7 @@
[bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"];
[[theCell indicator] bind:@"animate" toObject:theDocument withKeyPath:@"isProcessing" options:nil];
[[theCell indicator] bind:@"hidden" toObject:theDocument withKeyPath:@"isProcessing" options:bindingOptions];
- [theDocument addObserver:self forKeyPath:@"isProcessing" options:nil context:nil];
+ [theDocument addObserver:self forKeyPath:@"isProcessing" options:0 context:nil];
}
/**
diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m
index 57977be0..dfd55bf0 100644
--- a/Source/SPXMLExporter.m
+++ b/Source/SPXMLExporter.m
@@ -26,6 +26,7 @@
#import <MCPKit/MCPKit.h>
#import "SPXMLExporter.h"
+#import "SPExportFile.h"
#import "SPFileHandle.h"
#import "SPExportUtilities.h"
diff --git a/Source/SPXMLExporterDelegate.m b/Source/SPXMLExporterDelegate.m
index 9d8b97cf..7f286c46 100644
--- a/Source/SPXMLExporterDelegate.m
+++ b/Source/SPXMLExporterDelegate.m
@@ -26,7 +26,7 @@
#import "SPXMLExporterDelegate.h"
#import "SPXMLExporter.h"
#import "SPDatabaseDocument.h"
-#import "SPFileHandle.h"
+#import "SPExportFile.h"
@implementation SPExportController (SPXMLExporterDelegate)
diff --git a/Source/YRKSpinningProgressIndicator.m b/Source/YRKSpinningProgressIndicator.m
index b6f3c0ac..9d66f598 100644
--- a/Source/YRKSpinningProgressIndicator.m
+++ b/Source/YRKSpinningProgressIndicator.m
@@ -86,15 +86,15 @@
- (void)drawRect:(NSRect)rect
{
NSInteger i;
- CGFloat alpha = 1.0;
+ CGFloat alpha = 1.0f;
// Determine size based on current bounds
NSSize size = [self bounds].size;
- CGFloat maxSize;
+ CGFloat rectMaxSize;
if(size.width >= size.height)
- maxSize = size.height;
+ rectMaxSize = size.height;
else
- maxSize = size.width;
+ rectMaxSize = size.width;
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
[NSGraphicsContext saveGraphicsState];
@@ -112,12 +112,12 @@
if (_isIndeterminate) {
// do initial rotation to start place
- CGContextRotateCTM(currentContext, 3.14159*2/_numFins * _position);
+ CGContextRotateCTM(currentContext, 3.14159f*2/_numFins * _position);
NSBezierPath *path = [[NSBezierPath alloc] init];
- CGFloat lineWidth = 0.08 * maxSize; // should be 2.75 for 32x32
- CGFloat lineStart = 0.234375 * maxSize; // should be 7.5 for 32x32
- CGFloat lineEnd = 0.421875 * maxSize; // should be 13.5 for 32x32
+ CGFloat lineWidth = 0.08f * rectMaxSize; // should be 2.75 for 32x32
+ CGFloat lineStart = 0.234375f * rectMaxSize; // should be 7.5 for 32x32
+ CGFloat lineEnd = 0.421875f * rectMaxSize; // should be 13.5 for 32x32
[path setLineWidth:lineWidth];
[path setLineCapStyle:NSRoundLineCapStyle];
[path moveToPoint:NSMakePoint(0,lineStart)];
@@ -127,21 +127,21 @@
if(_isAnimating) {
[[_foreColor colorWithAlphaComponent:alpha] set];
} else {
- [[_foreColor colorWithAlphaComponent:0.2] set];
+ [[_foreColor colorWithAlphaComponent:0.2f] set];
}
[path stroke];
// we draw all the fins by rotating the CTM, then just redraw the same segment again
- CGContextRotateCTM(currentContext, 6.282185/_numFins);
- alpha -= 1.0/_numFins;
+ CGContextRotateCTM(currentContext, 6.282185f/_numFins);
+ alpha -= 1.0f/_numFins;
}
[path release];
} else {
- CGFloat lineWidth = 1 + (0.01 * maxSize);
- CGFloat circleRadius = (maxSize - lineWidth) / 2.1;
+ CGFloat lineWidth = 1 + (0.01f * rectMaxSize);
+ CGFloat circleRadius = (rectMaxSize - lineWidth) / 2.1f;
NSPoint circleCenter = NSMakePoint(0, 0);
[[_foreColor colorWithAlphaComponent:alpha] set];
NSBezierPath *path = [[NSBezierPath alloc] init];
@@ -150,7 +150,7 @@
[path stroke];
[path release];
path = [[NSBezierPath alloc] init];
- [path appendBezierPathWithArcWithCenter:circleCenter radius:circleRadius startAngle:90 endAngle:90-(360*(_currentValue/_maxValue)) clockwise:YES];
+ [path appendBezierPathWithArcWithCenter:circleCenter radius:circleRadius startAngle:90 endAngle:90-(360*(float)(_currentValue/_maxValue)) clockwise:YES];
[path lineToPoint:circleCenter] ;
[path fill];
[path release];
@@ -186,7 +186,7 @@
NSAutoreleasePool *animationPool = [[NSAutoreleasePool alloc] init];
// Set up the animation speed to subtly change with size > 32.
- NSInteger animationDelay = 38000 + (2000 * ([self bounds].size.height / 32));
+ useconds_t animationDelay = 38000 + (2000 * ([self bounds].size.height / 32));
NSInteger poolFlushCounter = 0;
do {