diff options
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 29 |
1 files changed, 5 insertions, 24 deletions
@@ -11492,10 +11492,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { return(0); if (ctxt->input == NULL) break; - if (ctxt->input->buf == NULL) - avail = ctxt->input->length - - (ctxt->input->cur - ctxt->input->base); - else { + if (ctxt->input->buf != NULL) { /* * If we are operating on converted input, try to flush * remaining chars to avoid them stalling in the non-converted @@ -11514,9 +11511,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, current); } - avail = xmlBufUse(ctxt->input->buf->buffer) - - (ctxt->input->cur - ctxt->input->base); } + avail = ctxt->input->end - ctxt->input->cur; if (avail < 1) goto done; switch (ctxt->instate) { @@ -11925,12 +11921,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { case XML_PARSER_PROLOG: case XML_PARSER_EPILOG: SKIP_BLANKS; - if (ctxt->input->buf == NULL) - avail = ctxt->input->length - - (ctxt->input->cur - ctxt->input->base); - else - avail = xmlBufUse(ctxt->input->buf->buffer) - - (ctxt->input->cur - ctxt->input->base); + avail = ctxt->input->end - ctxt->input->cur; if (avail < 2) goto done; cur = ctxt->input->cur[0]; @@ -12293,22 +12284,12 @@ xmldecl_done: /* * Check for termination */ - int cur_avail = 0; - - if (ctxt->input != NULL) { - if (ctxt->input->buf == NULL) - cur_avail = ctxt->input->length - - (ctxt->input->cur - ctxt->input->base); - else - cur_avail = xmlBufUse(ctxt->input->buf->buffer) - - (ctxt->input->cur - ctxt->input->base); - } - if ((ctxt->instate != XML_PARSER_EOF) && (ctxt->instate != XML_PARSER_EPILOG)) { xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); } - if ((ctxt->instate == XML_PARSER_EPILOG) && (cur_avail > 0)) { + if ((ctxt->instate == XML_PARSER_EPILOG) && + (ctxt->input->cur < ctxt->input->end)) { xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); } if (ctxt->instate != XML_PARSER_EOF) { |