aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPSQLParser.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-04-22 17:44:57 +0000
committerstuconnolly <stuart02@gmail.com>2011-04-22 17:44:57 +0000
commit4611475c5b255eed9202474dd3bdee147e932946 (patch)
tree39bdc50e046f802265950c6e2607ca9ebda453be /Source/SPSQLParser.m
parent3ed8b33deeadcc98185911f41bc6bcb4e53b4719 (diff)
downloadsequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.gz
sequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.bz2
sequelpro-4611475c5b255eed9202474dd3bdee147e932946.zip
Bring outline view branch up to date with trunk (r3234:3277).
Diffstat (limited to 'Source/SPSQLParser.m')
-rw-r--r--Source/SPSQLParser.m10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/SPSQLParser.m b/Source/SPSQLParser.m
index 6485fc85..6da67396 100644
--- a/Source/SPSQLParser.m
+++ b/Source/SPSQLParser.m
@@ -280,12 +280,14 @@ TO_BUFFER_STATE to_scan_string (const char *);
}
}
- if ([carriageReturnPositions count]) {
+ // If any CRs were found, iterate over them backwards, converting to LFs by replacing or subtracting as appropriate
+ NSUInteger carriageReturnCount = [carriageReturnPositions count];
+ if (carriageReturnCount) {
NSMutableString *normalisedString = [NSMutableString stringWithString:queryString];
BOOL isCRLF;
NSUInteger CRLocation;
- for (NSNumber *position in carriageReturnPositions) {
- CRLocation = [position unsignedIntegerValue];
+ while ( carriageReturnCount-- ) {
+ CRLocation = [[carriageReturnPositions objectAtIndex:carriageReturnCount] unsignedIntegerValue];
// Check whether it's a CRLF or just a CR
isCRLF = NO;
@@ -778,7 +780,7 @@ TO_BUFFER_STATE to_scan_string (const char *);
if (delimiter) [delimiter release];
delimiter = [[NSString alloc] initWithString:[delimiterCommandParts objectAtIndex:2]];
delimiterLengthMinusOne = [delimiter length] - 1;
- parsedToPosition = currentStringIndex + [[delimiterCommandParts objectAtIndex:1] length];
+ parsedToPosition = currentStringIndex + [(NSString*)[delimiterCommandParts objectAtIndex:1] length];
// Drop back to standard non-delimiter mode if the delimiter has ended
if ([delimiter isEqualToString:[NSString stringWithFormat:@"%C", character]]) {