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

Function xmlParserInputGrow

ThirdParty/libxml2/vtklibxml2/parserInternals.c:495–527  ·  view source on GitHub ↗

* xmlParserInputGrow: * @in: an XML parser input * @len: an indicative size for the lookahead * * DEPRECATED: Don't use. * * This function increase the input for the parser. It tries to * preserve pointers to the input buffer, and keep already read data * * Returns the amount of char read, or -1 in case of error, 0 indicate the * end of this entity */

Source from the content-addressed store, hash-verified

493 * end of this entity
494 */
495int
496xmlParserInputGrow(xmlParserInputPtr in, int len) {
497 int ret;
498 size_t indx;
499
500 if ((in == NULL) || (len < 0)) return(-1);
501 if (in->buf == NULL) return(-1);
502 if (in->base == NULL) return(-1);
503 if (in->cur == NULL) return(-1);
504 if (in->buf->buffer == NULL) return(-1);
505
506 /* Don't grow memory buffers. */
507 if ((in->buf->encoder == NULL) && (in->buf->readcallback == NULL))
508 return(0);
509
510 indx = in->cur - in->base;
511 if (xmlBufUse(in->buf->buffer) > (unsigned int) indx + INPUT_CHUNK) {
512 return(0);
513 }
514 ret = xmlParserInputBufferGrow(in->buf, len);
515
516 in->base = xmlBufContent(in->buf->buffer);
517 if (in->base == NULL) {
518 in->base = BAD_CAST "";
519 in->cur = in->base;
520 in->end = in->base;
521 return(-1);
522 }
523 in->cur = in->base + indx;
524 in->end = xmlBufEnd(in->buf->buffer);
525
526 return(ret);
527}
528
529/**
530 * xmlParserShrink:

Callers

nothing calls this directly

Calls 4

xmlBufUseFunction · 0.85
xmlParserInputBufferGrowFunction · 0.85
xmlBufContentFunction · 0.85
xmlBufEndFunction · 0.85

Tested by

no test coverage detected