mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-25 05:15:25 +00:00
Monotone-Parent: f4a48c355ec45a380e52409f4443bd4198ea038a
Monotone-Revision: 2067a16090e68b1eac6c1e860f41b09c466ff2f5 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-08-21T21:40:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -197,7 +197,7 @@ static NSMutableCharacterSet *urlStartChars = nil;
|
||||
{
|
||||
NSRange httpRange, currentURL, rest;
|
||||
NSString *urlText, *newUrlText;
|
||||
unsigned int length, matchLength;
|
||||
unsigned int length, matchLength, offset;
|
||||
int startLocation;
|
||||
|
||||
if (!urlStartChars)
|
||||
@@ -211,6 +211,7 @@ static NSMutableCharacterSet *urlStartChars = nil;
|
||||
httpRange = [selfCopy rangeOfString: match];
|
||||
if (httpRange.location != NSNotFound)
|
||||
{
|
||||
offset = 0;
|
||||
startLocation = httpRange.location;
|
||||
while (startLocation > -1
|
||||
&& [urlStartChars characterIsMember:
|
||||
@@ -220,7 +221,8 @@ static NSMutableCharacterSet *urlStartChars = nil;
|
||||
}
|
||||
while (httpRange.location != NSNotFound)
|
||||
{
|
||||
if ([ranges hasRangeIntersection: httpRange])
|
||||
currentURL = [selfCopy _rangeOfURLInRange: httpRange];
|
||||
if ([ranges hasRangeIntersection: httpRange withOffset: offset])
|
||||
rest.location = NSMaxRange(httpRange);
|
||||
else
|
||||
{
|
||||
@@ -237,6 +239,7 @@ static NSMutableCharacterSet *urlStartChars = nil;
|
||||
currentURL
|
||||
= NSMakeRange (currentURL.location, [newUrlText length]);
|
||||
[ranges addRange: currentURL];
|
||||
offset = offset + 9 + [prefix length];
|
||||
}
|
||||
rest.location = NSMaxRange(currentURL);
|
||||
}
|
||||
@@ -245,6 +248,15 @@ static NSMutableCharacterSet *urlStartChars = nil;
|
||||
rest.length = length - rest.location;
|
||||
httpRange = [selfCopy rangeOfString: match
|
||||
options: 0 range: rest];
|
||||
if (httpRange.location != NSNotFound)
|
||||
{
|
||||
startLocation = httpRange.location;
|
||||
while (startLocation > -1
|
||||
&& [urlStartChars characterIsMember:
|
||||
[selfCopy characterAtIndex: startLocation]])
|
||||
startLocation--;
|
||||
httpRange.location = startLocation + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user