MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlParserGrow

Function xmlParserGrow

ThirdParty/libxml2/vtklibxml2/parserInternals.c:440–480  ·  view source on GitHub ↗

* xmlParserGrow: * @ctxt: an XML parser context * * Grow the input buffer. * * Returns the number of bytes read or -1 in case of error. */

Source from the content-addressed store, hash-verified

438 * Returns the number of bytes read or -1 in case of error.
439 */
440int
441xmlParserGrow(xmlParserCtxtPtr ctxt) {
442 xmlParserInputPtr in = ctxt->input;
443 xmlParserInputBufferPtr buf = in->buf;
444 size_t curEnd = in->end - in->cur;
445 size_t curBase = in->cur - in->base;
446 size_t maxLength = (ctxt->options & XML_PARSE_HUGE) ?
447 XML_MAX_HUGE_LENGTH :
448 XML_MAX_LOOKUP_LIMIT;
449 int ret;
450
451 if (buf == NULL)
452 return(0);
453 /* Don't grow push parser buffer. */
454 if (PARSER_PROGRESSIVE(ctxt))
455 return(0);
456 /* Don't grow memory buffers. */
457 if ((buf->encoder == NULL) && (buf->readcallback == NULL))
458 return(0);
459 if (buf->error != 0)
460 return(-1);
461
462 if (curBase > maxLength) {
463 xmlFatalErr(ctxt, XML_ERR_RESOURCE_LIMIT,
464 "Buffer size limit exceeded, try XML_PARSE_HUGE\n");
465 xmlHaltParser(ctxt);
466 return(-1);
467 }
468
469 if (curEnd >= INPUT_CHUNK)
470 return(0);
471
472 ret = xmlParserInputBufferGrow(buf, INPUT_CHUNK);
473 xmlBufUpdateInput(buf->buffer, in, curBase);
474
475 if (ret < 0) {
476 xmlCtxtErrIO(ctxt, buf->error, NULL);
477 }
478
479 return(ret);
480}
481
482/**
483 * xmlParserInputGrow:

Callers 9

htmlCurrentCharFunction · 0.85
htmlSkipBlankCharsFunction · 0.85
xmlNextCharFunction · 0.85
xmlCurrentCharFunction · 0.85
xmlDetectEncodingFunction · 0.85
xmlSkipBlankCharsFunction · 0.85
xmlPopPEFunction · 0.85
xmlPopInputFunction · 0.85
xmlCtxtParseContentFunction · 0.85

Calls 5

xmlFatalErrFunction · 0.85
xmlHaltParserFunction · 0.85
xmlParserInputBufferGrowFunction · 0.85
xmlBufUpdateInputFunction · 0.85
xmlCtxtErrIOFunction · 0.85

Tested by

no test coverage detected