Differences From Artifact [ca01c9a5ad]:
- File src/OFXMLParser.m — part of check-in [fb515e8e24] at 2012-10-09 15:07:30 on branch trunk — Make use of instancetype. (user: js, size: 25105) [annotate] [blame] [check-ins using]
To Artifact [9e2d46e499]:
- File
src/OFXMLParser.m
— part of check-in
[ed4e64fd32]
at
2012-12-03 01:17:04
on branch trunk
— OFXMLParser: Add configurable depth limit.
The default is 32. (user: js, size: 25397) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
@"xml", @"http://www.w3.org/XML/1998/namespace",
@"xmlns", @"http://www.w3.org/2000/xmlns/", nil];
[namespaces addObject: dict];
acceptProlog = YES;
lineNumber = 1;
encoding = OF_STRING_ENCODING_UTF_8;
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
| > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
@"xml", @"http://www.w3.org/XML/1998/namespace",
@"xmlns", @"http://www.w3.org/2000/xmlns/", nil];
[namespaces addObject: dict];
acceptProlog = YES;
lineNumber = 1;
encoding = OF_STRING_ENCODING_UTF_8;
depthLimit = 32;
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
| ︙ | ︙ | |||
231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
return delegate;
}
- (void)setDelegate: (id <OFXMLParserDelegate>)delegate_
{
delegate = delegate_;
}
- (void)parseBuffer: (const char*)buffer
length: (size_t)length
{
size_t i, last = 0;
for (i = 0; i < length; i++) {
| > > > > > > > > > > | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
return delegate;
}
- (void)setDelegate: (id <OFXMLParserDelegate>)delegate_
{
delegate = delegate_;
}
- (size_t)depthLimit
{
return depthLimit;
}
- (void)setDepthLimit: (size_t)depthLimit_
{
depthLimit = depthLimit_;
}
- (void)parseBuffer: (const char*)buffer
length: (size_t)length
{
size_t i, last = 0;
for (i = 0; i < length; i++) {
|
| ︙ | ︙ | |||
360 361 362 363 364 365 366 367 368 369 370 371 372 373 | break; case '!': *last = *i + 1; state = OF_XMLPARSER_IN_EXCLAMATIONMARK; acceptProlog = NO; break; default: state = OF_XMLPARSER_IN_TAG_NAME; acceptProlog = NO; (*i)--; break; } } | > > > > > | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | break; case '!': *last = *i + 1; state = OF_XMLPARSER_IN_EXCLAMATIONMARK; acceptProlog = NO; break; default: if (depthLimit > 0 && [previous count] >= depthLimit) @throw [OFMalformedXMLException exceptionWithClass: [self class] parser: self]; state = OF_XMLPARSER_IN_TAG_NAME; acceptProlog = NO; (*i)--; break; } } |
| ︙ | ︙ |