aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-01-09 01:38:23 +0000
committerrowanbeentje <rowan@beent.je>2010-01-09 01:38:23 +0000
commit9004533ba1d84d670a77cbfc9eae401b66e9dd0e (patch)
tree8d16781c788a964e45102b66ffc04b77fa1fb9e9 /Source
parentfcb6ce6cbb0bd4179e22a3dd17dd12e4a3529cdd (diff)
downloadsequelpro-9004533ba1d84d670a77cbfc9eae401b66e9dd0e.tar.gz
sequelpro-9004533ba1d84d670a77cbfc9eae401b66e9dd0e.tar.bz2
sequelpro-9004533ba1d84d670a77cbfc9eae401b66e9dd0e.zip
- Upgrade Sequel Pro to be compiled as a 3-way PPC/i386/x86_64 binary for release builds, including a large number of 64bit compatibility upgrades and tweaks
- Upgrade RegexKitLite to 3.3
Diffstat (limited to 'Source')
-rw-r--r--Source/CMCopyTable.h6
-rw-r--r--Source/CMCopyTable.m28
-rw-r--r--Source/CMTextView.h12
-rw-r--r--Source/CMTextView.m66
-rw-r--r--Source/CustomQuery.h6
-rw-r--r--Source/CustomQuery.m136
-rw-r--r--Source/ICUTemplateMatcher.m8
-rw-r--r--Source/ImageAndTextCell.h6
-rw-r--r--Source/ImageAndTextCell.m6
-rw-r--r--Source/MGTemplateEngine.h4
-rw-r--r--Source/MGTemplateEngine.m18
-rw-r--r--Source/MGTemplateStandardFilters.m7
-rw-r--r--Source/MGTemplateStandardMarkers.h2
-rw-r--r--Source/MGTemplateStandardMarkers.m36
-rw-r--r--Source/NSArray_DeepMutableCopy.m2
-rw-r--r--Source/NSMutableArray-MultipleSort.m8
-rw-r--r--Source/NoodleLineNumberView.h6
-rw-r--r--Source/NoodleLineNumberView.m55
-rw-r--r--Source/QLPreviewPanel.h24
-rw-r--r--Source/RegexKitLite.h2
-rw-r--r--Source/RegexKitLite.m220
-rw-r--r--Source/SPAppController.m4
-rw-r--r--Source/SPCSVParser.h24
-rw-r--r--Source/SPCSVParser.m12
-rw-r--r--Source/SPConnectionController.h10
-rw-r--r--Source/SPConnectionController.m58
-rw-r--r--Source/SPConnectionDelegate.m2
-rw-r--r--Source/SPContentFilterManager.m18
-rw-r--r--Source/SPDataAdditions.h2
-rw-r--r--Source/SPDataAdditions.m42
-rw-r--r--Source/SPDataCellFormatter.h8
-rw-r--r--Source/SPDataCellFormatter.m10
-rw-r--r--Source/SPDatabaseData.h2
-rw-r--r--Source/SPDatabaseData.m2
-rw-r--r--Source/SPEditSheetTextView.h2
-rw-r--r--Source/SPEditSheetTextView.m10
-rw-r--r--Source/SPExportController.m10
-rw-r--r--Source/SPFavoriteTextFieldCell.m14
-rw-r--r--Source/SPFieldEditorController.h6
-rw-r--r--Source/SPFieldEditorController.m18
-rw-r--r--Source/SPGrowlController.h2
-rw-r--r--Source/SPGrowlController.m4
-rw-r--r--Source/SPHistoryController.h6
-rw-r--r--Source/SPHistoryController.m46
-rw-r--r--Source/SPKeychain.m12
-rw-r--r--Source/SPLogger.m2
-rw-r--r--Source/SPNarrowDownCompletion.m29
-rw-r--r--Source/SPNotLoaded.m2
-rw-r--r--Source/SPPreferenceController.h4
-rw-r--r--Source/SPPreferenceController.m86
-rw-r--r--Source/SPProcessListController.m16
-rw-r--r--Source/SPQueryController.m12
-rw-r--r--Source/SPQueryFavoriteManager.m16
-rw-r--r--Source/SPSQLParser.h36
-rw-r--r--Source/SPSQLParser.m90
-rw-r--r--Source/SPSSHTunnel.h18
-rw-r--r--Source/SPSSHTunnel.m42
-rw-r--r--Source/SPServerVariablesController.m4
-rw-r--r--Source/SPStringAdditions.h6
-rw-r--r--Source/SPStringAdditions.m52
-rw-r--r--Source/SPTableData.h2
-rw-r--r--Source/SPTableData.m18
-rw-r--r--Source/SPTableInfo.m10
-rw-r--r--Source/SPTableRelations.m14
-rw-r--r--Source/SPTableTextFieldCell.m6
-rw-r--r--Source/SPTableView.m4
-rw-r--r--Source/SPTextAndLinkCell.h10
-rw-r--r--Source/SPTextAndLinkCell.m6
-rw-r--r--Source/SPTextViewAdditions.m35
-rw-r--r--Source/SPTooltip.m29
-rw-r--r--Source/SPUserManager.m14
-rw-r--r--Source/SPWindowAdditions.h2
-rw-r--r--Source/SPWindowAdditions.m6
-rw-r--r--Source/SequelProTunnelAssistant.m4
-rw-r--r--Source/TableContent.h20
-rw-r--r--Source/TableContent.m146
-rw-r--r--Source/TableDocument.h18
-rw-r--r--Source/TableDocument.m60
-rw-r--r--Source/TableDump.h8
-rw-r--r--Source/TableDump.m128
-rw-r--r--Source/TableSource.h2
-rw-r--r--Source/TableSource.m66
-rw-r--r--Source/TablesList.h4
-rw-r--r--Source/TablesList.m200
-rw-r--r--Source/YRKSpinningProgressIndicator.h4
-rw-r--r--Source/YRKSpinningProgressIndicator.m20
86 files changed, 1134 insertions, 1099 deletions
diff --git a/Source/CMCopyTable.h b/Source/CMCopyTable.h
index 8b822df1..aede3540 100644
--- a/Source/CMCopyTable.h
+++ b/Source/CMCopyTable.h
@@ -70,7 +70,7 @@
@param isLocal who cares
@result Always calls for a copy type drag operation
*/
-- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
+- (NSUInteger)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
/*!
@method selectedRowsAsTabStringWithHeaders
@@ -107,5 +107,5 @@
@end
-extern int MENU_EDIT_COPY_WITH_COLUMN;
-extern int MENU_EDIT_COPY_AS_SQL;
+extern NSInteger MENU_EDIT_COPY_WITH_COLUMN;
+extern NSInteger MENU_EDIT_COPY_AS_SQL;
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m
index c12e7064..20b0e7f2 100644
--- a/Source/CMCopyTable.m
+++ b/Source/CMCopyTable.m
@@ -32,8 +32,8 @@
#import "SPNotLoaded.h"
#import "SPConstants.h"
-int MENU_EDIT_COPY_WITH_COLUMN = 2001;
-int MENU_EDIT_COPY_AS_SQL = 2002;
+NSInteger MENU_EDIT_COPY_WITH_COLUMN = 2001;
+NSInteger MENU_EDIT_COPY_AS_SQL = 2002;
@implementation CMCopyTable
@@ -71,7 +71,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
}
//allow for drag-n-drop out of the application as a copy
-- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
+- (NSUInteger)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
return NSDragOperationCopy;
}
@@ -202,15 +202,15 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
for(id enumObj in columns)
{
[tbHeader addObject:[[enumObj headerCell] stringValue]];
- NSString *t = [[columnDefinitions objectAtIndex:[[enumObj identifier] intValue]] objectForKey:@"typegrouping"];
+ NSString *t = [[columnDefinitions objectAtIndex:[[enumObj identifier] integerValue]] objectForKey:@"typegrouping"];
if([t isEqualToString:@"bit"] || [t isEqualToString:@"integer"] || [t isEqualToString:@"float"])
- [types addObject:[NSNumber numberWithInt:0]]; // numeric
+ [types addObject:[NSNumber numberWithInteger:0]]; // numeric
else if([t isEqualToString:@"blobdata"])
- [types addObject:[NSNumber numberWithInt:2]]; // blob data
+ [types addObject:[NSNumber numberWithInteger:2]]; // blob data
else if([t isEqualToString:@"textdata"])
- [types addObject:[NSNumber numberWithInt:3]]; // long text data
+ [types addObject:[NSNumber numberWithInteger:3]]; // long text data
else
- [types addObject:[NSNumber numberWithInt:1]]; // string (fallback coevally)
+ [types addObject:[NSNumber numberWithInteger:1]]; // string (fallback coevally)
}
[result appendString:[NSString stringWithFormat:@"INSERT INTO %@ (%@)\nVALUES\n",
[(selectedTable == nil)?@"<table>":selectedTable backtickQuotedString], [tbHeader componentsJoinedAndBacktickQuoted]]];
@@ -230,7 +230,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
rowCounter++;
for ( c = 0; c < numColumns; c++ )
{
- rowData = [[tableData objectAtIndex:rowIndex] objectAtIndex:[[columnMappings objectAtIndex:c] intValue]];
+ rowData = [[tableData objectAtIndex:rowIndex] objectAtIndex:[[columnMappings objectAtIndex:c] integerValue]];
// Check for NULL value
if([rowData isNSNull]) {
@@ -239,7 +239,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
}
else if ( rowData != nil ) {
// check column type and insert the data accordingly
- switch([[types objectAtIndex:c] intValue]) {
+ switch([[types objectAtIndex:c] integerValue]) {
case 0: // numeric
[value appendString:[NSString stringWithFormat:@"%@, ", [rowData description]]];
break;
@@ -265,11 +265,11 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
dbDataRow = [[mySQLConnection queryString:
[NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@",
[selectedTable backtickQuotedString], [tableInstance argumentForRow:rowIndex]]] fetchRowAsArray];
- if([[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] intValue]] isNSNull])
+ if([[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] integerValue]] isNSNull])
[value appendString:@"NULL, "];
else
[value appendString:[NSString stringWithFormat:@"X'%@', ",
- [mySQLConnection prepareBinaryData:[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] intValue]]]]];
+ [mySQLConnection prepareBinaryData:[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] integerValue]]]]];
} else {
[value appendString:[NSString stringWithFormat:@"X'%@', ", [mySQLConnection prepareBinaryData:rowData]]];
}
@@ -285,11 +285,11 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
dbDataRow = [[mySQLConnection queryString:
[NSString stringWithFormat:@"SELECT * FROM %@ WHERE %@",
[selectedTable backtickQuotedString], [tableInstance argumentForRow:rowIndex]]] fetchRowAsArray];
- if([[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] intValue]] isKindOfClass:[NSNull class]])
+ if([[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] integerValue]] isKindOfClass:[NSNull class]])
[value appendString:@"NULL, "];
else
[value appendString:[NSString stringWithFormat:@"'%@', ",
- [mySQLConnection prepareString:[[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] intValue]] description]]]];
+ [mySQLConnection prepareString:[[dbDataRow objectAtIndex:[[columnMappings objectAtIndex:c] integerValue]] description]]]];
} else {
[value appendString:[NSString stringWithFormat:@"'%@', ",
[[rowData description] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"] ] ];
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index 4f9daa88..229f3bbc 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -57,7 +57,7 @@ static inline void NSMutableAttributedStringAddAttributeValueRange (NSMutableAtt
NSUserDefaults *prefs;
MCPConnection *mySQLConnection;
- int mySQLmajorVersion;
+ NSInteger mySQLmajorVersion;
}
@@ -69,7 +69,7 @@ static inline void NSMutableAttributedStringAddAttributeValueRange (NSMutableAtt
- (BOOL) wrapSelectionWithPrefix:(NSString *)prefix suffix:(NSString *)suffix;
- (BOOL) shiftSelectionRight;
- (BOOL) shiftSelectionLeft;
-- (NSArray *) completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index;
+- (NSArray *) completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index;
- (NSArray *) keywords;
- (NSArray *) functions;
- (void) setAutoindent:(BOOL)enableAutoindent;
@@ -82,16 +82,16 @@ static inline void NSMutableAttributedStringAddAttributeValueRange (NSMutableAtt
- (BOOL) autouppercaseKeywords;
- (void) setAutohelp:(BOOL)enableAutohelp;
- (BOOL) autohelp;
-- (void) selectLineNumber:(unsigned int)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines;
-- (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex;
+- (void) selectLineNumber:(NSUInteger)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines;
+- (NSUInteger) getLineNumberForCharacterIndex:(NSUInteger)anIndex;
- (void) autoHelp;
- (void) doSyntaxHighlighting;
-- (void) setConnection:(MCPConnection *)theConnection withVersion:(int)majorVersion;
+- (void) setConnection:(MCPConnection *)theConnection withVersion:(NSInteger)majorVersion;
- (void) doCompletion;
- (NSArray *)suggestionsForSQLCompletionWith:(NSString *)currentWord dictMode:(BOOL)isDictMode;
- (void) selectCurrentQuery;
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint;
+- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint;
- (void)insertFileContentOfFile:(NSString *)aPath;
@end
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 547a4e0a..536f609f 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -38,8 +38,8 @@
* Include all the extern variables and prototypes required for flex (used for syntax highlighting)
*/
#import "SPEditorTokens.h"
-extern int yylex();
-extern int yyuoffset, yyuleng;
+extern NSInteger yylex();
+extern NSInteger yyuoffset, yyuleng;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
void yy_switch_to_buffer(YY_BUFFER_STATE);
YY_BUFFER_STATE yy_scan_string (const char *);
@@ -104,7 +104,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
prefs = [[NSUserDefaults standardUserDefaults] retain];
}
-- (void) setConnection:(MCPConnection *)theConnection withVersion:(int)majorVersion
+- (void) setConnection:(MCPConnection *)theConnection withVersion:(NSInteger)majorVersion
{
mySQLConnection = theConnection;
mySQLmajorVersion = majorVersion;
@@ -179,7 +179,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Remove current word from list
[uniqueArray removeObject:currentWord];
- int reverseSort = NO;
+ NSInteger reverseSort = NO;
NSArray *sortedArray = [[[uniqueArray mutableCopy] autorelease] sortedArrayUsingFunction:alphabeticSort context:&reverseSort];
for(id w in sortedArray)
[possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:w, @"display", @"dummy-small", @"image", nil]];
@@ -265,7 +265,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Returns the associated line number for a character position inside of the CMTextView
*/
-- (unsigned int) getLineNumberForCharacterIndex:(unsigned int)anIndex
+- (NSUInteger) getLineNumberForCharacterIndex:(NSUInteger)anIndex
{
return [lineNumberView lineNumberForCharacterIndex:anIndex inText:[self string]]+1;
}
@@ -284,7 +284,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
*/
- (BOOL) isNextCharMarkedBy:(id)attribute withValue:(id)aValue
{
- unsigned int caretPosition = [self selectedRange].location;
+ NSUInteger caretPosition = [self selectedRange].location;
// Perform bounds checking
if (caretPosition >= [[self string] length]) return NO;
@@ -302,7 +302,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
*/
- (BOOL) isCaretAdjacentToAlphanumCharWithInsertionOf:(unichar)aChar
{
- unsigned int caretPosition = [self selectedRange].location;
+ NSUInteger caretPosition = [self selectedRange].location;
NSCharacterSet *alphanum = [NSCharacterSet alphanumericCharacterSet];
BOOL leftIsAlphanum = NO;
BOOL rightIsAlphanum = NO;
@@ -328,7 +328,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
*/
- (BOOL) areAdjacentCharsLinked
{
- unsigned int caretPosition = [self selectedRange].location;
+ NSUInteger caretPosition = [self selectedRange].location;
unichar leftChar, matchingChar;
// Perform bounds checking
@@ -402,7 +402,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Selects the line lineNumber relatively to a selection (if given) and scrolls to it
*/
-- (void) selectLineNumber:(unsigned int)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines
+- (void) selectLineNumber:(NSUInteger)lineNumber ignoreLeadingNewLines:(BOOL)ignLeadingNewLines
{
NSRange selRange;
NSArray *lineRanges;
@@ -413,8 +413,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(ignLeadingNewLines) // ignore leading empty lines
{
- int arrayCount = [lineRanges count];
- int i;
+ NSInteger arrayCount = [lineRanges count];
+ NSInteger i;
for (i = 0; i < arrayCount; i++) {
if(NSRangeFromString([lineRanges objectAtIndex:i]).length > 0)
break;
@@ -451,7 +451,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Start autoHelp timer
if([prefs boolForKey:SPCustomQueryUpdateAutoHelp])
- [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] floatValue]];
+ [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] doubleValue]];
}
@@ -466,7 +466,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
selector:@selector(autoHelp)
object:nil];
[self performSelector:@selector(autoHelp) withObject:nil
- afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] floatValue]];
+ afterDelay:[[prefs valueForKey:SPCustomQueryAutoHelpDelay] doubleValue]];
}
long allFlags = (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask);
@@ -702,7 +702,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString *currentLine, *indentString = nil;
NSScanner *whitespaceScanner;
NSRange currentLineRange;
- int lineCursorLocation;
+ NSInteger lineCursorLocation;
// Extract the current line based on the text caret or selection start position
currentLineRange = [textViewString lineRangeForRange:NSMakeRange([self selectedRange].location, 0)];
@@ -747,7 +747,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSRange currentLineRange;
NSArray *lineRanges;
NSString *tabString = @"\t";
- int i, indentedLinesLength = 0;
+ NSInteger i, indentedLinesLength = 0;
if ([self selectedRange].location == NSNotFound) return NO;
@@ -800,7 +800,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString *textViewString = [[self textStorage] string];
NSRange currentLineRange;
NSArray *lineRanges;
- int i, unindentedLines = 0, unindentedLinesLength = 0;
+ NSInteger i, unindentedLines = 0, unindentedLinesLength = 0;
if ([self selectedRange].location == NSNotFound) return NO;
@@ -861,7 +861,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Handle autocompletion, returning a list of suggested completions for the supplied character range.
*/
-- (NSArray *)completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index
+- (NSArray *)completionsForPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index
{
if (!charRange.length) return nil;
@@ -881,12 +881,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSMutableArray *possibleCompletions = [[NSMutableArray alloc] initWithCapacity:32];
NSString *partialString = [[self string] substringWithRange:charRange];
- unsigned int partialLength = [partialString length];
+ NSUInteger partialLength = [partialString length];
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@ AND length > %d", partialString, partialLength];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@ AND length > %lu", partialString, (unsigned long)partialLength];
NSArray *matchingCompletions;
- unsigned i, insindex;
+ NSUInteger i, insindex;
insindex = 0;
@@ -2014,7 +2014,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
return;
}
// Otherwise show Help if caret is not inside quotes
- long cursorPosition = [self selectedRange].location;
+ NSUInteger cursorPosition = [self selectedRange].location;
if (cursorPosition >= [[self string] length]) cursorPosition--;
if(cursorPosition > -1 && (![[self textStorage] attribute:kQuote atIndex:cursorPosition effectiveRange:nil]||[[self textStorage] attribute:kSQLkeyword atIndex:cursorPosition effectiveRange:nil]))
[[[[self window] delegate] valueForKeyPath:@"customQueryInstance"] performSelector:@selector(showAutoHelpForCurrentWord:) withObject:self afterDelay:0.1];
@@ -2055,10 +2055,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(!visibleRange.length) return;
// Take roughly the middle position in the current view port
- int curPos = visibleRange.location+(int)(visibleRange.length/2);
+ NSInteger curPos = visibleRange.location+(NSInteger)(visibleRange.length/2);
// get the last line to parse due to SP_SYNTAX_HILITE_BIAS
- int end = curPos + SP_SYNTAX_HILITE_BIAS;
+ NSInteger end = curPos + SP_SYNTAX_HILITE_BIAS;
if (end > strlength ) {
end = strlength;
} else {
@@ -2070,7 +2070,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
// get the first line to parse due to SP_SYNTAX_HILITE_BIAS
- int start = end - (SP_SYNTAX_HILITE_BIAS*2);
+ NSInteger start = end - (SP_SYNTAX_HILITE_BIAS*2);
if (start > 0)
while(start>-1) {
if([selfstr characterAtIndex:start]=='\n')
@@ -2103,7 +2103,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
BOOL autouppercaseKeywords = [prefs boolForKey:SPCustomQueryAutoUppercaseKeywords];
- unsigned long tokenEnd, token;
+ NSUInteger tokenEnd, token;
NSRange tokenRange;
// first remove the old colors and kQuote
@@ -2293,7 +2293,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Enable or disable the search in the MySQL help menu item depending on whether there is a
// selection and whether it is a reasonable length.
if ([menuItem action] == @selector(showMySQLHelpForCurrentWord:)) {
- long stringSize = [self getRangeForCurrentWord].length;
+ NSUInteger stringSize = [self getRangeForCurrentWord].length;
return (stringSize || stringSize > 64);
}
// Enable Copy as RTF if something is selected
@@ -2365,7 +2365,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Start autohelp only if the user really changed the text (not e.g. for setting a background color)
if([prefs boolForKey:SPCustomQueryUpdateAutoHelp] && [textStore editedMask] != 1)
- [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] floatValue]];
+ [self performSelector:@selector(autoHelp) withObject:nil afterDelay:[[[prefs valueForKey:SPCustomQueryAutoHelpDelay] retain] doubleValue]];
if([[self string] length] > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING)
[NSObject cancelPreviousPerformRequestsWithTarget:self
@@ -2384,7 +2384,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Show only setable modes in the font panel
*/
-- (unsigned int)validModesForFontPanel:(NSFontPanel *)fontPanel
+- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
return (NSFontPanelFaceModeMask | NSFontPanelSizeModeMask);
}
@@ -2425,7 +2425,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Set the new insertion point
NSPoint draggingLocation = [sender draggingLocation];
draggingLocation = [self convertPoint:draggingLocation fromView:nil];
- unsigned int characterIndex = [self characterIndexOfPoint:draggingLocation];
+ NSUInteger characterIndex = [self characterIndexOfPoint:draggingLocation];
[self setSelectedRange:NSMakeRange(characterIndex,0)];
// Check if user pressed ⌘ while dragging for inserting only the file path
@@ -2473,7 +2473,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
/*
* Confirmation sheetDidEnd method
*/
-- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[[sheet window] orderOut:nil];
@@ -2485,11 +2485,11 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
* Convert a NSPoint, usually the mouse location, to
* a character index of the text view.
*/
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint
+- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint
{
- unsigned int glyphIndex;
+ NSUInteger glyphIndex;
NSLayoutManager *layoutManager = [self layoutManager];
- float fraction;
+ CGFloat fraction;
NSRange range;
range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 960859d0..1c9a32bf 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -174,9 +174,9 @@
// Query actions
- (void)performQueries:(NSArray *)queries withCallback:(SEL)customQueryCallbackMethod;
- (void)performQueriesTask:(NSDictionary *)taskArguments;
-- (NSString *)queryAtPosition:(long)position lookBehind:(BOOL *)doLookBehind;
-- (NSRange)queryRangeAtPosition:(long)position lookBehind:(BOOL *)doLookBehind;
-- (NSRange)queryTextRangeForQuery:(int)anIndex startPosition:(long)position;
+- (NSString *)queryAtPosition:(NSUInteger)position lookBehind:(BOOL *)doLookBehind;
+- (NSRange)queryRangeAtPosition:(NSUInteger)position lookBehind:(BOOL *)doLookBehind;
+- (NSRange)queryTextRangeForQuery:(NSInteger)anIndex startPosition:(NSUInteger)position;
// Accessors
- (NSArray *)currentResult;
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 7651640d..5540f198 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -392,7 +392,7 @@
/*
* Set font panel's valid modes
*/
-- (unsigned int)validModesForFontPanel:(NSFontPanel *)fontPanel
+- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask);
}
@@ -408,7 +408,7 @@
{
NSString *taskString;
if ([queries count] > 1) {
- taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %i of %i...", @"Running multiple queries string"), 1, [queries count]];
+ taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %i of %lu...", @"Running multiple queries string"), 1, (unsigned long)[queries count]];
} else {
taskString = NSLocalizedString(@"Running query...", @"Running single query string");
}
@@ -440,9 +440,9 @@
SEL callbackMethod = NULL;
NSString *taskButtonString;
- int i, j, totalQueriesRun = 0, totalAffectedRows = 0;
+ NSInteger i, j, totalQueriesRun = 0, totalAffectedRows = 0;
double executionTime = 0;
- int firstErrorOccuredInQuery = -1;
+ NSInteger firstErrorOccuredInQuery = -1;
BOOL suppressErrorSheet = NO;
BOOL tableListNeedsReload = NO;
BOOL databaseWasChanged = NO;
@@ -475,7 +475,7 @@
// Disable automatic query retries on failure for the custom queries
[mySQLConnection setAllowQueryRetries:NO];
- long queryCount = [queries count];
+ NSUInteger queryCount = [queries count];
NSMutableArray *tempQueries = [NSMutableArray arrayWithCapacity:queryCount];
// Enable task cancellation
@@ -489,7 +489,7 @@
for ( i = 0 ; i < queryCount ; i++ ) {
if (i > 0) {
- NSString *taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %i of %i...", @"Running multiple queries string"), i+1, queryCount];
+ NSString *taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %ld of %lu...", @"Running multiple queries string"), (long)(i+1), (unsigned long)queryCount];
[tableDocumentInstance setTaskDescription:taskString];
[errorText setStringValue:taskString];
}
@@ -534,10 +534,10 @@
[[theCol headerCell] setStringValue:NSArrayObjectAtIndex(theColumns, j)];
// Set the width of this column to saved value if exists and maps to a real column
- if ([columnDefinition objectForKey:@"org_name"] && [[columnDefinition objectForKey:@"org_name"] length]) {
+ if ([columnDefinition objectForKey:@"org_name"] && [(NSString *)[columnDefinition objectForKey:@"org_name"] length]) {
NSNumber *colWidth = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:[NSString stringWithFormat:@"%@@%@", [columnDefinition objectForKey:@"db"], [tableDocumentInstance host]]] objectForKey:[columnDefinition objectForKey:@"org_table"]] objectForKey:[columnDefinition objectForKey:@"org_name"]];
if ( colWidth ) {
- [theCol setWidth:[colWidth floatValue]];
+ [theCol setWidth:[colWidth doubleValue]];
}
}
@@ -550,9 +550,9 @@
//tries to fix problem with last row (otherwise to small)
//sets last column to width of the first if smaller than 30
//problem not fixed for resizing window
- if ( [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]] width] < 30 )
- [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]]
- setWidth:[[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:0]] width]];
+ if ( [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInteger:[theColumns count]-1]] width] < 30 )
+ [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInteger:[theColumns count]-1]]
+ setWidth:[[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInteger:0]] width]];
}
[self processResultIntoDataStorage:streamingResult];
@@ -587,8 +587,8 @@
if(!suppressErrorSheet)
{
// Update error text for the user
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"),
- i+1,
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"),
+ (long)(i+1),
errorString]];
[errorText setStringValue:errors];
@@ -601,7 +601,7 @@
[alert setMessageText:NSLocalizedString(@"MySQL Error", @"mysql error message")];
[alert setInformativeText:[mySQLConnection getLastErrorMessage]];
[alert setAlertStyle:NSWarningAlertStyle];
- int choice = [alert runModal];
+ NSInteger choice = [alert runModal];
switch (choice){
case NSAlertFirstButtonReturn:
suppressErrorSheet = YES;
@@ -614,8 +614,8 @@
}
}
} else {
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"),
- i+1,
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"),
+ (long)(i+1),
errorString]];
}
} else {
@@ -675,7 +675,7 @@
[queryHistoryButton addItemWithTitle:usedQuery];
// Check for max history
- NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] intValue];
+ NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] integerValue];
while ( [queryHistoryButton numberOfItems] > maxHistoryItems + 7 )
[queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1];
@@ -690,7 +690,7 @@
if(errorLineNumberRange.length) // if a line number was found
{
// Get the line number
- NSUInteger errorAtLine = [[errors substringWithRange:errorLineNumberRange] intValue];
+ NSUInteger errorAtLine = [[errors substringWithRange:errorLineNumberRange] integerValue];
NSUInteger lineOffset = [textView getLineNumberForCharacterIndex:queryTextViewStartPosition] - 1;
[textView selectLineNumber:errorAtLine+lineOffset ignoreLeadingNewLines:YES];
@@ -735,8 +735,8 @@
// Set up the status string
if ( [mySQLConnection queryCancelled] ) {
if (totalQueriesRun > 1) {
- [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Cancelled in query %i, after %@", @"text showing multiple queries were cancelled"),
- totalQueriesRun,
+ [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Cancelled in query %ld, after %@", @"text showing multiple queries were cancelled"),
+ (long)totalQueriesRun,
[NSString stringForTimeInterval:executionTime]
]];
} else {
@@ -746,15 +746,15 @@
}
} else if ( totalQueriesRun > 1 ) {
if (totalAffectedRows==1) {
- [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"1 row affected in total, by %i queries taking %@", @"text showing one row has been affected by multiple queries"),
- totalQueriesRun,
+ [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"1 row affected in total, by %ld queries taking %@", @"text showing one row has been affected by multiple queries"),
+ (long)totalQueriesRun,
[NSString stringForTimeInterval:executionTime]
]];
} else {
- [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%i rows affected in total, by %i queries taking %@", @"text showing how many rows have been affected by multiple queries"),
- totalAffectedRows,
- totalQueriesRun,
+ [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%ld rows affected in total, by %ld queries taking %@", @"text showing how many rows have been affected by multiple queries"),
+ (long)totalAffectedRows,
+ (long)totalQueriesRun,
[NSString stringForTimeInterval:executionTime]
]];
@@ -765,8 +765,8 @@
[NSString stringForTimeInterval:executionTime]
]];
} else {
- [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%i rows affected, taking %@", @"text showing how many rows have been affected by a single query"),
- totalAffectedRows,
+ [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%ld rows affected, taking %@", @"text showing how many rows have been affected by a single query"),
+ (long)totalAffectedRows,
[NSString stringForTimeInterval:executionTime]
]];
@@ -858,7 +858,7 @@
- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult
{
NSArray *tempRow;
- long rowsProcessed = 0;
+ NSUInteger rowsProcessed = 0;
NSUInteger nextTableDisplayBoundary = 50;
NSAutoreleasePool *dataLoadingPool;
BOOL tableViewRedrawn = NO;
@@ -912,15 +912,15 @@
* Retrieve the range of the query at a position specified
* within the custom query text view.
*/
-- (NSRange)queryRangeAtPosition:(long)position lookBehind:(BOOL *)doLookBehind
+- (NSRange)queryRangeAtPosition:(NSUInteger)position lookBehind:(BOOL *)doLookBehind
{
SPSQLParser *customQueryParser;
NSArray *queries;
NSString *query = nil;
NSRange queryRange;
- long i, j, queryPosition = 0;
- long queryCount;
+ NSUInteger i, j, queryPosition = 0;
+ NSUInteger queryCount;
NSCharacterSet *whitespaceAndNewlineSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceCharacterSet];
@@ -1016,8 +1016,8 @@
// Highlight by setting a background color the current query
// and ignore leading/trailing white spaces
- int biasStart = [query rangeOfRegex:@"^\\s*"].length;
- int biasEnd = [query rangeOfRegex:@"\\s*$"].length;
+ NSInteger biasStart = [query rangeOfRegex:@"^\\s*"].length;
+ NSInteger biasEnd = [query rangeOfRegex:@"\\s*$"].length;
queryRange.location += biasStart;
queryRange.length -= biasEnd+biasStart;
@@ -1035,7 +1035,7 @@
* Retrieve the range of the query for the passed index seen from a start position
* specified within the custom query text view.
*/
-- (NSRange)queryTextRangeForQuery:(int)anIndex startPosition:(long)position
+- (NSRange)queryTextRangeForQuery:(NSInteger)anIndex startPosition:(NSUInteger)position
{
SPSQLParser *customQueryParser;
NSArray *queries;
@@ -1063,7 +1063,7 @@
[queries release];
// Remove all leading white spaces
- int offset = [theQueryString rangeOfRegex:@"^(\\s*)"].length;
+ NSInteger offset = [theQueryString rangeOfRegex:@"^(\\s*)"].length;
theQueryRange.location += offset;
theQueryRange.length -= offset;
return theQueryRange;
@@ -1076,7 +1076,7 @@
* If lookBehind is set, returns the *previous* query, but only if the
* caret should be associated with the previous query based on whitespace.
*/
-- (NSString *)queryAtPosition:(long)position lookBehind:(BOOL *)doLookBehind
+- (NSString *)queryAtPosition:(NSUInteger)position lookBehind:(BOOL *)doLookBehind
{
BOOL lookBehind = *doLookBehind;
@@ -1214,7 +1214,7 @@
id tableColumn;
NSMutableArray *currentResult = [NSMutableArray array];
NSMutableArray *tempRow = [NSMutableArray array];
- int i;
+ NSInteger i;
//set field names as first line
while ( (tableColumn = [enumerator nextObject]) ) {
@@ -1341,12 +1341,12 @@
[database backtickQuotedString], [tableForColumn backtickQuotedString]]];
[theResult setReturnDataAsStrings:YES];
if ([theResult numOfRows]) [theResult dataSeek:0];
- int i;
+ NSInteger i;
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
theRow = [theResult fetchRowAsDictionary];
if ( [[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] ) {
for(field in columnsForFieldTableName) {
- id aValue = [dataRow objectAtIndex:[[field objectForKey:@"datacolumnindex"] intValue]];
+ id aValue = [dataRow objectAtIndex:[[field objectForKey:@"datacolumnindex"] integerValue]];
if([[field objectForKey:@"org_name"] isEqualToString:[theRow objectForKey:@"Field"]]) {
[fieldIDQueryStr appendFormat:@"%@.%@.%@ = %@)",
[database backtickQuotedString],
@@ -1361,7 +1361,7 @@
// If there is no primary key, all found fields belonging to the same table are used in the argument
for(field in columnsForFieldTableName) {
- id aValue = [dataRow objectAtIndex:[[field objectForKey:@"datacolumnindex"] intValue]];
+ id aValue = [dataRow objectAtIndex:[[field objectForKey:@"datacolumnindex"] integerValue]];
if ([aValue isKindOfClass:[NSNull class]] || [aValue isNSNull]) {
[fieldIDQueryStr appendFormat:@"%@ IS NULL", [[field objectForKey:@"org_name"] backtickQuotedString]];
} else {
@@ -1410,7 +1410,7 @@
// For NULL cell's display the user's NULL value placeholder in grey to easily distinguish it from other values
if ([cell respondsToSelector:@selector(setTextColor:)]) {
- NSUInteger columnIndex = [[aTableColumn identifier] intValue];
+ NSUInteger columnIndex = [[aTableColumn identifier] integerValue];
id theValue = nil;
// While the table is being loaded, additional validation is required - data
@@ -1445,7 +1445,7 @@
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if (aTableView == customQueryView) {
- NSUInteger columnIndex = [[aTableColumn identifier] intValue];
+ NSUInteger columnIndex = [[aTableColumn identifier] integerValue];
id theValue = nil;
// While the table is being loaded, additional validation is required - data
@@ -1512,7 +1512,7 @@
// NSString *fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn];
// Check if the IDstring identifies the current field bijectively
- int numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] intValue];
+ NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
if(numberOfPossibleUpdateRows == 1) {
// [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
@@ -1572,8 +1572,8 @@
} else {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Updating field content failed. Couldn't identify field origin unambiguously (%d match%@). It's very likely that while editing this field the table `%@` was changed by an other user.", @"message of panel when error while updating field to db after enabling it"),
- numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?@"es":@"", tableForColumn]);
+ [NSString stringWithFormat:NSLocalizedString(@"Updating field content failed. Couldn't identify field origin unambiguously (%ld match%@). It's very likely that while editing this field the table `%@` was changed by an other user.", @"message of panel when error while updating field to db after enabling it"),
+ (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?@"es":@"", tableForColumn]);
}
@@ -1600,10 +1600,10 @@
}
if (sortField) [sortField release];
- sortField = [[NSNumber alloc] initWithInt:[[tableColumn identifier] intValue]];
+ sortField = [[NSNumber alloc] initWithInteger:[[tableColumn identifier] integerValue]];
// Order by the column position number to avoid ambiguous name errors
- NSString* newOrder = [NSString stringWithFormat:@" ORDER BY %i %@ ", [[tableColumn identifier] intValue]+1, (isDesc)?@"DESC":@"ASC"];
+ NSString* newOrder = [NSString stringWithFormat:@" ORDER BY %ld %@ ", (long)([[tableColumn identifier] integerValue]+1), (isDesc)?@"DESC":@"ASC"];
// Remove any comments
[queryString replaceOccurrencesOfRegex:@"--.*?\n" withString:@""];
@@ -1612,7 +1612,7 @@
// Remove all quoted strings as a temp string to match the correct clauses
NSRange matchedRange;
- int i;
+ NSInteger i;
NSMutableString *tmpString = [NSMutableString stringWithString:queryString];
NSMutableString *qq = [NSMutableString string];
matchedRange = [tmpString rangeOfRegex:@"\"(?:[^\"\\\\]*+|\\\\.)*\""];
@@ -1791,7 +1791,7 @@
// possible exceptions (eg for reloading tables etc.)
id theValue;
@try{
- theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(fullResult, row), [[aTableColumn identifier] intValue]);
+ theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(fullResult, row), [[aTableColumn identifier] integerValue]);
}
@catch(id ae) {
return nil;
@@ -1829,7 +1829,7 @@
BOOL noTableName = NO;
BOOL isFieldEditable;
BOOL isBlob;
- int numberOfPossibleUpdateRows = -1;
+ NSInteger numberOfPossibleUpdateRows = -1;
// Retrieve the column defintion
for(id c in cqColumnDefinition) {
@@ -1862,7 +1862,7 @@
fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
// Actual check whether field can be identified bijectively
- numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] intValue];
+ numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
isFieldEditable = (numberOfPossibleUpdateRows == 1) ? YES : NO;
@@ -1870,7 +1870,7 @@
if(numberOfPossibleUpdateRows == 0)
[errorText setStringValue:[NSString stringWithFormat:@"Field is not editable. No matching record found. Try to add the primary key field or more fields in your SELECT statement for table '%@' to identify field origin unambiguously.", tableForColumn]];
else
- [errorText setStringValue:[NSString stringWithFormat:@"Field is not editable. Couldn't identify field origin unambiguously (%d match%@).", numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?@"es":@""]];
+ [errorText setStringValue:[NSString stringWithFormat:@"Field is not editable. Couldn't identify field origin unambiguously (%ld match%@).", (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?@"es":@""]];
} else {
// no table/databse name are given
@@ -1889,9 +1889,9 @@
// Set max text length
if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]
&& [columnDefinition valueForKey:@"char_length"])
- [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] intValue]];
+ [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] integerValue]];
- id originalData = [[fullResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]];
+ id originalData = [[fullResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] integerValue]];
if ([originalData isNSNull]) originalData = [prefs objectForKey:SPNullValue];
id editData = [[fieldEditor editWithObject:originalData
@@ -1935,11 +1935,11 @@
if (![cqColumnDefinition count]) return;
// Retrieve the original index of the column from the identifier
- int columnIndex = [[[[aNotification userInfo] objectForKey:@"NSTableColumn"] identifier] intValue];
+ NSInteger columnIndex = [[[[aNotification userInfo] objectForKey:@"NSTableColumn"] identifier] integerValue];
NSDictionary *columnDefinition = NSArrayObjectAtIndex(cqColumnDefinition, columnIndex);
// Don't save if the column doesn't map to an underlying SQL field
- if (![columnDefinition objectForKey:@"org_name"] || ![[columnDefinition objectForKey:@"org_name"] length])
+ if (![columnDefinition objectForKey:@"org_name"] || ![(NSString *)[columnDefinition objectForKey:@"org_name"] length])
return;
NSMutableDictionary *tableColumnWidths;
@@ -1969,7 +1969,7 @@
}
// Save the column size
- [[[tableColumnWidths objectForKey:host_db] objectForKey:table] setObject:[NSNumber numberWithFloat:[[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:col];
+ [[[tableColumnWidths objectForKey:host_db] objectForKey:table] setObject:[NSNumber numberWithDouble:[(NSTableColumn *)[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:col];
[prefs setObject:tableColumnWidths forKey:SPTableColumnWidths];
}
@@ -2037,7 +2037,7 @@
BOOL isLookBehind = YES;
NSRange currentSelection = [textView selectedRange];
- long caretPosition = currentSelection.location;
+ NSUInteger caretPosition = currentSelection.location;
NSRange qRange = [self queryRangeAtPosition:caretPosition lookBehind:&isLookBehind];
// Highlight by setting a background color the current query
@@ -2150,7 +2150,7 @@
/*
* Defines max position of splitView
*/
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
if ( offset == 0 ) {
return proposedMax - 100;
@@ -2162,7 +2162,7 @@
/*
* Defines min position of splitView
*/
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
if ( offset == 0 ) {
return proposedMin + 100;
@@ -2181,7 +2181,7 @@
- (void)setMySQLversion:(NSString *)theVersion
{
mySQLversion = [[theVersion substringToIndex:3] retain];
- [textView setConnection:mySQLConnection withVersion:[[[mySQLversion componentsSeparatedByString:@"."] objectAtIndex:0] intValue]];
+ [textView setConnection:mySQLConnection withVersion:[[[mySQLversion componentsSeparatedByString:@"."] objectAtIndex:0] integerValue]];
}
@@ -2409,7 +2409,7 @@
- (void)openMySQLonlineDocumentationWithString:(NSString *)searchString
{
NSString *version = nil;
- if([[mySQLversion stringByReplacingOccurrencesOfString:@"." withString:@""] intValue] < 42)
+ if([[mySQLversion stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue] < 42)
version = @"41";
else
version = [mySQLversion stringByReplacingOccurrencesOfString:@"." withString:@""];
@@ -2477,7 +2477,7 @@
// detect and generate http links
aRange = NSMakeRange(0,0);
- int safeCnt = 0; // safety counter - not more than 200 loops allowed
+ NSInteger safeCnt = 0; // safety counter - not more than 200 loops allowed
while(1){
aRange = [desc rangeOfRegex:@"\\s((https?|ftp|file)://.*?html)" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1];
if(aRange.location != NSNotFound) {
@@ -2536,8 +2536,8 @@
}
}
} else { // list all found topics
- int i;
- int r = [theResult numOfRows];
+ NSInteger i;
+ NSInteger r = [theResult numOfRows];
if (r) [theResult dataSeek:0];
// check if HELP 'contents' is called
if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING])
@@ -2573,7 +2573,7 @@
*/
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
{
- int navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
+ NSInteger navigationType = [[actionInformation objectForKey:WebActionNavigationTypeKey] integerValue];
if([[[request URL] scheme] isEqualToString:@"applewebdata"] && navigationType == WebNavigationTypeLinkClicked){
[self showHelpFor:[[[request URL] path] lastPathComponent] addToHistory:YES calledByAutoHelp:NO];
@@ -2619,7 +2619,7 @@
NSMenuItem *menuItem = nil;
while (menuItem = [itemEnumerator nextObject])
{
- int tag = [menuItem tag];
+ NSInteger tag = [menuItem tag];
switch (tag)
{
case 2000: // WebMenuItemTagOpenLink
@@ -2812,7 +2812,7 @@
/**
* Called when the save query favorite/clear history sheet is dismissed.
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if ([contextInfo isEqualToString:@"clearHistory"]) {
diff --git a/Source/ICUTemplateMatcher.m b/Source/ICUTemplateMatcher.m
index dbeb49aa..8fcdb73c 100644
--- a/Source/ICUTemplateMatcher.m
+++ b/Source/ICUTemplateMatcher.m
@@ -81,7 +81,7 @@
NSString *matchType = nil;
NSRange mrkrSubRange = [matchString rangeOfRegex:regex options:RKLNoOptions inRange:localRange capture:1 error:NULL];
BOOL isMarker = (mrkrSubRange.length > 0); // only matches if match has marker-delimiters
- int offset = 0;
+ NSInteger offset = 0;
if (isMarker) {
matchType = MARKER_TYPE_MARKER;
} else {
@@ -99,7 +99,7 @@
NSArray *markerComponents = [self argumentsFromString:markerString];
if (markerComponents && [markerComponents count] > 0) {
[markerInfo setObject:[markerComponents objectAtIndex:0] forKey:MARKER_NAME_KEY];
- int count = [markerComponents count];
+ NSInteger count = [markerComponents count];
if (count > 1) {
[markerInfo setObject:[markerComponents subarrayWithRange:NSMakeRange(1, count - 1)]
forKey:MARKER_ARGUMENTS_KEY];
@@ -130,7 +130,7 @@
NSArray *filterComponents = [self argumentsFromString:filterString];
if (filterComponents && [filterComponents count] > 0) {
[markerInfo setObject:[filterComponents objectAtIndex:0] forKey:MARKER_FILTER_KEY];
- int count = [filterComponents count];
+ NSInteger count = [filterComponents count];
if (count > 1) {
[markerInfo setObject:[filterComponents subarrayWithRange:NSMakeRange(1, count - 1)]
forKey:MARKER_FILTER_ARGUMENTS_KEY];
@@ -151,7 +151,7 @@
NSString *argsPattern = @"\"(.*?)(?<!\\\\)\"|'(.*?)(?<!\\\\)'|(\\S+)";
NSMutableArray *args = [NSMutableArray array];
- int location = 0;
+ NSInteger location = 0;
while (location != NSNotFound) {
NSRange searchRange = NSMakeRange(location, [argString length] - location);
NSRange entireRange = [argString rangeOfRegex:argsPattern options:RKLNoOptions
diff --git a/Source/ImageAndTextCell.h b/Source/ImageAndTextCell.h
index f652d3fe..a7728552 100644
--- a/Source/ImageAndTextCell.h
+++ b/Source/ImageAndTextCell.h
@@ -45,7 +45,7 @@
{
@private
NSImage *image;
- int _indentationLevel;
+ NSInteger _indentationLevel;
}
- (void)setImage:(NSImage *)anImage;
@@ -54,7 +54,7 @@
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
- (NSSize)cellSize;
-- (void)setIndentationLevel:(int)level;
-- (int)IndentationLevel;
+- (void)setIndentationLevel:(NSInteger)level;
+- (NSInteger)IndentationLevel;
@end
diff --git a/Source/ImageAndTextCell.m b/Source/ImageAndTextCell.m
index ddcf05d7..d67b45be 100644
--- a/Source/ImageAndTextCell.m
+++ b/Source/ImageAndTextCell.m
@@ -66,7 +66,7 @@
[super editWithFrame:aRect inView: controlView editor:textObj delegate:anObject event:theEvent];
}
-- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength
+- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength
{
if (_indentationLevel != 0) {
NSRect indentationFrame;
@@ -167,12 +167,12 @@
return cellSize;
}
-- (void)setIndentationLevel:(int)level
+- (void)setIndentationLevel:(NSInteger)level
{
_indentationLevel = MAX(0,level);
}
-- (int)IndentationLevel
+- (NSInteger)IndentationLevel
{
return _indentationLevel;
}
diff --git a/Source/MGTemplateEngine.h b/Source/MGTemplateEngine.h
index f0eb9a43..629b235c 100644
--- a/Source/MGTemplateEngine.h
+++ b/Source/MGTemplateEngine.h
@@ -55,8 +55,8 @@
@private
NSMutableArray *_openBlocksStack;
NSMutableDictionary *_globals;
- int _outputDisabledCount;
- int _templateLength;
+ NSInteger _outputDisabledCount;
+ NSInteger _templateLength;
NSMutableDictionary *_filters;
NSMutableDictionary *_markers;
NSMutableDictionary *_templateVariables;
diff --git a/Source/MGTemplateEngine.m b/Source/MGTemplateEngine.m
index bf99afec..86068b66 100644
--- a/Source/MGTemplateEngine.m
+++ b/Source/MGTemplateEngine.m
@@ -32,7 +32,7 @@
- (NSObject *)valueForVariable:(NSString *)var parent:(NSObject **)parent parentKey:(NSString **)parentKey;
- (void)setValue:(NSObject *)newValue forVariable:(NSString *)var forceCurrentStackFrame:(BOOL)inStackFrame;
-- (void)reportError:(NSString *)errorStr code:(int)code continuing:(BOOL)continuing;
+- (void)reportError:(NSString *)errorStr code:(NSInteger)code continuing:(BOOL)continuing;
- (void)reportBlockBoundaryStarted:(BOOL)started;
- (void)reportTemplateProcessingFinished;
@@ -174,7 +174,7 @@
#pragma mark Delegate
-- (void)reportError:(NSString *)errorStr code:(int)code continuing:(BOOL)continuing
+- (void)reportError:(NSString *)errorStr code:(NSInteger)code continuing:(BOOL)continuing
{
if (delegate) {
NSString *errStr = NSLocalizedString(errorStr, nil);
@@ -286,11 +286,11 @@
}
} else {
// Try iterative checking for array indices.
- int numKeys = [dotBits count];
+ NSInteger numKeys = [dotBits count];
if (numKeys > 1) { // otherwise no point in checking
NSObject *thisParent = currObj;
NSString *thisKey = nil;
- for (int i = 0; i < numKeys; i++) {
+ for (NSInteger i = 0; i < numKeys; i++) {
thisKey = [dotBits objectAtIndex:i];
NSObject *newObj = nil;
@try {
@@ -306,7 +306,7 @@
NSString *digits;
BOOL scanned = [scanner scanCharactersFromSet:numbersSet intoString:&digits];
if (scanned && digits && [digits length] > 0) {
- int index = [digits intValue];
+ NSInteger index = [digits integerValue];
if (index >= 0 && index < [((NSArray *)currObj) count]) {
newObj = [((NSArray *)currObj) objectAtIndex:index];
}
@@ -343,7 +343,7 @@
if (!inStackFrame && currValue && (currValue != newValue)) {
// Set new value appropriately.
if ([parent isKindOfClass:[NSMutableArray class]]) {
- [(NSMutableArray *)parent replaceObjectAtIndex:[parentKey intValue] withObject:newValue];
+ [(NSMutableArray *)parent replaceObjectAtIndex:[parentKey integerValue] withObject:newValue];
} else {
// Try using setValue:forKey:
@try {
@@ -618,10 +618,10 @@ but current block was started by \"%@\" marker",
}
// Check to see if there are open blocks left over.
- int openBlocks = [_openBlocksStack count];
+ NSInteger openBlocks = [_openBlocksStack count];
if (openBlocks > 0) {
- NSString *errMsg = [NSString stringWithFormat:@"Finished processing template, but %d %@ left open (%@).",
- openBlocks,
+ NSString *errMsg = [NSString stringWithFormat:@"Finished processing template, but %ld %@ left open (%@).",
+ (long)openBlocks,
(openBlocks == 1) ? @"block was" : @"blocks were",
[[_openBlocksStack valueForKeyPath:BLOCK_NAME_KEY] componentsJoinedByString:@", "]];
[self reportError:errMsg code:6 continuing:YES];
diff --git a/Source/MGTemplateStandardFilters.m b/Source/MGTemplateStandardFilters.m
index 45f1d51d..1453d949 100644
--- a/Source/MGTemplateStandardFilters.m
+++ b/Source/MGTemplateStandardFilters.m
@@ -68,10 +68,11 @@
return @"000000";
const CGFloat *components = CGColorGetComponents(color);
+#warning 64BIT: Check formatting arguments
NSString *colorHex = [NSString stringWithFormat:@"%02x%02x%02x",
- (int)(components[0] * 255),
- (int)(components[1] * 255),
- (int)(components[2] * 255)];
+ (NSInteger)(components[0] * 255),
+ (NSInteger)(components[1] * 255),
+ (NSInteger)(components[2] * 255)];
return colorHex;
#else
NSColor *color = [(NSColor *)value colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
diff --git a/Source/MGTemplateStandardMarkers.h b/Source/MGTemplateStandardMarkers.h
index 2830197a..975f9a05 100644
--- a/Source/MGTemplateStandardMarkers.h
+++ b/Source/MGTemplateStandardMarkers.h
@@ -18,7 +18,7 @@
}
- (BOOL)currentBlock:(NSDictionary *)blockInfo matchesTopOfStack:(NSMutableArray *)stack;
-- (BOOL)argIsNumeric:(NSString *)arg intValue:(int *)val checkVariables:(BOOL)checkVars;
+- (BOOL)argIsNumeric:(NSString *)arg intValue:(NSInteger *)val checkVariables:(BOOL)checkVars;
- (BOOL)argIsTrue:(NSString *)arg;
@end
diff --git a/Source/MGTemplateStandardMarkers.m b/Source/MGTemplateStandardMarkers.m
index df4fcf3e..1bf00f7c 100644
--- a/Source/MGTemplateStandardMarkers.m
+++ b/Source/MGTemplateStandardMarkers.m
@@ -158,7 +158,7 @@
BOOL valid = NO;
NSString *startArg = [args objectAtIndex:0];
NSString *endArg = [args objectAtIndex:2];
- int startIndex, endIndex;
+ NSInteger startIndex, endIndex;
if (isRange) {
// Check to see if either the arg itself is numeric, or it corresponds to a numeric variable.
valid = [self argIsNumeric:startArg intValue:&startIndex checkVariables:YES];
@@ -194,11 +194,11 @@
[forStack addObject:stackFrame];
// Set up variables for the block.
- int currentIndex = (reversed) ? endIndex : startIndex;
+ NSInteger currentIndex = (reversed) ? endIndex : startIndex;
NSMutableDictionary *loopVars = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:startIndex], FOR_LOOP_START_INDEX,
- [NSNumber numberWithInt:endIndex], FOR_LOOP_END_INDEX,
- [NSNumber numberWithInt:currentIndex], FOR_LOOP_CURR_INDEX,
+ [NSNumber numberWithInteger:startIndex], FOR_LOOP_START_INDEX,
+ [NSNumber numberWithInteger:endIndex], FOR_LOOP_END_INDEX,
+ [NSNumber numberWithInteger:currentIndex], FOR_LOOP_CURR_INDEX,
[NSNumber numberWithBool:reversed], FOR_REVERSE,
nil];
NSMutableDictionary *blockVars = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@@ -265,7 +265,7 @@
BOOL reversed = [[loopVars objectForKey:FOR_REVERSE] boolValue];
NSEnumerator *loopEnum = [frame objectForKey:FOR_STACK_ENUMERATOR];
NSObject *newEnumValue = nil;
- int currentIndex = [[loopVars objectForKey:FOR_LOOP_CURR_INDEX] intValue];
+ NSInteger currentIndex = [[loopVars objectForKey:FOR_LOOP_CURR_INDEX] integerValue];
if (loopEnum) {
// Enumerator type.
newEnumValue = [loopEnum nextObject];
@@ -275,12 +275,12 @@
} else {
// Range type.
if (reversed) {
- int minIndex = [[loopVars objectForKey:FOR_LOOP_START_INDEX] intValue];
+ NSInteger minIndex = [[loopVars objectForKey:FOR_LOOP_START_INDEX] integerValue];
if (currentIndex > minIndex) {
loop = YES;
}
} else {
- int maxIndex = [[loopVars objectForKey:FOR_LOOP_END_INDEX] intValue];
+ NSInteger maxIndex = [[loopVars objectForKey:FOR_LOOP_END_INDEX] integerValue];
if (currentIndex < maxIndex) {
loop = YES;
}
@@ -297,7 +297,7 @@
} else {
currentIndex++;
}
- [loopVars setObject:[NSNumber numberWithInt:currentIndex] forKey:FOR_LOOP_CURR_INDEX];
+ [loopVars setObject:[NSNumber numberWithInteger:currentIndex] forKey:FOR_LOOP_CURR_INDEX];
// Set new val for enumVar if specified
NSMutableDictionary *newVars = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@@ -359,7 +359,7 @@
NSString *secondArg = [args objectAtIndex:2];
BOOL firstTrue = [self argIsTrue:firstArg];
BOOL secondTrue = [self argIsTrue:secondArg];
- int num1, num2;
+ NSInteger num1, num2;
BOOL firstNumeric, secondNumeric;
firstNumeric = [self argIsNumeric:firstArg intValue:&num1 checkVariables:YES];
secondNumeric = [self argIsNumeric:secondArg intValue:&num2 checkVariables:YES];
@@ -513,17 +513,17 @@
NSMutableDictionary *cycle = [cycles objectForKey:rangeKey];
if (cycle) {
NSArray *vals = [cycle objectForKey:CYCLE_VALUES];
- int currIndex = [[cycle objectForKey:CYCLE_INDEX] intValue];
+ NSInteger currIndex = [[cycle objectForKey:CYCLE_INDEX] integerValue];
currIndex++;
if (currIndex >= [vals count]) {
currIndex = 0;
}
- [cycle setObject:[NSNumber numberWithInt:currIndex] forKey:CYCLE_INDEX];
+ [cycle setObject:[NSNumber numberWithInteger:currIndex] forKey:CYCLE_INDEX];
return [vals objectAtIndex:currIndex];
} else {
// New cycle. Create and output appropriately.
cycle = [NSMutableDictionary dictionaryWithCapacity:2];
- [cycle setObject:[NSNumber numberWithInt:0] forKey:CYCLE_INDEX];
+ [cycle setObject:[NSNumber numberWithInteger:0] forKey:CYCLE_INDEX];
[cycle setObject:args forKey:CYCLE_VALUES];
[cycles setObject:cycle forKey:rangeKey];
return [args objectAtIndex:0];
@@ -575,20 +575,20 @@
}
-- (BOOL)argIsNumeric:(NSString *)arg intValue:(int *)val checkVariables:(BOOL)checkVars
+- (BOOL)argIsNumeric:(NSString *)arg intValue:(NSInteger *)val checkVariables:(BOOL)checkVars
{
BOOL numeric = NO;
- int value = 0;
+ NSInteger value = 0;
if (arg && [arg length] > 0) {
- if ([[arg substringToIndex:1] isEqualToString:@"0"] || [arg intValue] != 0) {
+ if ([[arg substringToIndex:1] isEqualToString:@"0"] || [arg integerValue] != 0) {
numeric = YES;
- value = [arg intValue];
+ value = [arg integerValue];
} else if (checkVars) {
// Check to see if arg is a variable with an intValue.
NSObject *argObj = [engine resolveVariable:arg];
NSString *argStr = [NSString stringWithFormat:@"%@", argObj];
- if (argObj && [argObj respondsToSelector:@selector(intValue)] &&
+ if (argObj && [argObj respondsToSelector:@selector(integerValue)] &&
[self argIsNumeric:argStr intValue:&value checkVariables:NO]) { // avoid recursion
numeric = YES;
}
diff --git a/Source/NSArray_DeepMutableCopy.m b/Source/NSArray_DeepMutableCopy.m
index 72f64c06..bad87655 100644
--- a/Source/NSArray_DeepMutableCopy.m
+++ b/Source/NSArray_DeepMutableCopy.m
@@ -14,7 +14,7 @@
- (NSMutableArray *)deepMutableCopy;
{
NSMutableArray *newArray;
- unsigned int index, count;
+ NSUInteger index, count;
count = [self count];
newArray = [[NSMutableArray allocWithZone:[self zone]] initWithCapacity:count];
diff --git a/Source/NSMutableArray-MultipleSort.m b/Source/NSMutableArray-MultipleSort.m
index f98732b7..e76f1409 100644
--- a/Source/NSMutableArray-MultipleSort.m
+++ b/Source/NSMutableArray-MultipleSort.m
@@ -15,17 +15,17 @@
@implementation NSMutableArray(MultipleSort)
- (void)sortArrayUsingSelector:(SEL)comparator withPairedMutableArrays:(NSMutableArray *)array1, ...
{
- unsigned int stride = 1;
+ NSUInteger stride = 1;
BOOL found = NO;
- unsigned int count = [self count];
- unsigned int d;
+ NSUInteger count = [self count];
+ NSUInteger d;
while (stride <= count)
stride = stride * STRIDE_FACTOR + 1;
while (stride > (STRIDE_FACTOR - 1)) {
stride = stride / STRIDE_FACTOR;
- for (unsigned int c = stride; c < count; c++) {
+ for (NSUInteger c = stride; c < count; c++) {
found = NO;
if (stride > c) break;
diff --git a/Source/NoodleLineNumberView.h b/Source/NoodleLineNumberView.h
index 85316dd0..45f33c00 100644
--- a/Source/NoodleLineNumberView.h
+++ b/Source/NoodleLineNumberView.h
@@ -41,7 +41,7 @@
NSColor *backgroundColor;
// Add support for selection by clicking/dragging
- unsigned dragSelectionStartLine;
+ NSUInteger dragSelectionStartLine;
}
- (id)initWithScrollView:(NSScrollView *)aScrollView;
@@ -58,8 +58,8 @@
- (void)setBackgroundColor:(NSColor *)color;
- (NSColor *)backgroundColor;
-- (unsigned)lineNumberForLocation:(float)location;
+- (NSUInteger)lineNumberForLocation:(CGFloat)location;
-- (unsigned)lineNumberForCharacterIndex:(unsigned)index inText:(NSString *)text;
+- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text;
@end
diff --git a/Source/NoodleLineNumberView.m b/Source/NoodleLineNumberView.m
index f6626eb5..1ba6e2f1 100644
--- a/Source/NoodleLineNumberView.m
+++ b/Source/NoodleLineNumberView.m
@@ -32,6 +32,7 @@
#import "NoodleLineNumberView.h"
#import "SPArrayAdditions.h"
+#include <tgmath.h>
#define DEFAULT_THICKNESS 22.0
#define RULER_MARGIN 5.0
@@ -182,9 +183,9 @@
[self setNeedsDisplay:YES];
}
-- (unsigned)lineNumberForLocation:(float)location
+- (NSUInteger)lineNumberForLocation:(CGFloat)location
{
- unsigned line, count, index, rectCount, i;
+ NSUInteger line, count, index, rectCount, i;
NSRectArray rects;
NSRect visibleRect;
NSLayoutManager *layoutManager;
@@ -209,7 +210,7 @@
for (line = 0; line < count; line++)
{
- index = [NSArrayObjectAtIndex(lines, line) unsignedIntValue];
+ index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
withinSelectedCharacterRange:nullRange
@@ -236,9 +237,9 @@
if ([view isKindOfClass:[NSTextView class]])
{
- unsigned index, numberOfLines, stringLength, lineEnd, contentEnd;
+ NSUInteger index, numberOfLines, stringLength, lineEnd, contentEnd;
NSString *text;
- float oldThickness, newThickness;
+ CGFloat oldThickness, newThickness;
text = [view string];
stringLength = [text length];
@@ -255,7 +256,7 @@
do
{
- [lineIndices addObject:[NSNumber numberWithUnsignedInt:index]];
+ [lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]];
index = NSMaxRange([text lineRangeForRange:NSMakeRange(index, 0)]);
numberOfLines++;
@@ -263,10 +264,10 @@
while (index < stringLength);
// Check if text ends with a new line.
- [text getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] unsignedIntValue], 0)];
+ [text getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] unsignedIntegerValue], 0)];
if (contentEnd < lineEnd)
{
- [lineIndices addObject:[NSNumber numberWithUnsignedInt:index]];
+ [lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]];
}
oldThickness = [self ruleThickness];
@@ -287,9 +288,9 @@
}
}
-- (unsigned)lineNumberForCharacterIndex:(unsigned)index inText:(NSString *)text
+- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text
{
- unsigned left, right, mid, lineStart;
+ NSUInteger left, right, mid, lineStart;
NSMutableArray *lines;
lines = [self lineIndices];
@@ -301,7 +302,7 @@
while ((right - left) > 1)
{
mid = (right + left) / 2;
- lineStart = [NSArrayObjectAtIndex(lines, mid) unsignedIntValue];
+ lineStart = [NSArrayObjectAtIndex(lines, mid) unsignedIntegerValue];
if (index < lineStart)
{
@@ -327,14 +328,14 @@
nil];
}
-- (float)requiredThickness
+- (CGFloat)requiredThickness
{
- unsigned lineCount, digits, i;
+ NSUInteger lineCount, digits, i;
NSMutableString *sampleString;
NSSize stringSize;
lineCount = [[self lineIndices] count];
- digits = (unsigned)log10(lineCount) + 1;
+ digits = (NSUInteger)log10(lineCount) + 1;
sampleString = [NSMutableString string];
for (i = 0; i < digits; i++)
{
@@ -348,7 +349,7 @@
// Round up the value. There is a bug on 10.4 where the display gets all wonky when scrolling if you don't
// return an integral value here.
- return ceilf(MAX(DEFAULT_THICKNESS, stringSize.width + RULER_MARGIN * 2));
+ return ceil(MAX(DEFAULT_THICKNESS, stringSize.width + RULER_MARGIN * 2));
}
- (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
@@ -376,9 +377,9 @@
NSRect visibleRect;
NSRange range, glyphRange, nullRange;
NSString *text, *labelText;
- unsigned rectCount, index, line, count;
+ NSUInteger rectCount, index, line, count;
NSRectArray rects;
- float ypos, yinset;
+ CGFloat ypos, yinset;
NSDictionary *textAttributes, *currentTextAttributes;
NSSize stringSize;
NSMutableArray *lines;
@@ -407,7 +408,7 @@
for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
{
- index = [NSArrayObjectAtIndex(lines, line) unsignedIntValue];
+ index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
if (NSLocationInRange(index, range))
{
@@ -423,7 +424,7 @@
ypos = yinset + NSMinY(rects[0]) - NSMinY(visibleRect);
// Line numbers are internally stored starting at 0
- labelText = [NSString stringWithFormat:@"%d", line + 1];
+ labelText = [NSString stringWithFormat:@"%lu", (unsigned long)(line + 1)];
stringSize = [labelText sizeWithAttributes:textAttributes];
@@ -448,7 +449,7 @@
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint location;
- unsigned line;
+ NSUInteger line;
NSTextView *view;
if (![[self clientView] isKindOfClass:[NSTextView class]]) return;
@@ -460,12 +461,12 @@
if (line != NSNotFound)
{
- unsigned int selectionStart, selectionEnd;
+ NSUInteger selectionStart, selectionEnd;
NSMutableArray *lines = [self lineIndices];
- selectionStart = [[lines objectAtIndex:(line - 1)] unsignedIntValue];
+ selectionStart = [[lines objectAtIndex:(line - 1)] unsignedIntegerValue];
if (line < [lines count]) {
- selectionEnd = [[lines objectAtIndex:line] unsignedIntValue];
+ selectionEnd = [[lines objectAtIndex:line] unsignedIntegerValue];
} else {
selectionEnd = [[view string] length];
}
@@ -476,7 +477,7 @@
- (void)mouseDragged:(NSEvent *)theEvent
{
NSPoint location;
- unsigned line, startLine, endLine;
+ NSUInteger line, startLine, endLine;
NSTextView *view;
if (![[self clientView] isKindOfClass:[NSTextView class]] || dragSelectionStartLine == NSNotFound) return;
@@ -487,7 +488,7 @@
if (line != NSNotFound)
{
- unsigned int selectionStart, selectionEnd;
+ NSUInteger selectionStart, selectionEnd;
NSMutableArray *lines = [self lineIndices];
if (line >= dragSelectionStartLine) {
startLine = dragSelectionStartLine;
@@ -497,9 +498,9 @@
endLine = dragSelectionStartLine;
}
- selectionStart = [[lines objectAtIndex:(startLine - 1)] unsignedIntValue];
+ selectionStart = [[lines objectAtIndex:(startLine - 1)] unsignedIntegerValue];
if (endLine < [lines count]) {
- selectionEnd = [[lines objectAtIndex:endLine] unsignedIntValue];
+ selectionEnd = [[lines objectAtIndex:endLine] unsignedIntegerValue];
} else {
selectionEnd = [[view string] length];
}
diff --git a/Source/QLPreviewPanel.h b/Source/QLPreviewPanel.h
index 51e85e19..c72b0fa2 100644
--- a/Source/QLPreviewPanel.h
+++ b/Source/QLPreviewPanel.h
@@ -32,7 +32,7 @@
+ (id)sharedPreviewPanel;
+ (id)_previewPanel;
+ (BOOL)isSharedPreviewPanelLoaded;
-- (id)initWithContentRect:(struct _NSRect)fp8 styleMask:(unsigned int)fp24 backing:(unsigned int)fp28 defer:(BOOL)fp32;
+- (id)initWithContentRect:(struct _NSRect)fp8 styleMask:(NSUInteger)fp24 backing:(NSUInteger)fp28 defer:(BOOL)fp32;
- (id)initWithCoder:(id)fp8;
- (void)dealloc;
- (BOOL)isOpaque;
@@ -48,27 +48,27 @@
- (void)setAutosizesAndCenters:(BOOL)fp8;
- (BOOL)autosizesAndCenters;
- (void)makeKeyAndOrderFront:(id)fp8;
-- (void)makeKeyAndOrderFrontWithEffect:(int)fp8;
-- (void)makeKeyAndGoFullscreenWithEffect:(int)fp8;
-- (void)makeKeyAndOrderFrontWithEffect:(int)fp8 canClose:(BOOL)fp12;
-- (void)_makeKeyAndOrderFrontWithEffect:(int)fp8 canClose:(BOOL)fp12 willOpen:(BOOL)fp16 toFullscreen:(BOOL)fp20;
-- (int)openingEffect;
+- (void)makeKeyAndOrderFrontWithEffect:(NSInteger)fp8;
+- (void)makeKeyAndGoFullscreenWithEffect:(NSInteger)fp8;
+- (void)makeKeyAndOrderFrontWithEffect:(NSInteger)fp8 canClose:(BOOL)fp12;
+- (void)_makeKeyAndOrderFrontWithEffect:(NSInteger)fp8 canClose:(BOOL)fp12 willOpen:(BOOL)fp16 toFullscreen:(BOOL)fp20;
+- (NSInteger)openingEffect;
- (void)closePanel;
- (void)close;
-- (void)closeWithEffect:(int)fp8;
-- (void)closeWithEffect:(int)fp8 canReopen:(BOOL)fp12;
-- (void)_closeWithEffect:(int)fp8 canReopen:(BOOL)fp12;
+- (void)closeWithEffect:(NSInteger)fp8;
+- (void)closeWithEffect:(NSInteger)fp8 canReopen:(BOOL)fp12;
+- (void)_closeWithEffect:(NSInteger)fp8 canReopen:(BOOL)fp12;
- (void)windowEffectDidTerminate:(id)fp8;
- (void)_close:(id)fp8;
- (void)sendEvent:(id)fp8;
- (void)selectNextItem;
- (void)selectPreviousItem;
-- (void)setURLs:(id)fp8 currentIndex:(unsigned int)fp12 preservingDisplayState:(BOOL)fp16;
+- (void)setURLs:(id)fp8 currentIndex:(NSUInteger)fp12 preservingDisplayState:(BOOL)fp16;
- (void)setURLs:(id)fp8 preservingDisplayState:(BOOL)fp12;
- (void)setURLs:(id)fp8;
- (id)URLs;
-- (unsigned int)indexOfCurrentURL;
-- (void)setIndexOfCurrentURL:(unsigned int)fp8;
+- (NSUInteger)indexOfCurrentURL;
+- (void)setIndexOfCurrentURL:(NSUInteger)fp8;
- (void)setDelegate:(id)fp8;
- (id)sharedPreviewView;
- (void)setSharedPreviewView:(id)fp8;
diff --git a/Source/RegexKitLite.h b/Source/RegexKitLite.h
index 0161a713..920cb439 100644
--- a/Source/RegexKitLite.h
+++ b/Source/RegexKitLite.h
@@ -63,7 +63,7 @@ extern "C" {
#define _RKL_VERSION_STRING(a,b) _RKL_JOIN_VERSION(a,b)
#define REGEXKITLITE_VERSION_MAJOR 3
-#define REGEXKITLITE_VERSION_MINOR 0
+#define REGEXKITLITE_VERSION_MINOR 3
#define REGEXKITLITE_VERSION_CSTRING _RKL_VERSION_STRING(REGEXKITLITE_VERSION_MAJOR, REGEXKITLITE_VERSION_MINOR)
#define REGEXKITLITE_VERSION_NSSTRING @REGEXKITLITE_VERSION_CSTRING
diff --git a/Source/RegexKitLite.m b/Source/RegexKitLite.m
index 5c89139d..d8e4ba21 100644
--- a/Source/RegexKitLite.m
+++ b/Source/RegexKitLite.m
@@ -52,7 +52,12 @@
#define RKL_STRONG_REF
#endif // __OBJC_GC__
+#if (defined(TARGET_OS_EMBEDDED) && (TARGET_OS_EMBEDDED != 0)) || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0)) || (defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050))
#include <objc/runtime.h>
+#else
+#include <objc/objc-runtime.h>
+#endif
+
#include <libkern/OSAtomic.h>
#include <mach-o/loader.h>
#include <AvailabilityMacros.h>
@@ -113,10 +118,10 @@
#define RKL_PREFETCH(ptr) __builtin_prefetch(ptr)
#define RKL_PREFETCH_UNICHAR(ptr, off) { const char *p = ((const char *)(ptr)) + ((off) * sizeof(UniChar)) + RKL_CACHE_LINE_SIZE; RKL_PREFETCH(p); RKL_PREFETCH(p + RKL_CACHE_LINE_SIZE); }
#define RKL_HAVE_CLEANUP
-#define RKL_CLEANUP(func) __attribute__((cleanup(func)))
+#define RKL_CLEANUP(func) RKL_ATTRIBUTES(cleanup(func))
#else // defined (__GNUC__) && (__GNUC__ >= 4)
#define RKL_ATTRIBUTES(attr, ...)
-#define RKL_EXPECTED(cond, expect) cond
+#define RKL_EXPECTED(cond, expect) (cond)
#define RKL_PREFETCH(ptr)
#define RKL_PREFETCH_UNICHAR(ptr, off)
#define RKL_CLEANUP(func)
@@ -164,10 +169,10 @@
RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) RKL_ATTRIBUTES(warn_unused_result);
RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) { return((((cin.location - win.location) <= win.length) && ((NSMaxRange(cin) - win.location) <= win.length)) ? YES : NO); }
-#define NSMakeRange(loc, len) ((NSRange){.location=(NSUInteger)(loc), .length=(NSUInteger)(len)})
-#define CFMakeRange(loc, len) ((CFRange){.location= (CFIndex)(loc), .length= (CFIndex)(len)})
-#define NSNotFoundRange ((NSRange){.location= NSNotFound, .length= 0UL})
-#define NSMaxiumRange ((NSRange){.location= 0UL, .length= NSUIntegerMax})
+#define NSMakeRange(loc, len) ((NSRange){.location=(NSUInteger)(loc), .length=(NSUInteger)(len)})
+#define CFMakeRange(loc, len) ((CFRange){.location= (CFIndex)(loc), .length= (CFIndex)(len)})
+#define NSNotFoundRange ((NSRange){.location=(NSUInteger)NSNotFound, .length= 0UL})
+#define NSMaxiumRange ((NSRange){.location= 0UL, .length= NSUIntegerMax})
////////////
#pragma mark -
@@ -192,11 +197,11 @@ NSString * const RKLICURegexRegexOptionsErrorKey = @"RKLICURegexRegexOptions";
// In general, the ICU bits and pieces here must exactly match the definition in the ICU sources.
-#define U_ZERO_ERROR 0
-#define U_INDEX_OUTOFBOUNDS_ERROR 8
-#define U_BUFFER_OVERFLOW_ERROR 15
-
-#define U_PARSE_CONTEXT_LEN 16
+#define U_STRING_NOT_TERMINATED_WARNING -124
+#define U_ZERO_ERROR 0
+#define U_INDEX_OUTOFBOUNDS_ERROR 8
+#define U_BUFFER_OVERFLOW_ERROR 15
+#define U_PARSE_CONTEXT_LEN 16
typedef struct uregex uregex; // Opaque ICU regex type.
@@ -277,10 +282,10 @@ static RKL_STRONG_REF void *scratchBuffer[(RKL_SCRATCH_BUFFERS)]; // Used to hol
// The split strings are created, but not autoreleased. The (immutable) array is created using these callbacks, which skips the CFRetain() call, effectively transferring ownership to the CFArray object.
// For each split string this saves the overhead of an autorelease, then an array retain, then an NSAutoreleasePool release. This is good for a ~30% speed increase.
-static void RKLCFArrayRelease (CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { CFRelease((CFTypeRef)ptr); }
-static CFArrayCallBacks transferOwnershipArrayCallBacks = { (CFIndex)0L, NULL, RKLCFArrayRelease, CFCopyDescription, CFEqual };
+static void RKLCFArrayRelease (CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { CFRelease((CFTypeRef)ptr); }
+static const CFArrayCallBacks rkl_transferOwnershipArrayCallBacks = { (CFIndex)0L, NULL, RKLCFArrayRelease, CFCopyDescription, CFEqual };
-#if defined(__OBJC_GC__) || defined(RKL_FORCE_GC)
+#ifdef __OBJC_GC__
////////////
#pragma mark -
#pragma mark Low-level Garbage Collection aware memory/resource allocation utilities
@@ -294,7 +299,7 @@ enum { RKLScannedOption = NSScannedOption };
// This allows for graceful failure should we find ourselves running on an earlier version of the OS without NSGarbageCollector.
static BOOL rkl_collectingEnabled_first (void);
static BOOL rkl_collectingEnabled_yes (void) { return(YES); }
-static BOOL rkl_collectingEnabled_no (void) { return(NO); }
+static BOOL rkl_collectingEnabled_no (void) { return(NO); }
static BOOL(*rkl_collectingEnabled) (void) = rkl_collectingEnabled_first;
static BOOL rkl_collectingEnabled_first (void) {
BOOL gcEnabled = ([objc_getClass("NSGarbageCollector") defaultCollector] != NULL) ? YES : NO;
@@ -318,18 +323,18 @@ static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInt
static void *rkl_realloc_std (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); }
static void *rkl_realloc_gc (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((*ptr = NSReallocateCollectable(*ptr, (NSUInteger)size, flags))); }
static void *(*rkl_realloc) (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(2,1) = rkl_realloc_first;
-static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((rkl_realloc = (rkl_collectingEnabled()==YES) ? rkl_realloc_gc : rkl_realloc_std)(ptr, size, flags)); }
+static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { if(rkl_collectingEnabled()==YES) { rkl_realloc = rkl_realloc_gc; } else { rkl_realloc = rkl_realloc_std; } return(rkl_realloc(ptr, size, flags)); }
// rkl_free()
static void * rkl_free_first (RKL_STRONG_REF void **ptr);
static void * rkl_free_std (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); }
-static void * rkl_free_gc (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { *ptr = NULL; } return(NULL); }
+static void * rkl_free_gc (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { *ptr = NULL; } return(NULL); }
static void *(*rkl_free) (RKL_STRONG_REF void **ptr) RKL_NONNULL_ARGS(1) = rkl_free_first;
-static void * rkl_free_first (RKL_STRONG_REF void **ptr) { return((rkl_free = (rkl_collectingEnabled()==YES) ? rkl_free_gc : rkl_free_std)(ptr)); }
+static void *rkl_free_first (RKL_STRONG_REF void **ptr) { if(rkl_collectingEnabled()==YES) { rkl_free = rkl_free_gc; } else { rkl_free = rkl_free_std; } return(rkl_free(ptr)); }
// rkl_CFAutorelease()
static id rkl_CFAutorelease_first (CFTypeRef obj);
-static id rkl_CFAutorelease_std (CFTypeRef obj) { return([(id)obj autorelease]); }
+static id rkl_CFAutorelease_std (CFTypeRef obj) { return([(id)obj autorelease]); }
static id rkl_CFAutorelease_gc (CFTypeRef obj) { return(NSMakeCollectable(obj)); }
static id(*rkl_CFAutorelease) (CFTypeRef obj) = rkl_CFAutorelease_first;
static id rkl_CFAutorelease_first (CFTypeRef obj) { return((rkl_CFAutorelease = (rkl_collectingEnabled()==YES) ? rkl_CFAutorelease_gc : rkl_CFAutorelease_std)(obj)); }
@@ -344,13 +349,13 @@ static id rkl_CreateStringWithSubstring_first (id string, NSRange range) { retu
// rkl_ReleaseObject()
static id rkl_ReleaseObject_first (id obj);
static id rkl_ReleaseObject_std (id obj) { CFRelease((CFTypeRef)obj); return(NULL); }
-static id rkl_ReleaseObject_gc (id obj RKL_UNUSED_ARG) { return(NULL); }
+static id rkl_ReleaseObject_gc (id obj RKL_UNUSED_ARG) { return(NULL); }
static id (*rkl_ReleaseObject) (id obj) RKL_NONNULL_ARGS(1) = rkl_ReleaseObject_first;
static id rkl_ReleaseObject_first (id obj) { return((rkl_ReleaseObject = (rkl_collectingEnabled()==YES) ? rkl_ReleaseObject_gc : rkl_ReleaseObject_std)(obj)); }
// rkl_CreateArrayWithObjects()
static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count);
-static id rkl_CreateArrayWithObjects_std (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); }
+static id rkl_CreateArrayWithObjects_std (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &rkl_transferOwnershipArrayCallBacks)); }
static id rkl_CreateArrayWithObjects_gc (void **objects, NSUInteger count) { return([NSArray arrayWithObjects:(const id *)objects count:count]); }
static id(*rkl_CreateArrayWithObjects) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateArrayWithObjects_first;
static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count) { return((rkl_CreateArrayWithObjects = (rkl_collectingEnabled()==YES) ? rkl_CreateArrayWithObjects_gc : rkl_CreateArrayWithObjects_std)(objects, count)); }
@@ -358,7 +363,7 @@ static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count) {
// rkl_CreateAutoreleasedArray()
static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count);
static id rkl_CreateAutoreleasedArray_std (void **objects, NSUInteger count) { return((id)rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); }
-static id rkl_CreateAutoreleasedArray_gc (void **objects, NSUInteger count) { return(rkl_CreateArrayWithObjects(objects, count)); }
+static id rkl_CreateAutoreleasedArray_gc (void **objects, NSUInteger count) { return( rkl_CreateArrayWithObjects(objects, count) ); }
static id(*rkl_CreateAutoreleasedArray) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateAutoreleasedArray_first;
static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count) { return((rkl_CreateAutoreleasedArray = (rkl_collectingEnabled()==YES) ? rkl_CreateAutoreleasedArray_gc : rkl_CreateAutoreleasedArray_std)(objects, count)); }
@@ -382,7 +387,7 @@ RKL_STATIC_INLINE id rkl_ReleaseObject (id obj)
RKL_STATIC_INLINE void *rkl_realloc (void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); }
RKL_STATIC_INLINE void *rkl_free (void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); }
RKL_STATIC_INLINE id rkl_CFAutorelease (CFTypeRef obj) { return([(id)obj autorelease]); }
-RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); }
+RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &rkl_transferOwnershipArrayCallBacks)); }
RKL_STATIC_INLINE id rkl_CreateAutoreleasedArray (void **objects, NSUInteger count) { return(rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); }
RKL_STATIC_INLINE id rkl_CreateStringWithSubstring (id string, NSRange range) { return((id)CFStringCreateWithSubstring(NULL, (CFStringRef)string, CFMakeRange((CFIndex)range.location, (CFIndex)range.length))); }
RKL_STATIC_INLINE id rkl_ReleaseObject (id obj) { CFRelease((CFTypeRef)obj); return(NULL); }
@@ -412,7 +417,7 @@ int32_t RKL_ICU_FUNCTION_APPEND(uregex_start) (uregex *regexp, i
#pragma mark -
#pragma mark RegexKitLite internal, private function prototypes
-static RKLCacheSlot *rkl_getCachedRegex (NSString *regexString, RKLRegexOptions options, NSError **error, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,4);
+static RKLCacheSlot *rkl_getCachedRegex (NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) RKL_NONNULL_ARGS_WARN_UNUSED(1,4);
static NSUInteger rkl_setCacheSlotToString (RKLCacheSlot *cacheSlot, const NSRange *range, int32_t *status, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,3,4);
static RKLCacheSlot *rkl_getCachedRegexSetToString (NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4,5,7,8);
static id rkl_performRegexOp (id self, SEL _cmd, RKLRegexOp regexOp, NSString *regexString, RKLRegexOptions options, NSInteger capture, id matchString, NSRange *matchRange, NSString *replacementString, NSError **error, void *result) RKL_NONNULL_ARGS(1,2);
@@ -425,7 +430,7 @@ static NSUInteger rkl_growFindRanges (RKLCacheSlot *cacheSlot, NSU
static NSArray *rkl_makeArray (RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4);
static NSString *rkl_replaceString (RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCount, NSUInteger replaceMutable, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,8,9);
-static int32_t rkl_replaceAll (RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,7,8);
+static int32_t rkl_replaceAll (RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, int32_t *needU16Capacity, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,6,7,8,9);
static NSUInteger rkl_isRegexValid (id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) RKL_NONNULL_ARGS(1,2);
@@ -487,16 +492,18 @@ static void rkl_RegisterForLowMemoryNotifications(void) RKL_ATTRIBUTES(used);
@implementation RKLLowMemoryWarningObserver
+(void)lowMemoryWarning:(id)notification {
if(OSSpinLockTry(&cacheSpinLock)) { rkl_clearStringCache(); OSSpinLockUnlock(&cacheSpinLock); }
- else { [[RKLLowMemoryWarningObserver class] performSelector:@selector(lowMemoryWarning:) withObject:NULL afterDelay:(NSTimeInterval)0.1]; }
+ else { [[RKLLowMemoryWarningObserver class] performSelector:@selector(lowMemoryWarning:) withObject:notification afterDelay:(NSTimeInterval)0.1]; }
}
@end
-static int rkl_HaveRegisteredForLowMemoryNotifications = 0;
+static volatile int rkl_HaveRegisteredForLowMemoryNotifications = 0;
__attribute__((constructor)) static void rkl_RegisterForLowMemoryNotifications(void) {
- void **memoryWarningNotification = NULL;
-
- if(OSAtomicCompareAndSwapIntBarrier(0, 1, &rkl_HaveRegisteredForLowMemoryNotifications)) {
+ _Bool didSwap = false;
+ void **memoryWarningNotification = NULL;
+
+ while((rkl_HaveRegisteredForLowMemoryNotifications == 0) && ((didSwap = OSAtomicCompareAndSwapIntBarrier(0, 1, &rkl_HaveRegisteredForLowMemoryNotifications)) == false)) { /* Allows for spurious CAS failures. */ }
+ if(didSwap == true) {
if((memoryWarningNotification = (void **)dlsym(RTLD_DEFAULT, "UIApplicationDidReceiveMemoryWarningNotification")) != NULL) {
[[NSNotificationCenter defaultCenter] addObserver:[RKLLowMemoryWarningObserver class] selector:@selector(lowMemoryWarning:) name:(NSString *)*memoryWarningNotification object:NULL];
}
@@ -586,12 +593,12 @@ static void rkl_dtrace_getRegexUTF8(CFStringRef str, char *utf8Buffer) {
// IMPORTANT! Should only be called with cacheSpinLock already locked!
// ----------
-static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions options, NSError **error, id *exception RKL_UNUSED_ASSERTION_ARG) {
+static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) {
RKLCacheSlot *cacheSlot = NULL;
CFHashCode regexHash = 0UL;
int32_t status = 0;
- RKLCDelayedAssert((cacheSpinLock != 0) && (regexString != NULL), exception, exitNow);
+ RKLCDelayedAssert((cacheSpinLock != (OSSpinLock)0) && (regexString != NULL), exception, exitNow);
// Fast path the common case where this regex is exactly the same one used last time.
// The pointer equality test is valid under these circumstances since the cacheSlot->regexString is an immutable copy.
@@ -600,9 +607,10 @@ static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions o
rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL);
return(lastCacheSlot);
}
-
- regexHash = CFHash((CFTypeRef)regexString);
- cacheSlot = &rkl_cacheSlots[(regexHash % (CFHashCode)(RKL_CACHE_SIZE))]; // Retrieve the cache slot for this regex.
+
+ lastCacheSlot = NULL;
+ regexHash = CFHash((CFTypeRef)regexString);
+ cacheSlot = &rkl_cacheSlots[(regexHash % (CFHashCode)(RKL_CACHE_SIZE))]; // Retrieve the cache slot for this regex.
// Return the cached entry if it's a match, otherwise clear the slot and create a new ICU regex in its place.
// If regexString is mutable, the pointer equality test will fail, and CFEqual() is used to determine true
@@ -612,7 +620,7 @@ static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions o
rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL);
return(cacheSlot);
}
-
+
rkl_clearCacheSlotRegex(cacheSlot);
if(RKL_EXPECTED((cacheSlot->regexString = CFStringCreateCopy(NULL, (CFStringRef)regexString)) == NULL, 0L)) { goto exitNow; } ; // Get a cheap immutable copy.
@@ -641,7 +649,7 @@ static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions o
exitNow:
if(RKL_EXPECTED(scratchBuffer[0] != NULL, 0L)) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); }
- if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L)) { cacheSlot = NULL; if(error != NULL) { *error = rkl_NSErrorForRegex(regexString, options, &parseError, status); } }
+ if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L)) { rkl_clearCacheSlotRegex(cacheSlot); cacheSlot = NULL; if(error != NULL) { *error = rkl_NSErrorForRegex(regexString, options, &parseError, status); } }
#ifdef _RKL_DTRACE_ENABLED
if(RKL_EXPECTED(cacheSlot != NULL, 1L)) { rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 0, status, NULL); }
@@ -671,10 +679,10 @@ static NSUInteger rkl_setCacheSlotToString(RKLCacheSlot *cacheSlot, const NSRang
NSUInteger useFixedBuffer = (cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? 1UL : 0UL;
RKLBuffer *buffer = useFixedBuffer ? &fixedBuffer : &dynamicBuffer;
rkl_dtrace_addLookupFlag(lookupResultFlags, (useFixedBuffer ? 0U : RKLDynamicBufferLookupFlag));
+
+ if((buffer->uniChar != NULL) && (cacheSlot->setToString == buffer->string) && (cacheSlot->setToLength == buffer->length) && (cacheSlot->setToHash == buffer->hash)) { rkl_dtrace_addLookupFlag(lookupResultFlags, RKLCacheHitLookupFlag); cacheSlot->setToUniChar = buffer->uniChar; goto setRegexText; }
- if((cacheSlot->setToUniChar != NULL) && ((cacheSlot->setToString == buffer->string) || ((cacheSlot->setToLength == buffer->length) && (cacheSlot->setToHash == buffer->hash)))) { rkl_dtrace_addLookupFlag(lookupResultFlags, RKLCacheHitLookupFlag); goto setRegexText; }
-
- if(RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) != NULL, 0L)) { cacheSlot->setToNeedsConversion = 0U; cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; goto setRegexText; }
+ if((cacheSlot->setToNeedsConversion == 1U) && RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) != NULL, 0L)) { cacheSlot->setToNeedsConversion = 0U; cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; goto setRegexText; }
rkl_clearBuffer(buffer, 0UL);
@@ -719,23 +727,24 @@ exitNow:
static RKLCacheSlot *rkl_getCachedRegexSetToString(NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) {
RKLCacheSlot *cacheSlot = NULL;
RKLCDelayedAssert((regexString != NULL) && (exception != NULL) && (status != NULL) && (matchLengthPtr != NULL), exception, exitNow);
-
+
// Fast path the common case where this regex is exactly the same one used last time.
- if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L)) { cacheSlot = lastCacheSlot; rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 1, 0, NULL); }
- else { if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegex(regexString, options, error, exception)) == NULL, 0L)) { goto exitNow; } }
-
+ if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L)) { cacheSlot = lastCacheSlot; rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 1, 0, NULL); }
+ else { lastCacheSlot = NULL; if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegex(regexString, options, error, exception)) == NULL, 0L)) { goto exitNow; } }
+ RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot == lastCacheSlot), exception, exitNow);
+
// Optimize the case where the string to search (matchString) is immutable and the setToString immutable copy is the same string with its reference count incremented.
NSUInteger isSetTo = ((cacheSlot->setToString != NULL) && (cacheSlot->setToString == (CFStringRef)matchString)) ? 1UL : 0UL;
CFIndex matchLength = ((isSetTo == 1UL) && (cacheSlot->setToIsImmutable == 1U)) ? cacheSlot->setToLength : CFStringGetLength((CFStringRef)matchString);
-
+
*matchLengthPtr = (NSUInteger)matchLength;
if(matchRange->length == NSUIntegerMax) { matchRange->length = (NSUInteger)matchLength; } // For convenience, allow NSUIntegerMax == string length.
if(RKL_EXPECTED((NSUInteger)matchLength < NSMaxRange(*matchRange), 0L)) { goto exitNow; } // The match range is out of bounds for the string. performRegexOp will catch and report the problem.
- if((cacheSlot->setToIsImmutable == 0U) && (cacheSlot->setToString != NULL) && ((cacheSlot->setToLength != CFStringGetLength(cacheSlot->setToString)) || (cacheSlot->setToHash != CFHash((CFTypeRef)cacheSlot->setToString)))) { isSetTo = 0UL; }
+ if((isSetTo == 1UL) && (cacheSlot->setToIsImmutable == 0U) && (cacheSlot->setToString != NULL) && ((cacheSlot->setToLength != CFStringGetLength(cacheSlot->setToString)) || (cacheSlot->setToHash != CFHash((CFTypeRef)cacheSlot->setToString)))) { isSetTo = 0UL; }
else { // If the first pointer equality check failed, check the hash and length.
- if(((isSetTo == 0UL) || (cacheSlot->setToIsImmutable == 0U)) && (cacheSlot->setToString != NULL)) { isSetTo = ((cacheSlot->setToLength == matchLength) && (cacheSlot->setToHash == CFHash((CFTypeRef)matchString))) ? 1UL : 0UL; }
+ if(((isSetTo == 0UL) || (cacheSlot->setToIsImmutable == 0U)) && (cacheSlot->setToString != NULL)) { isSetTo = ((cacheSlot->setToString == (CFStringRef)matchString) && (cacheSlot->setToLength == matchLength) && (cacheSlot->setToHash == CFHash((CFTypeRef)matchString))) ? 1UL : 0UL; }
if(isSetTo == 1UL) { if(RKL_EXPECTED(rkl_setCacheSlotToString(cacheSlot, matchRange, status, exception) == 0UL, 0L)) { cacheSlot = NULL; if(*exception == NULL) { *exception = (id)RKLCAssertDictionary(@"Failed to set up UTF16 buffer."); } } goto exitNow; }
}
@@ -783,7 +792,7 @@ static void rkl_cleanup_cacheSpinLockStatus(volatile NSUInteger *cacheSpinLockSt
NSUInteger cacheSpinLockStatus = *cacheSpinLockStatusPtr;
if(RKL_EXPECTED((cacheSpinLockStatus & RKLUnlockedCacheSpinLock) == 0UL, 0L) && RKL_EXPECTED((cacheSpinLockStatus & RKLLockedCacheSpinLock) != 0UL, 1L)) {
- if(cacheSpinLock != 0) {
+ if(cacheSpinLock != (OSSpinLock)0) {
if(didPrintForcedUnlockWarning == 0UL) { didPrintForcedUnlockWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that cacheSpinLock was locked, but for some reason it was not unlocked. Forcibly unlocking cacheSpinLock. Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); }
rkl_debugCacheSpinLock(); // Since this is an unusual condition, offer an attempt to catch it before we unlock.
OSSpinLockUnlock(&cacheSpinLock);
@@ -827,12 +836,12 @@ static id rkl_performRegexOp(id self, SEL _cmd, RKLRegexOp regexOp, NSString *re
if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegexSetToString(regexString, options, matchString, &stringU16Length, matchRange, error, &exception, &status)) == NULL, 0L)) { stringU16Length = (NSUInteger)CFStringGetLength((CFStringRef)matchString); }
if(RKL_EXPECTED(matchRange->length == NSUIntegerMax, 1L)) { matchRange->length = stringU16Length; } // For convenience.
- if(RKL_EXPECTED(stringU16Length < NSMaxRange(*matchRange), 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"Range or index out of bounds"); goto exitNow; }
- if(RKL_EXPECTED(stringU16Length >= (NSUInteger)INT_MAX, 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"String length exceeds INT_MAX"); goto exitNow; }
+ if(RKL_EXPECTED(stringU16Length < NSMaxRange(*matchRange), 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"Range or index out of bounds."); goto exitNow; }
+ if(RKL_EXPECTED(stringU16Length >= (NSUInteger)INT_MAX, 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"String length exceeds INT_MAX."); goto exitNow; }
if(((maskedRegexOp == RKLRangeOp) || (maskedRegexOp == RKLArrayOfStringsOp)) && RKL_EXPECTED(cacheSlot != NULL, 1L) && (RKL_EXPECTED(capture < 0L, 0L) || RKL_EXPECTED(capture > cacheSlot->captureCount, 0L)) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSInvalidArgumentException, @"The capture argument is not valid."); goto exitNow; }
if(RKL_EXPECTED(cacheSlot == NULL, 0L) || RKL_EXPECTED(status > U_ZERO_ERROR, 0L) || RKL_EXPECTED(exception != NULL, 0L)) { goto exitNow; }
- RKLCDelayedAssert((cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToString != NULL) && (cacheSlot->setToLength >= 0L) && (cacheSlot->setToUniChar != NULL) && ((CFIndex)NSMaxRange(cacheSlot->setToRange) <= cacheSlot->setToLength), &exception, exitNow);
+ RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToString != NULL) && (cacheSlot->setToLength >= 0L) && (cacheSlot->setToUniChar != NULL) && ((CFIndex)NSMaxRange(cacheSlot->setToRange) <= cacheSlot->setToLength), &exception, exitNow);
#ifndef NS_BLOCK_ASSERTIONS
if(cacheSlot->setToNeedsConversion == 0U) { RKLCDelayedAssert((cacheSlot->setToUniChar == CFStringGetCharactersPtr(cacheSlot->setToString)), &exception, exitNow); }
@@ -870,7 +879,7 @@ static id rkl_performRegexOp(id self, SEL _cmd, RKLRegexOp regexOp, NSString *re
exitNow:
OSSpinLockUnlock(&cacheSpinLock);
- cacheSpinLockStatus |= RKLUnlockedCacheSpinLock;
+ cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; // Warning about cacheSpinLockStatus never being read can be safely ignored.
if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L) && RKL_EXPECTED(exception == NULL, 0L)) { exception = rkl_NSExceptionForRegex(regexString, options, NULL, status); } // If we had a problem, prepare an exception to be thrown.
if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); } // If there is an exception, throw it at this point.
@@ -878,8 +887,11 @@ exitNow:
// This is done outside the cache lock and with the objc replaceCharactersInRange:withString: method because Core Foundation
// does not assert that the string we are attempting to update is actually a mutable string, whereas Foundation ensures
// the object receiving the message is a mutable string and throws an exception if we're attempting to modify an immutable string.
- if(RKL_EXPECTED(replaceMutable == 1UL, 0L) && RKL_EXPECTED(*((NSUInteger *)result) > 0UL, 1L)) { NSCParameterAssert(resultObject != NULL); [matchString replaceCharactersInRange:*matchRange withString:resultObject]; }
-
+ if(RKL_EXPECTED(status == U_ZERO_ERROR, 1L) && RKL_EXPECTED(resultObject != NULL, 1L) && RKL_EXPECTED(replaceMutable == 1UL, 0L) && RKL_EXPECTED(*((NSUInteger *)result) > 0UL, 1L)) { [matchString replaceCharactersInRange:*matchRange withString:resultObject]; }
+ // If status < U_ZERO_ERROR, consider it an error, even though status < U_ZERO_ERROR is a 'warning' in ICU nomenclature.
+ // status > U_ZERO_ERROR are an exception and handled above.
+ // http://sourceforge.net/tracker/?func=detail&atid=990188&aid=2890810&group_id=204582
+ if(RKL_EXPECTED(status < U_ZERO_ERROR, 0L) && RKL_EXPECTED(resultObject == NULL, 0L) && (error != NULL)) { *error = [NSError errorWithDomain:RKLICURegexErrorDomain code:(NSInteger)status userInfo:rkl_userInfoDictionary(regexString, options, NULL, status, @"The ICU library returned an unexpected error code.", @"NSLocalizedDescription", NULL)]; }
return(resultObject);
}
@@ -900,8 +912,8 @@ static void rkl_handleDelayedAssert(id self, SEL _cmd, id exception) {
static NSUInteger rkl_search(RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUInteger updateSearchRange, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) {
NSUInteger foundMatch = 0UL, searchEqualsEndOfRange = (RKL_EXPECTED(NSEqualRanges(*searchRange, NSMakeRange(NSMaxRange(cacheSlot->setToRange), 0UL)) == YES, 0L) ? 1UL : 0UL);
-
- if((NSEqualRanges(*searchRange, cacheSlot->lastFindRange) == YES) || (searchEqualsEndOfRange == 1UL)) { foundMatch = (((cacheSlot->lastMatchRange.location == NSNotFound) || (searchEqualsEndOfRange == 1UL)) ? 0UL : 1UL);}
+
+ if((NSEqualRanges(*searchRange, cacheSlot->lastFindRange) == YES) || (searchEqualsEndOfRange == 1UL)) { foundMatch = (((cacheSlot->lastMatchRange.location == (NSUInteger)NSNotFound) || (searchEqualsEndOfRange == 1UL)) ? 0UL : 1UL);}
else { // Only perform an expensive 'find' operation iff the current find range is different than the last find range.
NSUInteger findLocation = (searchRange->location - cacheSlot->setToRange.location);
RKLCDelayedAssert(((searchRange->location >= cacheSlot->setToRange.location)) && (NSRangeInsideRange(*searchRange, cacheSlot->setToRange) == YES) && (findLocation < INT_MAX) && (findLocation <= cacheSlot->setToRange.length), exception, exitNow);
@@ -923,7 +935,7 @@ static NSUInteger rkl_search(RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUI
finishedFind:
if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { foundMatch = 0UL; cacheSlot->lastFindRange = NSNotFoundRange; }
- if(foundMatch == 0UL) { cacheSlot->lastMatchRange = NSNotFoundRange; if(updateSearchRange == 1UL) { *searchRange = NSMakeRange(NSMaxRange(*searchRange), 0UL); } }
+ if(foundMatch == 0UL) { cacheSlot->lastFindRange = NSNotFoundRange; cacheSlot->lastMatchRange = NSNotFoundRange; if(updateSearchRange == 1UL) { *searchRange = NSMakeRange(NSMaxRange(*searchRange), 0UL); } }
else {
RKLCDelayedAssert(NSRangeInsideRange(cacheSlot->lastMatchRange, *searchRange) == YES, exception, exitNow);
if(updateSearchRange == 1UL) {
@@ -934,7 +946,9 @@ finishedFind:
}
}
+#ifndef NS_BLOCK_ASSERTIONS
exitNow:
+#endif
return(foundMatch);
}
@@ -944,7 +958,7 @@ exitNow:
static BOOL rkl_findRanges(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception, int32_t *status) {
BOOL returnWithError = YES;
- RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToRange.location != NSNotFound)) && (status != NULL) && ((findAll != NULL) && (findAll->found == 0L) && ((findAll->capacity >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL)) ? ((findAll->ranges != NULL) && (findAll->capacity > 0L) && (findAll->size > 0UL)) : 1)) && (findAll->rangesScratchBuffer != NULL) && ((findAll->capture >= 0L) && (findAll->capture <= cacheSlot->captureCount)))), exception, exitNow);
+ RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToRange.location != (NSUInteger)NSNotFound)) && (status != NULL) && ((findAll != NULL) && (findAll->found == 0L) && ((findAll->capacity >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL)) ? ((findAll->ranges != NULL) && (findAll->capacity > 0L) && (findAll->size > 0UL)) : 1)) && (findAll->rangesScratchBuffer != NULL) && ((findAll->capture >= 0L) && (findAll->capture <= cacheSlot->captureCount)))), exception, exitNow);
if(RKL_EXPECTED(cacheSlot->setToLength == 0L, 0L) || RKL_EXPECTED(cacheSlot->setToRange.length == 0UL, 0L)) { returnWithError = NO; goto exitNow; }
@@ -958,7 +972,7 @@ static BOOL rkl_findRanges(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindA
if(RKL_EXPECTED(findAll->found >= ((findAll->capacity - ((captureCount + 2L) * 4L)) - 4L), 0L)) { if(RKL_EXPECTED(rkl_growFindRanges(cacheSlot, lastLocation, findAll, exception) == 0UL, 0L)) { goto exitNow; } }
- RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES), exception, exitNow);
+ RKLCDelayedAssert((searchRange.location != (NSUInteger)NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES), exception, exitNow);
// This fixes a 'bug' that is also present in ICU's uregex_split(). 'Bug', in this case, means that the results of a split operation can differ from those that perl's split() creates for the same input.
// "I|at|ice I eat rice" split using the regex "\b\s*" demonstrates the problem. ICU bug http://bugs.icu-project.org/trac/ticket/6826
@@ -968,7 +982,7 @@ static BOOL rkl_findRanges(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindA
while((maskedRegexOp == RKLSplitOp) && RKL_EXPECTED(shouldBreak == 0L, 1L) && RKL_EXPECTED(cacheSlot->lastMatchRange.length == 0UL, 0L) && RKL_EXPECTED((cacheSlot->lastMatchRange.location - lastLocation) == 0UL, 0L));
if(RKL_EXPECTED(shouldBreak == 1L, 0L)) { break; }
- RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(searchRange, findAll->findInRange) == YES), exception, exitNow);
+ RKLCDelayedAssert((searchRange.location != (NSUInteger)NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(searchRange, findAll->findInRange) == YES), exception, exitNow);
RKLCDelayedAssert((NSRangeInsideRange(cacheSlot->lastFindRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, findAll->findInRange) == YES), exception, exitNow);
RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->capacity >= 0L) && ((findAll->found + (captureCount + 3L) + 1L) < (findAll->capacity - 2L)), exception, exitNow);
@@ -1109,19 +1123,20 @@ exitNow:
static NSString *rkl_replaceString(RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCountPtr, NSUInteger replaceMutable, id *exception, int32_t *status) {
uint64_t searchU16Length64 = (uint64_t)searchU16Length, replacementU16Length64 = (uint64_t)replacementU16Length;
- int32_t resultU16Length = 0, tempUniCharBufferU16Capacity = 0;
+ int32_t resultU16Length = 0, tempUniCharBufferU16Capacity = 0, needU16Capacity = 0;
UniChar *tempUniCharBuffer = NULL;
const UniChar *replacementUniChar = NULL;
id resultObject = NULL;
NSUInteger replacedCount = 0UL;
- if((RKL_EXPECTED(replacementU16Length64 >= (uint64_t)INT_MAX, 0L) || RKL_EXPECTED(((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) >= (uint64_t)INT_MAX, 0L))) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Replacement string length exceeds INT_MAX" userInfo:NULL]; goto exitNow; }
+ if((RKL_EXPECTED(replacementU16Length64 >= (uint64_t)INT_MAX, 0L) || RKL_EXPECTED(((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) >= (uint64_t)INT_MAX, 0L))) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Replacement string length exceeds INT_MAX." userInfo:NULL]; goto exitNow; }
RKLCDelayedAssert((searchU16Length64 < (uint64_t)INT_MAX) && (replacementU16Length64 < (uint64_t)INT_MAX) && (((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) < (uint64_t)INT_MAX), exception, exitNow);
// Zero order approximation of the buffer sizes for holding the replaced string or split strings and split strings pointer offsets. As UTF16 code units.
tempUniCharBufferU16Capacity = (int32_t)(16UL + (searchU16Length + (searchU16Length / 2UL)) + (replacementU16Length * 2UL));
-
+ RKLCDelayedAssert((tempUniCharBufferU16Capacity < INT_MAX) && (tempUniCharBufferU16Capacity > 0), exception, exitNow);
+
// Buffer sizes converted from native units to bytes.
size_t stackSize = 0UL, replacementSize = ((size_t)replacementU16Length * sizeof(UniChar)), tempUniCharBufferSize = ((size_t)tempUniCharBufferU16Capacity * sizeof(UniChar));
@@ -1138,23 +1153,28 @@ static NSString *rkl_replaceString(RKLCacheSlot *cacheSlot, id searchString, NSU
replacementUniChar = uniCharBuffer;
}
- resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status);
+ resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, &needU16Capacity, exception, status);
+ RKLCDelayedAssert((resultU16Length <= tempUniCharBufferU16Capacity) && (needU16Capacity >= resultU16Length) && (needU16Capacity >= 0), exception, exitNow);
+ if(RKL_EXPECTED(needU16Capacity >= INT_MAX, 0L)) { *exception = [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Replaced string length exceeds INT_MAX." userInfo:NULL]; goto exitNow; }
if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { // Our buffer guess(es) were too small. Resize the buffers and try again.
- tempUniCharBufferSize = ((size_t)(tempUniCharBufferU16Capacity = resultU16Length + 4) * sizeof(UniChar));
- if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; }
+ tempUniCharBufferSize = ((size_t)(tempUniCharBufferU16Capacity = needU16Capacity + 4) * sizeof(UniChar)); // Use needU16Capacity. Bug 2890810.
+ if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; } // Warning about stackSize can be safely ignored.
else { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], tempUniCharBufferSize, 0UL)) == NULL, 0L)) { goto exitNow; } }
*status = U_ZERO_ERROR; // Make sure the status var is cleared and try again.
- resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status);
+ resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, &needU16Capacity, exception, status);
+ RKLCDelayedAssert((resultU16Length <= tempUniCharBufferU16Capacity) && (needU16Capacity >= resultU16Length) && (needU16Capacity >= 0), exception, exitNow);
}
- if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } // Something went wrong.
+ // If status != U_ZERO_ERROR, consider it an error, even though status < U_ZERO_ERROR is a 'warning' in ICU nomenclature.
+ // http://sourceforge.net/tracker/?func=detail&atid=990188&aid=2890810&group_id=204582
+ if(RKL_EXPECTED(*status != U_ZERO_ERROR, 0L)) { goto exitNow; } // Something went wrong.
if(resultU16Length == 0) { resultObject = @""; } // Optimize the case where the replaced text length == 0 with a @"" string.
else if(((NSUInteger)resultU16Length == searchU16Length) && (replacedCount == 0UL)) { // Optimize the case where the replacement == original by creating a copy. Very fast if self is immutable.
- if(replaceMutable == 0UL) { resultObject = rkl_CFAutorelease(CFStringCreateCopy(NULL, (CFStringRef)searchString)); } // .. but only if this is not replacing a mutable self.
- } else { resultObject = rkl_CFAutorelease(CFStringCreateWithCharacters(NULL, tempUniCharBuffer, (CFIndex)resultU16Length)); } // otherwise, create a new string.
+ if(replaceMutable == 0UL) { resultObject = rkl_CFAutorelease(CFStringCreateCopy(NULL, (CFStringRef)searchString)); } // .. but only if this is not replacing a mutable self. Warning about potential leak can be safely ignored.
+ } else { resultObject = rkl_CFAutorelease(CFStringCreateWithCharacters(NULL, tempUniCharBuffer, (CFIndex)resultU16Length)); } // otherwise, create a new string. Warning about potential leak can be safely ignored.
// If replaceMutable == 1UL, we don't do the replacement here. We wait until after we return and unlock the cache lock.
// This is because we may be trying to mutate an immutable string object.
@@ -1168,16 +1188,16 @@ exitNow:
if(scratchBuffer[1] != NULL) { scratchBuffer[1] = rkl_free(&scratchBuffer[1]); }
if(replacedCountPtr != NULL) { *replacedCountPtr = replacedCount; }
return(resultObject);
-}
+} // The two warnings about potential leaks can be safely ignored.
// IMPORTANT! Should only be called from rkl_replaceString().
// ----------
// Modified version of the ICU libraries uregex_replaceAll() that keeps count of the number of replacements made.
-static int32_t rkl_replaceAll(RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) {
- NSUInteger replaced = 0UL, bufferOverflowed = 0UL;
- int32_t u16Length = 0;
- RKLCDelayedAssert((cacheSlot != NULL) && (replacementUniChar != NULL) && (replacedUniChar != NULL) && (status != NULL) && (replacementU16Length >= 0) && (replacedU16Capacity >= 0), exception, exitNow);
+static int32_t rkl_replaceAll(RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, int32_t *needU16Capacity, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) {
+ int32_t u16Length = 0, initialReplacedU16Capacity = replacedU16Capacity;
+ NSUInteger replaced = 0UL, bufferOverflowed = 0UL;
+ RKLCDelayedAssert((cacheSlot != NULL) && (replacementUniChar != NULL) && (replacedUniChar != NULL) && (replacedCount != NULL) && (needU16Capacity != NULL) && (status != NULL) && (replacementU16Length >= 0) && (replacedU16Capacity >= 0), exception, exitNow);
cacheSlot->lastFindRange = cacheSlot->lastMatchRange = NSNotFoundRange; // Clear the cached find information for this regex so a subsequent find works correctly.
RKL_ICU_FUNCTION_APPEND(uregex_reset)(cacheSlot->icu_regex, 0, status);
@@ -1199,10 +1219,18 @@ static int32_t rkl_replaceAll(RKLCacheSlot *cacheSlot, const UniChar *replacemen
if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { bufferOverflowed = 1UL; *status = U_ZERO_ERROR; }
u16Length += RKL_ICU_FUNCTION_APPEND(uregex_appendTail)(cacheSlot->icu_regex, &replacedUniChar, &replacedU16Capacity, status);
- if(RKL_EXPECTED(*status == U_ZERO_ERROR, 1L) && RKL_EXPECTED(bufferOverflowed == 1UL, 0L)) { *status = U_BUFFER_OVERFLOW_ERROR; }
- if(replacedCount != NULL) { *replacedCount = replaced; }
+ // Check for status <= U_ZERO_ERROR (a 'warning' in ICU nomenclature) rather than just status == U_ZERO_ERROR.
+ // Under just the right circumstances, status might be equal to U_STRING_NOT_TERMINATED_WARNING. When this occured,
+ // rkl_replaceString would never get the U_BUFFER_OVERFLOW_ERROR status, and thus never grow the buffer to the size needed.
+ // http://sourceforge.net/tracker/?func=detail&atid=990188&aid=2890810&group_id=204582
+ if(RKL_EXPECTED(*status <= U_ZERO_ERROR, 1L) && RKL_EXPECTED(bufferOverflowed == 1UL, 0L)) { *status = U_BUFFER_OVERFLOW_ERROR; }
+
+#ifndef NS_BLOCK_ASSERTIONS
exitNow:
- return(u16Length);
+#endif
+ if(replacedCount != NULL) { *replacedCount = replaced; }
+ if(needU16Capacity != NULL) { *needU16Capacity = u16Length; } // Use needU16Capacity to return the number of characters that are needed for the completely replaced string. Bug 2890810.
+ return(initialReplacedU16Capacity - replacedU16Capacity); // Return the number of characters of replacedUniChar that were used.
}
static NSUInteger rkl_isRegexValid(id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) {
@@ -1222,7 +1250,7 @@ static NSUInteger rkl_isRegexValid(id self, SEL _cmd, NSString *regex, RKLRegexO
if((cacheSlot = rkl_getCachedRegex(regex, options, error, &exception)) != NULL) { gotCacheSlot = 1UL; captureCount = cacheSlot->captureCount; }
cacheSlot = NULL;
OSSpinLockUnlock(&cacheSpinLock);
- cacheSpinLockStatus |= RKLUnlockedCacheSpinLock;
+ cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; // Warning about cacheSpinLockStatus never being read can be safely ignored.
if(captureCountPtr != NULL) { *captureCountPtr = captureCount; }
if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); }
@@ -1230,7 +1258,7 @@ static NSUInteger rkl_isRegexValid(id self, SEL _cmd, NSString *regex, RKLRegexO
}
static void rkl_clearStringCache(void) {
- NSCParameterAssert(cacheSpinLock != 0);
+ NSCParameterAssert(cacheSpinLock != (OSSpinLock)0);
lastCacheSlot = NULL;
NSUInteger x = 0UL;
for(x = 0UL; x < (NSUInteger)(RKL_SCRATCH_BUFFERS); x++) { if(scratchBuffer[x] != NULL) { scratchBuffer[x] = rkl_free(&scratchBuffer[x]); } }
@@ -1307,7 +1335,7 @@ static NSError *rkl_NSErrorForRegex(NSString *regexString, RKLRegexOptions optio
}
static NSException *rkl_NSExceptionForRegex(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) {
- return([NSException exceptionWithName:RKLICURegexException reason:[NSString stringWithFormat:@"ICU regular expression error #%d, %s", status, RKL_ICU_FUNCTION_APPEND(u_errorName)(status)] userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, NULL)]);
+ return([NSException exceptionWithName:RKLICURegexException reason:[NSString stringWithFormat:@"ICU regular expression error #%d, %s.", status, RKL_ICU_FUNCTION_APPEND(u_errorName)(status)] userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, NULL)]);
}
static NSDictionary *rkl_makeAssertDictionary(const char *function, const char *file, int line, NSString *format, ...) {
@@ -1343,7 +1371,7 @@ static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString
cacheSpinLockStatus |= RKLLockedCacheSpinLock;
rkl_clearStringCache();
OSSpinLockUnlock(&cacheSpinLock);
- cacheSpinLockStatus |= RKLUnlockedCacheSpinLock;
+ cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; // Warning about cacheSpinLockStatus never being read can be safely ignored.
}
#pragma mark +captureCountForRegex:
@@ -1367,14 +1395,14 @@ static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString
- (NSInteger)RKL_METHOD_PREPEND(captureCount)
{
NSInteger captureCount = -1L;
- rkl_isRegexValid(self, _cmd, self, RKLNoOptions, &captureCount, NULL);
+ rkl_isRegexValid(self, _cmd, self, RKLNoOptions, &captureCount, NULL);
return(captureCount);
}
- (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error
{
NSInteger captureCount = -1L;
- rkl_isRegexValid(self, _cmd, self, options, &captureCount, error);
+ rkl_isRegexValid(self, _cmd, self, options, &captureCount, error);
return(captureCount);
}
@@ -1402,21 +1430,21 @@ static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString
{
NSRange result = NSNotFoundRange, range = NSMaxiumRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result);
- return((result.location == NSNotFound) ? NO : YES);
+ return((result.location == (NSUInteger)NSNotFound) ? NO : YES);
}
- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range
{
NSRange result = NSNotFoundRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result);
- return((result.location == NSNotFound) ? NO : YES);
+ return((result.location == (NSUInteger)NSNotFound) ? NO : YES);
}
- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error
{
NSRange result = NSNotFoundRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, 0L, self, &range, NULL, error, &result);
- return((result.location == NSNotFound) ? NO : YES);
+ return((result.location == (NSUInteger)NSNotFound) ? NO : YES);
}
#pragma mark -isRegexValid
@@ -1454,7 +1482,7 @@ static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString
if((buffer->string != NULL) && ((buffer->string == (CFStringRef)self) || ((buffer->length == selfLength) && (buffer->hash == selfHash)))) { rkl_clearBuffer(buffer, 0UL); }
OSSpinLockUnlock(&cacheSpinLock);
- cacheSpinLockStatus |= RKLUnlockedCacheSpinLock;
+ cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; // Warning about cacheSpinLockStatus never being read can be safely ignored.
}
#pragma mark -rangeOfRegex:
@@ -1493,29 +1521,29 @@ static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString
{
NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange);
- return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
-}
+ return((matchedRange.location == (NSUInteger)NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
+} // Warning about potential leak can be safely ignored.
- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture
{
NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, capture, self, &range, NULL, NULL, &matchedRange);
- return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
-}
+ return((matchedRange.location == (NSUInteger)NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
+} // Warning about potential leak can be safely ignored.
- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range
{
NSRange matchedRange = NSNotFoundRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange);
- return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
-}
+ return((matchedRange.location == (NSUInteger)NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
+} // Warning about potential leak can be safely ignored.
- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error
{
NSRange matchedRange = NSNotFoundRange;
rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, capture, self, &range, NULL, error, &matchedRange);
- return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
-}
+ return((matchedRange.location == (NSUInteger)NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length))));
+} // Warning about potential leak can be safely ignored.
#pragma mark -stringByReplacingOccurrencesOfRegex:
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index fb497621..4421f624 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -159,7 +159,7 @@
contextInfo:NULL];
}
else {
- int returnCode = [panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"spf", @"sql", nil]];
+ NSInteger returnCode = [panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"spf", @"sql", nil]];
if (returnCode) [self application:nil openFiles:[panel filenames]];
@@ -170,7 +170,7 @@
/**
* Invoked when the open connection panel is dismissed.
*/
-- (void)openConnectionPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)openConnectionPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode) {
[panel orderOut:self];
diff --git a/Source/SPCSVParser.h b/Source/SPCSVParser.h
index 0f1a8a20..63f7fef5 100644
--- a/Source/SPCSVParser.h
+++ b/Source/SPCSVParser.h
@@ -52,11 +52,11 @@
{
NSMutableString *csvString;
- long trimPosition;
- long parserPosition;
- long totalLengthParsed;
- long csvStringLength;
- int fieldCount;
+ NSUInteger trimPosition;
+ NSUInteger parserPosition;
+ NSUInteger totalLengthParsed;
+ NSUInteger csvStringLength;
+ NSInteger fieldCount;
NSString *nullReplacementString;
NSString *fieldEndString;
@@ -67,10 +67,10 @@
NSString *escapedLineEndString;
NSString *escapedFieldQuoteString;
NSString *escapedEscapeString;
- int fieldEndLength;
- int lineEndLength;
- int fieldQuoteLength;
- int escapeLength;
+ NSInteger fieldEndLength;
+ NSInteger lineEndLength;
+ NSInteger fieldQuoteLength;
+ NSInteger escapeLength;
NSCharacterSet *skipCharacterSet;
NSScanner *csvScanner;
@@ -89,8 +89,8 @@
/* Basic information */
- (NSUInteger) length;
- (NSString *) string;
-- (long) parserPosition;
-- (long) totalLengthParsed;
+- (NSUInteger) parserPosition;
+- (NSUInteger) totalLengthParsed;
/* Setting the terminator, quote, escape and null character replacement strings */
- (void) setFieldTerminatorString:(NSString *)theString convertDisplayStrings:(BOOL)convertString;
@@ -102,7 +102,7 @@
/* Init and internal update methods */
- (void) _initialiseCSVParserDefaults;
- (void) _moveParserPastSkippableCharacters;
-- (long) _getDistanceToString:(NSString *)theString;
+- (NSUInteger) _getDistanceToString:(NSString *)theString;
- (void) _updateState;
- (NSString *) _convertDisplayString:(NSString *)theString;
- (void) _updateSkipCharacterSet;
diff --git a/Source/SPCSVParser.m b/Source/SPCSVParser.m
index b141efcd..58b70942 100644
--- a/Source/SPCSVParser.m
+++ b/Source/SPCSVParser.m
@@ -83,8 +83,8 @@
{
NSMutableArray *csvRowArray;
NSMutableString *csvCellString = [NSMutableString string];
- long startingParserPosition, nextQuoteDistance, nextFieldEndDistance, nextLineEndDistance;
- int skipLength, j;
+ NSUInteger startingParserPosition, nextQuoteDistance, nextFieldEndDistance, nextLineEndDistance;
+ NSInteger skipLength, j;
BOOL fieldIsQuoted, isEscaped;
BOOL lineEndingEncountered = NO;
@@ -351,7 +351,7 @@
/**
* Return the parser position
*/
-- (long) parserPosition
+- (NSUInteger) parserPosition
{
return parserPosition;
}
@@ -360,7 +360,7 @@
* Return the total length of CSV parsed so far - differs from the parser position in
* streaming/trimming situations
*/
-- (long) totalLengthParsed
+- (NSUInteger) totalLengthParsed
{
return totalLengthParsed;
}
@@ -570,7 +570,7 @@
* parser location. Returns NSNotFound if the string could not be found before the end
* of the string.
*/
-- (long) _getDistanceToString:(NSString *)theString
+- (NSUInteger) _getDistanceToString:(NSString *)theString
{
NSRange stringRange = [csvString rangeOfString:theString options:NSLiteralSearch range:NSMakeRange(parserPosition, csvStringLength - parserPosition)];
@@ -589,7 +589,7 @@
{
if (!skipCharacterSet) return;
- int i = 0;
+ NSInteger i = 0;
while (parserPosition + i < csvStringLength) {
if (![skipCharacterSet characterIsMember:[csvString characterAtIndex:parserPosition+i]]) break;
i++;
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index d0a70148..f2c6ba9a 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -59,8 +59,8 @@
MCPConnection *mySQLConnection;
BOOL automaticFavoriteSelection;
- int previousType;
- int type;
+ NSInteger previousType;
+ NSInteger type;
NSString *name;
NSString *host;
NSString *user;
@@ -106,7 +106,7 @@
}
@property (readwrite, assign) id delegate;
-@property (readwrite, assign) int type;
+@property (readwrite, assign) NSInteger type;
@property (readwrite, retain) NSString *name;
@property (readwrite, retain) NSString *host;
@property (readwrite, retain) NSString *user;
@@ -132,13 +132,13 @@
- (void)sshTunnelCallback:(SPSSHTunnel *)theTunnel;
- (void)initiateMySQLConnection;
- (void)failConnectionWithTitle:(NSString *)theTitle errorMessage:(NSString *)theErrorMessage detail:(NSString *)errorDetail;
-- (void)errorSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo;
+- (void)errorSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (void)addConnectionToDocument;
// Interface interaction
- (IBAction)editFavorites:(id)sender;
- (IBAction)showHelp:(id)sender;
-- (void)resizeTabViewToConnectionType:(unsigned int)theType animating:(BOOL)animate;
+- (void)resizeTabViewToConnectionType:(NSUInteger)theType animating:(BOOL)animate;
// Connection details interaction
- (BOOL)checkHost;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 27c5c8fd..5c87bf7d 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -80,7 +80,7 @@
// Disable the toolbar icons
NSArray *toolbarItems = [[documentWindow toolbar] items];
- for (int i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:NO];
+ for (NSInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:NO];
// Set up a keychain instance and preferences reference, and create the initial favorites list
keychain = [[SPKeychain alloc] init];
@@ -97,15 +97,15 @@
// Set the focus to the favorites table and select the appropriate row
[documentWindow setInitialFirstResponder:favoritesTable];
- int tableRow;
+ NSInteger tableRow;
if ([prefs boolForKey:SPSelectLastFavoriteUsed] == YES) {
tableRow = [prefs integerForKey:SPLastFavoriteIndex] + 1;
} else {
tableRow = [prefs integerForKey:SPDefaultFavorite] + 1;
}
if (tableRow < [favorites count]) {
- previousType = [[[favorites objectAtIndex:tableRow] objectForKey:@"type"] intValue];
- [self resizeTabViewToConnectionType:[[[favorites objectAtIndex:tableRow] objectForKey:@"type"] intValue] animating:NO];
+ previousType = [[[favorites objectAtIndex:tableRow] objectForKey:@"type"] integerValue];
+ [self resizeTabViewToConnectionType:[[[favorites objectAtIndex:tableRow] objectForKey:@"type"] integerValue] animating:NO];
[favoritesTable selectRowIndexes:[NSIndexSet indexSetWithIndex:tableRow] byExtendingSelection:NO];
[favoritesTable scrollRowToVisible:[favoritesTable selectedRow]];
} else {
@@ -225,7 +225,7 @@
[progressIndicatorText display];
// Set up the tunnel details
- sshTunnel = [[SPSSHTunnel alloc] initToHost:[self sshHost] port:([[self sshPort] length]?[[self sshPort] intValue]:22) login:[self sshUser] tunnellingToPort:([[self port] length]?[[self port] intValue]:3306) onHost:[self host]];
+ sshTunnel = [[SPSSHTunnel alloc] initToHost:[self sshHost] port:([[self sshPort] length]?[[self sshPort] integerValue]:22) login:[self sshUser] tunnellingToPort:([[self port] length]?[[self port] integerValue]:3306) onHost:[self host]];
[sshTunnel setParentWindow:documentWindow];
// Add keychain or plaintext password as appropriate - note the checks in initiateConnection.
@@ -250,7 +250,7 @@
*/
- (void)sshTunnelCallback:(SPSSHTunnel *)theTunnel
{
- int newState = [theTunnel state];
+ NSInteger newState = [theTunnel state];
if (newState == PROXY_STATE_IDLE) {
[tableDocument setTitlebarStatus:@"SSH Disconnected"];
@@ -289,7 +289,7 @@
} else {
mySQLConnection = [[MCPConnection alloc] initToHost:[self host]
withLogin:[self user]
- usingPort:([[self port] length]?[[self port] intValue]:3306)];
+ usingPort:([[self port] length]?[[self port] integerValue]:3306)];
}
}
@@ -305,9 +305,9 @@
[mySQLConnection setDelegateQueryLogging:[prefs boolForKey:SPConsoleEnableLogging]];
// Set options from preferences
- [mySQLConnection setConnectionTimeout:[[prefs objectForKey:SPConnectionTimeoutValue] intValue]];
+ [mySQLConnection setConnectionTimeout:[[prefs objectForKey:SPConnectionTimeoutValue] integerValue]];
[mySQLConnection setUseKeepAlive:[[prefs objectForKey:SPUseKeepAlive] boolValue]];
- [mySQLConnection setKeepAliveInterval:[[prefs objectForKey:SPKeepAliveInterval] floatValue]];
+ [mySQLConnection setKeepAliveInterval:[[prefs objectForKey:SPKeepAliveInterval] doubleValue]];
// Connect
[mySQLConnection connect];
@@ -345,7 +345,7 @@
errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect via the socket, or the request timed out.\n\nDouble-check that the socket path is correct and that you have the necessary privileges, and that the server is running.\n\nMySQL said: %@", @"message of panel when connection to host failed"), [mySQLConnection getLastErrorMessage]];
[self failConnectionWithTitle:NSLocalizedString(@"Socket connection failed!", @"socket connection failed title") errorMessage:errorMessage detail:nil];
} else {
- errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %i seconds).\n\nMySQL said: %@", @"message of panel when connection to host failed"), [self host], [[prefs objectForKey:SPConnectionTimeoutValue] intValue], [mySQLConnection getLastErrorMessage]];
+ errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %ld seconds).\n\nMySQL said: %@", @"message of panel when connection to host failed"), [self host], (long)[[prefs objectForKey:SPConnectionTimeoutValue] integerValue], [mySQLConnection getLastErrorMessage]];
[self failConnectionWithTitle:NSLocalizedString(@"Connection failed!", @"connection failed title") errorMessage:errorMessage detail:nil];
}
@@ -419,7 +419,7 @@
/**
* Alert sheet callback method - invoked when an error sheet is closed.
*/
-- (void)errorSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)errorSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
[sheet orderOut:self];
@@ -470,7 +470,7 @@
// Restore the toolbar icons
NSArray *toolbarItems = [[documentWindow toolbar] items];
- for (int i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES];
+ for (NSInteger i = 0; i < [toolbarItems count]; i++) [[toolbarItems objectAtIndex:i] setEnabled:YES];
// Set keychain id for saving SPF files
if([self valueForKeyPath:@"selectedFavorite.id"])
@@ -520,7 +520,7 @@
*/
- (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
{
- int selectedTabView = [tabView indexOfTabViewItem:tabViewItem];
+ NSInteger selectedTabView = [tabView indexOfTabViewItem:tabViewItem];
// Deselect any selected favorite for manual changes
if (!automaticFavoriteSelection) [favoritesTable deselectAll:self];
@@ -563,10 +563,10 @@
* Control tab view resizing based on the supplied connection type,
* with an option defining whether it should be animated or not.
*/
-- (void) resizeTabViewToConnectionType:(unsigned int)theType animating:(BOOL)animate
+- (void) resizeTabViewToConnectionType:(NSUInteger)theType animating:(BOOL)animate
{
NSRect frameRect, targetResizeRect;
- int additionalFormHeight = 55;
+ NSInteger additionalFormHeight = 55;
frameRect = [connectionResizeContainer frame];
@@ -617,7 +617,7 @@
/**
* Alert sheet callback method - invoked when the error sheet is closed.
*/
-- (void)localhostErrorSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)localhostErrorSheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
[sheet orderOut:self];
if (returnCode == NSAlertAlternateReturn) {
@@ -665,7 +665,7 @@
if (connectionSSHKeychainItemAccount) [connectionSSHKeychainItemAccount release], connectionSSHKeychainItemAccount = nil;
// Update key-value properties from the selected favourite, using empty strings where not found
- [self setType:([self valueForKeyPath:@"selectedFavorite.type"] ? [[self valueForKeyPath:@"selectedFavorite.type"] intValue] : SPTCPIPConnection)];
+ [self setType:([self valueForKeyPath:@"selectedFavorite.type"] ? [[self valueForKeyPath:@"selectedFavorite.type"] integerValue] : SPTCPIPConnection)];
[self setName:([self valueForKeyPath:@"selectedFavorite.name"] ? [self valueForKeyPath:@"selectedFavorite.name"] : @"")];
[self setHost:([self valueForKeyPath:@"selectedFavorite.host"] ? [self valueForKeyPath:@"selectedFavorite.host"] : @"")];
[self setSocket:([self valueForKeyPath:@"selectedFavorite.socket"] ? [self valueForKeyPath:@"selectedFavorite.socket"] : @"")];
@@ -716,7 +716,7 @@
- (IBAction) addFavorite:(id)sender
{
NSString *thePassword, *theSSHPassword;
- NSNumber *favoriteid = [NSNumber numberWithInt:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
+ NSNumber *favoriteid = [NSNumber numberWithInteger:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
NSString *favoriteName = [[self name] length]?[self name]:[NSString stringWithFormat:@"%@@%@", ([self user] && [[self user] length])?[self user]:@"anonymous", (([self type] == SPSocketConnection)?@"localhost":[self host])];
if (![[self name] length] && [self database] && ![[self database] isEqualToString:@""])
favoriteName = [NSString stringWithFormat:@"%@ %@", [self database], favoriteName];
@@ -738,7 +738,7 @@
// Construct the favorite details - cannot use only dictionaryWithObjectsAndKeys for possible nil values.
NSMutableDictionary *newFavorite = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:[self type]], @"type",
+ [NSNumber numberWithInteger:[self type]], @"type",
favoriteName, @"name",
favoriteid, @"id",
nil];
@@ -769,7 +769,7 @@
}
if (thePassword && ![thePassword isEqualToString:@""]) {
[keychain addPassword:thePassword
- forName:[keychain nameForFavoriteName:favoriteName id:[NSString stringWithFormat:@"%i", [favoriteid intValue]]]
+ forName:[keychain nameForFavoriteName:favoriteName id:[NSString stringWithFormat:@"%lld", [favoriteid longLongValue]]]
account:[keychain accountForUser:[self user] host:(([self type] == SPSocketConnection)?@"localhost":[self host]) database:[self database]]];
}
@@ -780,7 +780,7 @@
}
if (theSSHPassword && ![theSSHPassword isEqualToString:@""]) {
[keychain addPassword:theSSHPassword
- forName:[keychain nameForSSHForFavoriteName:favoriteName id:[NSString stringWithFormat:@"%i", [favoriteid intValue]]]
+ forName:[keychain nameForSSHForFavoriteName:favoriteName id:[NSString stringWithFormat:@"%lld", [favoriteid longLongValue]]]
account:[keychain accountForSSHUser:[self sshUser] sshHost:[self sshHost]]];
}
@@ -809,7 +809,7 @@
/**
* Returns the number of favorites to display
*/
-- (int) numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger) numberOfRowsInTableView:(NSTableView *)aTableView
{
return [favorites count];
}
@@ -817,7 +817,7 @@
/**
* Returns the favorite names to be displayed in the table
*/
-- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
return [[favorites objectAtIndex:rowIndex] objectForKey:@"name"];
}
@@ -838,7 +838,7 @@
/**
* Display the title row
*/
-- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(NSInteger)rowIndex
{
return (rowIndex == 0);
}
@@ -846,7 +846,7 @@
/**
* Don't allow the title row to be selected
*/
-- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
{
return (rowIndex != 0);
}
@@ -854,7 +854,7 @@
/**
* Set the title row to display with extra height
*/
-- (float)tableView:(NSTableView *)tableView heightOfRow:(int)row
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
return (row == 0) ? 25 : 17;
}
@@ -862,7 +862,7 @@
/**
* Control the display of rows within the favorites table
*/
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
[(ImageAndTextCell*)aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
if (rowIndex == 0) {
@@ -891,7 +891,7 @@
/**
* Return the maximum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 445);
}
@@ -899,7 +899,7 @@
/**
* Return the minimum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 80);
}
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index ca0378b3..2742c7a8 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -111,7 +111,7 @@
- (MCPConnectionCheck)connectionLost:(id)connection
{
[NSApp beginSheet:connectionErrorDialog modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
- int connectionErrorCode = [NSApp runModalForWindow:connectionErrorDialog];
+ NSInteger connectionErrorCode = [NSApp runModalForWindow:connectionErrorDialog];
[NSApp endSheet:connectionErrorDialog];
[connectionErrorDialog orderOut:nil];
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index cdf7ee1f..5ef8695c 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -384,7 +384,7 @@
/**
* Return the maximum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 245);
}
@@ -392,7 +392,7 @@
/**
* Return the minimum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 120);
}
@@ -548,7 +548,7 @@
[numberOfArgsLabel setHidden:(![[contentFilterTextView string] length])];
NSUInteger numOfArgs = [[[contentFilterTextView string] componentsMatchedByRegex:@"(?<!\\\\)(\\$\\{.*?\\})"] count];
- [numberOfArgsLabel setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Number of arguments: %d", @"Number of arguments: %d"), numOfArgs]];
+ [numberOfArgsLabel setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Number of arguments: %lu", @"Number of arguments: %lu"), (unsigned long)numOfArgs]];
[contentFilterConjunctionTextField setHidden:(numOfArgs < 2)];
[contentFilterConjunctionLabel setHidden:(numOfArgs < 2)];
@@ -663,7 +663,7 @@
NSMutableArray *draggedRows = [[NSMutableArray alloc] initWithCapacity:1];
NSUInteger rowIndex = [draggedIndexes firstIndex];
while ( rowIndex != NSNotFound ) {
- [draggedRows addObject:[NSNumber numberWithInt:rowIndex]];
+ [draggedRows addObject:[NSNumber numberWithInteger:rowIndex]];
rowIndex = [draggedIndexes indexGreaterThanIndex: rowIndex];
}
@@ -675,7 +675,7 @@
for(i=0; i<[draggedRows count]; i++) {
- NSInteger originalRow = [[draggedRows objectAtIndex:i] intValue];
+ NSInteger originalRow = [[draggedRows objectAtIndex:i] integerValue];
if(originalRow < destinationRow) destinationRow--;
@@ -710,7 +710,7 @@
/**
* Sheet did end method
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Is disabled - do we need that?
// if ([contextInfo isEqualToString:@"removeAllFavorites"]) {
@@ -745,7 +745,7 @@
/**
* Import panel did end method.
*/
-- (void)importPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)importPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if (returnCode == NSOKButton) {
@@ -809,7 +809,7 @@
/**
* Save panel did end method.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if([contextInfo isEqualToString:@"exportFilter"]) {
@@ -821,7 +821,7 @@
NSMutableArray *filterData = [NSMutableArray array];
- [spfdata setObject:[NSNumber numberWithInt:1] forKey:@"version"];
+ [spfdata setObject:[NSNumber numberWithInteger:1] forKey:@"version"];
[spfdata setObject:@"content filters" forKey:@"format"];
[spfdata setObject:[NSNumber numberWithBool:NO] forKey:@"encrypted"];
diff --git a/Source/SPDataAdditions.h b/Source/SPDataAdditions.h
index 40bea690..8c19d572 100644
--- a/Source/SPDataAdditions.h
+++ b/Source/SPDataAdditions.h
@@ -26,7 +26,7 @@
@interface NSData (SPDataAdditions)
-- (NSString *)base64EncodingWithLineLength:(unsigned int)lineLength;
+- (NSString *)base64EncodingWithLineLength:(NSUInteger)lineLength;
- (NSString *)dataToFormattedHexString;
- (NSString *)shortStringRepresentationUsingEncoding:(NSStringEncoding)encoding;
- (NSData*)dataEncryptedWithPassword:(NSString*)password;
diff --git a/Source/SPDataAdditions.m b/Source/SPDataAdditions.m
index 332cb7ab..3f45a5fa 100644
--- a/Source/SPDataAdditions.m
+++ b/Source/SPDataAdditions.m
@@ -49,16 +49,16 @@ static char base64encodingTable[64] = {
*
* Convert self to a base64 encoded NSString
*/
-- (NSString *) base64EncodingWithLineLength:(unsigned int)lineLength {
+- (NSString *) base64EncodingWithLineLength:(NSUInteger)lineLength {
const unsigned char *bytes = [self bytes];
- unsigned long ixtext = 0;
- unsigned long lentext = [self length];
- long ctremaining = 0;
+ NSUInteger ixtext = 0;
+ NSUInteger lentext = [self length];
+ NSInteger ctremaining = 0;
unsigned char inbuf[3], outbuf[4];
short i = 0;
short charsonline = 0, ctcopy = 0;
- unsigned long ix = 0;
+ NSUInteger ix = 0;
NSMutableString *base64 = [NSMutableString stringWithCapacity:lentext];
@@ -111,15 +111,15 @@ static char base64encodingTable[64] = {
{
// Create a random 128-bit initialization vector
srand(time(NULL));
- int ivIndex;
+ NSInteger ivIndex;
unsigned char iv[16];
for (ivIndex = 0; ivIndex < 16; ivIndex++)
iv[ivIndex] = rand() & 0xff;
// Calculate the 16-byte AES block padding
- int dataLength = [self length];
- int paddedLength = dataLength + (32 - (dataLength % 16));
- int totalLength = paddedLength + 16; // Data plus IV
+ NSInteger dataLength = [self length];
+ NSInteger paddedLength = dataLength + (32 - (dataLength % 16));
+ NSInteger totalLength = paddedLength + 16; // Data plus IV
// Allocate enough space for the IV + ciphertext
unsigned char *encryptedBytes = calloc(1, totalLength);
@@ -130,7 +130,7 @@ static char base64encodingTable[64] = {
memcpy(paddedBytes, [self bytes], dataLength);
// The last 32-bit chunk is the size of the plaintext, which is encrypted with the plaintext
- int bigIntDataLength = NSSwapHostIntToBig(dataLength);
+ NSInteger bigIntDataLength = NSSwapHostIntToBig(dataLength);
memcpy(paddedBytes + (paddedLength - 4), &bigIntDataLength, 4);
// Create the key from first 128-bits of the 160-bit password hash
@@ -157,8 +157,8 @@ static char base64encodingTable[64] = {
AES_set_decrypt_key(passwordDigest, 128, &aesKey);
// Total length = encrypted length + IV
- int totalLength = [self length];
- int encryptedLength = totalLength - 16;
+ NSInteger totalLength = [self length];
+ NSInteger encryptedLength = totalLength - 16;
// Take the IV from the first 128-bit block
unsigned char iv[16];
@@ -169,16 +169,16 @@ static char base64encodingTable[64] = {
AES_cbc_encrypt([self bytes] + 16, decryptedBytes, encryptedLength, &aesKey, iv, AES_DECRYPT);
// If decryption was successful, these blocks will be zeroed
- if ( *((unsigned int*)decryptedBytes + ((encryptedLength / 4) - 4)) ||
- *((unsigned int*)decryptedBytes + ((encryptedLength / 4) - 3)) ||
- *((unsigned int*)decryptedBytes + ((encryptedLength / 4) - 2)) )
+ if ( *((NSUInteger*)decryptedBytes + ((encryptedLength / 4) - 4)) ||
+ *((NSUInteger*)decryptedBytes + ((encryptedLength / 4) - 3)) ||
+ *((NSUInteger*)decryptedBytes + ((encryptedLength / 4) - 2)) )
{
return nil;
}
// Get the size of the data from the last 32-bit chunk
- int bigIntDataLength = *((unsigned int*)decryptedBytes + ((encryptedLength / 4) - 1));
- int dataLength = NSSwapBigIntToHost(bigIntDataLength);
+ NSInteger bigIntDataLength = *((NSUInteger*)decryptedBytes + ((encryptedLength / 4) - 1));
+ NSInteger dataLength = NSSwapBigIntToHost(bigIntDataLength);
return [NSData dataWithBytesNoCopy:decryptedBytes length:dataLength];
}
@@ -187,12 +187,12 @@ static char base64encodingTable[64] = {
{
if ([self length] == 0) return self;
- unsigned full_length = [self length];
- unsigned half_length = [self length] / 2;
+ NSUInteger full_length = [self length];
+ NSUInteger half_length = [self length] / 2;
NSMutableData *unzipData = [NSMutableData dataWithLength: full_length + half_length];
BOOL done = NO;
- int status;
+ NSInteger status;
z_stream zlibStream;
zlibStream.next_in = (Bytef *)[self bytes];
@@ -295,7 +295,7 @@ static char base64encodingTable[64] = {
buffLength = totalLength - i;
}
- buffer = (unsigned char*) malloc( sizeof( unsigned char ) * buffLength + 1);
+ buffer = (unsigned char*) malloc( sizeof(unsigned char) * buffLength + 1);
[self getBytes:buffer range:NSMakeRange(i, buffLength)];
diff --git a/Source/SPDataCellFormatter.h b/Source/SPDataCellFormatter.h
index 9c2e8c3a..a669fdc6 100644
--- a/Source/SPDataCellFormatter.h
+++ b/Source/SPDataCellFormatter.h
@@ -27,14 +27,14 @@
@interface SPDataCellFormatter : NSFormatter
{
- int textLimit;
+ NSInteger textLimit;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- @property int textLimit;
+ @property NSInteger textLimit;
#else
- -(int)textLimit;
- -(void)setTextLimit:(int)limit;
+ -(NSInteger)textLimit;
+ -(void)setTextLimit:(NSInteger)limit;
#endif
@end
diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m
index f14774f9..d373d608 100644
--- a/Source/SPDataCellFormatter.m
+++ b/Source/SPDataCellFormatter.m
@@ -32,12 +32,12 @@
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
@synthesize textLimit;
#else
- -(int)textLimit
+ -(NSInteger)textLimit
{
return textLimit;
}
- -(void)setTextLimit:(int)limit
+ -(void)setTextLimit:(NSInteger)limit
{
textLimit = limit;
}
@@ -47,7 +47,7 @@
{
// Truncate the string for speed purposes if it's very long - improves table scrolling speed.
- if ([anObject length] > 150) {
+ if ([(NSString *)anObject length] > 150) {
return ([NSString stringWithFormat:@"%@...", [anObject substringToIndex:147]]);
}
@@ -81,13 +81,13 @@
// A single character over the length of the string - likely typed. Prevent the change.
if ([partialString length] == textLimit + 1) {
- [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %d.", @"Maximum text length is set to %d."), textLimit]];
+ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %ld.", @"Maximum text length is set to %ld."), (long)textLimit]];
return NO;
}
// If the string is considerably longer than the limit, likely pasted. Accept but truncate.
if ([partialString length] > textLimit) {
- [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %d. Inserted text was truncated.", @"Maximum text length is set to %d. Inserted text was truncated."), textLimit]];
+ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %ld. Inserted text was truncated.", @"Maximum text length is set to %ld. Inserted text was truncated."), (long)textLimit]];
*newString = [NSString stringWithString:[partialString substringToIndex:textLimit]];
return NO;
}
diff --git a/Source/SPDatabaseData.h b/Source/SPDatabaseData.h
index a7d093ff..d4bbf36c 100644
--- a/Source/SPDatabaseData.h
+++ b/Source/SPDatabaseData.h
@@ -28,7 +28,7 @@
typedef struct _CHAR_SETS
{
- unsigned int nr;
+ NSUInteger nr;
const char *name;
const char *collation;
const char *description;
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m
index e8782fad..b27863b9 100644
--- a/Source/SPDatabaseData.m
+++ b/Source/SPDatabaseData.m
@@ -437,7 +437,7 @@ const CHAR_SETS charsets[] =
if ([[connection getLastErrorMessage] isEqualToString:@""]) {
[result dataSeek:0];
- for (int i = 0; i < [result numOfRows]; i++)
+ for (NSInteger i = 0; i < [result numOfRows]; i++)
{
[array addObject:[result fetchRowAsDictionary]];
}
diff --git a/Source/SPEditSheetTextView.h b/Source/SPEditSheetTextView.h
index d6af35ce..52c04c1b 100644
--- a/Source/SPEditSheetTextView.h
+++ b/Source/SPEditSheetTextView.h
@@ -29,7 +29,7 @@
BOOL textWasChanged;
}
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint;
+- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint;
- (void)insertFileContentOfFile:(NSString *)aPath;
- (void)saveChangedFontInUserDefaults;
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m
index 52e7eca6..776d000e 100644
--- a/Source/SPEditSheetTextView.m
+++ b/Source/SPEditSheetTextView.m
@@ -149,7 +149,7 @@
// Set the new insertion point
NSPoint draggingLocation = [sender draggingLocation];
draggingLocation = [self convertPoint:draggingLocation fromView:nil];
- unsigned int characterIndex = [self characterIndexOfPoint:draggingLocation];
+ NSUInteger characterIndex = [self characterIndexOfPoint:draggingLocation];
[self setSelectedRange:NSMakeRange(characterIndex,0)];
// Check if user pressed ⌘ while dragging for inserting only the file path
@@ -197,7 +197,7 @@
/*
* Confirmation sheetDidEnd method
*/
-- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)dragAlertSheetDidEnd:(NSAlert *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[[sheet window] orderOut:nil];
@@ -209,11 +209,11 @@
* Convert a NSPoint, usually the mouse location, to
* a character index of the text view.
*/
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint
+- (NSUInteger)characterIndexOfPoint:(NSPoint)aPoint
{
- unsigned int glyphIndex;
+ NSUInteger glyphIndex;
NSLayoutManager *layoutManager = [self layoutManager];
- float fraction;
+ CGFloat fraction;
NSRange range;
range = [layoutManager glyphRangeForTextContainer:[self textContainer]];
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index c4fa682c..4a0e78ee 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -175,7 +175,7 @@
#pragma mark -
#pragma mark Table view datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
{
return [tables count];
}
@@ -248,7 +248,7 @@
/**
* Invoked when the user
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
// Perform the export
if (returnCode == NSOKButton) {
@@ -261,7 +261,7 @@
/**
* Invoked when the user dismisses the save panel. Updates the selected directory is they clicked OK.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
[exportPathField setStringValue:[panel directory]];
@@ -404,7 +404,7 @@
// Update the progress text and reset the progress bar to indeterminate status
NSString *tableName = [exportTables objectAtIndex:i];
- [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %d of %d (%@): fetching data...", @"text showing that app is fetching data for table dump"), (i + 1), tableCount, tableName]];
+ [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %l (%@): fetching data...", @"text showing that app is fetching data for table dump"), (unsigned long)(i + 1), (unsigned long)tableCount, tableName]];
[exportProgressText displayIfNeeded];
[exportProgressIndicator setIndeterminate:YES];
@@ -493,7 +493,7 @@
}
// Update the progress text and set the progress bar back to determinate
- [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %d of %d (%@): Writing...", @"text showing that app is writing data for table export"), (i + 1), tableCount, tableName]];
+ [exportProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %lu of %lu (%@): Writing...", @"text showing that app is writing data for table export"), (unsigned long)(i + 1), (unsigned long)tableCount, tableName]];
[exportProgressText displayIfNeeded];
[exportProgressIndicator stopAnimation:self];
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m
index 1c1c6f86..ea460af0 100644
--- a/Source/SPFavoriteTextFieldCell.m
+++ b/Source/SPFavoriteTextFieldCell.m
@@ -127,7 +127,7 @@
NSRect subFrame = NSMakeRect(0.0, 0.0, [subString size].width, [subString size].height);
// Total height of both strings with a 2 pixel separation space
- float totalHeight = [mainString size].height + [subString size].height + 1.0;
+ CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0;
cellFrame.origin.y += (cellFrame.size.height - totalHeight) / 2.0;
cellFrame.origin.x += 10.0; // Indent main string from image
@@ -138,10 +138,10 @@
cellFrame.size.height = totalHeight;
- int i;
- float maxWidth = cellFrame.size.width;
- float mainStringWidth = [mainString size].width;
- float subStringWidth = [subString size].width;
+ NSInteger i;
+ CGFloat maxWidth = cellFrame.size.width;
+ CGFloat mainStringWidth = [mainString size].width;
+ CGFloat subStringWidth = [subString size].width;
// Set a right-padding
maxWidth -= 10;
@@ -173,9 +173,9 @@
NSAttributedString *subString = [[self constructSubStringAttributedString] autorelease];
// 15 := indention 10 from image to string plus 5 px padding
- float theWidth = MAX([mainString size].width, [subString size].width) + (([self image] != nil) ? [[self image] size].width : 0) + 15;
+ CGFloat theWidth = MAX([mainString size].width, [subString size].width) + (([self image] != nil) ? [[self image] size].width : 0) + 15;
- float totalHeight = [mainString size].height + [subString size].height + 1.0;
+ CGFloat totalHeight = [mainString size].height + [subString size].height + 1.0;
cellSize.width = theWidth;
cellSize.height = totalHeight + 13.0;
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index a4142547..d6a0be1e 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -44,13 +44,13 @@
id sheetEditData;
BOOL editSheetWillBeInitialized;
BOOL isBlob;
- int quickLookCloseMarker;
+ NSInteger quickLookCloseMarker;
NSStringEncoding encoding;
NSString *stringValue;
NSString *tmpFileName;
NSString *tmpDirPath;
- int counter;
+ NSInteger counter;
unsigned long long maxTextLength;
BOOL editTextViewWasChanged;
BOOL allowUndo;
@@ -61,7 +61,7 @@
NSDictionary *qlTypes;
- int editSheetReturnCode;
+ NSInteger editSheetReturnCode;
NSUndoManager *esUndoManager;
}
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index ed10dbf1..fa7a8edd 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -271,7 +271,7 @@
// wait for editSheet
NSModalSession session = [NSApp beginModalSessionForWindow:editSheet];
- int cycleCounter = 0;
+ NSInteger cycleCounter = 0;
BOOL doGroupDueToChars = NO;
for (;;) {
@@ -355,7 +355,7 @@
if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:SPNullValue]]) {
[editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)];
[editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)];
- [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %d.", @"Text is too long. Maximum text length is set to %d."), maxTextLength]];
+ [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;
}
[NSApp stopModal];
@@ -445,7 +445,7 @@
/**
* Save panel didEndSelector. Writes the current content to disk.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
@@ -473,7 +473,7 @@
/**
* Open panel didEndSelector. Opens the selected file.
*/
-- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
NSString *fileName = [panel filename];
@@ -543,7 +543,7 @@
{
if(qlTypes != nil && [[qlTypes objectForKey:@"QuickLookTypes"] count] > [sender tag] - 2) {
NSDictionary *type = [[qlTypes objectForKey:@"QuickLookTypes"] objectAtIndex:[sender tag] - 2];
- [self invokeQuickLookOfType:[type objectForKey:@"Extension"] treatAsText:([[type objectForKey:@"treatAsText"] intValue])];
+ [self invokeQuickLookOfType:[type objectForKey:@"Extension"] treatAsText:([[type objectForKey:@"treatAsText"] integerValue])];
}
}
@@ -844,7 +844,7 @@
if(textView == editTextView && maxTextLength > 0
&& ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:SPNullValue]]) {
- int newLength;
+ NSInteger newLength;
// Auxilary to ensure that eg textViewDidChangeSelection:
// saves a non-space char + base char if that combination
@@ -862,7 +862,7 @@
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 %d.", @"Maximum text length is set to %d."), maxTextLength]];
+ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Maximum text length is set to %llu.", @"Maximum text length is set to %llu."), maxTextLength]];
[textView unmarkText];
return NO;
}
@@ -884,9 +884,9 @@
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 %d. Inserted text was truncated.", @"Maximum text length is set to %d. Inserted text was truncated."), maxTextLength]];
+ [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 %d.", @"Maximum text length is set to %d."), maxTextLength]];
+ [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]];
}
return NO;
diff --git a/Source/SPGrowlController.h b/Source/SPGrowlController.h
index a0a1e597..f3bac6d2 100644
--- a/Source/SPGrowlController.h
+++ b/Source/SPGrowlController.h
@@ -50,7 +50,7 @@
window:(NSWindow *)window
notificationName:(NSString *)name
iconData:(NSData *)data
- priority:(int)priority
+ priority:(NSInteger)priority
isSticky:(BOOL)sticky
clickContext:(id)clickContext;
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 5322f0b1..0e41a258 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -78,7 +78,7 @@ static SPGrowlController *sharedGrowlController = nil;
- (id)retain { return self; }
-- (unsigned)retainCount { return UINT_MAX; }
+- (NSUInteger)retainCount { return NSUIntegerMax; }
- (id)autorelease { return self; }
@@ -124,7 +124,7 @@ static SPGrowlController *sharedGrowlController = nil;
/**
* Posts a Growl notification using the supplied details and effectively ignoring the default values.
*/
-- (void)notifyWithTitle:(NSString *)title description:(NSString *)description window:(NSWindow *)window notificationName:(NSString *)name iconData:(NSData *)data priority:(int)priority isSticky:(BOOL)sticky clickContext:(id)clickContext
+- (void)notifyWithTitle:(NSString *)title description:(NSString *)description window:(NSWindow *)window notificationName:(NSString *)name iconData:(NSData *)data priority:(NSInteger)priority isSticky:(BOOL)sticky clickContext:(id)clickContext
{
BOOL postNotification = YES;
diff --git a/Source/SPHistoryController.h b/Source/SPHistoryController.h
index 1b5ecaf3..4497c283 100644
--- a/Source/SPHistoryController.h
+++ b/Source/SPHistoryController.h
@@ -56,19 +56,19 @@ enum sphistory_view_types
- (void)goBackInHistory;
- (void)goForwardInHistory;
- (IBAction) historyControlClicked:(NSSegmentedControl *)theControl;
-- (unsigned int) currentlySelectedView;
+- (NSUInteger) currentlySelectedView;
// Adding or updating history entries
- (void) updateHistoryEntries;
// Loading history entries
-- (void) loadEntryAtPosition:(unsigned int)position;
+- (void) loadEntryAtPosition:(NSUInteger)position;
- (void) loadEntryTaskWithPosition:(NSNumber *)positionNumber;
- (void) abortEntryLoadWithPool:(NSAutoreleasePool *)pool;
- (void) loadEntryFromMenuItem:(id)theMenuItem;
// History entry details and description
-- (NSMenuItem *) menuEntryForHistoryEntryAtIndex:(int)theIndex;
+- (NSMenuItem *) menuEntryForHistoryEntryAtIndex:(NSInteger)theIndex;
- (NSString *) nameForHistoryEntryDetails:(NSDictionary *)theEntry;
@end \ No newline at end of file
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 17f2d3d7..af92a928 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -70,7 +70,7 @@
{
BOOL backEnabled = NO;
BOOL forwardEnabled = NO;
- int i;
+ NSInteger i;
NSMenu *navMenu;
// Set the active state of the segments if appropriate
@@ -146,9 +146,9 @@
/**
* Retrieve the view that is currently selected from the database
*/
-- (unsigned int) currentlySelectedView
+- (NSUInteger) currentlySelectedView
{
- unsigned int theView = NSNotFound;
+ NSUInteger theView = NSNotFound;
NSString *viewName = [[[theDocument valueForKey:@"tableTabView"] selectedTabViewItem] identifier];
if ([viewName isEqualToString:@"source"]) {
@@ -185,10 +185,10 @@
// Work out the current document details
NSString *theDatabase = [theDocument database];
NSString *theTable = [theDocument table];
- unsigned int theView = [self currentlySelectedView];
+ NSUInteger theView = [self currentlySelectedView];
NSString *contentSortCol = [tableContentInstance sortColumnName];
BOOL contentSortColIsAsc = [tableContentInstance sortColumnIsAscending];
- unsigned int contentPageNumber = [tableContentInstance pageNumber];
+ NSUInteger contentPageNumber = [tableContentInstance pageNumber];
NSIndexSet *contentSelectedIndexSet = [tableContentInstance selectedRowIndexes];
NSRect contentViewport = [tableContentInstance viewport];
NSDictionary *contentFilter = [tableContentInstance filterSettings];
@@ -206,10 +206,10 @@
// creating a new entry every time detail is changed.
if ([[currentHistoryEntry objectForKey:@"database"] isEqualToString:theDatabase]
&& [[currentHistoryEntry objectForKey:@"table"] isEqualToString:theTable]
- && ([[currentHistoryEntry objectForKey:@"view"] intValue] != theView
+ && ([[currentHistoryEntry objectForKey:@"view"] integerValue] != theView
|| ((![currentHistoryEntry objectForKey:@"contentFilter"] && !contentFilter)
|| (![currentHistoryEntry objectForKey:@"contentFilter"]
- && ![[contentFilter objectForKey:@"filterValue"] length]
+ && ![(NSString *)[contentFilter objectForKey:@"filterValue"] length]
&& ![[contentFilter objectForKey:@"filterComparison"] isEqualToString:@"IS NULL"]
&& ![[contentFilter objectForKey:@"filterComparison"] isEqualToString:@"IS NOT NULL"])
|| [[currentHistoryEntry objectForKey:@"contentFilter"] isEqualToDictionary:contentFilter])))
@@ -230,9 +230,9 @@
NSMutableDictionary *newEntry = [NSMutableDictionary dictionaryWithObjectsAndKeys:
theDatabase, @"database",
theTable, @"table",
- [NSNumber numberWithInt:theView], @"view",
+ [NSNumber numberWithInteger:theView], @"view",
[NSNumber numberWithBool:contentSortColIsAsc], @"contentSortColIsAsc",
- [NSNumber numberWithInt:contentPageNumber], @"contentPageNumber",
+ [NSNumber numberWithInteger:contentPageNumber], @"contentPageNumber",
[NSValue valueWithRect:contentViewport], @"contentViewport",
nil];
if (contentSortCol) [newEntry setObject:contentSortCol forKey:@"contentSortCol"];
@@ -255,7 +255,7 @@
* Load a history entry and attempt to return the interface to that state.
* Performs the load in a task which is threaded as necessary.
*/
-- (void) loadEntryAtPosition:(unsigned int)position
+- (void) loadEntryAtPosition:(NSUInteger)position
{
// Sanity check the input
@@ -270,15 +270,15 @@
// Start the task and perform the load
[theDocument startTaskWithDescription:NSLocalizedString(@"Loading history entry...", @"Loading history entry task desc")];
if ([NSThread isMainThread]) {
- [NSThread detachNewThreadSelector:@selector(loadEntryTaskWithPosition:) toTarget:self withObject:[NSNumber numberWithUnsignedInt:position]];
+ [NSThread detachNewThreadSelector:@selector(loadEntryTaskWithPosition:) toTarget:self withObject:[NSNumber numberWithUnsignedInteger:position]];
} else {
- [self loadEntryTaskWithPosition:[NSNumber numberWithUnsignedInt:position]];
+ [self loadEntryTaskWithPosition:[NSNumber numberWithUnsignedInteger:position]];
}
}
- (void) loadEntryTaskWithPosition:(NSNumber *)positionNumber
{
NSAutoreleasePool *loadPool = [[NSAutoreleasePool alloc] init];
- unsigned int position = [positionNumber unsignedIntValue];
+ NSUInteger position = [positionNumber unsignedIntegerValue];
modifyingHistoryState = YES;
@@ -288,7 +288,7 @@
// Set table content details for restore
[tableContentInstance setSortColumnNameToRestore:[historyEntry objectForKey:@"contentSortCol"] isAscending:[[historyEntry objectForKey:@"contentSortCol"] boolValue]];
- [tableContentInstance setPageToRestore:[[historyEntry objectForKey:@"contentPageNumber"] intValue]];
+ [tableContentInstance setPageToRestore:[[historyEntry objectForKey:@"contentPageNumber"] integerValue]];
[tableContentInstance setSelectedRowIndexesToRestore:[historyEntry objectForKey:@"contentSelectedIndexSet"]];
[tableContentInstance setViewportToRestore:[[historyEntry objectForKey:@"contentViewport"] rectValue]];
[tableContentInstance setFiltersToRestore:[historyEntry objectForKey:@"contentFilter"]];
@@ -296,7 +296,7 @@
// If the database, table, and view are the same and content - just trigger a table reload (filters)
if ([[theDocument database] isEqualToString:[historyEntry objectForKey:@"database"]]
&& [historyEntry objectForKey:@"table"] && [[theDocument table] isEqualToString:[historyEntry objectForKey:@"table"]]
- && [[historyEntry objectForKey:@"view"] intValue] == [self currentlySelectedView] == SP_VIEW_CONTENT)
+ && [[historyEntry objectForKey:@"view"] integerValue] == [self currentlySelectedView] == SP_VIEW_CONTENT)
{
[tableContentInstance loadTable:[historyEntry objectForKey:@"table"]];
modifyingHistoryState = NO;
@@ -338,8 +338,8 @@
}
// Check and set the view
- if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] intValue]) {
- switch ([[historyEntry objectForKey:@"view"] intValue]) {
+ if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) {
+ switch ([[historyEntry objectForKey:@"view"] integerValue]) {
case SP_VIEW_STRUCTURE:
[theDocument viewStructure:self];
break;
@@ -356,7 +356,7 @@
[theDocument viewRelations:self];
break;
}
- if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] intValue]) {
+ if ([self currentlySelectedView] != [[historyEntry objectForKey:@"view"] integerValue]) {
return [self abortEntryLoadWithPool:loadPool];
}
}
@@ -395,7 +395,7 @@
/**
* Returns a menuitem for a history entry at a supplied index
*/
-- (NSMenuItem *) menuEntryForHistoryEntryAtIndex:(int)theIndex
+- (NSMenuItem *) menuEntryForHistoryEntryAtIndex:(NSInteger)theIndex
{
NSMenuItem *theMenuItem = [[NSMenuItem alloc] init];
NSDictionary *theHistoryEntry = [history objectAtIndex:theIndex];
@@ -416,7 +416,7 @@
if (![theEntry objectForKey:@"database"]) return NSLocalizedString(@"(no selection)", @"History item title with nothing selected");
NSMutableString *theName = [NSMutableString stringWithString:[theEntry objectForKey:@"database"]];
- if (![theEntry objectForKey:@"table"] || ![[theEntry objectForKey:@"table"] length]) return theName;
+ if (![theEntry objectForKey:@"table"] || ![(NSString *)[theEntry objectForKey:@"table"] length]) return theName;
[theName appendFormat:@"/%@", [theEntry objectForKey:@"table"]];
@@ -431,10 +431,10 @@
}
if ([theEntry objectForKey:@"contentPageNumber"]) {
- NSUInteger pageNumber = [[theEntry objectForKey:@"contentPageNumber"] unsignedIntValue];
+ NSUInteger pageNumber = [[theEntry objectForKey:@"contentPageNumber"] unsignedIntegerValue];
if (pageNumber > 1) {
- theName = [NSString stringWithFormat:NSLocalizedString(@"%@ (Page %i)", @"History item with page number label"),
- theName, pageNumber];
+ theName = [NSString stringWithFormat:NSLocalizedString(@"%@ (Page %lu)", @"History item with page number label"),
+ theName, (unsigned long)pageNumber];
}
}
diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m
index e808d3ea..eecca884 100644
--- a/Source/SPKeychain.m
+++ b/Source/SPKeychain.m
@@ -199,7 +199,7 @@
{
SecKeychainItemRef item;
SecKeychainSearchRef search = NULL;
- int numberOfItemsFound = 0;
+ NSInteger numberOfItemsFound = 0;
SecKeychainAttributeList list;
SecKeychainAttribute attributes[2];
@@ -237,9 +237,10 @@
{
NSString *keychainItemName;
- keychainItemName = [NSString stringWithFormat:@"Sequel Pro : %@ (%i)",
+ // Look up the keychain name using long longs to support 64-bit > 32-bit keychain usage
+ keychainItemName = [NSString stringWithFormat:@"Sequel Pro : %@ (%lld)",
theName?theName:@"",
- [theID intValue]];
+ [theID longLongValue]];
return keychainItemName;
}
@@ -266,9 +267,10 @@
{
NSString *sshKeychainItemName;
- sshKeychainItemName = [NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@ (%i)",
+ // Look up the keychain name using long longs to support 64-bit > 32-bit keychain usage
+ sshKeychainItemName = [NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@ (%lld)",
theName?theName:@"",
- [theID intValue]];
+ [theID longLongValue]];
return sshKeychainItemName;
}
diff --git a/Source/SPLogger.m b/Source/SPLogger.m
index 8c65f245..9d8f7a92 100644
--- a/Source/SPLogger.m
+++ b/Source/SPLogger.m
@@ -104,7 +104,7 @@ static SPLogger *logger = nil;
[logFileHandle seekToEndOfFile];
NSString *bundleName = [[NSFileManager defaultManager] displayNameAtPath:[[NSBundle mainBundle] bundlePath]];
NSMutableString *logStart = [NSMutableString stringWithString:@"\n\n\n==========================================================================\n\n"];
- [logStart appendString:[NSString stringWithFormat:@"%@ (r%i)\n", bundleName, [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue]]];
+ [logStart appendString:[NSString stringWithFormat:@"%@ (r%ld)\n", bundleName, (long)[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] integerValue]]];
[logFileHandle writeData:[logStart dataUsingEncoding:NSUTF8StringEncoding]];
}
}
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 378bec77..275142ca 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -32,6 +32,7 @@
#import "SPArrayAdditions.h"
#import "ImageAndTextCell.h"
#import "SPConstants.h"
+#include <tgmath.h>
@interface NSTableView (MovingSelectedRow)
@@ -54,9 +55,9 @@
- (BOOL)SP_NarrowDownCompletion_canHandleEvent:(NSEvent*)anEvent
{
- int visibleRows = (int)floorf(NSHeight([self visibleRect]) / ([self rowHeight]+[self intercellSpacing].height)) - 1;
+ NSInteger visibleRows = (NSInteger)floor(NSHeight([self visibleRect]) / ([self rowHeight]+[self intercellSpacing].height)) - 1;
- struct { unichar key; int rows; } const key_movements[] =
+ struct { unichar key; NSInteger rows; } const key_movements[] =
{
{ NSUpArrowFunctionKey, -1 },
{ NSDownArrowFunctionKey, +1 },
@@ -77,7 +78,7 @@
{
if(keyCode == key_movements[i].key)
{
- int row = MAX(0, MIN([self selectedRow] + key_movements[i].rows, [self numberOfRows]-1));
+ NSInteger row = MAX(0, MIN([self selectedRow] + key_movements[i].rows, [self numberOfRows]-1));
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
[self scrollRowToVisible:row];
@@ -158,7 +159,7 @@
NSRect mainScreen = [self rectOfMainScreen];
- int offx = (caretPos.x/mainScreen.size.width) + 1;
+ NSInteger offx = (caretPos.x/mainScreen.size.width) + 1;
if((caretPos.x + [self frame].size.width) > (mainScreen.size.width*offx))
caretPos.x = caretPos.x - [self frame].size.width;
@@ -209,12 +210,12 @@
// ========================
// = TableView DataSource =
// ========================
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [filtered count];
}
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
NSImage* image = nil;
NSString* imageName = nil;
@@ -259,15 +260,15 @@
}
NSPoint old = NSMakePoint([self frame].origin.x, [self frame].origin.y + [self frame].size.height);
- int displayedRows = [newFiltered count] < SP_NARROWDOWNLIST_MAX_ROWS ? [newFiltered count] : SP_NARROWDOWNLIST_MAX_ROWS;
- float newHeight = ([theTableView rowHeight] + [theTableView intercellSpacing].height) * displayedRows;
+ NSInteger displayedRows = [newFiltered count] < SP_NARROWDOWNLIST_MAX_ROWS ? [newFiltered count] : SP_NARROWDOWNLIST_MAX_ROWS;
+ CGFloat newHeight = ([theTableView rowHeight] + [theTableView intercellSpacing].height) * displayedRows;
- float maxLen = 1;
+ CGFloat maxLen = 1;
NSString* item;
- int i;
+ NSInteger i;
BOOL spaceInSuggestion = NO;
[textualInputCharacters removeCharactersInString:@" "];
- float maxWidth = [self frame].size.width;
+ CGFloat maxWidth = [self frame].size.width;
if([newFiltered count]>0)
{
for(i=0; i<[newFiltered count]; i++)
@@ -357,7 +358,7 @@
}
else if(t == NSKeyDown)
{
- unsigned int flags = [event modifierFlags];
+ NSUInteger flags = [event modifierFlags];
unichar key = [[event characters] length] == 1 ? [[event characters] characterAtIndex:0] : 0;
// Check if user pressed ⌥ to allow composing of accented characters.
@@ -440,7 +441,7 @@
// ==================
- (void)insertCommonPrefix
{
- int row = [theTableView selectedRow];
+ NSInteger row = [theTableView selectedRow];
if(row == -1)
return;
@@ -454,7 +455,7 @@
{
NSString* prefix = [curMatch substringToIndex:[[self filterString] length] + 1];
NSMutableArray* candidates = [NSMutableArray array];
- for(int i = row; i < [filtered count]; ++i)
+ for(NSInteger i = row; i < [filtered count]; ++i)
{
id candidate = [filtered objectAtIndex:i];
NSString* candidateMatch;
diff --git a/Source/SPNotLoaded.m b/Source/SPNotLoaded.m
index f8afda1b..e1e76806 100644
--- a/Source/SPNotLoaded.m
+++ b/Source/SPNotLoaded.m
@@ -67,7 +67,7 @@ static SPNotLoaded *notLoaded = nil;
- (id) retain { return self; }
-- (unsigned) retainCount { return UINT_MAX; }
+- (NSUInteger) retainCount { return NSUIntegerMax; }
- (void) release {}
diff --git a/Source/SPPreferenceController.h b/Source/SPPreferenceController.h
index 47ad0dd8..b8cf7be3 100644
--- a/Source/SPPreferenceController.h
+++ b/Source/SPPreferenceController.h
@@ -77,7 +77,7 @@
NSUserDefaults *prefs;
BOOL favoriteNameFieldWasTouched;
- int favoriteType;
+ NSInteger favoriteType;
}
- (void)applyRevisionChanges;
@@ -103,7 +103,7 @@
// Other
- (void)updateDefaultFavoritePopup;
- (void)selectFavorites:(NSArray *)favorite;
-- (void)selectFavoriteAtIndex:(unsigned int)theIndex;
+- (void)selectFavoriteAtIndex:(NSUInteger)theIndex;
- (void)changeFont:(id)sender;
- (IBAction)favoriteTypeDidChange:(id)sender;
- (void)updateFavoritePasswordsFromField:(NSControl *)passwordControl;
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index ef01ebf7..6377153a 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -100,22 +100,22 @@
// -------------------------------------------------------------------------------
- (void)applyRevisionChanges
{
- int i;
- int currentVersionNumber, recordedVersionNumber = 0;
+ NSInteger i;
+ NSInteger currentVersionNumber, recordedVersionNumber = 0;
// Get the current bundle version number (the SVN build number) for per-version upgrades
- currentVersionNumber = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] intValue];
+ currentVersionNumber = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] integerValue];
// Get the current revision
- if ([prefs objectForKey:@"lastUsedVersion"]) recordedVersionNumber = [[prefs objectForKey:@"lastUsedVersion"] intValue];
- if ([prefs objectForKey:SPLastUsedVersion]) recordedVersionNumber = [[prefs objectForKey:SPLastUsedVersion] intValue];
+ if ([prefs objectForKey:@"lastUsedVersion"]) recordedVersionNumber = [[prefs objectForKey:@"lastUsedVersion"] integerValue];
+ if ([prefs objectForKey:SPLastUsedVersion]) recordedVersionNumber = [[prefs objectForKey:SPLastUsedVersion] integerValue];
// Skip processing if the current version matches or is less than recorded version
if (currentVersionNumber <= recordedVersionNumber) return;
// If no recorded version, update to current revision and skip processing
if (!recordedVersionNumber) {
- [prefs setObject:[NSNumber numberWithInt:currentVersionNumber] forKey:SPLastUsedVersion];
+ [prefs setObject:[NSNumber numberWithInteger:currentVersionNumber] forKey:SPLastUsedVersion];
return;
}
@@ -125,7 +125,7 @@
NSEnumerator *databaseEnumerator, *tableEnumerator, *columnEnumerator;
NSString *databaseKey, *tableKey, *columnKey;
NSMutableDictionary *newDatabase, *newTable;
- float columnWidth;
+ CGFloat columnWidth;
NSMutableDictionary *newTableColumnWidths = [[NSMutableDictionary alloc] init];
databaseEnumerator = [[prefs objectForKey:SPTableColumnWidths] keyEnumerator];
@@ -136,9 +136,9 @@
newTable = [[NSMutableDictionary alloc] init];
columnEnumerator = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] objectForKey:tableKey] keyEnumerator];
while (columnKey = [columnEnumerator nextObject]) {
- columnWidth = [[[[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] objectForKey:tableKey] objectForKey:columnKey] floatValue];
+ columnWidth = [[[[[prefs objectForKey:SPTableColumnWidths] objectForKey:databaseKey] objectForKey:tableKey] objectForKey:columnKey] doubleValue];
if (columnWidth >= 15) {
- [newTable setObject:[NSNumber numberWithFloat:columnWidth] forKey:[NSString stringWithString:columnKey]];
+ [newTable setObject:[NSNumber numberWithDouble:columnWidth] forKey:[NSString stringWithString:columnKey]];
}
}
if ([newTable count]) {
@@ -201,14 +201,14 @@
for (i = 0; i < [favoritesArray count]; i++) {
favorite = [NSMutableDictionary dictionaryWithDictionary:[favoritesArray objectAtIndex:i]];
if ([favorite objectForKey:@"id"]) continue;
- [favorite setObject:[NSNumber numberWithInt:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]] forKey:@"id"];
+ [favorite setObject:[NSNumber numberWithInteger:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]] forKey:@"id"];
keychainName = [NSString stringWithFormat:@"Sequel Pro : %@", [favorite objectForKey:@"name"]];
keychainAccount = [NSString stringWithFormat:@"%@@%@/%@",
[favorite objectForKey:@"user"], [favorite objectForKey:@"host"], [favorite objectForKey:@"database"]];
password = [upgradeKeychain getPasswordForName:keychainName account:keychainAccount];
[upgradeKeychain deletePasswordForName:keychainName account:keychainAccount];
if (password && [password length]) {
- keychainName = [NSString stringWithFormat:@"Sequel Pro : %@ (%i)", [favorite objectForKey:@"name"], [[favorite objectForKey:@"id"] intValue]];
+ keychainName = [NSString stringWithFormat:@"Sequel Pro : %@ (%ld)", [favorite objectForKey:@"name"], (long)[[favorite objectForKey:@"id"] integerValue]];
[upgradeKeychain addPassword:password forName:keychainName account:keychainAccount];
}
[favoritesArray replaceObjectAtIndex:i withObject:[NSDictionary dictionaryWithDictionary:favorite]];
@@ -230,17 +230,17 @@
// If the favorite has a socket, or has the host set to "localhost", set to socket-type connection
if ([[favorite objectForKey:@"host"] isEqualToString:@"localhost"]
- || ([favorite objectForKey:@"socket"] && [[favorite objectForKey:@"socket"] length]))
+ || ([favorite objectForKey:@"socket"] && [(NSString *)[favorite objectForKey:@"socket"] length]))
{
- [favorite setObject:[NSNumber numberWithInt:1] forKey:@"type"];
+ [favorite setObject:[NSNumber numberWithInteger:1] forKey:@"type"];
// If SSH details are set, set to tunnel connection
- } else if ([favorite objectForKey:@"useSSH"] && [[favorite objectForKey:@"useSSH"] intValue]) {
- [favorite setObject:[NSNumber numberWithInt:2] forKey:@"type"];
+ } else if ([favorite objectForKey:@"useSSH"] && [[favorite objectForKey:@"useSSH"] integerValue]) {
+ [favorite setObject:[NSNumber numberWithInteger:2] forKey:@"type"];
// Default to TCP/IP
} else {
- [favorite setObject:[NSNumber numberWithInt:0] forKey:@"type"];
+ [favorite setObject:[NSNumber numberWithInteger:0] forKey:@"type"];
}
// Remove SSH tunnel flag - no longer required
@@ -294,7 +294,7 @@
}
// Update the prefs revision
- [prefs setObject:[NSNumber numberWithInt:currentVersionNumber] forKey:SPLastUsedVersion];
+ [prefs setObject:[NSNumber numberWithInteger:currentVersionNumber] forKey:SPLastUsedVersion];
}
#pragma mark -
@@ -305,10 +305,10 @@
// -------------------------------------------------------------------------------
- (IBAction)addFavorite:(id)sender
{
- NSNumber *favoriteid = [NSNumber numberWithInt:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
+ NSNumber *favoriteid = [NSNumber numberWithInteger:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
// Create default favorite
- NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"New Favorite", [NSNumber numberWithInt:0], @"", @"", @"", @"", @"", @"", @"", @"", favoriteid, nil]
+ NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"New Favorite", [NSNumber numberWithInteger:0], @"", @"", @"", @"", @"", @"", @"", @"", favoriteid, nil]
forKeys:[NSArray arrayWithObjects:@"name", @"type", @"host", @"socket", @"user", @"port", @"database", @"sshHost", @"sshUser", @"sshPort", @"id", nil]];
[favoritesController addObject:favorite];
@@ -338,7 +338,7 @@
NSString *sshUser = [favoritesController valueForKeyPath:@"selection.sshUser"];
NSString *sshHost = [favoritesController valueForKeyPath:@"selection.sshHost"];
NSString *favoriteid = [favoritesController valueForKeyPath:@"selection.id"];
- int type = [[favoritesController valueForKeyPath:@"selection.type"] intValue];
+ NSInteger type = [[favoritesController valueForKeyPath:@"selection.type"] integerValue];
// Remove passwords from the Keychain
[keychain deletePasswordForName:[keychain nameForFavoriteName:name id:favoriteid]
@@ -371,8 +371,8 @@
if ([favoritesTableView numberOfSelectedRows] == 1) {
NSString *keychainName, *keychainAccount, *password, *keychainSSHName, *keychainSSHAccount, *sshPassword;
NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithDictionary:[[favoritesController arrangedObjects] objectAtIndex:[favoritesTableView selectedRow]]];
- NSNumber *favoriteid = [NSNumber numberWithInt:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
- int duplicatedFavoriteType = [[favorite objectForKey:@"type"] intValue];
+ NSNumber *favoriteid = [NSNumber numberWithInteger:[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
+ NSInteger duplicatedFavoriteType = [[favorite objectForKey:@"type"] integerValue];
// Select the keychain passwords for duplication
keychainName = [keychain nameForFavoriteName:[favorite objectForKey:@"name"] id:[favorite objectForKey:@"id"]];
@@ -536,7 +536,7 @@
// -------------------------------------------------------------------------------
// numberOfRowsInTableView:
// -------------------------------------------------------------------------------
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [[favoritesController arrangedObjects] count];
}
@@ -544,7 +544,7 @@
// -------------------------------------------------------------------------------
// tableView:objectValueForTableColumn:row:
// -------------------------------------------------------------------------------
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
return [[[favoritesController arrangedObjects] objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
}
@@ -560,7 +560,7 @@
if ([rows count] == 1) {
[pboard declareTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType] owner:nil];
- [pboard setString:[[NSNumber numberWithInt:[rows firstIndex]] stringValue] forType:SPFavoritesPasteboardDragType];
+ [pboard setString:[[NSNumber numberWithInteger:[rows firstIndex]] stringValue] forType:SPFavoritesPasteboardDragType];
return YES;
} else {
return NO;
@@ -571,14 +571,14 @@
// -------------------------------------------------------------------------------
// tableView:validateDrop:proposedRow:proposedDropOperation:
// -------------------------------------------------------------------------------
-- (NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)operation
+- (NSDragOperation)tableView:(NSTableView *)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation
{
- int originalRow;
+ NSInteger originalRow;
NSArray *pboardTypes = [[info draggingPasteboard] types];
if (([pboardTypes count] > 1) && (row != -1)) {
if (([pboardTypes containsObject:SPFavoritesPasteboardDragType]) && (operation == NSTableViewDropAbove)) {
- originalRow = [[[info draggingPasteboard] stringForType:SPFavoritesPasteboardDragType] intValue];
+ originalRow = [[[info draggingPasteboard] stringForType:SPFavoritesPasteboardDragType] integerValue];
if ((row != originalRow) && (row != (originalRow + 1))) {
return NSDragOperationMove;
@@ -592,14 +592,14 @@
// -------------------------------------------------------------------------------
// tableView:acceptDrop:row:dropOperation:
// -------------------------------------------------------------------------------
-- (BOOL)tableView:(NSTableView *)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
+- (BOOL)tableView:(NSTableView *)tv acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation
{
- int originalRow;
- int destinationRow;
- int lastFavoriteIndexCached;
+ NSInteger originalRow;
+ NSInteger destinationRow;
+ NSInteger lastFavoriteIndexCached;
NSMutableDictionary *draggedRow;
- originalRow = [[[info draggingPasteboard] stringForType:SPFavoritesPasteboardDragType] intValue];
+ originalRow = [[[info draggingPasteboard] stringForType:SPFavoritesPasteboardDragType] integerValue];
destinationRow = row;
if (destinationRow > originalRow) {
@@ -637,11 +637,11 @@
// -------------------------------------------------------------------------------
// tableView:willDisplayCell:forTableColumn:row:
// -------------------------------------------------------------------------------
-- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)index
+- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)index
{
if ([cell isKindOfClass:[SPFavoriteTextFieldCell class]]) {
[cell setFavoriteName:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"name"]];
- if ([[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"type"] intValue] == SPSocketConnection) {
+ if ([[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"type"] integerValue] == SPSocketConnection) {
[cell setFavoriteHost:@"localhost"];
} else {
[cell setFavoriteHost:[[[favoritesController arrangedObjects] objectAtIndex:index] objectForKey:@"host"]];
@@ -673,7 +673,7 @@
// Retrieve and set the password.
NSString *keychainName = [keychain nameForFavoriteName:[currentFavorite objectForKey:@"name"] id:[currentFavorite objectForKey:@"id"]];
- NSString *keychainAccount = [keychain accountForUser:[currentFavorite objectForKey:@"user"] host:(([[currentFavorite objectForKey:@"type"] intValue] == SPSocketConnection)?@"localhost":[currentFavorite objectForKey:@"host"]) database:[currentFavorite objectForKey:@"database"]];
+ NSString *keychainAccount = [keychain accountForUser:[currentFavorite objectForKey:@"user"] host:(([[currentFavorite objectForKey:@"type"] integerValue] == SPSocketConnection)?@"localhost":[currentFavorite objectForKey:@"host"]) database:[currentFavorite objectForKey:@"database"]];
NSString *passwordValue = [keychain getPasswordForName:keychainName account:keychainAccount];
[standardPasswordField setStringValue:passwordValue];
[socketPasswordField setStringValue:passwordValue];
@@ -753,7 +753,7 @@
// -------------------------------------------------------------------------------
// splitView:constrainMaxCoordinate:ofSubviewAt:
// -------------------------------------------------------------------------------
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 220);
}
@@ -761,7 +761,7 @@
// -------------------------------------------------------------------------------
// splitView:constrainMinCoordinate:ofSubviewAt:
// -------------------------------------------------------------------------------
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 94);
}
@@ -881,8 +881,8 @@
NSString *passwordValue;
NSString *oldKeychainName, *newKeychainName;
NSString *oldKeychainAccount, *newKeychainAccount;
- NSString *oldHostnameForPassword = ([[currentFavorite objectForKey:@"type"] intValue] == SPSocketConnection) ? @"localhost" : [currentFavorite objectForKey:@"host"];
- NSString *newHostnameForPassword = ([[favoritesController valueForKeyPath:@"selection.type"] intValue] == SPSocketConnection) ? @"localhost" : [favoritesController valueForKeyPath:@"selection.host"];
+ NSString *oldHostnameForPassword = ([[currentFavorite objectForKey:@"type"] integerValue] == SPSocketConnection) ? @"localhost" : [currentFavorite objectForKey:@"host"];
+ NSString *newHostnameForPassword = ([[favoritesController valueForKeyPath:@"selection.type"] integerValue] == SPSocketConnection) ? @"localhost" : [favoritesController valueForKeyPath:@"selection.host"];
// SQL passwords are indexed by name, host, user and database. If any of these
// have changed, or a standard password field has, alter the keychain item to match.
@@ -1005,7 +1005,7 @@
[defaultFavoritePopup addItemWithTitle:@"Last Used"];
[[defaultFavoritePopup menu] addItem:[NSMenuItem separatorItem]];
- int i;
+ NSInteger i;
for(i=0; i<[[[favoritesController arrangedObjects] valueForKeyPath:@"name"] count]; i++ ){
NSMenuItem *favoritePrefMenuItem = [[NSMenuItem alloc] initWithTitle:[[[favoritesController arrangedObjects] valueForKeyPath:@"name"] objectAtIndex:i]
action:NULL
@@ -1044,7 +1044,7 @@
//
// Selects the favorite at the specified index in the favorites list
// -------------------------------------------------------------------------------
-- (void)selectFavoriteAtIndex:(unsigned int)theIndex
+- (void)selectFavoriteAtIndex:(NSUInteger)theIndex
{
[favoritesController setSelectionIndex:theIndex];
[favoritesTableView scrollRowToVisible:theIndex];
@@ -1077,7 +1077,7 @@
}
// set font panel's valid modes
-- (unsigned int)validModesForFontPanel:(NSFontPanel *)fontPanel
+- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel
{
return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask);
}
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 63529a29..fb3dec5d 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -201,7 +201,7 @@
defaultButton:NSLocalizedString(@"Kill", @"kill button")
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to kill the current query executing on connection ID %d.\n\nPlease be aware that continuing to kill this query may result in data corruption. Please proceed with caution.", @"kill query informative message"), processId]];
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to kill the current query executing on connection ID %lu?\n\nPlease be aware that continuing to kill this query may result in data corruption. Please proceed with caution.", @"kill query informative message"), (unsigned long)processId]];
NSArray *buttons = [alert buttons];
@@ -229,7 +229,7 @@
defaultButton:NSLocalizedString(@"Kill", @"kill button")
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to kill connection ID %d.\n\nPlease be aware that continuing to kill this connection may result in data corruption. Please proceed with caution.", @"kill connection informative message"), processId]];
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to kill connection ID %lu?\n\nPlease be aware that continuing to kill this connection may result in data corruption. Please proceed with caution.", @"kill connection informative message"), (unsigned long)processId]];
NSArray *buttons = [alert buttons];
@@ -363,7 +363,7 @@
/**
* Table view delegate method. Returns the number of rows in the table veiw.
*/
-- (int)numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return [processesFiltered count];
}
@@ -436,12 +436,12 @@
- (void)_killProcessQueryWithId:(NSUInteger)processId
{
// Kill the query
- [connection queryString:[NSString stringWithFormat:@"KILL QUERY %d", processId]];
+ [connection queryString:[NSString stringWithFormat:@"KILL QUERY %lu", (unsigned long)processId]];
// Check for errors
if (![[connection getLastErrorMessage] isEqualToString:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Unable to kill query", @"error killing query message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while attempting to kill the query associated with connection %d.\n\nMySQL said: %@", @"error killing query informative message"), processId, [connection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while attempting to kill the query associated with connection %lu.\n\nMySQL said: %@", @"error killing query informative message"), (unsigned long)processId, [connection getLastErrorMessage]]);
}
// Refresh the process list
@@ -454,12 +454,12 @@
- (void)_killProcessConnectionWithId:(NSUInteger)processId
{
// Kill the connection
- [connection queryString:[NSString stringWithFormat:@"KILL CONNECTION %d", processId]];
+ [connection queryString:[NSString stringWithFormat:@"KILL CONNECTION %lu", (unsigned long)processId]];
// Check for errors
if (![[connection getLastErrorMessage] isEqualToString:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Unable to kill connection", @"error killing connection message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while attempting to kill connection %d.\n\nMySQL said: %@", @"error killing query informative message"), processId, [connection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while attempting to kill connection %lu.\n\nMySQL said: %@", @"error killing query informative message"), (unsigned long)processId, [connection getLastErrorMessage]]);
}
// Refresh the process list
@@ -514,7 +514,7 @@
[processListTableView reloadData];
- [processesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered item count"), [processesFiltered count], [processes count]]];
+ [processesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%lu of %lu", "filtered item count"), (unsigned long)[processesFiltered count], (unsigned long)[processes count]]];
[processesCountTextField setHidden:NO];
if ([processesFiltered count] == 0) return;
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 177ec197..37b4aa97 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -116,7 +116,7 @@ static SPQueryController *sharedQueryController = nil;
- (id)retain { return self; }
-- (unsigned)retainCount { return UINT_MAX; }
+- (NSUInteger)retainCount { return NSUIntegerMax; }
- (id)autorelease { return self; }
@@ -313,10 +313,10 @@ static SPQueryController *sharedQueryController = nil;
/**
* Called when the NSSavePanel sheet ends. Writes the console's current content to the selected file if required.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
- [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton intValue] connections:[includeConnectionButton intValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton integerValue] connections:[includeConnectionButton integerValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}
}
@@ -326,7 +326,7 @@ static SPQueryController *sharedQueryController = nil;
/**
* Table view delegate method. Returns the number of rows in the table veiw.
*/
-- (int)numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return [messagesVisibleSet count];
}
@@ -468,7 +468,7 @@ static SPQueryController *sharedQueryController = nil;
{
// Register a new untiled document and return its URL
if(fileURL == nil) {
- NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %d", untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+ NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %ld", (unsigned long)untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
untitledDocumentCounter++;
if(![favoritesContainer objectForKey:[new absoluteString]]) {
@@ -594,7 +594,7 @@ static SPQueryController *sharedQueryController = nil;
- (void)addHistory:(NSString *)history forFileURL:(NSURL *)fileURL
{
- NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] intValue];
+ NSUInteger maxHistoryItems = [[prefs objectForKey:SPCustomQueryMaxHistoryItems] integerValue];
// Save each history item due to its document source
if([historyContainer objectForKey:[fileURL absoluteString]]) {
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m
index d03581a6..11a5ec13 100644
--- a/Source/SPQueryFavoriteManager.m
+++ b/Source/SPQueryFavoriteManager.m
@@ -386,7 +386,7 @@
/**
* Return the maximum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 240);
}
@@ -394,7 +394,7 @@
/**
* Return the minimum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 120);
}
@@ -622,7 +622,7 @@
NSMutableArray *draggedRows = [[NSMutableArray alloc] initWithCapacity:1];
NSUInteger rowIndex = [draggedIndexes firstIndex];
while ( rowIndex != NSNotFound ) {
- [draggedRows addObject:[NSNumber numberWithInt:rowIndex]];
+ [draggedRows addObject:[NSNumber numberWithInteger:rowIndex]];
rowIndex = [draggedIndexes indexGreaterThanIndex: rowIndex];
}
@@ -633,7 +633,7 @@
for(i=0; i<[draggedRows count]; i++) {
- NSInteger originalRow = [[draggedRows objectAtIndex:i] intValue];
+ NSInteger originalRow = [[draggedRows objectAtIndex:i] integerValue];
if(originalRow < destinationRow) destinationRow--;
@@ -669,7 +669,7 @@
/**
* Sheet did end method
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Is disabled - do we need that?
// if ([contextInfo isEqualToString:@"removeAllFavorites"]) {
@@ -704,7 +704,7 @@
/**
* Import panel did end method.
*/
-- (void)importPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)importPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if (returnCode == NSOKButton) {
@@ -770,7 +770,7 @@
/**
* Save panel did end method.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if([contextInfo isEqualToString:@"saveQuery"]) {
@@ -793,7 +793,7 @@
NSMutableArray *favoriteData = [NSMutableArray array];
- [spfdata setObject:[NSNumber numberWithInt:1] forKey:@"version"];
+ [spfdata setObject:[NSNumber numberWithInteger:1] forKey:@"version"];
[spfdata setObject:@"query favorites" forKey:@"format"];
[spfdata setObject:[NSNumber numberWithBool:NO] forKey:@"encrypted"];
diff --git a/Source/SPSQLParser.h b/Source/SPSQLParser.h
index 9625f8a4..a3ae4224 100644
--- a/Source/SPSQLParser.h
+++ b/Source/SPSQLParser.h
@@ -61,11 +61,11 @@
id string;
unichar *stringCharCache;
unichar parsedToChar;
- long parsedToPosition;
- long charCacheStart;
- long charCacheEnd;
+ NSInteger parsedToPosition;
+ NSInteger charCacheStart;
+ NSInteger charCacheEnd;
NSString *delimiter;
- int delimiterLength;
+ NSInteger delimiterLength;
BOOL charIsDelimiter;
BOOL isDelimiterCommand;
BOOL ignoreCommentStrings;
@@ -223,17 +223,17 @@ typedef enum _SPCommentTypes {
/*
* Methods used internally by this class to power the methods above:
*/
-- (long) firstOccurrenceOfCharacter:(unichar)character ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
-- (long) firstOccurrenceOfCharacter:(unichar)character afterIndex:(long)startIndex ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
-- (long) firstOccurrenceOfCharacter:(unichar)character afterIndex:(long)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
-- (long) firstOccurrenceInSqlOfCharacter:(unichar)character afterIndex:(long)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
-- (long) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(long)index;
-- (long) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(long)index;
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
+- (NSUInteger) firstOccurrenceInSqlOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings;
+- (NSUInteger) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(NSInteger)index;
+- (NSUInteger) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(NSInteger)index;
/*
* Cacheing methods to enable a faster alternative to characterAtIndex: when walking strings, and overrides to update.
*/
-- (unichar) charAtIndex:(long)index;
+- (unichar) charAtIndex:(NSInteger)index;
- (void) clearCharCache;
- (void) deleteCharactersInRange:(NSRange)aRange;
- (void) insertString:(NSString *)aString atIndex:(NSUInteger)anIndex;
@@ -241,19 +241,19 @@ typedef enum _SPCommentTypes {
/* Required and primitive methods to allow subclassing class cluster */
#pragma mark -
- (id) init;
-- (id) initWithBytes:(const void *)bytes length:(unsigned int)length encoding:(NSStringEncoding)encoding;
-- (id) initWithBytesNoCopy:(void *)bytes length:(unsigned int)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag;
-- (id) initWithCapacity:(unsigned int)capacity;
-- (id) initWithCharactersNoCopy:(unichar *)chars length:(unsigned int)length freeWhenDone:(BOOL)flag;
+- (id) initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding;
+- (id) initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag;
+- (id) initWithCapacity:(NSUInteger)capacity;
+- (id) initWithCharactersNoCopy:(unichar *)chars length:(NSUInteger)length freeWhenDone:(BOOL)flag;
- (id) initWithContentsOfFile:(id)path;
- (id) initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error;
- (id) initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding;
- (id) initWithFormat:(NSString *)format, ...;
- (id) initWithFormat:(NSString *)format arguments:(va_list)argList;
-- (unsigned int) length;
-- (unichar) characterAtIndex:(unsigned int)index;
+- (NSUInteger) length;
+- (unichar) characterAtIndex:(NSUInteger)index;
- (id) description;
-- (unsigned int) replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(unsigned)opts range:(NSRange)searchRange;
+- (NSUInteger) replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSUInteger)opts range:(NSRange)searchRange;
- (void) setString:(NSString *)string;
- (void) replaceCharactersInRange:(NSRange)range withString:(NSString *)string;
- (void) dealloc;
diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m
index f9ac506e..c93f3198 100644
--- a/Source/SPSQLParser.m
+++ b/Source/SPSQLParser.m
@@ -30,8 +30,8 @@
* Include all the extern variables and prototypes required for flex (used for syntax highlighting)
*/
#import "SPSQLTokenizer.h"
-extern int tolex();
-extern int yyuoffset, yyuleng;
+extern NSInteger tolex();
+extern NSInteger yyuoffset, yyuleng;
typedef struct to_buffer_state *TO_BUFFER_STATE;
void to_switch_to_buffer(TO_BUFFER_STATE);
TO_BUFFER_STATE to_scan_string (const char *);
@@ -52,9 +52,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
*/
- (void) deleteComments
{
- long currentStringIndex, commentEndIndex, quotedStringEndIndex;
+ NSUInteger currentStringIndex, commentEndIndex, quotedStringEndIndex;
unichar currentCharacter;
- long stringLength = [string length];
+ NSUInteger stringLength = [string length];
// Walk along the string, processing characters.
for (currentStringIndex = 0; currentStringIndex < stringLength; currentStringIndex++) {
@@ -116,7 +116,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
- (NSString *) unquotedString
{
NSMutableString *returnString;
- long stringEndIndex;
+ NSUInteger stringEndIndex;
unichar quoteCharacter;
if (![string length]) return nil;
@@ -167,7 +167,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
*/
- (BOOL) trimToCharacter:(unichar)character inclusively:(BOOL)inclusive ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long stringIndex;
+ NSUInteger stringIndex;
// Get the first occurrence of the specified character, returning NO if not found
stringIndex = [self firstOccurrenceOfCharacter:character ignoringQuotedStrings:ignoreQuotedStrings];
@@ -193,7 +193,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
* are ignored.
*/
- (NSString *) stringToCharacter:(unichar)character inclusively:(BOOL)inclusive ignoringQuotedStrings:(BOOL)ignoreQuotedStrings {
- long stringIndex;
+ NSUInteger stringIndex;
// Get the first occurrence of the specified character, returning nil if not found
stringIndex = [self firstOccurrenceOfCharacter:character ignoringQuotedStrings:ignoreQuotedStrings];
@@ -220,7 +220,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
*/
- (NSString *) trimAndReturnStringToCharacter:(unichar)character trimmingInclusively:(BOOL)inclusiveTrim returningInclusively:(BOOL)inclusiveReturn ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long stringIndex;
+ NSUInteger stringIndex;
NSString *resultString;
if (character != parsedToChar) {
@@ -275,7 +275,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
*/
- (NSString *) stringFromCharacter:(unichar)fromCharacter toCharacter:(unichar)toCharacter inclusively:(BOOL)inclusive skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long fromCharacterIndex, toCharacterIndex;
+ NSUInteger fromCharacterIndex, toCharacterIndex;
// Look for the first occurrence of the from: character
fromCharacterIndex = [self firstOccurrenceOfCharacter:fromCharacter afterIndex:-1 skippingBrackets:skipBrackets ignoringQuotedStrings:ignoreQuotedStrings];
@@ -326,7 +326,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
*/
- (NSString *) trimAndReturnStringFromCharacter:(unichar)fromCharacter toCharacter:(unichar)toCharacter trimmingInclusively:(BOOL)inclusiveTrim returningInclusively:(BOOL)inclusiveReturn skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long fromCharacterIndex, toCharacterIndex;
+ NSUInteger fromCharacterIndex, toCharacterIndex;
NSString *resultString;
// Look for the first occurrence of the from: character
@@ -376,7 +376,8 @@ TO_BUFFER_STATE to_scan_string (const char *);
- (NSArray *) splitStringByCharacter:(unichar)character skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
NSMutableArray *resultsArray = [NSMutableArray array];
- long stringIndex = -1, nextIndex = 0;
+ NSInteger stringIndex = -1;
+ NSUInteger nextIndex = 0;
// Walk through the string finding the character to split by, and add all strings to the array.
while (1) {
@@ -404,8 +405,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
{
NSMutableArray *resultsArray = [NSMutableArray arrayWithCapacity:2000];
- long stringIndex = -1, nextIndex = 0;
- int queryLength;
+ NSInteger stringIndex = -1;
+ NSUInteger nextIndex = 0;
+ NSInteger queryLength;
// these delimiter variables will be set in firstOccurrenceOfCharacter:
delimiter = nil;
@@ -419,7 +421,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Walk through the string finding the character to split by, and add all strings to the array.
while (1) {
- nextIndex = (long)(*firstOccOfChar)(self, @selector(firstOccurrenceInSqlOfCharacter:afterIndex:skippingBrackets:ignoringQuotedStrings:), character, stringIndex, NO, YES);
+ nextIndex = (NSUInteger)(*firstOccOfChar)(self, @selector(firstOccurrenceInSqlOfCharacter:afterIndex:skippingBrackets:ignoringQuotedStrings:), character, stringIndex, NO, YES);
if (nextIndex == NSNotFound)
break;
@@ -451,8 +453,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
{
NSMutableArray *resultsArray = [NSMutableArray arrayWithCapacity:2000];
- long stringIndex = -1, nextIndex = 0;
- int queryLength;
+ NSInteger stringIndex = -1;
+ NSUInteger nextIndex = 0;
+ NSInteger queryLength;
// these delimiter variables will be set in firstOccurrenceOfCharacter:
delimiter = nil;
@@ -465,7 +468,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
// Walk through the string finding the character to split by, and add all strings to the array.
while (1) {
- nextIndex = (long)(*firstOccOfChar)(self, @selector(firstOccurrenceInSqlOfCharacter:afterIndex:skippingBrackets:ignoringQuotedStrings:), character, stringIndex, NO, YES);
+ nextIndex = (NSUInteger)(*firstOccOfChar)(self, @selector(firstOccurrenceInSqlOfCharacter:afterIndex:skippingBrackets:ignoringQuotedStrings:), character, stringIndex, NO, YES);
if (nextIndex == NSNotFound)
break;
@@ -488,7 +491,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
/*
* A method intended for use by the functions above.
*/
-- (long) firstOccurrenceOfCharacter:(unichar)character ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
return [self firstOccurrenceOfCharacter:character afterIndex:-1 skippingBrackets:NO ignoringQuotedStrings:ignoreQuotedStrings];
}
@@ -497,18 +500,18 @@ TO_BUFFER_STATE to_scan_string (const char *);
/*
* A method intended for use by the functions above.
*/
-- (long) firstOccurrenceOfCharacter:(unichar)character afterIndex:(long)startIndex ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
return [self firstOccurrenceOfCharacter:character afterIndex:startIndex skippingBrackets:NO ignoringQuotedStrings:ignoreQuotedStrings];
}
-- (long) firstOccurrenceOfCharacter:(unichar)character afterIndex:(long)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
+- (NSUInteger) firstOccurrenceOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long currentStringIndex, quotedStringEndIndex;
+ NSUInteger currentStringIndex, quotedStringEndIndex;
unichar currentCharacter;
- long stringLength = [string length];
- int bracketingLevel = 0;
+ NSUInteger stringLength = [string length];
+ NSInteger bracketingLevel = 0;
// Cache frequently used selectors, avoiding dynamic binding overhead
IMP charAtIndex = [self methodForSelector:@selector(charAtIndex:)];
@@ -537,7 +540,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
case '"':
case '`':
if (!ignoreQuotedStrings) break;
- quotedStringEndIndex = (long)(*endIndex)(self, @selector(endIndexOfStringQuotedByCharacter:startingAtIndex:), currentCharacter, currentStringIndex+1);
+ quotedStringEndIndex = (NSUInteger)(*endIndex)(self, @selector(endIndexOfStringQuotedByCharacter:startingAtIndex:), currentCharacter, currentStringIndex+1);
if (quotedStringEndIndex == NSNotFound) {
parsedToPosition = stringLength - 1;
return NSNotFound;
@@ -586,12 +589,12 @@ TO_BUFFER_STATE to_scan_string (const char *);
* Look for the first occurence of a char and reset the split char on runtime
* via “delimiter” command for splitSqlStringIntoRangesByCharacter: and splitSqlStringByCharacter.
*/
-- (long) firstOccurrenceInSqlOfCharacter:(unichar)character afterIndex:(long)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
+- (NSUInteger) firstOccurrenceInSqlOfCharacter:(unichar)character afterIndex:(NSInteger)startIndex skippingBrackets:(BOOL)skipBrackets ignoringQuotedStrings:(BOOL)ignoreQuotedStrings
{
- long currentStringIndex, quotedStringEndIndex;
+ NSUInteger currentStringIndex, quotedStringEndIndex;
unichar currentCharacter;
- long stringLength = [string length];
- int bracketingLevel = 0;
+ NSUInteger stringLength = [string length];
+ NSInteger bracketingLevel = 0;
// Cache frequently used selectors, avoiding dynamic binding overhead
IMP charAtIndex = [self methodForSelector:@selector(charAtIndex:)];
@@ -628,7 +631,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
case '"':
case '`':
if (!ignoreQuotedStrings) break;
- quotedStringEndIndex = (long)(*endIndex)(self, @selector(endIndexOfStringQuotedByCharacter:startingAtIndex:), currentCharacter, currentStringIndex+1);
+ quotedStringEndIndex = (NSUInteger)(*endIndex)(self, @selector(endIndexOfStringQuotedByCharacter:startingAtIndex:), currentCharacter, currentStringIndex+1);
if (quotedStringEndIndex == NSNotFound) {
return NSNotFound;
}
@@ -711,9 +714,10 @@ TO_BUFFER_STATE to_scan_string (const char *);
/*
* A method intended for use by the functions above.
*/
-- (long) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(long)index
+- (NSUInteger) endIndexOfStringQuotedByCharacter:(unichar)quoteCharacter startingAtIndex:(NSInteger)index
{
- long currentStringIndex, stringLength, i, quotedStringLength;
+ NSInteger currentStringIndex;
+ NSUInteger stringLength, i, quotedStringLength;
BOOL characterIsEscaped;
unichar currentCharacter;
@@ -769,9 +773,9 @@ TO_BUFFER_STATE to_scan_string (const char *);
/*
* A method intended for use by the functions above.
*/
-- (long) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(long)index
+- (NSUInteger) endIndexOfCommentOfType:(SPCommentType)commentType startingAtIndex:(NSInteger)index
{
- long stringLength = [string length];
+ NSUInteger stringLength = [string length];
unichar currentCharacter;
// Cache the charAtIndex selector, avoiding dynamic binding overhead
@@ -817,7 +821,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
* Does no bounds checking on the underlying string, and so is kept
* separate for characterAtIndex:.
*/
-- (unichar) charAtIndex:(long)index
+- (unichar) charAtIndex:(NSInteger)index
{
// If the current cache doesn't include the current character, update it.
@@ -825,8 +829,8 @@ TO_BUFFER_STATE to_scan_string (const char *);
if (charCacheEnd > -1) {
free(stringCharCache);
}
- unsigned int remainingStringLength = [string length] - index;
- unsigned int newcachelength = (CHARACTER_CACHE_LENGTH < remainingStringLength)?CHARACTER_CACHE_LENGTH:remainingStringLength;
+ NSUInteger remainingStringLength = [string length] - index;
+ NSUInteger newcachelength = (CHARACTER_CACHE_LENGTH < remainingStringLength)?CHARACTER_CACHE_LENGTH:remainingStringLength;
stringCharCache = (unichar *)calloc(newcachelength, sizeof(unichar));
[string getCharacters:stringCharCache range:NSMakeRange(index, newcachelength)];
charCacheEnd = index + newcachelength - 1;
@@ -873,7 +877,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
return self;
}
-- (id) initWithBytes:(const void *)bytes length:(unsigned int)length encoding:(NSStringEncoding)encoding {
+- (id) initWithBytes:(const void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding {
if (self = [super init]) {
string = [[NSMutableString alloc] initWithBytes:bytes length:length encoding:encoding];
}
@@ -882,7 +886,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
charCacheEnd = -1;
return self;
}
-- (id) initWithBytesNoCopy:(void *)bytes length:(unsigned int)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag {
+- (id) initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag {
if (self = [super init]) {
string = [[NSMutableString alloc] initWithBytesNoCopy:bytes length:length encoding:encoding freeWhenDone:flag];
}
@@ -891,7 +895,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
charCacheEnd = -1;
return self;
}
-- (id) initWithCapacity:(unsigned int)capacity {
+- (id) initWithCapacity:(NSUInteger)capacity {
if (self = [super init]) {
string = [[NSMutableString stringWithCapacity:capacity] retain];
}
@@ -900,7 +904,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
charCacheEnd = -1;
return self;
}
-- (id) initWithCharactersNoCopy:(unichar *)characters length:(unsigned int)length freeWhenDone:(BOOL)flag {
+- (id) initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)flag {
if (self = [super init]) {
string = [[NSMutableString alloc] initWithCharactersNoCopy:characters length:length freeWhenDone:flag];
}
@@ -952,16 +956,16 @@ TO_BUFFER_STATE to_scan_string (const char *);
charCacheEnd = -1;
return self;
}
-- (unsigned int) length {
+- (NSUInteger) length {
return [string length];
}
-- (unichar) characterAtIndex:(unsigned int)index {
+- (unichar) characterAtIndex:(NSUInteger)index {
return [string characterAtIndex:index];
}
- (id) description {
return [string description];
}
-- (unsigned int) replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(unsigned)options range:(NSRange)searchRange {
+- (NSUInteger) replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSUInteger)options range:(NSRange)searchRange {
return [string replaceOccurrencesOfString:target withString:replacement options:options range:searchRange];
[self clearCharCache];
}
diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h
index 3fba9b50..1a061619 100644
--- a/Source/SPSSHTunnel.h
+++ b/Source/SPSSHTunnel.h
@@ -62,23 +62,23 @@ enum spsshtunnel_password_modes
BOOL useHostFallback;
BOOL requestedResponse;
BOOL passwordInKeychain;
- int sshPort;
- int remotePort;
- int localPort;
- int localPortFallback;
- int connectionState;
+ NSInteger sshPort;
+ NSInteger remotePort;
+ NSInteger localPort;
+ NSInteger localPortFallback;
+ NSInteger connectionState;
}
-- (id) initToHost:(NSString *) theHost port:(int) thePort login:(NSString *) theLogin tunnellingToPort:(int) targetPort onHost:(NSString *) targetHost;
+- (id) initToHost:(NSString *) theHost port:(NSInteger) thePort login:(NSString *) theLogin tunnellingToPort:(NSInteger) targetPort onHost:(NSString *) targetHost;
- (BOOL) setConnectionStateChangeSelector:(SEL)theStateChangeSelector delegate:(id)theDelegate;
- (void) setParentWindow:(NSWindow *)theWindow;
- (BOOL) setPasswordKeychainName:(NSString *)theName account:(NSString *)theAccount;
- (BOOL) setPassword:(NSString *)thePassword;
-- (int) state;
+- (NSInteger) state;
- (NSString *) lastError;
- (NSString *) debugMessages;
-- (int) localPort;
-- (int) localPortFallback;
+- (NSInteger) localPort;
+- (NSInteger) localPortFallback;
- (void) connect;
- (void) launchTask:(id) dummy;
- (void) disconnect;
diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m
index a2aed5d1..f74804ca 100644
--- a/Source/SPSSHTunnel.m
+++ b/Source/SPSSHTunnel.m
@@ -38,7 +38,7 @@
* therefore not recommended, or via setPasswordKeychainName:, which will use the keychain on-demand
* and is therefore preferred.
*/
-- (id) initToHost:(NSString *) theHost port:(int) thePort login:(NSString *) theLogin tunnellingToPort:(int) targetPort onHost:(NSString *) targetHost
+- (id) initToHost:(NSString *) theHost port:(NSInteger) thePort login:(NSString *) theLogin tunnellingToPort:(NSInteger) targetPort onHost:(NSString *) targetHost
{
if (!theHost || !thePort || !targetPort || !targetHost) return nil;
@@ -57,8 +57,8 @@
debugMessages = [[NSMutableArray alloc] init];
// Set up a connection for use by the tunnel process
- tunnelConnectionName = [[NSString alloc] initWithFormat:@"SequelPro-%u", [[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
- tunnelConnectionVerifyHash = [[NSString alloc] initWithFormat:@"%u", [[NSString stringWithFormat:@"%f%i", [[NSDate date] timeIntervalSince1970]] hash]];
+ tunnelConnectionName = [[NSString alloc] initWithFormat:@"SequelPro-%lu", (unsigned long)[[NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]] hash]];
+ tunnelConnectionVerifyHash = [[NSString alloc] initWithFormat:@"%lu", (unsigned long)[[NSString stringWithFormat:@"%f-seeded", [[NSDate date] timeIntervalSince1970]] hash]];
tunnelConnection = [[NSConnection defaultConnection] retain];
[tunnelConnection runInNewThread];
[tunnelConnection removeRunLoop:[NSRunLoop currentRunLoop]];
@@ -135,7 +135,7 @@
/*
* Get the state of the connection.
*/
-- (int) state
+- (NSInteger) state
{
return connectionState;
}
@@ -195,7 +195,7 @@
return;
}
- int connectionTimeout = [[[NSUserDefaults standardUserDefaults] objectForKey:SPConnectionTimeoutValue] intValue];
+ NSInteger connectionTimeout = [[[NSUserDefaults standardUserDefaults] objectForKey:SPConnectionTimeoutValue] integerValue];
if (!connectionTimeout) connectionTimeout = 10;
BOOL useKeepAlive = [[[NSUserDefaults standardUserDefaults] objectForKey:SPUseKeepAlive] doubleValue];
double keepAliveInterval = [[[NSUserDefaults standardUserDefaults] objectForKey:SPKeepAliveInterval] doubleValue];
@@ -203,9 +203,9 @@
// If no local port has yet been chosen, choose one
if (!localPort) {
- int tempSocket;
+ NSInteger tempSocket;
struct sockaddr_in tempSocketAddress;
- int addressLength = sizeof(tempSocketAddress);
+ NSInteger addressLength = sizeof(tempSocketAddress);
if((tempSocket = socket(AF_INET, SOCK_STREAM, 0)) > 0) {
memset(&tempSocketAddress, 0, sizeof(tempSocketAddress));
tempSocketAddress.sin_family = AF_INET;
@@ -257,24 +257,24 @@
// [taskArguments addObject:@"-C"]; // TODO: compression?
[taskArguments addObject:@"-M"]; // Places the ssh client into 'master' mode for connection sharing
[taskArguments addObject:@"-o ExitOnForwardFailure=yes"];
- [taskArguments addObject:[NSString stringWithFormat:@"-o ConnectTimeout=%i", connectionTimeout]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-o ConnectTimeout=%ld", (long)connectionTimeout]];
[taskArguments addObject:@"-o NumberOfPasswordPrompts=3"];
if (useKeepAlive && keepAliveInterval) {
[taskArguments addObject:@"-o TCPKeepAlive=no"];
- [taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%i", (int)ceil(keepAliveInterval)]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-o ServerAliveInterval=%ld", (long)ceil(keepAliveInterval)]];
[taskArguments addObject:@"-o ServerAliveCountMax=1"];
}
- [taskArguments addObject:[NSString stringWithFormat:@"-p %i", sshPort]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-p %ld", (long)sshPort]];
if ([sshLogin length]) {
[taskArguments addObject:[NSString stringWithFormat:@"%@@%@", sshLogin, sshHost]];
} else {
[taskArguments addObject:sshHost];
}
if (useHostFallback) {
- [taskArguments addObject:[NSString stringWithFormat:@"-L %i/127.0.0.1/%i", localPort, remotePort]];
- [taskArguments addObject:[NSString stringWithFormat:@"-L %i/%@/%i", localPortFallback, remoteHost, remotePort]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-L %ld/127.0.0.1/%ld", (long)localPort, (long)remotePort]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-L %ld/%@/%ld", (long)localPortFallback, remoteHost, (long)remotePort]];
} else {
- [taskArguments addObject:[NSString stringWithFormat:@"-L %i/%@/%i", localPort, remoteHost, remotePort]];
+ [taskArguments addObject:[NSString stringWithFormat:@"-L %ld/%@/%ld", (long)localPort, remoteHost, (long)remotePort]];
}
[task setArguments:taskArguments];
@@ -286,13 +286,13 @@
[taskEnvironment setObject:tunnelConnectionName forKey:@"SP_CONNECTION_NAME"];
[taskEnvironment setObject:tunnelConnectionVerifyHash forKey:@"SP_CONNECTION_VERIFY_HASH"];
if (passwordInKeychain) {
- [taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_PASSWORD_USES_KEYCHAIN] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_PASSWORD_USES_KEYCHAIN] stringValue] forKey:@"SP_PASSWORD_METHOD"];
[taskEnvironment setObject:keychainName forKey:@"SP_KEYCHAIN_ITEM_NAME"];
[taskEnvironment setObject:keychainAccount forKey:@"SP_KEYCHAIN_ITEM_ACCOUNT"];
} else if (password) {
- [taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_PASSWORD_ASKS_UI] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_PASSWORD_ASKS_UI] stringValue] forKey:@"SP_PASSWORD_METHOD"];
} else {
- [taskEnvironment setObject:[[NSNumber numberWithInt:SPSSH_NO_PASSWORD] stringValue] forKey:@"SP_PASSWORD_METHOD"];
+ [taskEnvironment setObject:[[NSNumber numberWithInteger:SPSSH_NO_PASSWORD] stringValue] forKey:@"SP_PASSWORD_METHOD"];
}
[task setEnvironment:taskEnvironment];
@@ -420,7 +420,7 @@
connectionState = PROXY_STATE_IDLE;
[task terminate];
if (lastError) [lastError release];
- lastError = [[NSString alloc] initWithFormat:NSLocalizedString(@"The SSH Tunnel was unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %i seconds).", @"SSH tunnel failed or timed out message"), sshHost, [[[NSUserDefaults standardUserDefaults] objectForKey:SPConnectionTimeoutValue] intValue]];
+ lastError = [[NSString alloc] initWithFormat:NSLocalizedString(@"The SSH Tunnel was unable to connect to host %@, or the request timed out.\n\nBe sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently %ld seconds).", @"SSH tunnel failed or timed out message"), sshHost, (long)[[[NSUserDefaults standardUserDefaults] objectForKey:SPConnectionTimeoutValue] integerValue]];
if (delegate) [delegate performSelectorOnMainThread:stateChangeSelector withObject:self waitUntilDone:NO];
}
}
@@ -436,7 +436,7 @@
/*
* Returns the local port assigned for use by the tunnel
*/
-- (int) localPort
+- (NSInteger) localPort
{
return localPort;
}
@@ -444,7 +444,7 @@
/*
* Returns the local port assigned for fallback use by the tunnel, if any
*/
-- (int) localPortFallback
+- (NSInteger) localPortFallback
{
if (!useHostFallback) return 0;
return localPortFallback;
@@ -486,7 +486,7 @@
windowFrameRect.size.height = ((questionTextSize.height < 100)?100:questionTextSize.height) + 70 + ([sshPasswordDialog isSheet]?0:22);
[sshQuestionDialog setFrame:windowFrameRect display:NO];
[NSApp beginSheet:sshQuestionDialog modalForWindow:parentWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
- int sshQueryResponseCode = [NSApp runModalForWindow:sshQuestionDialog];
+ NSInteger sshQueryResponseCode = [NSApp runModalForWindow:sshQuestionDialog];
[NSApp endSheet:sshQuestionDialog];
[sshQuestionDialog orderOut:nil];
@@ -544,7 +544,7 @@
windowFrameRect.size.height = ((queryTextSize.height < 40)?40:queryTextSize.height) + 140 + ([sshPasswordDialog isSheet]?0:22);
[sshPasswordDialog setFrame:windowFrameRect display:NO];
[NSApp beginSheet:sshPasswordDialog modalForWindow:parentWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
- int sshQueryResponseCode = [NSApp runModalForWindow:sshPasswordDialog];
+ NSInteger sshQueryResponseCode = [NSApp runModalForWindow:sshPasswordDialog];
[NSApp endSheet:sshPasswordDialog];
[sshPasswordDialog orderOut:nil];
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m
index dd3632e5..f8b39c19 100644
--- a/Source/SPServerVariablesController.m
+++ b/Source/SPServerVariablesController.m
@@ -236,7 +236,7 @@
/**
* Table view delegate method. Returns the number of rows in the table veiw.
*/
-- (int)numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return [variablesFiltered count];
}
@@ -344,7 +344,7 @@
[variablesTableView reloadData];
[variablesCountTextField setHidden:NO];
- [variablesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d of %d", "filtered item count"), [variablesFiltered count], [variables count]]];
+ [variablesCountTextField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%lu of %lu", "filtered item count"), (unsigned long)[variablesFiltered count], (unsigned long)[variables count]]];
if ([variablesFiltered count] == 0) return;
diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h
index 8ae44b38..b67baa54 100644
--- a/Source/SPStringAdditions.h
+++ b/Source/SPStringAdditions.h
@@ -41,7 +41,7 @@ static inline const char* NSStringUTF8String(NSString* self) {
@interface NSString (SPStringAdditions)
+ (NSString *)stringForByteSize:(long long)byteSize;
-+ (NSString *)stringForTimeInterval:(float)timeInterval;
++ (NSString *)stringForTimeInterval:(CGFloat)timeInterval;
- (NSString *)backtickQuotedString;
- (NSString *)tickQuotedString;
@@ -49,10 +49,10 @@ static inline const char* NSStringUTF8String(NSString* self) {
- (NSArray *)lineRangesForRange:(NSRange)aRange;
- (NSString *)createViewSyntaxPrettifier;
-- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*) charSet options:(unsigned) mask;
+- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*) charSet options:(NSUInteger) mask;
- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*) charSet;
-- (float)levenshteinDistanceWithWord:(NSString *)stringB;
+- (CGFloat)levenshteinDistanceWithWord:(NSString *)stringB;
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
- (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)set;
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index fdd37514..bc9e99fe 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -27,7 +27,7 @@
#import "RegexKitLite.h"
@interface NSString (Private)
-- (int)smallestOf:(int)a andOf:(int)b andOf:(int)c;
+- (NSInteger)smallestOf:(NSInteger)a andOf:(NSInteger)b andOf:(NSInteger)c;
@end
@implementation NSString (SPStringAdditions)
@@ -37,7 +37,7 @@
*/
+ (NSString *)stringForByteSize:(long long)byteSize
{
- float size = byteSize;
+ CGFloat size = byteSize;
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
@@ -46,7 +46,7 @@
if (size < 1023) {
[numberFormatter setFormat:@"#,##0 B"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithInt:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithInteger:size]];
}
size = (size / 1024);
@@ -54,7 +54,7 @@
if (size < 1023) {
[numberFormatter setFormat:@"#,##0.0 KB"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:size]];
}
size = (size / 1024);
@@ -62,7 +62,7 @@
if (size < 1023) {
[numberFormatter setFormat:@"#,##0.0 MB"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:size]];
}
size = (size / 1024);
@@ -70,14 +70,14 @@
if (size < 1023) {
[numberFormatter setFormat:@"#,##0.0 GB"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:size]];
}
size = (size / 1024);
[numberFormatter setFormat:@"#,##0.0 TB"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:size]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:size]];
}
@@ -86,7 +86,7 @@
//
// Returns a human readable version string of the supplied time interval.
// -------------------------------------------------------------------------------
-+ (NSString *)stringForTimeInterval:(float)timeInterval
++ (NSString *)stringForTimeInterval:(CGFloat)timeInterval
{
NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
@@ -96,51 +96,51 @@
if (timeInterval < 0.0001) {
[numberFormatter setFormat:@"< #,##0.0 ms"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:0.1]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:0.1]];
}
if (timeInterval < 0.1) {
timeInterval = (timeInterval * 1000);
[numberFormatter setFormat:@"#,##0.0 ms"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
if (timeInterval < 1) {
timeInterval = (timeInterval * 1000);
[numberFormatter setFormat:@"#,##0 ms"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
if (timeInterval < 10) {
[numberFormatter setFormat:@"#,##0.00 s"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
if (timeInterval < 100) {
[numberFormatter setFormat:@"#,##0.0 s"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
if (timeInterval < 300) {
[numberFormatter setFormat:@"#,##0 s"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
if (timeInterval < 3600) {
timeInterval = (timeInterval / 60);
[numberFormatter setFormat:@"#,##0 min"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
timeInterval = (timeInterval / 3600);
[numberFormatter setFormat:@"#,##0 hours"];
- return [numberFormatter stringFromNumber:[NSNumber numberWithFloat:timeInterval]];
+ return [numberFormatter stringFromNumber:[NSNumber numberWithDouble:timeInterval]];
}
@@ -320,11 +320,11 @@
#endif
-- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*) charSet options:(unsigned) mask
+- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*) charSet options:(NSUInteger) mask
{
NSRange range;
NSMutableString* newString = [NSMutableString string];
- unsigned len = [self length];
+ NSUInteger len = [self length];
mask &= ~NSBackwardsSearch;
range = NSMakeRange (0, len);
@@ -332,7 +332,7 @@
while (range.length)
{
NSRange substringRange;
- unsigned pos = range.location;
+ NSUInteger pos = range.location;
range = [self rangeOfCharacterFromSet:charSet options:mask range:range];
if (range.location == NSNotFound)
@@ -356,7 +356,7 @@
}
// calculate the distance between two string case-insensitively
-- (float)levenshteinDistanceWithWord:(NSString *)stringB
+- (CGFloat)levenshteinDistanceWithWord:(NSString *)stringB
{
// normalize strings
NSString * stringA = [NSString stringWithString: self];
@@ -367,14 +367,14 @@
stringA = [stringA lowercaseString];
stringB = [stringB lowercaseString];
- int k, i, j, cost, * d, distance;
+ NSInteger k, i, j, cost, * d, distance;
- int n = [stringA length];
- int m = [stringB length];
+ NSInteger n = [stringA length];
+ NSInteger m = [stringB length];
if( n++ != 0 && m++ != 0 ) {
- d = malloc( sizeof(int) * m * n );
+ d = malloc( sizeof(NSInteger) * m * n );
for( k = 0; k < n; k++)
d[k] = k;
@@ -405,9 +405,9 @@
}
// return the minimum of a, b and c
-- (int)smallestOf:(int)a andOf:(int)b andOf:(int)c
+- (NSInteger)smallestOf:(NSInteger)a andOf:(NSInteger)b andOf:(NSInteger)c
{
- int min = a;
+ NSInteger min = a;
if ( b < min )
min = b;
diff --git a/Source/SPTableData.h b/Source/SPTableData.h
index 0d248e15..c4e7495a 100644
--- a/Source/SPTableData.h
+++ b/Source/SPTableData.h
@@ -47,7 +47,7 @@
- (NSArray *) columns;
- (NSDictionary *) columnWithName:(NSString *)colName;
- (NSArray *) columnNames;
-- (NSDictionary *) columnAtIndex:(int)index;
+- (NSDictionary *) columnAtIndex:(NSInteger)index;
- (NSArray *) getConstraints;
- (BOOL) columnIsBlobOrText:(NSString *)colName;
- (NSString *) statusValueForKey:(NSString *)aKey;
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 0ccac919..0411458a 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -128,7 +128,7 @@
[self updateInformationForCurrentTable];
}
}
- int columnIndex = [columnNames indexOfObject:colName];
+ NSInteger columnIndex = [columnNames indexOfObject:colName];
if (columnIndex == NSNotFound) return nil;
return [columns objectAtIndex:columnIndex];
}
@@ -153,7 +153,7 @@
/*
* Retrieve a specified column for the current table as a dictionary, using or refreshing the cache as appropriate.
*/
-- (NSDictionary *) columnAtIndex:(int)index
+- (NSDictionary *) columnAtIndex:(NSInteger)index
{
if ([columns count] == 0) {
if ([tableListInstance tableType] == SP_TABLETYPE_VIEW) {
@@ -308,7 +308,7 @@
NSMutableArray *tableColumns, *fieldStrings, *definitionParts;
NSMutableDictionary *tableColumn, *tableData;
NSString *encodingString;
- unsigned i, stringStart;
+ NSUInteger i, stringStart;
unichar quoteCharacter;
[columns removeAllObjects];
@@ -406,14 +406,14 @@
}
[fieldsParser setIgnoringCommentStrings:NO];
- [tableColumn setObject:[NSNumber numberWithInt:[tableColumns count]] forKey:@"datacolumnindex"];
+ [tableColumn setObject:[NSNumber numberWithInteger:[tableColumns count]] forKey:@"datacolumnindex"];
[tableColumn setObject:fieldName forKey:@"name"];
// Split the remaining field definition string by spaces and process
[tableColumn addEntriesFromDictionary:[self parseFieldDefinitionStringParts:[fieldsParser splitStringByCharacter:' ' skippingBrackets:YES]]];
//if column is not null, but doesn't have a default value, set empty string
- if([[tableColumn objectForKey:@"null"] intValue] == 0 && [[tableColumn objectForKey:@"autoincrement"] intValue] == 0 && ![tableColumn objectForKey:@"default"]) {
+ if([[tableColumn objectForKey:@"null"] integerValue] == 0 && [[tableColumn objectForKey:@"autoincrement"] integerValue] == 0 && ![tableColumn objectForKey:@"default"]) {
[tableColumn setObject:@"" forKey:@"default"];
}
@@ -449,7 +449,7 @@
[fieldsParser setString:[[parts objectAtIndex:7] stringByTrimmingCharactersInSet:bracketSet]];
[constraintDetails setObject:[fieldsParser unquotedString] forKey:@"ref_columns"];
- int nextOffs = 12;
+ NSInteger nextOffs = 12;
if( [parts count] > 8 ) {
// NOTE: this won't get SET NULL | NO ACTION | RESTRICT
if( [[parts objectAtIndex:9] hasPrefix:@"UPDATE"] ) {
@@ -619,7 +619,7 @@
NSMutableArray *tableColumns;
NSDictionary *resultRow;
NSMutableDictionary *tableColumn, *viewData;
- unsigned i;
+ NSUInteger i;
// Catch unselected views and return nil
if ([viewName isEqualToString:@""] || !viewName) return nil;
@@ -669,7 +669,7 @@
resultRow = [theResult fetchRowAsDictionary];
// Add the column index and name
- [tableColumn setObject:[NSNumber numberWithInt:[tableColumns count]] forKey:@"datacolumnindex"];
+ [tableColumn setObject:[NSNumber numberWithInteger:[tableColumns count]] forKey:@"datacolumnindex"];
[tableColumn setObject:[NSString stringWithString:[resultRow objectForKey:@"Field"]] forKey:@"name"];
// Populate type, length, and other available details from the Type columns
@@ -808,7 +808,7 @@
NSMutableDictionary *fieldDetails = [[NSMutableDictionary alloc] init];
NSMutableArray *detailParts;
NSString *detailString;
- int i, definitionPartsIndex = 0, partsArrayLength;
+ NSInteger i, definitionPartsIndex = 0, partsArrayLength;
// Skip blank items within the definition parts
while (definitionPartsIndex < [definitionParts count]
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index b8b8820a..dc7d216d 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -204,12 +204,12 @@
#pragma mark -
#pragma mark TableView datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [info count];
}
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
return [info objectAtIndex:rowIndex];
}
@@ -220,19 +220,19 @@
}
-- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
{
// row 1 and 6 should be editable - ie be able to rename the table and change the auto_increment value.
return NO;//(rowIndex == 1 || rowIndex == 6 );
}
-- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(int)row
+- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(NSInteger)row
{
// This makes the top row (TABLE INFORMATION) have the diff styling
return (row == 0);
}
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ((rowIndex > 0) && [[aTableColumn identifier] isEqualToString:@"info"]) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-property"]];
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 07ab03c4..504797e2 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -131,7 +131,7 @@
// Execute query
[connection queryString:query];
- int retCode = (![[connection getLastErrorMessage] isEqualToString:@""]);
+ NSInteger retCode = (![[connection getLastErrorMessage] isEqualToString:@""]);
// 0 indicates success
if (retCode) {
@@ -179,7 +179,7 @@
[result dataSeek:0];
- for (int i = 0; i < [result numOfRows]; i++)
+ for (NSInteger i = 0; i < [result numOfRows]; i++)
{
[refTablePopUpButton addItemWithTitle:[[result fetchRowAsArray] objectAtIndex:0]];
}
@@ -265,12 +265,12 @@
#pragma mark -
#pragma mark Tableview datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return [relationData count];
}
-- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
return [[relationData objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]];
}
@@ -290,7 +290,7 @@
* Double-click action on table cells - for the time being, return
* NO to disable editing.
*/
-- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([tableDocumentInstance isWorking]) return NO;
@@ -346,7 +346,7 @@
/**
* NSAlert didEnd method.
*/
-- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if ([contextInfo isEqualToString:@"removeRelation"]) {
@@ -355,7 +355,7 @@
NSString *thisTable = [tablesListInstance tableName];
NSIndexSet *selectedSet = [relationsTableView selectedRowIndexes];
- unsigned int row = [selectedSet lastIndex];
+ NSUInteger row = [selectedSet lastIndex];
while (row != NSNotFound)
{
diff --git a/Source/SPTableTextFieldCell.m b/Source/SPTableTextFieldCell.m
index d08486bb..bcfa0138 100644
--- a/Source/SPTableTextFieldCell.m
+++ b/Source/SPTableTextFieldCell.m
@@ -35,9 +35,9 @@
// Construct and get the sub text attributed string
NSAttributedString *string = [self attributedStringValue];
- int i;
- float maxWidth = cellFrame.size.width;
- float stringWidth = [string size].width;
+ NSInteger i;
+ CGFloat maxWidth = cellFrame.size.width;
+ CGFloat stringWidth = [string size].width;
// Set a right padding
maxWidth -= 5;
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index a2e0c713..982c3f42 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -40,12 +40,12 @@
return [self menu];
// Right-click at a row will select that row before ordering out the context menu
- int row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
+ NSInteger row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
if(row >= 0 && row < [self numberOfRows]) {
// Check for TablesList if right-click on header, then suppress context menu
if([[[[self delegate] class] description] isEqualToString:@"TablesList"]) {
- if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"tableTypes"], row) intValue] == -1)
+ if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"tableTypes"], row) integerValue] == -1)
return nil;
}
if([[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]) {
diff --git a/Source/SPTextAndLinkCell.h b/Source/SPTextAndLinkCell.h
index 76604092..75723796 100644
--- a/Source/SPTextAndLinkCell.h
+++ b/Source/SPTextAndLinkCell.h
@@ -38,13 +38,13 @@ enum sptextandlinkcell_drawstates
id linkTarget;
SEL linkAction;
- int lastLinkColumn;
- int lastLinkRow;
- int drawState;
+ NSInteger lastLinkColumn;
+ NSInteger lastLinkRow;
+ NSInteger drawState;
}
- (void) setTarget:(id)theTarget action:(SEL)theAction;
-- (int) getClickedColumn;
-- (int) getClickedRow;
+- (NSInteger) getClickedColumn;
+- (NSInteger) getClickedRow;
@end
diff --git a/Source/SPTextAndLinkCell.m b/Source/SPTextAndLinkCell.m
index 244cd379..ac5cde0e 100644
--- a/Source/SPTextAndLinkCell.m
+++ b/Source/SPTextAndLinkCell.m
@@ -134,7 +134,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
[super drawInteriorWithFrame:textRect inView:controlView];
// Get the new link state
- int newDrawState = ([self isHighlighted])?
+ NSInteger newDrawState = ([self isHighlighted])?
((([(NSTableView *)[self controlView] editedColumn] != -1
|| [[[self controlView] window] firstResponder] == [self controlView])
&& [[[self controlView] window] isKeyWindow])?SP_LINKDRAWSTATE_HIGHLIGHT:SP_LINKDRAWSTATE_BACKGROUNDHIGHLIGHT):
@@ -251,7 +251,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
/**
* Retrieve the last column that recorded a click with the link cell
*/
-- (int) getClickedColumn
+- (NSInteger) getClickedColumn
{
return lastLinkColumn;
}
@@ -259,7 +259,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
/**
* Retrieve the last row that recorded a click with the link cell
*/
-- (int) getClickedRow
+- (NSInteger) getClickedRow
{
return lastLinkRow;
}
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m
index 28fe7371..63a01798 100644
--- a/Source/SPTextViewAdditions.m
+++ b/Source/SPTextViewAdditions.m
@@ -40,13 +40,13 @@
if (curRange.length)
return curRange;
- unsigned long curLocation = curRange.location;
+ NSUInteger curLocation = curRange.location;
[self moveWordLeft:self];
[self moveWordRightAndModifySelection:self];
- unsigned long newStartRange = [self selectedRange].location;
- unsigned long newEndRange = newStartRange + [self selectedRange].length;
+ NSUInteger newStartRange = [self selectedRange].location;
+ NSUInteger newEndRange = newStartRange + [self selectedRange].length;
// if current location does not intersect with found range
// then caret is at the begin of a word -> change strategy
@@ -60,7 +60,7 @@
}
// how many space in front of the selection
- int bias = [self selectedRange].length - [[[[self string] substringWithRange:[self selectedRange]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length];
+ NSInteger bias = [self selectedRange].length - [[[[self string] substringWithRange:[self selectedRange]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length];
[self setSelectedRange:NSMakeRange([self selectedRange].location+bias, [self selectedRange].length-bias)];
newStartRange += bias;
newEndRange -= bias;
@@ -101,17 +101,17 @@
*/
- (IBAction)selectEnclosingBrackets:(id)sender
{
- long caretPosition = [self selectedRange].location;
- long stringLength = [[self string] length];
+ NSUInteger caretPosition = [self selectedRange].location;
+ NSUInteger stringLength = [[self string] length];
unichar co, cc;
if(caretPosition == 0 || caretPosition >= stringLength) return;
- long pcnt = 0;
- long bcnt = 0;
- long scnt = 0;
+ NSInteger pcnt = 0;
+ NSInteger bcnt = 0;
+ NSInteger scnt = 0;
- long i;
+ NSInteger i;
// look for the first non-balanced closing bracket
for(i=caretPosition; i<stringLength; i++) {
@@ -140,9 +140,9 @@
}
}
- long start = -1;
- long end = -1;
- long bracketCounter = 0;
+ NSInteger start = -1;
+ NSInteger end = -1;
+ NSInteger bracketCounter = 0;
if([[self string] characterAtIndex:caretPosition] == cc)
bracketCounter--;
@@ -372,11 +372,10 @@
// reverse string : TODO not yet combining diacritics safe!
- if(workingRange.length > 1)
+ NSUInteger len = workingRange.length;
+ if (len > 1)
{
- NSMutableString *reversedStr;
- unsigned long len = workingRange.length;
- reversedStr = [NSMutableString stringWithCapacity:len];
+ NSMutableString *reversedStr = [NSMutableString stringWithCapacity:len];
while (len > 0)
[reversedStr appendString:
[NSString stringWithFormat:@"%C", [[self string] characterAtIndex:--len+workingRange.location]]];
@@ -418,7 +417,7 @@
- (void)makeTextSizeSmaller
{
NSFont *aFont = [self font];
- int newSize = ([aFont pointSize]-1 < 4) ? [aFont pointSize] : [aFont pointSize]-1;
+ NSInteger newSize = ([aFont pointSize]-1 < 4) ? [aFont pointSize] : [aFont pointSize]-1;
BOOL editableStatus = [self isEditable];
[self setEditable:YES];
[self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:newSize]];
diff --git a/Source/SPTooltip.m b/Source/SPTooltip.m
index 5a0bd954..90f4b202 100644
--- a/Source/SPTooltip.m
+++ b/Source/SPTooltip.m
@@ -56,10 +56,11 @@
#import "SPTooltip.h"
#import "SPTextViewAdditions.h"
+#include <tgmath.h>
-static int spTooltipCounter = 0;
+static NSInteger spTooltipCounter = 0;
-static float slow_in_out (float t)
+static CGFloat slow_in_out (CGFloat t)
{
if(t < 1.0f)
t = 1.0f / (1.0f + exp((-t*12.0f)+6.0f));
@@ -157,8 +158,8 @@ static float slow_in_out (float t)
NSSize s = [(NSImage *)content size];
// Downsize a large image
- int w = s.width;
- int h = s.height;
+ NSInteger w = s.width;
+ NSInteger h = s.height;
if(w>h) {
if(s.width > 200) {
w = 200;
@@ -207,7 +208,7 @@ static float slow_in_out (float t)
[webPreferences setJavaScriptEnabled:YES];
NSString *fontName = ([displayOptions objectForKey:@"fontname"]) ? [displayOptions objectForKey:@"fontname"] : @"Lucida Grande";
- int fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] intValue] : 10;
+ NSInteger fontSize = ([displayOptions objectForKey:@"fontsize"]) ? [[displayOptions objectForKey:@"fontsize"] integerValue] : 10;
if(fontSize < 5) fontSize = 5;
NSFont* font = [NSFont fontWithName:fontName size:fontSize];
@@ -325,8 +326,8 @@ static float slow_in_out (float t)
// The webview is set to a large initial size and then sized down to fit the content
[self setContentSize:NSMakeSize(screenFrame.size.width - screenFrame.size.width / 3.0f , screenFrame.size.height)];
- int height = [[[webView windowScriptObject] evaluateWebScript:@"document.body.offsetHeight + document.body.offsetTop;"] intValue];
- int width = [[[webView windowScriptObject] evaluateWebScript:@"document.body.offsetWidth + document.body.offsetLeft;"] intValue];
+ NSInteger height = [[[webView windowScriptObject] evaluateWebScript:@"document.body.offsetHeight + document.body.offsetTop;"] integerValue];
+ NSInteger width = [[[webView windowScriptObject] evaluateWebScript:@"document.body.offsetWidth + document.body.offsetLeft;"] integerValue];
[webView setFrameSize:NSMakeSize(width, height)];
@@ -361,7 +362,7 @@ static float slow_in_out (float t)
// ==================
- (BOOL)shouldCloseForMousePosition:(NSPoint)aPoint
{
- float ignorePeriod = 0.05f;
+ CGFloat ignorePeriod = 0.05f;
if(-[didOpenAtDate timeIntervalSinceNow] < ignorePeriod)
return NO;
@@ -372,11 +373,11 @@ static float slow_in_out (float t)
}
NSPoint p = mousePositionWhenOpened;
- float deltaX = p.x - aPoint.x;
- float deltaY = p.y - aPoint.y;
- float dist = sqrtf(deltaX * deltaX + deltaY * deltaY);
+ CGFloat deltaX = p.x - aPoint.x;
+ CGFloat deltaY = p.y - aPoint.y;
+ CGFloat dist = sqrt(deltaX * deltaX + deltaY * deltaY);
- float moveThreshold = 10;
+ CGFloat moveThreshold = 10;
return dist > moveThreshold;
}
@@ -389,7 +390,7 @@ static float slow_in_out (float t)
BOOL didAcceptMouseMovedEvents = [keyWindow acceptsMouseMovedEvents];
[keyWindow setAcceptsMouseMovedEvents:YES];
NSEvent* event = nil;
- int eventType;
+ NSInteger eventType;
while(event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES])
{
eventType = [event type];
@@ -432,7 +433,7 @@ static float slow_in_out (float t)
- (void)animationTick:(id)sender
{
- float alpha = 0.97f * (1.0f - 40*slow_in_out(-2.2 * [animationStart timeIntervalSinceNow]));
+ CGFloat alpha = 0.97f * (1.0f - 40*slow_in_out(-2.2 * [animationStart timeIntervalSinceNow]));
if(alpha > 0.0f && spTooltipCounter==1)
{
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 83ffa52d..8e60a334 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -127,14 +127,14 @@
// Select users from the mysql.user table
MCPResult *result = [self.mySqlConnection queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"];
- int rows = [result numOfRows];
+ NSInteger rows = [result numOfRows];
if (rows > 0) {
// Go to the beginning
[result dataSeek:0];
}
- for (int i = 0; i < rows; i++)
+ for (NSInteger i = 0; i < rows; i++)
{
[resultAsArray addObject:[result fetchRowAsDictionary]];
}
@@ -180,7 +180,7 @@
// Go through each item that contains a dictionary of key-value pairs
// for each user currently in the database.
- for(int i = 0; i < [items count]; i++)
+ for(NSInteger i = 0; i < [items count]; i++)
{
NSString *username = [[items objectAtIndex:i] objectForKey:@"User"];
NSArray *parentResults = [[self _fetchUserWithUserName:username] retain];
@@ -251,7 +251,7 @@
}
else if ([key hasPrefix:@"max"]) // Resource Management restrictions
{
- NSNumber *value = [NSNumber numberWithInt:[[item objectForKey:key] intValue]];
+ NSNumber *value = [NSNumber numberWithInteger:[[item objectForKey:key] integerValue]];
[child setValue:value forKey:key];
}
else if (![key isEqualToString:@"User"] && ![key isEqualToString:@"Password"])
@@ -589,8 +589,6 @@
NSArray *inserted = [[notification userInfo] valueForKey:NSInsertedObjectsKey];
NSArray *deleted = [[notification userInfo] valueForKey:NSDeletedObjectsKey];
- NSLog(@"%d", [inserted count]);
-
if ([inserted count] > 0) {
[self insertUsers:inserted];
}
@@ -814,7 +812,7 @@
/**
* Return the maximum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 220);
}
@@ -822,7 +820,7 @@
/**
* Return the minimum possible size of the splitview.
*/
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 120);
}
diff --git a/Source/SPWindowAdditions.h b/Source/SPWindowAdditions.h
index 56fdcd54..cb201d6f 100644
--- a/Source/SPWindowAdditions.h
+++ b/Source/SPWindowAdditions.h
@@ -27,7 +27,7 @@
@interface NSWindow (SPWindowAdditions)
-- (float)toolbarHeight;
+- (CGFloat)toolbarHeight;
- (void)resizeForContentView:(NSView *)view titleBarVisible:(BOOL)visible;
@end
diff --git a/Source/SPWindowAdditions.m b/Source/SPWindowAdditions.m
index 105e2bd7..b04562e3 100644
--- a/Source/SPWindowAdditions.m
+++ b/Source/SPWindowAdditions.m
@@ -32,10 +32,10 @@
//
// Returns the height of the currently visible toolbar.
// -------------------------------------------------------------------------------
-- (float)toolbarHeight
+- (CGFloat)toolbarHeight
{
NSRect windowFrame;
- float toolbarHeight = 0.0;
+ CGFloat toolbarHeight = 0.0;
if (([self toolbar]) && ([[self toolbar] isVisible])) {
windowFrame = [NSWindow contentRectForFrameRect:[self frame] styleMask:[self styleMask]];
@@ -60,7 +60,7 @@
viewSize.height = [self contentMinSize].height;
}
- float newHeight = (viewSize.height + [self toolbarHeight]);
+ CGFloat newHeight = (viewSize.height + [self toolbarHeight]);
// If the title bar is visible add 22 pixels to new height of window.
if (visible) {
diff --git a/Source/SequelProTunnelAssistant.m b/Source/SequelProTunnelAssistant.m
index 0d9138a1..0805df8c 100644
--- a/Source/SequelProTunnelAssistant.m
+++ b/Source/SequelProTunnelAssistant.m
@@ -68,7 +68,7 @@ int main(int argc, const char *argv[])
// If the password method is set to use the keychain, use the supplied keychain name to
// request the password
- if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] intValue] == SPSSH_PASSWORD_USES_KEYCHAIN) {
+ if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSH_PASSWORD_USES_KEYCHAIN) {
SPKeychain *keychain;
NSString *keychainName = [environment objectForKey:@"SP_KEYCHAIN_ITEM_NAME"];
NSString *keychainAccount = [environment objectForKey:@"SP_KEYCHAIN_ITEM_ACCOUNT"];
@@ -94,7 +94,7 @@ int main(int argc, const char *argv[])
}
// If the password method is set to request the password from the tunnel instance, do so.
- if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] intValue] == SPSSH_PASSWORD_ASKS_UI) {
+ if ([[environment objectForKey:@"SP_PASSWORD_METHOD"] integerValue] == SPSSH_PASSWORD_ASKS_UI) {
NSString *password;
if (!connectionName || !verificationHash) {
diff --git a/Source/TableContent.h b/Source/TableContent.h
index e675d528..c467b865 100644
--- a/Source/TableContent.h
+++ b/Source/TableContent.h
@@ -40,7 +40,7 @@
IBOutlet id tableWindow;
IBOutlet CMCopyTable *tableContentView;
- IBOutlet id fieldField;
+ IBOutlet NSPopUpButton *fieldField;
IBOutlet id compareField;
IBOutlet id argumentField;
IBOutlet id filterButton;
@@ -79,7 +79,7 @@
BOOL isEditingRow, isEditingNewRow, isSavingRow, isDesc, setLimit;
BOOL isFiltered, isLimited, isInterruptedLoad, maxNumRowsIsEstimate;
NSUserDefaults *prefs;
- int currentlyEditingRow, maxNumRows;
+ NSInteger currentlyEditingRow, maxNumRows;
NSMutableDictionary *contentFilters;
NSMutableDictionary *numberOfDefaultFilters;
@@ -90,12 +90,12 @@
BOOL sortColumnToRestoreIsAsc;
BOOL tableRowsSelectable;
NSString *sortColumnToRestore;
- unsigned int pageToRestore;
+ NSUInteger pageToRestore;
NSIndexSet *selectionIndexToRestore;
NSRect selectionViewportToRestore;
NSString *filterFieldToRestore, *filterComparisonToRestore, *filterValueToRestore, *firstBetweenValueToRestore, *secondBetweenValueToRestore;
- int paginationViewHeight;
+ NSInteger paginationViewHeight;
}
// Table loading methods and information
@@ -137,26 +137,26 @@
- (void)setConnection:(MCPConnection *)theConnection;
- (void)clickLinkArrow:(SPTextAndLinkCell *)theArrowCell;
- (IBAction)setCompareTypes:(id)sender;
-- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(long)targetRowCount;
+- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(NSUInteger)targetRowCount;
- (BOOL)addRowToDB;
-- (NSString *)argumentForRow:(int)row;
+- (NSString *)argumentForRow:(NSInteger)row;
- (BOOL)tableContainsBlobOrTextColumns;
- (NSString *)fieldListForQuery;
-- (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo;
+- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (void)updateNumberOfRows;
-- (int)fetchNumberOfRows;
+- (NSInteger)fetchNumberOfRows;
- (BOOL)saveRowOnDeselect;
- (void)sortTableTaskWithColumn:(NSTableColumn *)tableColumn;
// Retrieving and setting table state
- (NSString *) sortColumnName;
- (BOOL) sortColumnIsAscending;
-- (unsigned int) pageNumber;
+- (NSUInteger) pageNumber;
- (NSIndexSet *) selectedRowIndexes;
- (NSRect) viewport;
- (NSDictionary *) filterSettings;
- (void) setSortColumnNameToRestore:(NSString *)theSortColumnName isAscending:(BOOL)isAscending;
-- (void) setPageToRestore:(unsigned int)thePage;
+- (void) setPageToRestore:(NSUInteger)thePage;
- (void) setSelectedRowIndexesToRestore:(NSIndexSet *)theIndexSet;
- (void) setViewportToRestore:(NSRect)theViewport;
- (void) setFiltersToRestore:(NSDictionary *)filterSettings;
diff --git a/Source/TableContent.m b/Source/TableContent.m
index cacccc97..04f8fb2a 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -113,9 +113,9 @@
NSLog(@"Error while reading 'ContentFilters.plist':\n%@\n%@", [readError localizedDescription], convError);
NSBeep();
} else {
- [numberOfDefaultFilters setObject:[NSNumber numberWithInt:[[contentFilters objectForKey:@"number"] count]] forKey:@"number"];
- [numberOfDefaultFilters setObject:[NSNumber numberWithInt:[[contentFilters objectForKey:@"date"] count]] forKey:@"date"];
- [numberOfDefaultFilters setObject:[NSNumber numberWithInt:[[contentFilters objectForKey:@"string"] count]] forKey:@"string"];
+ [numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"number"] count]] forKey:@"number"];
+ [numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"date"] count]] forKey:@"date"];
+ [numberOfDefaultFilters setObject:[NSNumber numberWithInteger:[[contentFilters objectForKey:@"string"] count]] forKey:@"string"];
}
@@ -413,7 +413,7 @@
// Set field length limit if field is a varchar to match varchar length
if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]) {
- [[dataCell formatter] setTextLimit:[[columnDefinition objectForKey:@"length"] intValue]];
+ [[dataCell formatter] setTextLimit:[[columnDefinition objectForKey:@"length"] integerValue]];
}
// Set the data cell font according to the preferences
@@ -425,7 +425,7 @@
// Set the width of this column to saved value if exists
colWidth = [[[[prefs objectForKey:SPTableColumnWidths] objectForKey:[NSString stringWithFormat:@"%@@%@", [tableDocumentInstance database], [tableDocumentInstance host]]] objectForKey:[tablesListInstance tableName]] objectForKey:[columnDefinition objectForKey:@"name"]];
if ( colWidth ) {
- [theCol setWidth:[colWidth floatValue]];
+ [theCol setWidth:[colWidth doubleValue]];
}
// Set the column to be reselected for sorting if appropriate
@@ -549,7 +549,7 @@
NSString *queryStringBeforeLimit = nil;
NSString *filterString;
MCPStreamingResult *streamingResult;
- NSInteger rowsToLoad = [[tableDataInstance statusValueForKey:@"Rows"] intValue];
+ NSInteger rowsToLoad = [[tableDataInstance statusValueForKey:@"Rows"] integerValue];
[countText setStringValue:NSLocalizedString(@"Loading table data...", @"Loading table data string")];
@@ -571,7 +571,7 @@
// Add sorting details if appropriate
if (sortCol) {
- [queryString appendFormat:@" ORDER BY %@", [[[dataColumns objectAtIndex:[sortCol intValue]] objectForKey:@"name"] backtickQuotedString]];
+ [queryString appendFormat:@" ORDER BY %@", [[[dataColumns objectAtIndex:[sortCol integerValue]] objectForKey:@"name"] backtickQuotedString]];
if (isDesc) [queryString appendString:@" DESC"];
}
@@ -582,7 +582,7 @@
if (contentPage <= 0)
contentPage = 1;
else if (contentPage > 1 && (contentPage - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows)
- contentPage = ceil((float)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
+ contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
// If the result set is from a late page, take a copy of the string to allow resetting limit
// if no results are found
@@ -591,7 +591,7 @@
}
// Append the limit settings
- [queryString appendFormat:@" LIMIT %d,%d", (contentPage-1)*[prefs integerForKey:SPLimitResultsValue], [prefs integerForKey:SPLimitResultsValue]];
+ [queryString appendFormat:@" LIMIT %ld,%ld", (long)((contentPage-1)*[prefs integerForKey:SPLimitResultsValue]), (long)[prefs integerForKey:SPLimitResultsValue]];
// Update the approximate count of the rows to load
rowsToLoad = rowsToLoad - (contentPage-1)*[prefs integerForKey:SPLimitResultsValue];
@@ -611,7 +611,7 @@
// If the result is empty, and a late page is selected, reset the page
if ([prefs boolForKey:SPLimitResults] && queryStringBeforeLimit && !tableRowsCount && ![mySQLConnection queryCancelled]) {
contentPage = 1;
- queryString = [NSMutableString stringWithFormat:@"%@ LIMIT 0,%d", queryStringBeforeLimit, [prefs integerForKey:SPLimitResultsValue]];
+ queryString = [NSMutableString stringWithFormat:@"%@ LIMIT 0,%ld", queryStringBeforeLimit, (long)[prefs integerForKey:SPLimitResultsValue]];
[self setUsedQuery:queryString];
streamingResult = [mySQLConnection streamingQueryString:queryString];
[self processResultIntoDataStorage:streamingResult approximateRowCount:[prefs integerForKey:SPLimitResultsValue]];
@@ -651,7 +651,7 @@
/*
* Processes a supplied streaming result set, loading it into the data array.
*/
-- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(long)targetRowCount
+- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult approximateRowCount:(NSUInteger)targetRowCount
{
NSArray *tempRow;
NSMutableArray *newRow;
@@ -659,11 +659,11 @@
NSUInteger i;
NSUInteger dataColumnsCount = [dataColumns count];
- float relativeTargetRowCount = 100.0/targetRowCount;
+ CGFloat relativeTargetRowCount = 100.0/targetRowCount;
NSUInteger nextTableDisplayBoundary = 50;
BOOL tableViewRedrawn = NO;
- long rowsProcessed = 0;
+ NSUInteger rowsProcessed = 0;
NSAutoreleasePool *dataLoadingPool;
NSProgressIndicator *dataLoadingIndicator = [tableDocumentInstance valueForKey:@"queryProgressBar"];
@@ -783,7 +783,7 @@
return nil;
}
- NSUInteger numberOfArguments = [[filter objectForKey:@"NumberOfArguments"] intValue];
+ NSUInteger numberOfArguments = [[filter objectForKey:@"NumberOfArguments"] integerValue];
// argument if Filter requires only one argument
NSMutableString *argument = [[NSMutableString alloc] initWithString:[argumentField stringValue]];
@@ -1030,7 +1030,7 @@
if (![prefs boolForKey:SPLimitResults] || [paginationPageField integerValue] <= 0)
contentPage = 1;
else if (([paginationPageField integerValue] - 1) * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows)
- contentPage = ceil((float)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
+ contentPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
else
contentPage = [paginationPageField integerValue];
@@ -1060,7 +1060,7 @@
lastSelectedContentFilterIndex = [[compareField selectedItem] tag];
NSDictionary *filter = [[contentFilters objectForKey:compareType] objectAtIndex:lastSelectedContentFilterIndex];
- NSUInteger numOfArgs = [[filter objectForKey:@"NumberOfArguments"] intValue];
+ NSUInteger numOfArgs = [[filter objectForKey:@"NumberOfArguments"] integerValue];
if (numOfArgs == 2) {
[argumentField setHidden:YES];
@@ -1122,11 +1122,11 @@
{
if (sender == paginationPreviousButton) {
if (contentPage <= 1) return;
- [paginationPageField setIntValue:(contentPage - 1)];
+ [paginationPageField setIntegerValue:(contentPage - 1)];
[self filterTable:sender];
} else if (sender == paginationNextButton) {
if (contentPage * [prefs integerForKey:SPLimitResultsValue] >= maxNumRows) return;
- [paginationPageField setIntValue:(contentPage + 1)];
+ [paginationPageField setIntegerValue:(contentPage + 1)];
[self filterTable:sender];
}
}
@@ -1177,7 +1177,7 @@
*/
- (void) updatePaginationState
{
- NSUInteger maxPage = ceil((float)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
+ NSUInteger maxPage = ceil((CGFloat)maxNumRows / [prefs floatForKey:SPLimitResultsValue]);
if (isFiltered && !isLimited) {
maxPage = contentPage;
}
@@ -1204,7 +1204,7 @@
// Set the values and maximums for the text field and associated pager
[paginationPageField setStringValue:[numberFormatter stringFromNumber:[NSNumber numberWithUnsignedInteger:contentPage]]];
[[paginationPageField formatter] setMaximum:[NSNumber numberWithUnsignedInteger:maxPage]];
- [paginationPageStepper setIntValue:contentPage];
+ [paginationPageStepper setIntegerValue:contentPage];
[paginationPageStepper setMaxValue:maxPage];
}
@@ -1337,15 +1337,15 @@
contextInfo = @"removeallrows";
[alert setMessageText:NSLocalizedString(@"Delete all rows?", @"delete all rows message")];
- [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete all the rows from this table. This action cannot be undone.", @"delete all rows informative message")];
+ [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete all the rows from this table? This action cannot be undone.", @"delete all rows informative message")];
}
else if ([tableContentView numberOfSelectedRows] == 1) {
[alert setMessageText:NSLocalizedString(@"Delete selected row?", @"delete selected row message")];
- [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete the selected row from this table. This action cannot be undone.", @"delete selected row informative message")];
+ [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete the selected row from this table? This action cannot be undone.", @"delete selected row informative message")];
}
else {
[alert setMessageText:NSLocalizedString(@"Delete rows?", @"delete rows message")];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %d rows from this table. This action cannot be undone.", @"delete rows informative message"), [tableContentView numberOfSelectedRows]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %ld rows from this table? This action cannot be undone.", @"delete rows informative message"), (long)[tableContentView numberOfSelectedRows]]];
}
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
@@ -1383,7 +1383,7 @@
[tempRow removeAllObjects];
enumerator = [tableColumns objectEnumerator];
while ( (tableColumn = [enumerator nextObject]) ) {
- id o = [NSArrayObjectAtIndex(tableValues, i) objectAtIndex:[[tableColumn identifier] intValue]];
+ id o = [NSArrayObjectAtIndex(tableValues, i) objectAtIndex:[[tableColumn identifier] integerValue]];
if([o isNSNull])
[tempRow addObject:@"NULL"];
else if ([o isSPNotLoaded])
@@ -1396,8 +1396,8 @@
NSInteger imageWidth = [image size].width;
if (imageWidth > 100) imageWidth = 100;
[tempRow addObject:[NSString stringWithFormat:
- @"<IMG WIDTH='%d' SRC=\"data:image/auto;base64,%@\">",
- imageWidth,
+ @"<IMG WIDTH='%ld' SRC=\"data:image/auto;base64,%@\">",
+ (long)imageWidth,
[[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01] base64EncodingWithLineLength:0]]];
} else {
[tempRow addObject:@"&lt;BLOB&gt;"];
@@ -1471,7 +1471,7 @@
if ([tableDocumentInstance isWorking]) return;
if ([theArrowCell getClickedColumn] == NSNotFound || [theArrowCell getClickedRow] == NSNotFound) return;
- NSUInteger dataColumnIndex = [[[[tableContentView tableColumns] objectAtIndex:[theArrowCell getClickedColumn]] identifier] intValue];
+ NSUInteger dataColumnIndex = [[[[tableContentView tableColumns] objectAtIndex:[theArrowCell getClickedColumn]] identifier] integerValue];
// Ensure the clicked cell has foreign key details available
NSDictionary *refDictionary = [[dataColumns objectAtIndex:dataColumnIndex] objectForKey:@"foreignkeyreference"];
@@ -1581,7 +1581,7 @@
// Remove user-defined filters first
if([numberOfDefaultFilters objectForKey:compareType]) {
- NSUInteger cycles = [[contentFilters objectForKey:compareType] count] - [[numberOfDefaultFilters objectForKey:compareType] intValue];
+ NSUInteger cycles = [[contentFilters objectForKey:compareType] count] - [[numberOfDefaultFilters objectForKey:compareType] integerValue];
while(cycles > 0) {
[[contentFilters objectForKey:compareType] removeLastObject];
cycles--;
@@ -1704,7 +1704,7 @@
// Catch CURRENT_TIMESTAMP automatic updates - if the row is new and the cell value matches
// the default value, or if the cell hasn't changed, update the current timestamp.
- } else if ([[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"onupdatetimestamp"] intValue]
+ } else if ([[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"onupdatetimestamp"] integerValue]
&& ( (isEditingNewRow && [rowObject isEqualTo:[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"default"]])
|| (!isEditingNewRow && [rowObject isEqualTo:NSArrayObjectAtIndex(oldRow, i)])))
{
@@ -1817,7 +1817,7 @@
// Set the insertId for fields with auto_increment
for ( i = 0; i < [dataColumns count] ; i++ ) {
- if ([[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"autoincrement"] intValue]) {
+ if ([[NSArrayObjectAtIndex(dataColumns, i) objectForKey:@"autoincrement"] integerValue]) {
[[tableValues objectAtIndex:currentlyEditingRow] replaceObjectAtIndex:i withObject:[[NSNumber numberWithLong:[mySQLConnection insertId]] description]];
}
}
@@ -1880,7 +1880,7 @@
* If "row" is -2, it uses the oldRow.
* Uses the primary key if available, otherwise uses all fields as argument and sets LIMIT to 1
*/
-- (NSString *)argumentForRow:(int)row
+- (NSString *)argumentForRow:(NSInteger)row
{
MCPResult *theResult;
NSDictionary *theRow;
@@ -1936,11 +1936,11 @@
// Use the selected row if appropriate
if ( row >= 0 ) {
- tempValue = [NSArrayObjectAtIndex(tableValues, row) objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"datacolumnindex"] intValue]];
+ tempValue = [NSArrayObjectAtIndex(tableValues, row) objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"datacolumnindex"] integerValue]];
// Otherwise use the oldRow
} else {
- tempValue = [oldRow objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"datacolumnindex"] intValue]];
+ tempValue = [oldRow objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(keys, i)] objectForKey:@"datacolumnindex"] integerValue]];
}
if ( [tempValue isNSNull] ) {
@@ -2013,7 +2013,7 @@
}
}
-- (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
/*
if contextInfo == addrow: remain in edit-mode if user hits OK, otherwise cancel editing
if contextInfo == removerow: removes row if user hits OK
@@ -2100,7 +2100,7 @@
}
// Check for uniqueness via LIMIT numberOfRows-1,numberOfRows for speed
if(numberOfRows > 0) {
- [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM %@ GROUP BY %@ LIMIT %d,%d", [selectedTable backtickQuotedString], [primaryKeyFieldNames componentsJoinedAndBacktickQuoted], numberOfRows-1, numberOfRows]];
+ [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM %@ GROUP BY %@ LIMIT %ld,%ld", [selectedTable backtickQuotedString], [primaryKeyFieldNames componentsJoinedAndBacktickQuoted], (long)(numberOfRows-1), (long)numberOfRows]];
if([mySQLConnection affectedRows] == 0)
primaryKeyFieldNames = nil;
} else {
@@ -2143,7 +2143,7 @@
while (index != NSNotFound) {
- id keyValue = [NSArrayObjectAtIndex(tableValues, index) objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(primaryKeyFieldNames,0)] objectForKey:@"datacolumnindex"] intValue]];
+ id keyValue = [NSArrayObjectAtIndex(tableValues, index) objectAtIndex:[[[tableDataInstance columnWithName:NSArrayObjectAtIndex(primaryKeyFieldNames,0)] objectForKey:@"datacolumnindex"] integerValue]];
if([keyValue isKindOfClass:[NSData class]])
[deleteQuery appendString:[NSString stringWithFormat:@"X'%@'", [mySQLConnection prepareBinaryData:keyValue]]];
@@ -2190,7 +2190,7 @@
for(NSString *primaryKeyFieldName in primaryKeyFieldNames) {
- id keyValue = [NSArrayObjectAtIndex(tableValues, index) objectAtIndex:[[[tableDataInstance columnWithName:primaryKeyFieldName] objectForKey:@"datacolumnindex"] intValue]];
+ id keyValue = [NSArrayObjectAtIndex(tableValues, index) objectAtIndex:[[[tableDataInstance columnWithName:primaryKeyFieldName] objectForKey:@"datacolumnindex"] integerValue]];
[deleteQuery appendString:[primaryKeyFieldName backtickQuotedString]];
if ([keyValue isKindOfClass:[NSData class]]) {
@@ -2240,16 +2240,16 @@
NSArray *message;
if(errors < 0) {
message = [NSArray arrayWithObjects:NSLocalizedString(@"Warning", @"warning"),
- [NSString stringWithFormat:NSLocalizedString(@"%d row%@ more %@ removed! Please check the Console and inform the Sequel Pro team!", @"message of panel when more rows were deleted"), errors*-1, ((errors*-1)>1)?@"s":@"", (errors>1)?@"were":@"was"],
+ [NSString stringWithFormat:NSLocalizedString(@"%ld row%@ more %@ removed! Please check the Console and inform the Sequel Pro team!", @"message of panel when more rows were deleted"), (long)(errors*-1), ((errors*-1)>1)?@"s":@"", (errors>1)?@"were":@"was"],
nil];
} else {
if(primaryKeyFieldNames == nil)
message = [NSArray arrayWithObjects:NSLocalizedString(@"Warning", @"warning"),
- [NSString stringWithFormat:NSLocalizedString(@"%d row%@ ha%@ not been removed. Reload the table to be sure that the rows exist and use a primary key for your table.", @"message of panel when not all selected fields have been deleted"), errors, (errors>1)?@"s":@"", (errors>1)?@"ve":@"s"],
+ [NSString stringWithFormat:NSLocalizedString(@"%ld row%@ ha%@ not been removed. Reload the table to be sure that the rows exist and use a primary key for your table.", @"message of panel when not all selected fields have been deleted"), (long)errors, (errors>1)?@"s":@"", (errors>1)?@"ve":@"s"],
nil];
else
message = [NSArray arrayWithObjects:NSLocalizedString(@"Warning", @"warning"),
- [NSString stringWithFormat:NSLocalizedString(@"%d row%@ ha%@ not been removed. Reload the table to be sure that the rows exist and check the Console for possible errors inside the primary key%@ for your table.", @"message of panel when not all selected fields have been deleted by using primary keys"), errors, (errors>1)?@"s":@"", (errors>1)?@"ve":@"s", (errors>1)?@"s":@""],
+ [NSString stringWithFormat:NSLocalizedString(@"%ld row%@ ha%@ not been removed. Reload the table to be sure that the rows exist and check the Console for possible errors inside the primary key%@ for your table.", @"message of panel when not all selected fields have been deleted by using primary keys"), (long)errors, (errors>1)?@"s":@"", (errors>1)?@"ve":@"s", (errors>1)?@"s":@""],
nil];
}
[self performSelector:@selector(showErrorSheetWith:)
@@ -2297,7 +2297,7 @@
{
if (!sortCol || !dataColumns) return nil;
- return [[dataColumns objectAtIndex:[sortCol intValue]] objectForKey:@"name"];
+ return [[dataColumns objectAtIndex:[sortCol integerValue]] objectForKey:@"name"];
}
/**
@@ -2319,7 +2319,7 @@
/**
* Provide a getter for the page number
*/
-- (unsigned int) pageNumber
+- (NSUInteger) pageNumber
{
return contentPage;
}
@@ -2345,7 +2345,7 @@
[self tableFilterString], @"menuLabel",
[[fieldField selectedItem] title], @"filterField",
[[compareField selectedItem] title], @"filterComparison",
- [NSNumber numberWithInt:[[compareField selectedItem] tag]], @"filterComparisonTag",
+ [NSNumber numberWithInteger:[[compareField selectedItem] tag]], @"filterComparisonTag",
[argumentField stringValue], @"filterValue",
[firstBetweenField stringValue], @"firstBetweenField",
[secondBetweenField stringValue], @"secondBetweenField",
@@ -2370,7 +2370,7 @@
/**
* Sets the value for the page number to use on next table load
*/
-- (void) setPageToRestore:(unsigned int)thePage
+- (void) setPageToRestore:(NSUInteger)thePage
{
pageToRestore = thePage;
}
@@ -2475,33 +2475,33 @@
if (!isLimited && !isFiltered && !isInterruptedLoad) {
maxNumRows = tableRowsCount;
maxNumRowsIsEstimate = NO;
- [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
+ [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
[tableInfoInstance tableChanged:nil];
[[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
// Otherwise, if the table status value is accurate, use it
} else if ([[tableDataInstance statusValueForKey:@"RowsCountAccurate"] boolValue]) {
- maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] intValue];
+ maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue];
maxNumRowsIsEstimate = NO;
checkStatusCount = YES;
// Choose whether to display an estimate, or to fetch the correct row count, based on prefs
- } else if ([[prefs objectForKey:SPTableRowCountQueryLevel] intValue] == SPRowCountFetchAlways
- || ([[prefs objectForKey:SPTableRowCountQueryLevel] intValue] == SPRowCountFetchIfCheap
+ } else if ([[prefs objectForKey:SPTableRowCountQueryLevel] integerValue] == SPRowCountFetchAlways
+ || ([[prefs objectForKey:SPTableRowCountQueryLevel] integerValue] == SPRowCountFetchIfCheap
&& [tableDataInstance statusValueForKey:@"Data_length"]
- && [[prefs objectForKey:SPTableRowCountCheapSizeBoundary] intValue] > [[tableDataInstance statusValueForKey:@"Data_length"] intValue]))
+ && [[prefs objectForKey:SPTableRowCountCheapSizeBoundary] integerValue] > [[tableDataInstance statusValueForKey:@"Data_length"] integerValue]))
{
maxNumRows = [self fetchNumberOfRows];
maxNumRowsIsEstimate = NO;
- [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
+ [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:@"y" forKey:@"RowsCountAccurate"];
[tableInfoInstance tableChanged:nil];
[[tableDocumentInstance valueForKey:@"extendedTableInfoInstance"] performSelectorOnMainThread:@selector(loadTable:) withObject:selectedTable waitUntilDone:YES];
// Use the estimate count
} else {
- maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] intValue];
+ maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue];
maxNumRowsIsEstimate = YES;
checkStatusCount = YES;
}
@@ -2524,7 +2524,7 @@
maxNumRows = tableRowsCount;
maxNumRowsIsEstimate = YES;
}
- [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%d", maxNumRows] forKey:@"Rows"];
+ [tableDataInstance setStatusValue:[NSString stringWithFormat:@"%ld", (long)maxNumRows] forKey:@"Rows"];
[tableDataInstance setStatusValue:maxNumRowsIsEstimate?@"n":@"y" forKey:@"RowsCountAccurate"];
[tableInfoInstance tableChanged:nil];
}
@@ -2533,9 +2533,9 @@
/*
* Fetches the number of rows in the selected table using a "SELECT COUNT(1)" query and return it
*/
-- (int)fetchNumberOfRows
+- (NSInteger)fetchNumberOfRows
{
- return [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [selectedTable backtickQuotedString]]] fetchRowAsArray] objectAtIndex:0] intValue];
+ return [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [selectedTable backtickQuotedString]]] fetchRowAsArray] objectAtIndex:0] integerValue];
}
#pragma mark -
@@ -2562,7 +2562,7 @@
// possible exceptions (eg for reloading tables etc.)
id theValue;
@try{
- theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(tableValues, row), [[aTableColumn identifier] intValue]);
+ theValue = NSArrayObjectAtIndex(NSArrayObjectAtIndex(tableValues, row), [[aTableColumn identifier] integerValue]);
}
@catch(id ae) {
return nil;
@@ -2583,14 +2583,14 @@
return nil;
}
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return tableRowsCount;
}
-- (id)tableView:(CMCopyTable *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(CMCopyTable *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
- NSUInteger columnIndex = [[aTableColumn identifier] intValue];
+ NSUInteger columnIndex = [[aTableColumn identifier] integerValue];
id theValue = nil;
// While the table is being loaded, additional validation is required - data
@@ -2627,11 +2627,11 @@
/**
* This function changes the text color of text/blob fields which are null or not yet loaded to gray
*/
-- (void)tableView:(CMCopyTable *)aTableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)aTableColumn row:(int)rowIndex
+- (void)tableView:(CMCopyTable *)aTableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex
{
if (![cell respondsToSelector:@selector(setTextColor:)]) return;
- NSUInteger columnIndex = [[aTableColumn identifier] intValue];
+ NSUInteger columnIndex = [[aTableColumn identifier] integerValue];
id theValue = nil;
// While the table is being loaded, additional validation is required - data
@@ -2657,7 +2657,7 @@
// If user wants to edit 'cell' set text color to black and return to avoid
// writing in gray if value was NULL
- if ( [aTableView editedColumn] == [[aTableColumn identifier] intValue] && [aTableView editedRow] == rowIndex) {
+ if ( [aTableView editedColumn] == [[aTableColumn identifier] integerValue] && [aTableView editedRow] == rowIndex) {
[cell setTextColor:[NSColor blackColor]];
return;
}
@@ -2672,7 +2672,7 @@
}
}
-- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
// Catch editing events in the row and if the row isn't currently being edited,
// start an edit. This allows edits including enum changes to save correctly.
@@ -2682,7 +2682,7 @@
currentlyEditingRow = rowIndex;
}
- NSDictionary *column = NSArrayObjectAtIndex(dataColumns, [[aTableColumn identifier] intValue]);
+ NSDictionary *column = NSArrayObjectAtIndex(dataColumns, [[aTableColumn identifier] integerValue]);
if (anObject) {
@@ -2690,9 +2690,9 @@
if ([anObject isEqualToString:[prefs objectForKey:SPNullValue]] && [[column objectForKey:@"null"] boolValue])
anObject = [NSNull null];
- [NSArrayObjectAtIndex(tableValues, rowIndex) replaceObjectAtIndex:[[aTableColumn identifier] intValue] withObject:anObject];
+ [NSArrayObjectAtIndex(tableValues, rowIndex) replaceObjectAtIndex:[[aTableColumn identifier] integerValue] withObject:anObject];
} else {
- [NSArrayObjectAtIndex(tableValues, rowIndex) replaceObjectAtIndex:[[aTableColumn identifier] intValue] withObject:@""];
+ [NSArrayObjectAtIndex(tableValues, rowIndex) replaceObjectAtIndex:[[aTableColumn identifier] integerValue] withObject:@""];
}
}
@@ -2739,7 +2739,7 @@
[tableContentView setIndicatorImage:nil inTableColumn:[tableContentView tableColumnWithIdentifier:sortCol]];
}
if (sortCol) [sortCol release];
- sortCol = [[NSNumber alloc] initWithInt:[[tableColumn identifier] intValue]];
+ sortCol = [[NSNumber alloc] initWithInteger:[[tableColumn identifier] integerValue]];
// Update data using the new sort order
previousTableRowsCount = tableRowsCount;
@@ -2823,7 +2823,7 @@
}
// save column size
- [[[tableColumnWidths objectForKey:database] objectForKey:table] setObject:[NSNumber numberWithFloat:[[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:[[[[aNotification userInfo] objectForKey:@"NSTableColumn"] headerCell] stringValue]];
+ [[[tableColumnWidths objectForKey:database] objectForKey:table] setObject:[NSNumber numberWithDouble:[(NSTableColumn *)[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:[[[[aNotification userInfo] objectForKey:@"NSTableColumn"] headerCell] stringValue]];
[prefs setObject:tableColumnWidths forKey:SPTableColumnWidths];
}
@@ -2841,7 +2841,7 @@
if ([wherePart length] == 0) return NO;
// If the selected cell hasn't been loaded, load it.
- if ([NSArrayObjectAtIndex(NSArrayObjectAtIndex(tableValues, rowIndex), [[aTableColumn identifier] intValue]) isSPNotLoaded]) {
+ if ([NSArrayObjectAtIndex(NSArrayObjectAtIndex(tableValues, rowIndex), [[aTableColumn identifier] integerValue]) isSPNotLoaded]) {
// Only get the data for the selected column, not all of them
NSString *query = [NSString stringWithFormat:@"SELECT %@ FROM %@ WHERE %@", [[[aTableColumn headerCell] stringValue] backtickQuotedString], [selectedTable backtickQuotedString], wherePart];
@@ -2867,7 +2867,7 @@
[fieldEditor setTextMaxLength:[[[aTableColumn dataCellForRow:rowIndex] formatter] textLimit]];
- id cellValue = [[tableValues objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]];
+ id cellValue = [[tableValues objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] integerValue]];
if ([cellValue isNSNull]) cellValue = [NSString stringWithString:[prefs objectForKey:SPNullValue]];
id editData = [[fieldEditor editWithObject:cellValue
@@ -2886,12 +2886,12 @@
if ([editData isKindOfClass:[NSString class]]
&& [editData isEqualToString:[prefs objectForKey:SPNullValue]]
- && [[NSArrayObjectAtIndex(dataColumns, [[aTableColumn identifier] intValue]) objectForKey:@"null"] boolValue])
+ && [[NSArrayObjectAtIndex(dataColumns, [[aTableColumn identifier] integerValue]) objectForKey:@"null"] boolValue])
{
[editData release];
editData = [[NSNull null] retain];
}
- [[tableValues objectAtIndex:rowIndex] replaceObjectAtIndex:[[aTableColumn identifier] intValue] withObject:[[editData copy] autorelease]];
+ [[tableValues objectAtIndex:rowIndex] replaceObjectAtIndex:[[aTableColumn identifier] integerValue] withObject:[[editData copy] autorelease]];
}
[fieldEditor release];
@@ -2950,12 +2950,12 @@
return NO;
}
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return (proposedMax - 180);
}
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return (proposedMin + 200);
}
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 391066a9..60bb2bdd 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -106,7 +106,7 @@
IBOutlet id inputTextWindowHeader;
IBOutlet id inputTextWindowMessage;
IBOutlet id inputTextWindowSecureTextField;
- int passwordSheetReturnCode;
+ NSInteger passwordSheetReturnCode;
// Controllers
SPConnectionController *connectionController;
@@ -125,16 +125,16 @@
BOOL _encodingViaLatin1;
BOOL _shouldOpenConnectionAutomatically;
BOOL _isConnected;
- int _isWorkingLevel;
+ NSInteger _isWorkingLevel;
BOOL _mainNibLoaded;
BOOL databaseListIsSelectable;
- int _queryMode;
+ NSInteger _queryMode;
NSWindow *taskProgressWindow;
BOOL taskDisplayIsIndeterminate;
- float taskProgressValue;
- float taskDisplayLastValue;
- float taskProgressValueDisplayInterval;
+ CGFloat taskProgressValue;
+ CGFloat taskDisplayLastValue;
+ CGFloat taskProgressValueDisplayInterval;
NSTimer *taskDrawTimer;
NSViewAnimation *taskFadeAnimator;
BOOL taskCanBeCancelled;
@@ -185,7 +185,7 @@
- (void) startTaskWithDescription:(NSString *)description;
- (void) showTaskProgressWindow:(NSTimer *)theTimer;
- (void) setTaskDescription:(NSString *)description;
-- (void) setTaskPercentage:(float)taskPercentage;
+- (void) setTaskPercentage:(CGFloat)taskPercentage;
- (void) setTaskProgressToIndeterminateAfterDelay:(BOOL)afterDelay;
- (void) endTask;
- (void) enableTaskCancellationWithTitle:(NSString *)buttonTitle callbackObject:(id)callbackObject callbackFunction:(SEL)callbackFunction;
@@ -219,7 +219,7 @@
- (IBAction)copyCreateTableSyntaxFromSheet:(id)sender;
// Other methods
-- (void) setQueryMode:(int)theQueryMode;
+- (void) setQueryMode:(NSInteger)theQueryMode;
- (IBAction)closeSheet:(id)sender;
- (IBAction)closeErrorConnectionSheet:(id)sender;
- (IBAction)closePanelSheet:(id)sender;
@@ -229,7 +229,7 @@
- (void)closeConnection;
- (NSWindow *)getCreateTableSyntaxWindow;
- (void)refreshCurrentDatabase;
-- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (IBAction)validateSaveConnectionAccessory:(id)sender;
- (BOOL)saveDocumentWithFilePath:(NSString *)fileName inBackground:(BOOL)saveInBackground onlyPreferences:(BOOL)saveOnlyPreferences;
- (IBAction)closePasswordSheet:(id)sender;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 368c8a65..17964e92 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -47,7 +47,7 @@
#import "SPHistoryController.h"
#import "SPPreferenceController.h"
#import "SPPrintAccessory.h"
-#import "QLPreviewPanel.h"
+//#import "QLPreviewPanel.h"
#import "SPUserManager.h"
#import "SPEncodingPopupAccessory.h"
#import "SPConstants.h"
@@ -254,7 +254,7 @@
NSDictionary *connection = nil;
NSDictionary *spf = nil;
- int connectionType;
+ NSInteger connectionType;
// Inform about the data source in the window title bar
[tableWindow setTitle:[self displaySPName]];
@@ -447,8 +447,8 @@
if([connection objectForKey:@"host"])
[connectionController setHost:[connection objectForKey:@"host"]];
if([connection objectForKey:@"port"])
- [connectionController setPort:[NSString stringWithFormat:@"%d", [[connection objectForKey:@"port"] intValue]]];
- if([connection objectForKey:@"kcid"] && [[connection objectForKey:@"kcid"] length])
+ [connectionController setPort:[NSString stringWithFormat:@"%ld", (long)[[connection objectForKey:@"port"] integerValue]]];
+ if([connection objectForKey:@"kcid"] && [(NSString *)[connection objectForKey:@"kcid"] length])
[self setKeychainID:[connection objectForKey:@"kcid"]];
// Set password - if not in SPF file try to get it via the KeyChain
@@ -469,7 +469,7 @@
if([connection objectForKey:@"ssh_user"])
[connectionController setSshUser:[connection objectForKey:@"ssh_user"]];
if([connection objectForKey:@"ssh_port"])
- [connectionController setSshPort:[NSString stringWithFormat:@"%d", [[connection objectForKey:@"ssh_port"] intValue]]];
+ [connectionController setSshPort:[NSString stringWithFormat:@"%ld", (long)[[connection objectForKey:@"ssh_port"] integerValue]]];
// Set ssh password - if not in SPF file try to get it via the KeyChain
if([connection objectForKey:@"ssh_password"])
@@ -541,7 +541,7 @@
if([spfSession objectForKey:@"contentSelectedIndexSet"]) {
NSMutableIndexSet *anIndexSet = [NSMutableIndexSet indexSet];
NSArray *items = [spfSession objectForKey:@"contentSelectedIndexSet"];
- unsigned int i;
+ NSUInteger i;
for(i=0; i<[items count]; i++)
[anIndexSet addIndex:(NSUInteger)NSArrayObjectAtIndex(items, i)];
@@ -552,7 +552,7 @@
if([spfSession objectForKey:@"contentSortCol"])
[tableContentInstance setSortColumnNameToRestore:[spfSession objectForKey:@"contentSortCol"] isAscending:[[spfSession objectForKey:@"contentSortCol"] boolValue]];
if([spfSession objectForKey:@"contentPageNumber"])
- [tableContentInstance setPageToRestore:[[spfSession objectForKey:@"pageNumber"] intValue]];
+ [tableContentInstance setPageToRestore:[[spfSession objectForKey:@"pageNumber"] integerValue]];
if([spfSession objectForKey:@"contentViewport"])
[tableContentInstance setViewportToRestore:NSRectFromString([spfSession objectForKey:@"contentViewport"])];
if([spfSession objectForKey:@"contentFilter"])
@@ -560,7 +560,7 @@
// Select table
- [tablesListInstance selectTableAtIndex:[NSNumber numberWithInt:[tables indexOfObject:[spfSession objectForKey:@"table"]]]];
+ [tablesListInstance selectTableAtIndex:[NSNumber numberWithInteger:[tables indexOfObject:[spfSession objectForKey:@"table"]]]];
// Reset database view encoding if differs from default
if([spfSession objectForKey:@"connectionEncoding"] && ![[self connectionEncoding] isEqualToString:[spfSession objectForKey:@"connectionEncoding"]])
@@ -918,7 +918,7 @@
NSMutableArray *systemDatabases = [NSMutableArray array];
- for (int i = 0 ; i < [queryResult numOfRows] ; i++)
+ for (NSInteger i = 0 ; i < [queryResult numOfRows] ; i++)
{
NSString *database = NSArrayObjectAtIndex([queryResult fetchRowAsArray], 0);
@@ -1057,7 +1057,7 @@
defaultButton:NSLocalizedString(@"Delete", @"delete button")
alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
otherButton:nil
- informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the database '%@'. This operation cannot be undone.", @"delete database informative message"), [self database]]];
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the database '%@'? This operation cannot be undone.", @"delete database informative message"), [self database]]];
NSArray *buttons = [alert buttons];
@@ -1119,7 +1119,7 @@
* if contextInfo == removeDatabase -> Remove the selected database
* if contextInfo == addDatabase -> Add a new database
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Remove the current database
if ([contextInfo isEqualToString:@"removeDatabase"]) {
@@ -1166,8 +1166,8 @@
MCPResult *theResult = [mySQLConnection queryString:@"SELECT DATABASE()"];
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- int i;
- int r = [theResult numOfRows];
+ NSInteger i;
+ NSInteger r = [theResult numOfRows];
if (r) [theResult dataSeek:0];
for ( i = 0 ; i < r ; i++ ) {
dbName = NSArrayObjectAtIndex([theResult fetchRowAsArray], 0);
@@ -1235,7 +1235,7 @@
/**
* Set a query mode, used to control logging dependant on preferences
*/
-- (void) setQueryMode:(int)theQueryMode
+- (void) setQueryMode:(NSInteger)theQueryMode
{
_queryMode = theQueryMode;
}
@@ -1319,7 +1319,7 @@
* Sets the task percentage progress - the first call to this automatically
* switches the progress display to determinate.
*/
-- (void) setTaskPercentage:(float)taskPercentage
+- (void) setTaskPercentage:(CGFloat)taskPercentage
{
if (taskDisplayIsIndeterminate) {
taskDisplayIsIndeterminate = NO;
@@ -1553,7 +1553,7 @@
{
NSEnumerator *dbEncodingMenuEn = [[selectEncodingMenu itemArray] objectEnumerator];
id menuItem;
- int correctStateForMenuItem;
+ NSInteger correctStateForMenuItem;
while (menuItem = [dbEncodingMenuEn nextObject]) {
correctStateForMenuItem = [[menuItem title] isEqualToString:encoding] ? NSOnState : NSOffState;
@@ -1684,7 +1684,7 @@
- (IBAction)showCreateTableSyntax:(id)sender
{
//Create the query and get results
- int colOffs = 1;
+ NSInteger colOffs = 1;
NSString *query = nil;
NSString *typeString = @"";
@@ -1745,7 +1745,7 @@
{
// Create the query and get results
NSString *query = nil;
- int colOffs = 1;
+ NSInteger colOffs = 1;
if( [tablesListInstance tableType] == SP_TABLETYPE_TABLE ) {
query = [NSString stringWithFormat:@"SHOW CREATE TABLE %@", [[self table] backtickQuotedString]];
@@ -2465,7 +2465,7 @@
}
-- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if ( returnCode ) {
@@ -2624,7 +2624,7 @@
NSIndexSet *contentSelectedIndexSet = [tableContentInstance selectedRowIndexes];
- [spfdata setObject:[NSNumber numberWithInt:1] forKey:@"version"];
+ [spfdata setObject:[NSNumber numberWithInteger:1] forKey:@"version"];
[spfdata setObject:@"connection" forKey:@"format"];
[spfdata setObject:@"mysql" forKey:@"rdbms_type"];
[spfdata setObject:[self mySQLVersion] forKey:@"rdbms_version"];
@@ -2658,7 +2658,7 @@
[connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
[connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
if([connectionController sshPort] && [[connectionController sshPort] length])
- [connection setObject:[NSNumber numberWithInt:[[connectionController sshPort] intValue]] forKey:@"ssh_port"];
+ [connection setObject:[NSNumber numberWithInteger:[[connectionController sshPort] integerValue]] forKey:@"ssh_port"];
break;
default:
aString = @"SPTCPIPConnection";
@@ -2675,7 +2675,7 @@
}
if([connectionController port] && [[connectionController port] length])
- [connection setObject:[NSNumber numberWithInt:[[connectionController port] intValue]] forKey:@"port"];
+ [connection setObject:[NSNumber numberWithInteger:[[connectionController port] integerValue]] forKey:@"port"];
if([[self database] length])
[connection setObject:[self database] forKey:@"database"];
@@ -2715,18 +2715,18 @@
[session setObject:[self connectionEncoding] forKey:@"connectionEncoding"];
[session setObject:[NSNumber numberWithBool:[tableContentInstance sortColumnIsAscending]] forKey:@"contentSortColIsAsc"];
- [session setObject:[NSNumber numberWithInt:[tableContentInstance pageNumber]] forKey:@"contentPageNumber"];
+ [session setObject:[NSNumber numberWithInteger:[tableContentInstance pageNumber]] forKey:@"contentPageNumber"];
[session setObject:NSStringFromRect([tableContentInstance viewport]) forKey:@"contentViewport"];
if([tableContentInstance filterSettings])
[session setObject:[tableContentInstance filterSettings] forKey:@"contentFilter"];
if (contentSelectedIndexSet && [contentSelectedIndexSet count]) {
NSMutableArray *indices = [NSMutableArray array];
- unsigned indexBuffer[[contentSelectedIndexSet count]];
- unsigned limit = [contentSelectedIndexSet getIndexes:indexBuffer maxCount:[contentSelectedIndexSet count] inIndexRange:NULL];
- unsigned idx;
+ NSUInteger indexBuffer[[contentSelectedIndexSet count]];
+ NSUInteger limit = [contentSelectedIndexSet getIndexes:indexBuffer maxCount:[contentSelectedIndexSet count] inIndexRange:NULL];
+ NSUInteger idx;
for (idx = 0; idx < limit; idx++) {
- [indices addObject:[NSNumber numberWithInt:indexBuffer[idx]]];
+ [indices addObject:[NSNumber numberWithInteger:indexBuffer[idx]]];
}
[session setObject:indices forKey:@"contentSelectedIndexSet"];
}
@@ -3067,7 +3067,7 @@
/**
* Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if (returnCode == NSOKButton) {
if ([contextInfo isEqualToString:@"CreateSyntax"]) {
@@ -3557,7 +3557,7 @@
[self updateChooseDatabaseToolbarItemWidth];
}
-- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
+- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex
{
if (sidebarGrabber != nil) {
return [sidebarGrabber convertRect:[sidebarGrabber bounds] toView:splitView];
@@ -3573,7 +3573,7 @@
return;
// grab the width of the left pane
- float leftPaneWidth = [[[contentViewSplitter subviews] objectAtIndex:0] frame].size.width;
+ CGFloat leftPaneWidth = [[[contentViewSplitter subviews] objectAtIndex:0] frame].size.width;
// subtract some pixels to allow for misc stuff
leftPaneWidth -= 12;
diff --git a/Source/TableDump.h b/Source/TableDump.h
index d0f4d336..3b89bdc5 100644
--- a/Source/TableDump.h
+++ b/Source/TableDump.h
@@ -102,7 +102,7 @@
NSMutableArray *fieldMappingTableColumnNames;
NSMutableArray *fieldMappingArray;
NSMutableArray *fieldMappingButtonOptions;
- int fieldMappingCurrentRow;
+ NSInteger fieldMappingCurrentRow;
NSUserDefaults *prefs;
BOOL progressCancelled;
}
@@ -116,8 +116,8 @@
// Export methods
- (void)export;
-- (void)exportFile:(int)tag;
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo;
+- (void)exportFile:(NSInteger)tag;
+- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (void)exportBackgroundProcess:(NSDictionary *)exportAction;
// Import methods
@@ -127,7 +127,7 @@
- (void)importCSVFile:(NSString *)filename;
- (IBAction)changeFormat:(id)sender;
- (IBAction)changeTable:(id)sender;
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo;
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
- (BOOL) buildFieldMappingArrayWithData:(NSArray *)importData isPreview:(BOOL)dataIsPreviewData;
- (void)setupFieldMappingArray;
- (void)updateFieldMappingButtonCell;
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 39bc6d0f..5640388b 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -49,7 +49,7 @@
- (IBAction)reloadTables:(id)sender
{
MCPResult *queryResult;
- int i;
+ NSInteger i;
//get tables
[tables removeAllObjects];
@@ -130,12 +130,12 @@
[NSApp beginSheet:exportWindow modalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
}
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
}
-- (void)exportFile:(int)tag
+- (void)exportFile:(NSInteger)tag
/*
invoked when user clicks on an export menuItem
*/
@@ -239,7 +239,7 @@
* When the export "Save" dialog is closed, fire up a background thread to perform
* the requested export.
*/
-- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
[sheet orderOut:self];
@@ -517,7 +517,7 @@
[self setupFieldMappingArray];
[rowDownButton setEnabled:NO];
[rowUpButton setEnabled:([fieldMappingImportArray count] > 1)];
- [recordCountLabel setStringValue:[NSString stringWithFormat:@"%i of %@%i records", fieldMappingCurrentRow+1, fieldMappingImportArrayIsPreview?@"first ":@"", [fieldMappingImportArray count]]];
+ [recordCountLabel setStringValue:[NSString stringWithFormat:@"%ld of %@%lu records", (long)(fieldMappingCurrentRow+1), fieldMappingImportArrayIsPreview?@"first ":@"", (unsigned long)[fieldMappingImportArray count]]];
[self updateFieldMappingButtonCell];
[fieldMappingTableView reloadData];
@@ -609,7 +609,7 @@
NSBeginAlertSheet(NSLocalizedString(@"SQL read error title", @"File read error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"SQL read error", @"An error occurred when reading the file.\n\nOnly %i queries were executed.\n\n(%@)"), queriesPerformed, [exception reason]]);
+ [NSString stringWithFormat:NSLocalizedString(@"SQL read error", @"An error occurred when reading the file.\n\nOnly %ld queries were executed.\n\n(%@)"), (long)queriesPerformed, [exception reason]]);
[sqlParser release];
[sqlDataBuffer release];
[importPool drain];
@@ -657,7 +657,7 @@
NSBeginAlertSheet(NSLocalizedString(@"SQL read error title", @"File read error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"SQL encoding read error", @"An error occurred when reading the file, as it could not be read in either UTF-8 or %@.\n\nOnly %i queries were executed."), [[tableDocumentInstance connectionEncoding] UTF8String], queriesPerformed]);
+ [NSString stringWithFormat:NSLocalizedString(@"SQL encoding read error", @"An error occurred when reading the file, as it could not be read in either UTF-8 or %@.\n\nOnly %ld queries were executed."), [[tableDocumentInstance connectionEncoding] UTF8String], (long)queriesPerformed]);
[sqlParser release];
[sqlDataBuffer release];
[importPool drain];
@@ -701,7 +701,7 @@
// Check for any errors
if ([[mySQLConnection getLastErrorMessage] length] && ![[mySQLConnection getLastErrorMessage] isEqualToString:@"Query was empty"]) {
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"), (queriesPerformed+1), [mySQLConnection getLastErrorMessage]]];
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), (long)(queriesPerformed+1), [mySQLConnection getLastErrorMessage]]];
}
// Increment the processed queries count
@@ -730,7 +730,7 @@
// Check for any errors
if ([[mySQLConnection getLastErrorMessage] length] && ![[mySQLConnection getLastErrorMessage] isEqualToString:@"Query was empty"]) {
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"), (queriesPerformed+1), [mySQLConnection getLastErrorMessage]]];
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), (long)(queriesPerformed+1), [mySQLConnection getLastErrorMessage]]];
}
// Increment the processed queries count
@@ -794,7 +794,7 @@
NSInteger dataBufferLength = 0;
NSInteger dataBufferPosition = 0;
NSInteger dataBufferLastQueryEndPosition = 0;
- int i;
+ NSInteger i;
BOOL allDataRead = NO;
BOOL insertBaseStringHasEntries;
NSStringEncoding csvEncoding = [MCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]];
@@ -867,7 +867,7 @@
NSBeginAlertSheet(NSLocalizedString(@"CSV read error title", @"File read error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"CSV read error", @"An error occurred when reading the file.\n\nOnly %i rows were imported.\n\n(%@)"), rowsImported, [exception reason]]);
+ [NSString stringWithFormat:NSLocalizedString(@"CSV read error", @"An error occurred when reading the file.\n\nOnly %ld rows were imported.\n\n(%@)"), (long)rowsImported, [exception reason]]);
[csvParser release];
[csvDataBuffer release];
[parsedRows release];
@@ -907,7 +907,7 @@
NSBeginAlertSheet(NSLocalizedString(@"CSV read error title", @"File read error"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"CSV encoding read error", @"An error occurred when reading the file, as it could not be read using %@.\n\nOnly %i rows were imported."), [[tableDocumentInstance connectionEncoding] UTF8String], rowsImported]);
+ [NSString stringWithFormat:NSLocalizedString(@"CSV encoding read error", @"An error occurred when reading the file, as it could not be read using %@.\n\nOnly %ld rows were imported."), [[tableDocumentInstance connectionEncoding] UTF8String], (long)rowsImported]);
[csvParser release];
[csvDataBuffer release];
[parsedRows release];
@@ -942,7 +942,7 @@
// If valid, add the row array and length to local storage
if (csvRowArray) {
[parsedRows addObject:csvRowArray];
- [parsePositions addObject:[NSNumber numberWithLong:[csvParser totalLengthParsed]]];
+ [parsePositions addObject:[NSNumber numberWithUnsignedInteger:[csvParser totalLengthParsed]]];
}
// If we have no field mapping array, and either the first hundred rows or all
@@ -974,7 +974,7 @@
[insertBaseString appendString:@" ("];
insertBaseStringHasEntries = NO;
for (i = 0; i < [fieldMappingArray count]; i++) {
- if ([NSArrayObjectAtIndex(fieldMappingArray, i) intValue] > 0) {
+ if ([NSArrayObjectAtIndex(fieldMappingArray, i) integerValue] > 0) {
if (insertBaseStringHasEntries) [insertBaseString appendString:@","];
else insertBaseStringHasEntries = YES;
[insertBaseString appendString:[NSArrayObjectAtIndex(fieldMappingTableColumnNames, i) backtickQuotedString]];
@@ -1021,8 +1021,8 @@
[query release];
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[errors appendString:[NSString stringWithFormat:
- NSLocalizedString(@"[ERROR in row %d] %@\n", @"error text when reading of csv file gave errors"),
- (rowsImported+1),[mySQLConnection getLastErrorMessage]]];
+ NSLocalizedString(@"[ERROR in row %ld] %@\n", @"error text when reading of csv file gave errors"),
+ (long)(rowsImported+1),[mySQLConnection getLastErrorMessage]]];
}
rowsImported++;
[singleProgressBar setDoubleValue:[[parsePositions objectAtIndex:i] doubleValue]];
@@ -1088,7 +1088,7 @@
}
}
-- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// save values to preferences
[prefs setObject:[sheet directory] forKey:@"openPath"];
@@ -1194,7 +1194,7 @@
didEndSelector:nil
contextInfo:nil];
- int code = [NSApp runModalForWindow:fieldMappingSheet];
+ NSInteger code = [NSApp runModalForWindow:fieldMappingSheet];
[NSApp endSheet:fieldMappingSheet];
[fieldMappingSheet orderOut:nil];
@@ -1211,7 +1211,7 @@
*/
- (void)setupFieldMappingArray
{
- int i, value;
+ NSInteger i, value;
if (!fieldMappingArray) {
fieldMappingArray = [[NSMutableArray alloc] init];
@@ -1223,7 +1223,7 @@
value = 0;
}
- [fieldMappingArray addObject:[NSNumber numberWithInt:value]];
+ [fieldMappingArray addObject:[NSNumber numberWithInteger:value]];
}
}
@@ -1262,7 +1262,7 @@
//-----------[self setupFieldMappingArray];
[fieldMappingTableView reloadData];
- [recordCountLabel setStringValue:[NSString stringWithFormat:@"%i of %@%i records", fieldMappingCurrentRow+1, fieldMappingImportArrayIsPreview?@"first ":@"", [fieldMappingImportArray count]]];
+ [recordCountLabel setStringValue:[NSString stringWithFormat:@"%ld of %@%lu records", (long)(fieldMappingCurrentRow+1), fieldMappingImportArrayIsPreview?@"first ":@"", (unsigned long)[fieldMappingImportArray count]]];
// enable/disable buttons
[rowDownButton setEnabled:(fieldMappingCurrentRow != 0)];
@@ -1276,13 +1276,13 @@
- (NSString *) mappedValueStringForRowArray:(NSArray *)csvRowArray
{
NSMutableString *valueString = [NSMutableString stringWithString:@"("];
- int i;
- int mapColumn;
+ NSInteger i;
+ NSInteger mapColumn;
id cellData;
- int mappingArrayCount = [fieldMappingArray count];
+ NSInteger mappingArrayCount = [fieldMappingArray count];
for (i = 0; i < mappingArrayCount; i++) {
- mapColumn = [NSArrayObjectAtIndex(fieldMappingArray, i) intValue];
+ mapColumn = [NSArrayObjectAtIndex(fieldMappingArray, i) integerValue];
// Skip unmapped columns
if (!mapColumn) continue;
@@ -1313,9 +1313,9 @@
*/
- (BOOL)dumpSelectedTablesAsSqlToFileHandle:(NSFileHandle *)fileHandle
{
- int i,j,t,rowCount, colCount, lastProgressValue, queryLength;
- int progressBarWidth;
- int tableType = SP_TABLETYPE_TABLE; //real tableType will be setup later
+ NSInteger i,j,t,rowCount, colCount, lastProgressValue, queryLength;
+ NSInteger progressBarWidth;
+ NSInteger tableType = SP_TABLETYPE_TABLE; //real tableType will be setup later
MCPResult *queryResult;
MCPStreamingResult *streamingResult;
NSAutoreleasePool *exportAutoReleasePool = nil;
@@ -1344,7 +1344,7 @@
[singleProgressText displayIfNeeded];
[singleProgressBar setDoubleValue:0];
[singleProgressBar displayIfNeeded];
- progressBarWidth = (int)[singleProgressBar bounds].size.width;
+ progressBarWidth = (NSInteger)[singleProgressBar bounds].size.width;
[singleProgressBar setMaxValue:progressBarWidth];
// Open the progress sheet
@@ -1407,7 +1407,7 @@
// Update the progress text and reset the progress bar to indeterminate status while fetching data
tableName = NSArrayObjectAtIndex(selectedTables, i);
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): Fetching data...", @"text showing that app is fetching data for table dump"), (i+1), [selectedTables count], tableName]];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): Fetching data...", @"text showing that app is fetching data for table dump"), (long)(i+1), (unsigned long)[selectedTables count], tableName]];
[singleProgressText displayIfNeeded];
[singleProgressBar setIndeterminate:YES];
[singleProgressBar setUsesThreadedAnimation:YES];
@@ -1481,7 +1481,7 @@
fieldNames = [streamingResult fetchFieldNames];
// Update the progress text and set the progress bar back to determinate
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): Dumping...", @"text showing that app is writing data for table dump"), (i+1), [selectedTables count], tableName]];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): Dumping...", @"text showing that app is writing data for table dump"), (long)(i+1), (unsigned long)[selectedTables count], tableName]];
[singleProgressText displayIfNeeded];
[singleProgressBar stopAnimation:self];
[singleProgressBar setIndeterminate:NO];
@@ -1515,8 +1515,8 @@
// Update the progress bar
[singleProgressBar setDoubleValue:(j*progressBarWidth/rowCount)];
- if ((int)[singleProgressBar doubleValue] > lastProgressValue) {
- lastProgressValue = (int)[singleProgressBar doubleValue];
+ if ((NSInteger)[singleProgressBar doubleValue] > lastProgressValue) {
+ lastProgressValue = (NSInteger)[singleProgressBar doubleValue];
[singleProgressBar displayIfNeeded];
}
@@ -1671,7 +1671,7 @@
- (BOOL)dumpSchemaAsDotToFileHandle:(NSFileHandle *)fileHandle
{
NSMutableString *metaString = [NSMutableString string];
- int progressBarWidth;
+ NSInteger progressBarWidth;
NSString *previousConnectionEncoding;
BOOL previousConnectionEncodingViaLatin1;
@@ -1679,7 +1679,7 @@
[singleProgressTitle displayIfNeeded];
[singleProgressText setStringValue:NSLocalizedString(@"Dumping...", @"text showing that app is writing dump")];
[singleProgressText displayIfNeeded];
- progressBarWidth = (int)[singleProgressBar bounds].size.width;
+ progressBarWidth = (NSInteger)[singleProgressBar bounds].size.width;
[singleProgressBar setDoubleValue:0];
[singleProgressBar displayIfNeeded];
@@ -1719,13 +1719,13 @@
NSMutableArray *fkInfo = [[NSMutableArray alloc] init];
// tables here
- for ( int i = 0 ; i < [tables count] ; i++ ) {
+ for ( NSInteger i = 0 ; i < [tables count] ; i++ ) {
if (progressCancelled) break;
NSString *tableName = [[tables objectAtIndex:i] objectAtIndex:1];
NSDictionary *tinfo = [tableDataInstance informationForTable:tableName];
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): Fetching data...", @"text showing that app is fetching data for table dump"), (i+1), [tables count], tableName]];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): Fetching data...", @"text showing that app is fetching data for table dump"), (long)(i+1), (unsigned long)[tables count], tableName]];
[singleProgressText displayIfNeeded];
[singleProgressBar setIndeterminate:YES];
[singleProgressBar setUsesThreadedAnimation:YES];
@@ -1744,7 +1744,7 @@
// grab column info
NSArray *cinfo = [tinfo objectForKey:@"columns"];
- for( int j = 0; j < [cinfo count]; j++ ) {
+ for( NSInteger j = 0; j < [cinfo count]; j++ ) {
[metaString appendString:[NSString stringWithFormat:@"\t\t\t<TR><TD COLSPAN=\"3\" PORT=\"%@\">%@:<FONT FACE=\"Helvetica-Oblique\" POINT-SIZE=\"10\">%@</FONT></TD></TR>\n", [[cinfo objectAtIndex:j] objectForKey:@"name"], [[cinfo objectAtIndex:j] objectForKey:@"name"], [[cinfo objectAtIndex:j] objectForKey:@"type"]]];
}
@@ -1755,7 +1755,7 @@
// see about relations
cinfo = [tinfo objectForKey:@"constraints"];
- for( int j = 0; j < [cinfo count]; j++ ) {
+ for( NSInteger j = 0; j < [cinfo count]; j++ ) {
if (progressCancelled) break;
// Get the column references. Currently the columns themselves are an array,
@@ -1789,7 +1789,7 @@
[metaString setString:@"edge [ arrowhead=inv, arrowtail=normal, style=dashed, color=\"#444444\" ];\n"];
// grab the relations
- for( int i = 0; i < [fkInfo count]; i++ ) {
+ for( NSInteger i = 0; i < [fkInfo count]; i++ ) {
[metaString appendString:[NSString stringWithFormat:@"%@;\n", [fkInfo objectAtIndex:i]]];
}
@@ -1850,8 +1850,8 @@
NSScanner *csvNumericTester;
BOOL quoteFieldSeparators = [enclosingString isEqualToString:@""];
BOOL csvCellIsNumeric;
- int i, progressBarWidth, lastProgressValue, currentPoolDataLength;
- int csvCellCount = 0;
+ NSInteger i, progressBarWidth, lastProgressValue, currentPoolDataLength;
+ NSInteger csvCellCount = 0;
// Detect and restore special characters being used as terminating or line end strings
NSMutableString *tempSeparatorString = [NSMutableString stringWithString:fieldSeparatorString];
@@ -1878,7 +1878,7 @@
lineEndString = [NSString stringWithString:tempLineEndString];
// Updating the progress bar can take >20% of processing time - store details to only update when required
- progressBarWidth = (int)[singleProgressBar bounds].size.width;
+ progressBarWidth = (NSInteger)[singleProgressBar bounds].size.width;
lastProgressValue = 0;
[singleProgressBar setMaxValue:progressBarWidth];
[singleProgressBar setDoubleValue:0];
@@ -2046,8 +2046,8 @@
currentRowIndex++;
if (totalRows)
[singleProgressBar setDoubleValue:(currentRowIndex*progressBarWidth/totalRows)];
- if ((int)[singleProgressBar doubleValue] > lastProgressValue) {
- lastProgressValue = (int)[singleProgressBar doubleValue];
+ if ((NSInteger)[singleProgressBar doubleValue] > lastProgressValue) {
+ lastProgressValue = (NSInteger)[singleProgressBar doubleValue];
[singleProgressBar displayIfNeeded];
}
@@ -2093,11 +2093,11 @@
NSMutableString *xmlString = [NSMutableString string];
NSMutableString *xmlItem = [NSMutableString string];
NSString *dataConversionString;
- int i, currentRowIndex, lastProgressValue, progressBarWidth, currentPoolDataLength;
- int xmlRowCount = 0;
+ NSInteger i, currentRowIndex, lastProgressValue, progressBarWidth, currentPoolDataLength;
+ NSInteger xmlRowCount = 0;
// Updating the progress bar can take >20% of processing time - store details to only update when required
- progressBarWidth = (int)[singleProgressBar bounds].size.width;
+ progressBarWidth = (NSInteger)[singleProgressBar bounds].size.width;
lastProgressValue = 0;
[singleProgressBar setIndeterminate:NO];
[singleProgressBar setMaxValue:progressBarWidth];
@@ -2214,8 +2214,8 @@
currentRowIndex++;
if (totalRows)
[singleProgressBar setDoubleValue:(currentRowIndex*progressBarWidth/totalRows)];
- if ((int)[singleProgressBar doubleValue] > lastProgressValue) {
- lastProgressValue = (int)[singleProgressBar doubleValue];
+ if ((NSInteger)[singleProgressBar doubleValue] > lastProgressValue) {
+ lastProgressValue = (NSInteger)[singleProgressBar doubleValue];
[singleProgressBar displayIfNeeded];
}
@@ -2254,7 +2254,7 @@
*/
- (BOOL)exportSelectedTablesToFileHandle:(NSFileHandle *)fileHandle usingFormat:(NSString *)type
{
- int i;
+ NSInteger i;
NSMutableArray *selectedTables = [NSMutableArray array];
// Extract the table names of the selected tables
@@ -2273,7 +2273,7 @@
*/
- (BOOL)exportTables:(NSArray *)selectedTables toFileHandle:(NSFileHandle *)fileHandle usingFormat:(NSString *)type usingMulti:(BOOL)multi
{
- int i, j;
+ NSInteger i, j;
MCPResult *queryResult;
MCPStreamingResult *streamingResult;
NSInteger streamingResultCount;
@@ -2341,7 +2341,7 @@
// Update the progress text and reset the progress bar to indeterminate status
tableName = [selectedTables objectAtIndex:i];
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): fetching data...", @"text showing that app is fetching data for table dump"), (i+1), [selectedTables count], tableName]];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): fetching data...", @"text showing that app is fetching data for table dump"), (long)(i+1), (unsigned long)[selectedTables count], tableName]];
[singleProgressText displayIfNeeded];
[singleProgressBar setIndeterminate:YES];
[singleProgressBar setUsesThreadedAnimation:YES];
@@ -2396,7 +2396,7 @@
}
// Update the progress text and set the progress bar back to determinate
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %i of %i (%@): Writing data...", @"text showing that app is writing data for table export"), (i+1), [selectedTables count], tableName]];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Table %ld of %lu (%@): Writing data...", @"text showing that app is writing data for table export"), (long)(i+1), (unsigned long)[selectedTables count], tableName]];
[singleProgressText displayIfNeeded];
[singleProgressBar stopAnimation:self];
[singleProgressBar setUsesThreadedAnimation:NO];
@@ -2513,7 +2513,7 @@
NSMutableString *placeholderSyntax, *fieldString;
NSArray *viewColumns;
NSDictionary *column;
- int i, j;
+ NSInteger i, j;
// Get structured information for the view via the SPTableData parsers
viewInformation = [tableDataInstance informationForView:viewName];
@@ -2543,17 +2543,17 @@
}
// Field specification details
- if ([[column objectForKey:@"unsigned"] intValue] == 1) [fieldString appendString:@" UNSIGNED"];
- if ([[column objectForKey:@"zerofill"] intValue] == 1) [fieldString appendString:@" ZEROFILL"];
- if ([[column objectForKey:@"binary"] intValue] == 1) [fieldString appendString:@" BINARY"];
- if ([[column objectForKey:@"null"] intValue] == 0) [fieldString appendString:@" NOT NULL"];
+ if ([[column objectForKey:@"unsigned"] integerValue] == 1) [fieldString appendString:@" UNSIGNED"];
+ if ([[column objectForKey:@"zerofill"] integerValue] == 1) [fieldString appendString:@" ZEROFILL"];
+ if ([[column objectForKey:@"binary"] integerValue] == 1) [fieldString appendString:@" BINARY"];
+ if ([[column objectForKey:@"null"] integerValue] == 0) [fieldString appendString:@" NOT NULL"];
// Provide the field default if appropriate
if ([column objectForKey:@"default"]) {
// Some MySQL server versions show a default of NULL for NOT NULL columns - don't export those.
if ([[column objectForKey:@"default"] isEqualToString:@"NULL"]) {
- if ([[column objectForKey:@"null"] intValue])
+ if ([[column objectForKey:@"null"] integerValue])
[fieldString appendString:@" DEFAULT NULL"];
} else if ([[column objectForKey:@"type"] isEqualToString:@"TIMESTAMP"]
@@ -2622,17 +2622,17 @@
#pragma mark -
#pragma mark Table view datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
{
return (aTableView == fieldMappingTableView) ? [fieldMappingTableColumnNames count] : [tables count];
}
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
[aCell setFont:([prefs boolForKey:SPUseMonospacedFonts]) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
}
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
id returnObject = nil;
@@ -2660,7 +2660,7 @@
return returnObject;
}
-- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ( aTableView == fieldMappingTableView ) {
[fieldMappingArray replaceObjectAtIndex:rowIndex withObject:anObject];
diff --git a/Source/TableSource.h b/Source/TableSource.h
index 52030cdb..10c82dae 100644
--- a/Source/TableSource.h
+++ b/Source/TableSource.h
@@ -60,7 +60,7 @@
NSMutableDictionary *oldRow, *enumFields;
NSDictionary *defaultValues;
BOOL isEditingRow, isEditingNewRow, isSavingRow, alertSheetOpened;
- int currentlyEditingRow;
+ NSInteger currentlyEditingRow;
NSUserDefaults *prefs;
}
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 9d1c6814..a183434e 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -53,7 +53,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
NSMutableDictionary *tempDefaultValues;
NSEnumerator *extrasEnumerator;
id extra;
- int i;
+ NSInteger i;
SPSQLParser *fieldParser;
BOOL enableInteraction = ![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableStructure] || ![tableDocumentInstance isWorking];
@@ -170,7 +170,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
// For timestamps check to see whether "on update CURRENT_TIMESTAMP" - not returned
// by SHOW COLUMNS - should be set from the table data store
if ([type isEqualToString:@"timestamp"]
- && [[[tableDataInstance columnWithName:[field objectForKey:@"Field"]] objectForKey:@"onupdatetimestamp"] intValue])
+ && [[[tableDataInstance columnWithName:[field objectForKey:@"Field"]] objectForKey:@"onupdatetimestamp"] integerValue])
{
[field setObject:@"on update CURRENT_TIMESTAMP" forKey:@"Extra"];
}
@@ -260,7 +260,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
// Check whether a save of the current row is required.
if ( ![self saveRowOnDeselect] ) return;
- int insertIndex = ([tableSourceView numberOfSelectedRows] == 0 ? [tableSourceView numberOfRows] : [tableSourceView selectedRow] + 1);
+ NSInteger insertIndex = ([tableSourceView numberOfSelectedRows] == 0 ? [tableSourceView numberOfRows] : [tableSourceView selectedRow] + 1);
[tableFields insertObject:[NSMutableDictionary
dictionaryWithObjects:[NSArray arrayWithObjects:@"", @"int", @"", @"0", @"0", @"0", ([prefs boolForKey:SPNewFieldsAllowNulls]) ? @"1" : @"0", @"", [prefs stringForKey:SPNullValue], @"None", nil]
@@ -421,7 +421,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab
*/
- (IBAction)openIndexSheet:(id)sender
{
- int i;
+ NSInteger i;
// Check whether a save of the current field row is required.
if (![self saveRowOnDeselect]) return;
@@ -513,12 +513,12 @@ fetches the result as an array with a dictionary for each row in it
*/
- (NSArray *)fetchResultAsArray:(MCPResult *)theResult
{
- unsigned long numOfRows = [theResult numOfRows];
+ NSUInteger numOfRows = [theResult numOfRows];
NSMutableArray *tempResult = [NSMutableArray arrayWithCapacity:numOfRows];
NSMutableDictionary *tempRow;
NSArray *keys;
id key;
- int i;
+ NSInteger i;
Class nullClass = [NSNull class];
id prefsNullValue = [prefs objectForKey:SPNullValue];
@@ -528,7 +528,7 @@ fetches the result as an array with a dictionary for each row in it
//use NULL string from preferences instead of the NSNull oject returned by the framework
keys = [tempRow allKeys];
- for (int i = 0; i < [keys count] ; i++) {
+ for (NSInteger i = 0; i < [keys count] ; i++) {
key = NSArrayObjectAtIndex(keys, i);
if ( [[tempRow objectForKey:key] isMemberOfClass:nullClass] )
[tempRow setObject:prefsNullValue forKey:key];
@@ -583,7 +583,7 @@ fetches the result as an array with a dictionary for each row in it
*/
- (BOOL)addRowToDB;
{
- int code;
+ NSInteger code;
NSDictionary *theRow;
NSMutableString *queryString;
@@ -641,19 +641,19 @@ fetches the result as an array with a dictionary for each row in it
}
// Field specification
- if ([[theRow objectForKey:@"unsigned"] intValue] == 1) {
+ if ([[theRow objectForKey:@"unsigned"] integerValue] == 1) {
[queryString appendString:@" UNSIGNED"];
}
- if ( [[theRow objectForKey:@"zerofill"] intValue] == 1) {
+ if ( [[theRow objectForKey:@"zerofill"] integerValue] == 1) {
[queryString appendString:@" ZEROFILL"];
}
- if ( [[theRow objectForKey:@"binary"] intValue] == 1) {
+ if ( [[theRow objectForKey:@"binary"] integerValue] == 1) {
[queryString appendString:@" BINARY"];
}
- if ([[theRow objectForKey:@"Null"] intValue] == 0) {
+ if ([[theRow objectForKey:@"Null"] integerValue] == 0) {
[queryString appendString:@" NOT NULL"];
} else {
[queryString appendString:@" NULL"];
@@ -666,7 +666,7 @@ fetches the result as an array with a dictionary for each row in it
else {
// If a NULL value has been specified, and NULL is allowed, specify DEFAULT NULL
if ([[theRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:SPNullValue]]) {
- if ([[theRow objectForKey:@"Null"] intValue] == 1) {
+ if ([[theRow objectForKey:@"Null"] integerValue] == 1) {
[queryString appendString:@" DEFAULT NULL "];
}
}
@@ -704,7 +704,7 @@ fetches the result as an array with a dictionary for each row in it
NSDictionary *originalColumnDetails = [[tableDataInstance columns] objectAtIndex:currentlyEditingRow];
// Any column comments
- if ([originalColumnDetails objectForKey:@"comment"] && [[originalColumnDetails objectForKey:@"comment"] length]) {
+ if ([originalColumnDetails objectForKey:@"comment"] && [(NSString *)[originalColumnDetails objectForKey:@"comment"] length]) {
[queryString appendString:[NSString stringWithFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]];
}
@@ -873,7 +873,7 @@ fetches the result as an array with a dictionary for each row in it
* if contextInfo == addIndex: adds and index to the mysql-db if user hits ok
* if contextInfo == cannotremovefield: do nothing
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Order out current sheet to suppress overlapping of sheets
if ([sheet respondsToSelector:@selector(orderOut:)]) [sheet orderOut:nil];
@@ -971,7 +971,7 @@ returns a dictionary containing enum/set field names as key and possible values
{
MCPResult *queryResult;
NSMutableArray *tempResult = [NSMutableArray array];
- int i;
+ NSInteger i;
queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]];
[queryResult setReturnDataAsStrings:YES];
@@ -1043,12 +1043,12 @@ returns a dictionary containing enum/set field names as key and possible values
#pragma mark -
#pragma mark TableView datasource methods
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return (aTableView == tableSourceView) ? [tableFields count] : [indexes count];
}
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
NSDictionary *theRow;
@@ -1065,7 +1065,7 @@ returns a dictionary containing enum/set field names as key and possible values
return [theRow objectForKey:[aTableColumn identifier]];
}
-- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
// Make sure that the drag operation is for the right table view
if (aTableView!=tableSourceView) return;
@@ -1093,7 +1093,7 @@ Begin a drag and drop operation from the table - copy a single dragged row to th
if ([rows count] == 1) {
[pboard declareTypes:[NSArray arrayWithObject:@"SequelProPasteboard"] owner:nil];
- [pboard setString:[[NSNumber numberWithInt:[rows firstIndex]] stringValue] forType:@"SequelProPasteboard"];
+ [pboard setString:[[NSNumber numberWithInteger:[rows firstIndex]] stringValue] forType:@"SequelProPasteboard"];
return YES;
} else {
return NO;
@@ -1106,21 +1106,21 @@ Determine whether to allow a drag and drop operation on this table - for the pur
validate that the original source is of the correct type and within the same table, and that the drag
would result in a position change.
*/
-- (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
+- (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row
proposedDropOperation:(NSTableViewDropOperation)operation
{
//make sure that the drag operation is for the right table view
if (tableView!=tableSourceView) return NO;
NSArray *pboardTypes = [[info draggingPasteboard] types];
- int originalRow;
+ NSInteger originalRow;
// Ensure the drop is of the correct type
if (operation == NSTableViewDropAbove && row != -1 && [pboardTypes containsObject:@"SequelProPasteboard"]) {
// Ensure the drag originated within this table
if ([info draggingSource] == tableView) {
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] integerValue];
if (row != originalRow && row != (originalRow+1)) {
return NSDragOperationMove;
@@ -1134,17 +1134,17 @@ would result in a position change.
/*
* Having validated a drop, perform the field/column reordering to match.
*/
-- (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id <NSDraggingInfo>)info row:(int)destinationRowIndex dropOperation:(NSTableViewDropOperation)operation
+- (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id <NSDraggingInfo>)info row:(NSInteger)destinationRowIndex dropOperation:(NSTableViewDropOperation)operation
{
//make sure that the drag operation is for the right table view
if (tableView!=tableSourceView) return NO;
- int originalRowIndex;
+ NSInteger originalRowIndex;
NSMutableString *queryString;
NSDictionary *originalRow;
// Extract the original row position from the pasteboard and retrieve the details
- originalRowIndex = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+ originalRowIndex = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] integerValue];
originalRow = [[NSDictionary alloc] initWithDictionary:[tableFields objectAtIndex:originalRowIndex]];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
@@ -1179,7 +1179,7 @@ would result in a position change.
// Add the default value
if ([[originalRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:SPNullValue]]) {
- if ([[originalRow objectForKey:@"Null"] intValue] == 1) {
+ if ([[originalRow objectForKey:@"Null"] integerValue] == 1) {
[queryString appendString:@" DEFAULT NULL"];
}
} else if ( [[originalRow objectForKey:@"Type"] isEqualToString:@"timestamp"] && ([[[originalRow objectForKey:@"Default"] uppercaseString] isEqualToString:@"CURRENT_TIMESTAMP"]) ) {
@@ -1192,7 +1192,7 @@ would result in a position change.
NSDictionary *originalColumnDetails = [[tableDataInstance columns] objectAtIndex:originalRowIndex];
// Any column comments
- if ([originalColumnDetails objectForKey:@"comment"] && [[originalColumnDetails objectForKey:@"comment"] length]) {
+ if ([originalColumnDetails objectForKey:@"comment"] && [(NSString *)[originalColumnDetails objectForKey:@"comment"] length]) {
[queryString appendString:[NSString stringWithFormat:@" COMMENT '%@'", [mySQLConnection prepareString:[originalColumnDetails objectForKey:@"comment"]]]];
}
@@ -1280,7 +1280,7 @@ would result in a position change.
*/
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
{
- int row, column;
+ NSInteger row, column;
row = [tableSourceView editedRow];
column = [tableSourceView editedColumn];
@@ -1334,7 +1334,7 @@ would result in a position change.
* Modify cell display by disabling table cells when a view is selected, meaning structure/index
* is uneditable.
*/
-- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {
+- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex {
//make sure that the message is from the right table view
if (tableView!=tableSourceView) return;
@@ -1350,17 +1350,17 @@ would result in a position change.
return YES;
}
-- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset
{
return proposedMax - 150;
}
-- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
+- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset
{
return proposedMin + 150;
}
-- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
+- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex
{
return [structureGrabber convertRect:[structureGrabber bounds] toView:splitView];
}
diff --git a/Source/TablesList.h b/Source/TablesList.h
index d7a22b53..b9a3d0c2 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -101,7 +101,7 @@ enum sp_table_types
NSMutableArray *filteredTables;
NSMutableArray *tableTypes;
NSMutableArray *filteredTableTypes;
- int selectedTableType;
+ NSInteger selectedTableType;
NSString *selectedTableName;
BOOL isTableListFiltered;
BOOL tableListIsSelectable;
@@ -130,7 +130,7 @@ enum sp_table_types
// Getters
- (NSString *)tableName;
-- (int)tableType;
+- (NSInteger)tableType;
- (NSArray *)tables;
- (NSArray *)tableTypes;
- (NSArray *)allTableAndViewNames;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 0472e0c4..5a98971b 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -61,7 +61,7 @@
{
MCPResult *theResult;
NSArray *resultRow;
- int i;
+ NSInteger i;
NSString *previousSelectedTable = nil;
BOOL previousTableListIsSelectable = tableListIsSelectable;
@@ -93,17 +93,17 @@
if ([theResult numOfFields] == 1) {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
[tables addObject:[[theResult fetchRowAsArray] objectAtIndex:0]];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
}
} else {
for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
resultRow = [theResult fetchRowAsArray];
[tables addObject:[resultRow objectAtIndex:0]];
if ([[resultRow objectAtIndex:1] isEqualToString:@"VIEW"]) {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_VIEW]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_VIEW]];
tableListContainsViews = YES;
} else {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
}
}
}
@@ -125,16 +125,16 @@
if([[mySQLConnection getLastErrorMessage] isEqualToString:@""] && theResult != nil && [theResult numOfRows] ) {
// add the header row
[tables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
[theResult dataSeek:0];
if( [theResult numOfFields] == 1 ) {
for( i = 0; i < [theResult numOfRows]; i++ ) {
[tables addObject:NSArrayObjectAtIndex([theResult fetchRowAsArray],3)];
if( [NSArrayObjectAtIndex([theResult fetchRowAsArray], 4) isEqualToString:@"PROCEDURE"]) {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_PROC]];
} else {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_FUNC]];
}
}
} else {
@@ -142,9 +142,9 @@
resultRow = [theResult fetchRowAsArray];
[tables addObject:NSArrayObjectAtIndex(resultRow, 3)];
if( [NSArrayObjectAtIndex(resultRow, 4) isEqualToString:@"PROCEDURE"] ) {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_PROC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_PROC]];
} else {
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_FUNC]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_FUNC]];
}
}
}
@@ -211,19 +211,19 @@
} else {
[tables insertObject:NSLocalizedString(@"TABLES",@"header for table list") atIndex:0];
}
- [tableTypes insertObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE] atIndex:0];
+ [tableTypes insertObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE] atIndex:0];
[tablesListView reloadData];
// if the previous selected table still exists, select it
if( previousSelectedTable != nil && [tables indexOfObject:previousSelectedTable] < [tables count]) {
- int itemToReselect = [tables indexOfObject:previousSelectedTable];
+ NSInteger itemToReselect = [tables indexOfObject:previousSelectedTable];
tableListIsSelectable = YES;
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemToReselect] byExtendingSelection:NO];
tableListIsSelectable = previousTableListIsSelectable;
if (selectedTableName) [selectedTableName release];
selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemToReselect]];
- selectedTableType = [[tableTypes objectAtIndex:itemToReselect] intValue];
+ selectedTableType = [[tableTypes objectAtIndex:itemToReselect] integerValue];
} else {
if (selectedTableName) [selectedTableName release];
selectedTableName = nil;
@@ -308,28 +308,28 @@
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
NSString *tblTypes;
- unsigned currentIndex = [indexes lastIndex];
+ NSUInteger currentIndex = [indexes lastIndex];
if ([tablesListView numberOfSelectedRows] == 1) {
- if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW)
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_VIEW)
tblTypes = NSLocalizedString(@"view", @"view");
- else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_TABLE)
tblTypes = NSLocalizedString(@"table", @"table");
- else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_PROC)
tblTypes = NSLocalizedString(@"procedure", @"procedure");
- else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC)
+ else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_FUNC)
tblTypes = NSLocalizedString(@"function", @"function");
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete %@ '%@'?", @"delete table/view message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'. This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'? This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
BOOL areTableTypeEqual = YES;
- int lastType = [[filteredTableTypes objectAtIndex:currentIndex] intValue];
+ NSInteger lastType = [[filteredTableTypes objectAtIndex:currentIndex] integerValue];
while (currentIndex != NSNotFound)
{
- if([[filteredTableTypes objectAtIndex:currentIndex] intValue]!=lastType)
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue]!=lastType)
{
areTableTypeEqual = NO;
break;
@@ -357,7 +357,7 @@
tblTypes = NSLocalizedString(@"items", @"items");
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete selected %@?", @"delete tables/views message"), tblTypes]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %@. This operation cannot be undone.", @"delete tables/views informative message"), tblTypes]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %@? This operation cannot be undone.", @"delete tables/views informative message"), tblTypes]];
}
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeRow"];
@@ -376,7 +376,7 @@
[tableWindow endEditingFor:nil];
// Detect table type: table or view
- int tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
+ NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
switch (tblType){
case SP_TABLETYPE_TABLE:
@@ -476,11 +476,11 @@
if ([tablesListView numberOfSelectedRows] == 1) {
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Truncate table '%@'?", @"truncate table message"), [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete ALL records in the table '%@'. This operation cannot be undone.", @"truncate table informative message"), [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete ALL records in the table '%@'? This operation cannot be undone.", @"truncate table informative message"), [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
[alert setMessageText:NSLocalizedString(@"Truncate selected tables?", @"truncate tables message")];
- [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete ALL records in the selected tables. This operation cannot be undone.", @"truncate tables informative message")];
+ [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete ALL records in the selected tables? This operation cannot be undone.", @"truncate tables informative message")];
}
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"truncateTable"];
@@ -502,7 +502,7 @@
/**
* Method for alert sheets.
*/
-- (void)sheetDidEnd:(id)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
// Order out current sheet to suppress overlapping of sheets
if ([sheet respondsToSelector:@selector(orderOut:)])
@@ -590,7 +590,7 @@
// Only RETURN/ENTER will be recognized for Add/Rename/Duplicate sheets to
// activate the Add/Rename/Duplicate buttons
- if([[[notification userInfo] objectForKey:@"NSTextMovement"] intValue] != 0)
+ if([[[notification userInfo] objectForKey:@"NSTextMovement"] integerValue] != 0)
return;
if (object == tableRenameField) {
@@ -612,7 +612,7 @@
{
// If there is a multiple or blank selection, clear all views directly.
- if ( [tablesListView numberOfSelectedRows] != 1 || ![[filteredTables objectAtIndex:[tablesListView selectedRow]] length] ) {
+ if ( [tablesListView numberOfSelectedRows] != 1 || ![(NSString *)[filteredTables objectAtIndex:[tablesListView selectedRow]] length] ) {
// Update the selection variables and the interface
[self performSelectorOnMainThread:@selector(setSelection:) withObject:nil waitUntilDone:YES];
@@ -752,12 +752,12 @@
// Set gear menu items Remove/Duplicate table/view according to the table types
// if at least one item is selected
if([indexes count]) {
- unsigned int currentIndex = [indexes lastIndex];
+ NSUInteger currentIndex = [indexes lastIndex];
BOOL areTableTypeEqual = YES;
- int lastType = [[filteredTableTypes objectAtIndex:currentIndex] intValue];
+ NSInteger lastType = [[filteredTableTypes objectAtIndex:currentIndex] integerValue];
while (currentIndex != NSNotFound)
{
- if ([[filteredTableTypes objectAtIndex:currentIndex] intValue] != lastType)
+ if ([[filteredTableTypes objectAtIndex:currentIndex] integerValue] != lastType)
{
areTableTypeEqual = NO;
break;
@@ -828,7 +828,7 @@
// Remove the "current selection" item for filtered lists if appropriate
if (isTableListFiltered && [tablesListView selectedRow] < [filteredTables count] - 2 && [filteredTables count] > 2
- && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] intValue] == SP_TABLETYPE_NONE
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-2] integerValue] == SP_TABLETYPE_NONE
&& [[filteredTables objectAtIndex:[filteredTables count]-2] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
{
[filteredTables removeObjectsInRange:NSMakeRange([filteredTables count]-2, 2)];
@@ -980,7 +980,7 @@
/*
* Returns the currently selected table type, or -1 if no table or multiple tables are selected
*/
-- (int) tableType
+- (NSInteger) tableType
{
return selectedTableType;
}
@@ -999,10 +999,10 @@
- (NSArray *)allTableAndViewNames
{
NSMutableArray *returnArray = [NSMutableArray array];
- int i;
- int cnt = [[self tables] count];
+ NSInteger i;
+ NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_TABLE || [NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_VIEW)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_TABLE || [NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_VIEW)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1010,10 +1010,10 @@
- (NSArray *)allTableNames
{
NSMutableArray *returnArray = [NSMutableArray array];
- int i;
- int cnt = [[self tables] count];
+ NSInteger i;
+ NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_TABLE)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_TABLE)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1021,10 +1021,10 @@
- (NSArray *)allViewNames
{
NSMutableArray *returnArray = [NSMutableArray array];
- int i;
- int cnt = [[self tables] count];
+ NSInteger i;
+ NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_VIEW)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_VIEW)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
[returnArray sortUsingSelector:@selector(compare:)];
@@ -1033,10 +1033,10 @@
- (NSArray *)allProcedureNames
{
NSMutableArray *returnArray = [NSMutableArray array];
- int i;
- int cnt = [[self tables] count];
+ NSInteger i;
+ NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_PROC)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_PROC)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1044,10 +1044,10 @@
- (NSArray *)allFunctionNames
{
NSMutableArray *returnArray = [NSMutableArray array];
- int i;
- int cnt = [[self tables] count];
+ NSInteger i;
+ NSInteger cnt = [[self tables] count];
for(i=0; i<cnt; i++) {
- if([NSArrayObjectAtIndex([self tableTypes],i) intValue] == SP_TABLETYPE_FUNC)
+ if([NSArrayObjectAtIndex([self tableTypes],i) integerValue] == SP_TABLETYPE_FUNC)
[returnArray addObject:NSArrayObjectAtIndex([self tables], i)];
}
return returnArray;
@@ -1118,13 +1118,13 @@
*/
- (BOOL)selectTableOrViewWithName:(NSString *)theName
{
- int i, tableType;
- int itemIndex = NSNotFound;
- int caseInsensitiveItemIndex = NSNotFound;
+ NSInteger i, tableType;
+ NSInteger itemIndex = NSNotFound;
+ NSInteger caseInsensitiveItemIndex = NSNotFound;
// Loop through the unfiltered tables/views to find the desired item
for (i = 0; i < [tables count]; i++) {
- tableType = [[tableTypes objectAtIndex:i] intValue];
+ tableType = [[tableTypes objectAtIndex:i] integerValue];
if (tableType != SP_TABLETYPE_TABLE && tableType != SP_TABLETYPE_VIEW) continue;
if ([[tables objectAtIndex:i] isEqualToString:theName]) {
itemIndex = i;
@@ -1144,14 +1144,14 @@
if (!isTableListFiltered) {
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
} else {
- int filteredIndex = [filteredTables indexOfObject:[tables objectAtIndex:itemIndex]];
+ NSInteger filteredIndex = [filteredTables indexOfObject:[tables objectAtIndex:itemIndex]];
if (filteredIndex != NSNotFound) {
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:filteredIndex] byExtendingSelection:NO];
} else {
[tablesListView deselectAll:nil];
if (selectedTableName) [selectedTableName release];
selectedTableName = [[NSString alloc] initWithString:[tables objectAtIndex:itemIndex]];
- selectedTableType = [[tableTypes objectAtIndex:itemIndex] intValue];
+ selectedTableType = [[tableTypes objectAtIndex:itemIndex] integerValue];
[self updateFilter:self];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), theName]];
}
@@ -1165,7 +1165,7 @@
/**
* Returns the number of tables in the current database.
*/
-- (int)numberOfRowsInTableView:(NSTableView *)aTableView
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [filteredTables count];
}
@@ -1173,7 +1173,7 @@
/**
* Returns the table names to be displayed in the tables list table view.
*/
-- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
// During imports the table view sometimes appears to request items beyond the end of the array.
@@ -1195,7 +1195,7 @@
/**
* Renames a table (in tables-array and mysql-db).
*/
-- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([selectedTableName isEqualToString:anObject]) {
// No changes in table name
@@ -1258,7 +1258,7 @@
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
// Renamed with success
if (isTableListFiltered) {
- int unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:rowIndex]];
+ NSInteger unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:rowIndex]];
[tables replaceObjectAtIndex:unfilteredIndex withObject:anObject];
}
[filteredTables replaceObjectAtIndex:rowIndex withObject:anObject];
@@ -1368,9 +1368,9 @@
// Perform no action if the selected table hasn't actually changed - reselection etc
if ([tablesListView numberOfSelectedRows] == 1
- && [[filteredTables objectAtIndex:[tablesListView selectedRow]] length]
+ && [(NSString *)[filteredTables objectAtIndex:[tablesListView selectedRow]] length]
&& [selectedTableName isEqualToString:[filteredTables objectAtIndex:[tablesListView selectedRow]]]
- && selectedTableType == [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue])
+ && selectedTableType == [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue])
{
return;
}
@@ -1379,7 +1379,7 @@
[spHistoryControllerInstance updateHistoryEntries];
NSString *tableName = @"data";
- if ([tablesListView numberOfSelectedRows] == 1 && [[filteredTables objectAtIndex:[tablesListView selectedRow]] length])
+ if ([tablesListView numberOfSelectedRows] == 1 && [(NSString *)[filteredTables objectAtIndex:[tablesListView selectedRow]] length])
tableName = [filteredTables objectAtIndex:[tablesListView selectedRow]];
[self updateSelectionWithTaskString:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), tableName]];
}
@@ -1387,7 +1387,7 @@
/**
* Table view delegate method
*/
-- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex
{
// Disallow selection while the document is working on a task
@@ -1396,38 +1396,38 @@
//return (rowIndex != 0);
if( [filteredTableTypes count] == 0 )
return (rowIndex != 0 );
- return ([[filteredTableTypes objectAtIndex:rowIndex] intValue] != SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] != SP_TABLETYPE_NONE );
}
/**
* Table view delegate method
*/
-- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(int)rowIndex
+- (BOOL)tableView:(NSTableView *)aTableView isGroupRow:(NSInteger)rowIndex
{
// For empty tables - title still present - or while lists are being altered
if (rowIndex >= [filteredTableTypes count]) return (rowIndex == 0 );
- return ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE );
+ return ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE );
}
/**
* Table view delegate method
*/
-- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if (rowIndex > 0 && rowIndex < [filteredTableTypes count]
&& [[aTableColumn identifier] isEqualToString:@"tables"]) {
- if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_VIEW) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_VIEW) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-view-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_TABLE) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_TABLE) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_PROC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_PROC) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"proc-small"]];
- } else if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_FUNC) {
+ } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_FUNC) {
[(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"func-small"]];
}
- if ([[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE) {
+ if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE) {
[(ImageAndTextCell*)aCell setImage:nil];
[(ImageAndTextCell*)aCell setIndentationLevel:0];
} else {
@@ -1443,7 +1443,7 @@
/**
* Table view delegate method
*/
-- (float)tableView:(NSTableView *)tableView heightOfRow:(int)row
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
return (row == 0) ? 25 : 17;
}
@@ -1567,10 +1567,10 @@
filteredTables = [[NSMutableArray alloc] init];
filteredTableTypes = [[NSMutableArray alloc] init];
- int i, lastTableType = NSNotFound, tableType;
+ NSInteger i, lastTableType = NSNotFound, tableType;
NSRange substringRange;
for (i = 0; i < [tables count]; i++) {
- tableType = [[tableTypes objectAtIndex:i] intValue];
+ tableType = [[tableTypes objectAtIndex:i] integerValue];
if (tableType == SP_TABLETYPE_NONE) continue;
substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch];
if (substringRange.location == NSNotFound) continue;
@@ -1583,12 +1583,12 @@
} else {
[filteredTables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
}
- [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
} else if ((tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC)
&& (lastTableType == NSNotFound || lastTableType == SP_TABLETYPE_TABLE || lastTableType == SP_TABLETYPE_VIEW))
{
[filteredTables addObject:NSLocalizedString(@"PROCS & FUNCS",@"header for procs & funcs list")];
- [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
}
lastTableType = tableType;
@@ -1600,15 +1600,15 @@
// Add a "no matches" title if nothing matches the current filter settings
if (![filteredTables count]) {
[filteredTables addObject:NSLocalizedString(@"NO MATCHES",@"header for no matches in filtered list")];
- [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
}
// If the currently selected table isn't present in the filter list, add it as a special entry
if (selectedTableName && [filteredTables indexOfObject:selectedTableName] == NSNotFound) {
[filteredTables addObject:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")];
- [filteredTableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_NONE]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_NONE]];
[filteredTables addObject:selectedTableName];
- [filteredTableTypes addObject:[NSNumber numberWithInt:selectedTableType]];
+ [filteredTableTypes addObject:[NSNumber numberWithInteger:selectedTableType]];
}
isTableListFiltered = YES;
@@ -1632,8 +1632,8 @@
*/
- (void) selectTableAtIndex:(NSNumber *)row
{
- int rowIndex = [row intValue];
- if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] intValue] == SP_TABLETYPE_NONE)
+ NSInteger rowIndex = [row integerValue];
+ if (rowIndex == NSNotFound || rowIndex > [filteredTables count] || [[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SP_TABLETYPE_NONE)
return;
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:rowIndex] byExtendingSelection:NO];
@@ -1772,23 +1772,23 @@
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
// get last index
- unsigned currentIndex = [indexes lastIndex];
+ NSUInteger currentIndex = [indexes lastIndex];
while (currentIndex != NSNotFound)
{
- if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW) {
+ if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_VIEW) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP VIEW %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_TABLE) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_TABLE) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP TABLE %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_PROC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_PROC) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP PROCEDURE %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
- } else if([[filteredTableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_FUNC) {
+ } else if([[filteredTableTypes objectAtIndex:currentIndex] integerValue] == SP_TABLETYPE_FUNC) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP FUNCTION %@",
[[filteredTables objectAtIndex:currentIndex] backtickQuotedString]
]];
@@ -1798,7 +1798,7 @@
if ([[mySQLConnection getLastErrorMessage] isEqualTo:@""]) {
//dropped table with success
if (isTableListFiltered) {
- int unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:currentIndex]];
+ NSInteger unfilteredIndex = [tables indexOfObject:[filteredTables objectAtIndex:currentIndex]];
[tables removeObjectAtIndex:unfilteredIndex];
[tableTypes removeObjectAtIndex:unfilteredIndex];
}
@@ -1825,7 +1825,7 @@
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
currentIndex = NSNotFound;
} else {
- int choice = [alert runModal];
+ NSInteger choice = [alert runModal];
if (choice == NSAlertFirstButtonReturn) {
currentIndex = [indexes indexLessThanIndex:currentIndex];
} else {
@@ -1837,7 +1837,7 @@
// Remove the isolated "current selection" item for filtered lists if appropriate
if (isTableListFiltered && [filteredTables count] > 1
- && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-1] intValue] == SP_TABLETYPE_NONE
+ && [[filteredTableTypes objectAtIndex:[filteredTableTypes count]-1] integerValue] == SP_TABLETYPE_NONE
&& [[filteredTables objectAtIndex:[filteredTables count]-1] isEqualToString:NSLocalizedString(@"CURRENT SELECTION",@"header for current selection in filtered list")])
{
[filteredTables removeLastObject];
@@ -1860,7 +1860,7 @@
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
// Get last index
- unsigned currentIndex = [indexes lastIndex];
+ NSUInteger currentIndex = [indexes lastIndex];
while (currentIndex != NSNotFound)
{
@@ -1905,9 +1905,9 @@
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
// Table creation was successful - insert the new item into the tables list and select it.
- int addItemAtIndex = NSNotFound;
- for (int i = 0; i < [tables count]; i++) {
- int tableType = [[tableTypes objectAtIndex:i] intValue];
+ NSInteger addItemAtIndex = NSNotFound;
+ for (NSInteger i = 0; i < [tables count]; i++) {
+ NSInteger tableType = [[tableTypes objectAtIndex:i] integerValue];
if (tableType == SP_TABLETYPE_NONE) continue;
if (tableType == SP_TABLETYPE_PROC || tableType == SP_TABLETYPE_FUNC) {
addItemAtIndex = i - 1;
@@ -1920,10 +1920,10 @@
}
if (addItemAtIndex == NSNotFound) {
[tables addObject:tableName];
- [tableTypes addObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE]];
+ [tableTypes addObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE]];
} else {
[tables insertObject:tableName atIndex:addItemAtIndex];
- [tableTypes insertObject:[NSNumber numberWithInt:SP_TABLETYPE_TABLE] atIndex:addItemAtIndex];
+ [tableTypes insertObject:[NSNumber numberWithInteger:SP_TABLETYPE_TABLE] atIndex:addItemAtIndex];
}
// Set the selected table name and type, and then use updateFilter and updateSelection to update the filter list and selection.
@@ -1964,7 +1964,7 @@
BOOL copyTableContent = ([copyTableContentSwitch state] == NSOnState);
- int tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] intValue];
+ NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
switch (tblType){
case SP_TABLETYPE_TABLE:
@@ -2089,9 +2089,9 @@
}
// Insert the new item into the tables list and select it.
- int addItemAtIndex = NSNotFound;
- for (int i = 0; i < [tables count]; i++) {
- int tableType = [[tableTypes objectAtIndex:i] intValue];
+ NSInteger addItemAtIndex = NSNotFound;
+ for (NSInteger i = 0; i < [tables count]; i++) {
+ NSInteger tableType = [[tableTypes objectAtIndex:i] integerValue];
if (tableType == SP_TABLETYPE_NONE) continue;
if ((tableType == SP_TABLETYPE_VIEW || tableType == SP_TABLETYPE_TABLE)
&& (tblType == SP_TABLETYPE_PROC || tblType == SP_TABLETYPE_FUNC)) {
@@ -2109,10 +2109,10 @@
}
if (addItemAtIndex == NSNotFound) {
[tables addObject:[copyTableNameField stringValue]];
- [tableTypes addObject:[NSNumber numberWithInt:tblType]];
+ [tableTypes addObject:[NSNumber numberWithInteger:tblType]];
} else {
[tables insertObject:[copyTableNameField stringValue] atIndex:addItemAtIndex];
- [tableTypes insertObject:[NSNumber numberWithInt:tblType] atIndex:addItemAtIndex];
+ [tableTypes insertObject:[NSNumber numberWithInteger:tblType] atIndex:addItemAtIndex];
}
// Set the selected table name and type, and use updateFilter to update the filter list and selection
diff --git a/Source/YRKSpinningProgressIndicator.h b/Source/YRKSpinningProgressIndicator.h
index fae46208..355ebf2f 100644
--- a/Source/YRKSpinningProgressIndicator.h
+++ b/Source/YRKSpinningProgressIndicator.h
@@ -8,8 +8,8 @@
@interface YRKSpinningProgressIndicator : NSView {
- int _position;
- int _numFins;
+ NSInteger _position;
+ NSInteger _numFins;
BOOL _isIndeterminate;
double _currentValue;
diff --git a/Source/YRKSpinningProgressIndicator.m b/Source/YRKSpinningProgressIndicator.m
index cca0a28c..b9af4847 100644
--- a/Source/YRKSpinningProgressIndicator.m
+++ b/Source/YRKSpinningProgressIndicator.m
@@ -81,12 +81,12 @@
- (void)drawRect:(NSRect)rect
{
- int i;
- float alpha = 1.0;
+ NSInteger i;
+ CGFloat alpha = 1.0;
// Determine size based on current bounds
NSSize size = [self bounds].size;
- float maxSize;
+ CGFloat maxSize;
if(size.width >= size.height)
maxSize = size.height;
else
@@ -110,9 +110,9 @@
CGContextRotateCTM(currentContext, 3.14159*2/_numFins * _position);
NSBezierPath *path = [[NSBezierPath alloc] init];
- float lineWidth = 0.08 * maxSize; // should be 2.75 for 32x32
- float lineStart = 0.234375 * maxSize; // should be 7.5 for 32x32
- float lineEnd = 0.421875 * maxSize; // should be 13.5 for 32x32
+ 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
[path setLineWidth:lineWidth];
[path setLineCapStyle:NSRoundLineCapStyle];
[path moveToPoint:NSMakePoint(0,lineStart)];
@@ -135,8 +135,8 @@
} else {
- float lineWidth = 1 + (0.01 * maxSize);
- float circleRadius = (maxSize - lineWidth) / 2.1;
+ CGFloat lineWidth = 1 + (0.01 * maxSize);
+ CGFloat circleRadius = (maxSize - lineWidth) / 2.1;
NSPoint circleCenter = NSMakePoint(0, 0);
[[_foreColor colorWithAlphaComponent:alpha] set];
NSBezierPath *path = [[NSBezierPath alloc] init];
@@ -173,8 +173,8 @@
NSAutoreleasePool *animationPool = [[NSAutoreleasePool alloc] init];
// Set up the animation speed to subtly change with size > 32.
- int animationDelay = 38000 + (2000 * ([self bounds].size.height / 32));
- int poolFlushCounter = 0;
+ NSInteger animationDelay = 38000 + (2000 * ([self bounds].size.height / 32));
+ NSInteger poolFlushCounter = 0;
do {
[self animate:nil];