mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Make maxEntityLength the actual length of the longest entity name in the entities dictionary.
This commit is contained in:
@@ -165,11 +165,19 @@ static NSString *RSParserStringWithValue(uint32_t value);
|
||||
|
||||
NSString *s = self.string;
|
||||
NSUInteger initialScanLocation = self.scanLocation;
|
||||
static NSUInteger maxEntityLength = 20; // It’s probably smaller, but this is just for sanity.
|
||||
|
||||
unichar ch = 0;
|
||||
|
||||
static NSUInteger maxEntityLength = 0;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
for (NSString *entityName in RSEntitiesDictionary().allKeys) {
|
||||
maxEntityLength = MAX(maxEntityLength, entityName.length);
|
||||
}
|
||||
});
|
||||
|
||||
while (true) {
|
||||
|
||||
unichar ch = [s characterAtIndex:self.scanLocation];
|
||||
|
||||
ch = [s characterAtIndex:self.scanLocation];
|
||||
if ([NSCharacterSet.whitespaceAndNewlineCharacterSet characterIsMember:ch]) {
|
||||
break;
|
||||
}
|
||||
@@ -272,6 +280,7 @@ static NSDictionary *RSEntitiesDictionary(void) {
|
||||
@"cedil": @"¸",
|
||||
@"cent": @"¢",
|
||||
@"copy": @"©",
|
||||
@"CounterClockwiseContourIntegral": @"∳",
|
||||
@"curren": @"¤",
|
||||
@"deg": @"°",
|
||||
@"die": @"¨",
|
||||
|
||||
Reference in New Issue
Block a user