Differences From Artifact [3771da0801]:
- File src/OFXMLParser.m — part of check-in [4c8d02cc0d] at 2017-01-18 03:45:05 on branch trunk — Move parsing of encoding names to a single place (user: js, size: 24004) [annotate] [blame] [check-ins using]
To Artifact [829d513f17]:
- File
src/OFXMLParser.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 24013) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
56 57 58 59 60 61 62 | length: length]; [buffer addItems: [tmp UTF8String] count: [tmp UTF8StringLength]]; objc_autoreleasePoolPop(pool); } } | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | length: length]; [buffer addItems: [tmp UTF8String] count: [tmp UTF8StringLength]]; objc_autoreleasePoolPop(pool); } } static OFString * transformString(OFXMLParser *parser, OFDataArray *buffer, size_t cut, bool unescape) { char *items = [buffer items]; size_t length = [buffer count] - cut; bool hasEntities = false; OFString *ret; |
︙ | ︙ | |||
94 95 96 97 98 99 100 | exceptionWithParser: parser]; } } return ret; } | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | exceptionWithParser: parser]; } } return ret; } static OFString * namespaceForPrefix(OFString *prefix, OFArray *namespaces) { OFDictionary *const *objects = [namespaces objects]; size_t count = [namespaces count]; if (prefix == nil) prefix = @""; |
︙ | ︙ | |||
228 229 230 231 232 233 234 | [_attributeName release]; [_attributePrefix release]; [_previous release]; [super dealloc]; } | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | [_attributeName release]; [_attributePrefix release]; [_previous release]; [super dealloc]; } - (void)parseBuffer: (const char *)buffer length: (size_t)length { _data = buffer; for (_i = _last = 0; _i < length; _i++) { size_t j = _i; |
︙ | ︙ | |||
255 256 257 258 259 260 261 | /* In OF_XMLPARSER_IN_TAG, there can be only spaces */ if (length - _last > 0 && _state != OF_XMLPARSER_IN_TAG) appendToBuffer(_buffer, _data + _last, _encoding, length - _last); } | | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | /* In OF_XMLPARSER_IN_TAG, there can be only spaces */ if (length - _last > 0 && _state != OF_XMLPARSER_IN_TAG) appendToBuffer(_buffer, _data + _last, _encoding, length - _last); } - (void)parseString: (OFString *)string { [self parseBuffer: [string UTF8String] length: [string UTF8StringLength]]; } - (void)parseStream: (OFStream *)stream { size_t pageSize = [OFSystemInfo pageSize]; char *buffer = [self allocMemoryWithSize: pageSize]; @try { while (![stream isAtEndOfStream]) { size_t length = [stream readIntoBuffer: buffer length: pageSize]; [self parseBuffer: buffer length: length]; } } @finally { [self freeMemory: buffer]; } } #ifdef OF_HAVE_FILES - (void)parseFile: (OFString *)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"rb"]; @try { [self parseStream: file]; } @finally { |
︙ | ︙ | |||
386 387 388 389 390 391 392 | _acceptProlog = false; _i--; break; } } /* <?xml […]?> */ | | | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | _acceptProlog = false; _i--; break; } } /* <?xml […]?> */ - (bool)OF_parseXMLProcessingInstructions: (OFString *)pi { const char *cString; size_t length, last; int PIState = 0; OFString *attribute = nil; OFMutableString *value = nil; char piDelimiter = 0; |
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | } - (bool)hasFinishedParsing { return _finishedParsing; } | | | | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 | } - (bool)hasFinishedParsing { return _finishedParsing; } - (OFString *)string: (OFString *)string containsUnknownEntityNamed: (OFString *)entity { if ([_delegate respondsToSelector: @selector(parser:foundUnknownEntityNamed:)]) return [_delegate parser: self foundUnknownEntityNamed: entity]; return nil; } @end |