aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-03-14 01:26:57 +0000
committerrowanbeentje <rowan@beent.je>2011-03-14 01:26:57 +0000
commitf63d1de5460968e5466be02676c8c6f9ed8787b6 (patch)
treec66735047936114febbddcb0a963d43cfd868db5
parent52eb2680673fca634013fa45ef16f4173a33c880 (diff)
downloadsequelpro-f63d1de5460968e5466be02676c8c6f9ed8787b6.tar.gz
sequelpro-f63d1de5460968e5466be02676c8c6f9ed8787b6.tar.bz2
sequelpro-f63d1de5460968e5466be02676c8c6f9ed8787b6.zip
- Fix more warnings
-rw-r--r--Source/MGTemplateEngine.m6
-rw-r--r--Source/MGTemplateStandardMarkers.m2
-rw-r--r--Source/NoodleLineNumberView.m52
-rw-r--r--Source/SPExportController.h2
-rw-r--r--Source/SPExportController.m22
-rw-r--r--Source/SPFieldEditorController.h4
-rw-r--r--Source/SPFieldEditorController.m87
-rw-r--r--Source/SPFieldMapperController.h4
-rw-r--r--Source/SPFieldMapperController.m85
-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/SPTableContent.m2
-rw-r--r--Source/SPTableView.m7
-rw-r--r--Source/SPTextView.h3
-rw-r--r--Source/SPTextView.m97
-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/YRKSpinningProgressIndicator.m30
23 files changed, 320 insertions, 276 deletions
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/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/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..433be826 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,7 +1503,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
}
// Add global values if any
- if([fieldMappingGlobalValues count]>numberOfImportColumns)
+ if((NSInteger)[fieldMappingGlobalValues count]>numberOfImportColumns)
for(i; i < [fieldMappingGlobalValues count]; i++) {
if ([NSArrayObjectAtIndex(fieldMappingGlobalValues, i) isNSNull])
[fieldMappingButtonOptions addObject:[NSString stringWithFormat:@"%i. <%@>", i+1, [prefs objectForKey:SPNullValue]]];
@@ -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/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/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/SPTableView.m b/Source/SPTableView.m
index d574420d..65536b6d 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/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 d009d03c..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
@@ -82,8 +83,8 @@ 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
@@ -851,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];
@@ -917,7 +918,7 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse)
} @catch(id ae) { }
- return (leftIsAlphanum ^ rightIsAlphanum || leftIsAlphanum && rightIsAlphanum);
+ return (leftIsAlphanum ^ rightIsAlphanum || (leftIsAlphanum && rightIsAlphanum));
}
/**
@@ -1137,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];
}
@@ -1262,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];
}
@@ -1473,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];
@@ -1519,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
@@ -1630,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];
}
@@ -1878,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)
@@ -1898,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) {
@@ -1939,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
@@ -1968,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;
}
}
@@ -2805,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];
@@ -2853,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];
@@ -2882,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];
@@ -2918,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];
@@ -3170,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
@@ -3187,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
@@ -3381,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];
@@ -3410,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/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 {