| 3482 | } |
| 3483 | |
| 3484 | static enum XML_Error PTRCALL |
| 3485 | entityValueInitProcessor(XML_Parser parser, |
| 3486 | const char *s, |
| 3487 | const char *end, |
| 3488 | const char **nextPtr) |
| 3489 | { |
| 3490 | int tok; |
| 3491 | const char *start = s; |
| 3492 | const char *next = start; |
| 3493 | eventPtr = start; |
| 3494 | |
| 3495 | for (;;) { |
| 3496 | tok = XmlPrologTok(encoding, start, end, &next); |
| 3497 | eventEndPtr = next; |
| 3498 | if (tok <= 0) { |
| 3499 | if (!ps_finalBuffer && tok != XML_TOK_INVALID) { |
| 3500 | *nextPtr = s; |
| 3501 | return XML_ERROR_NONE; |
| 3502 | } |
| 3503 | switch (tok) { |
| 3504 | case XML_TOK_INVALID: |
| 3505 | return XML_ERROR_INVALID_TOKEN; |
| 3506 | case XML_TOK_PARTIAL: |
| 3507 | return XML_ERROR_UNCLOSED_TOKEN; |
| 3508 | case XML_TOK_PARTIAL_CHAR: |
| 3509 | return XML_ERROR_PARTIAL_CHAR; |
| 3510 | case XML_TOK_NONE: /* start == end */ |
| 3511 | default: |
| 3512 | break; |
| 3513 | } |
| 3514 | /* found end of entity value - can store it now */ |
| 3515 | return storeEntityValue(parser, encoding, s, end); |
| 3516 | } |
| 3517 | else if (tok == XML_TOK_XML_DECL) { |
| 3518 | enum XML_Error result; |
| 3519 | result = processXmlDecl(parser, 0, start, next); |
| 3520 | if (result != XML_ERROR_NONE) |
| 3521 | return result; |
| 3522 | switch (ps_parsing) { |
| 3523 | case XML_SUSPENDED: |
| 3524 | *nextPtr = next; |
| 3525 | return XML_ERROR_NONE; |
| 3526 | case XML_FINISHED: |
| 3527 | return XML_ERROR_ABORTED; |
| 3528 | default: |
| 3529 | *nextPtr = next; |
| 3530 | } |
| 3531 | /* stop scanning for text declaration - we found one */ |
| 3532 | processor = entityValueProcessor; |
| 3533 | return entityValueProcessor(parser, next, end, nextPtr); |
| 3534 | } |
| 3535 | /* If we are at the end of the buffer, this would cause XmlPrologTok to |
| 3536 | return XML_TOK_NONE on the next call, which would then cause the |
| 3537 | function to exit with *nextPtr set to s - that is what we want for other |
| 3538 | tokens, but not for the BOM - we would rather like to skip it; |
| 3539 | then, when this routine is entered the next time, XmlPrologTok will |
| 3540 | return XML_TOK_INVALID, since the BOM is still in the buffer |
| 3541 | */ |
no test coverage detected