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

Function xmlParserInputBufferPush

ThirdParty/libxml2/vtklibxml2/xmlIO.c:2274–2314  ·  view source on GitHub ↗

* xmlParserInputBufferPush: * @in: a buffered parser input * @len: the size in bytes of the array. * @buf: an char array * * Push the content of the arry in the input buffer * This routine handle the I18N transcoding to internal UTF-8 * This is used when operating the parser in progressive (push) mode. * * Returns the number of chars read and stored in the buffer, or -1 * in c

Source from the content-addressed store, hash-verified

2272 * in case of error.
2273 */
2274int
2275xmlParserInputBufferPush(xmlParserInputBufferPtr in,
2276 int len, const char *buf) {
2277 int nbchars = 0;
2278 int ret;
2279
2280 if (len < 0) return(0);
2281 if ((in == NULL) || (in->error)) return(-1);
2282 if (in->encoder != NULL) {
2283 /*
2284 * Store the data in the incoming raw buffer
2285 */
2286 if (in->raw == NULL) {
2287 in->raw = xmlBufCreate();
2288 if (in->raw == NULL) {
2289 in->error = XML_ERR_NO_MEMORY;
2290 return(-1);
2291 }
2292 }
2293 ret = xmlBufAdd(in->raw, (const xmlChar *) buf, len);
2294 if (ret != 0) {
2295 in->error = XML_ERR_NO_MEMORY;
2296 return(-1);
2297 }
2298
2299 /*
2300 * convert as much as possible to the parser reading buffer.
2301 */
2302 nbchars = xmlCharEncInput(in);
2303 if (nbchars < 0)
2304 return(-1);
2305 } else {
2306 nbchars = len;
2307 ret = xmlBufAdd(in->buffer, (xmlChar *) buf, nbchars);
2308 if (ret != 0) {
2309 in->error = XML_ERR_NO_MEMORY;
2310 return(-1);
2311 }
2312 }
2313 return(nbchars);
2314}
2315
2316/**
2317 * endOfInput:

Callers 3

htmlParseChunkFunction · 0.85
xmlNewInputPushFunction · 0.85
xmlParseChunkFunction · 0.85

Calls 3

xmlBufCreateFunction · 0.85
xmlBufAddFunction · 0.85
xmlCharEncInputFunction · 0.85

Tested by

no test coverage detected