| 13466 | } |
| 13467 | |
| 13468 | static int |
| 13469 | xmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask) |
| 13470 | { |
| 13471 | int allMask; |
| 13472 | |
| 13473 | if (ctxt == NULL) |
| 13474 | return(-1); |
| 13475 | |
| 13476 | /* |
| 13477 | * XInclude options aren't handled by the parser. |
| 13478 | * |
| 13479 | * XML_PARSE_XINCLUDE |
| 13480 | * XML_PARSE_NOXINCNODE |
| 13481 | * XML_PARSE_NOBASEFIX |
| 13482 | */ |
| 13483 | allMask = XML_PARSE_RECOVER | |
| 13484 | XML_PARSE_NOENT | |
| 13485 | XML_PARSE_DTDLOAD | |
| 13486 | XML_PARSE_DTDATTR | |
| 13487 | XML_PARSE_DTDVALID | |
| 13488 | XML_PARSE_NOERROR | |
| 13489 | XML_PARSE_NOWARNING | |
| 13490 | XML_PARSE_PEDANTIC | |
| 13491 | XML_PARSE_NOBLANKS | |
| 13492 | #ifdef LIBXML_SAX1_ENABLED |
| 13493 | XML_PARSE_SAX1 | |
| 13494 | #endif |
| 13495 | XML_PARSE_NONET | |
| 13496 | XML_PARSE_NODICT | |
| 13497 | XML_PARSE_NSCLEAN | |
| 13498 | XML_PARSE_NOCDATA | |
| 13499 | XML_PARSE_COMPACT | |
| 13500 | XML_PARSE_OLD10 | |
| 13501 | XML_PARSE_HUGE | |
| 13502 | XML_PARSE_OLDSAX | |
| 13503 | XML_PARSE_IGNORE_ENC | |
| 13504 | XML_PARSE_BIG_LINES | |
| 13505 | XML_PARSE_NO_XXE; |
| 13506 | |
| 13507 | ctxt->options = (ctxt->options & keepMask) | (options & allMask); |
| 13508 | |
| 13509 | /* |
| 13510 | * For some options, struct members are historically the source |
| 13511 | * of truth. The values are initalized from global variables and |
| 13512 | * old code could also modify them directly. Several older API |
| 13513 | * functions that don't take an options argument rely on these |
| 13514 | * deprecated mechanisms. |
| 13515 | * |
| 13516 | * Once public access to struct members and the globals are |
| 13517 | * disabled, we can use the options bitmask as source of |
| 13518 | * truth, making all these struct members obsolete. |
| 13519 | * |
| 13520 | * The XML_DETECT_IDS flags is misnamed. It simply enables |
| 13521 | * loading of the external subset. |
| 13522 | */ |
| 13523 | ctxt->recovery = (options & XML_PARSE_RECOVER) ? 1 : 0; |
| 13524 | ctxt->replaceEntities = (options & XML_PARSE_NOENT) ? 1 : 0; |
| 13525 | ctxt->loadsubset = (options & XML_PARSE_DTDLOAD) ? XML_DETECT_IDS : 0; |
no test coverage detected