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

Function xmlCharEncInFunc

ThirdParty/libxml2/vtklibxml2/encoding.c:2385–2415  ·  view source on GitHub ↗

* xmlCharEncInFunc: * @handler: char encoding transformation data structure * @out: an xmlBuffer for the output. * @in: an xmlBuffer for the input * * Generic front-end for the encoding handler input function * * Returns the number of bytes written or an XML_ENC_ERR code. */

Source from the content-addressed store, hash-verified

2383 * Returns the number of bytes written or an XML_ENC_ERR code.
2384 */
2385int
2386xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out,
2387 xmlBufferPtr in)
2388{
2389 int ret;
2390 int written;
2391 int toconv;
2392
2393 if (handler == NULL)
2394 return(XML_ENC_ERR_INTERNAL);
2395 if (out == NULL)
2396 return(XML_ENC_ERR_INTERNAL);
2397 if (in == NULL)
2398 return(XML_ENC_ERR_INTERNAL);
2399
2400 toconv = in->use;
2401 if (toconv == 0)
2402 return (0);
2403 written = out->size - out->use -1; /* count '\0' */
2404 if (toconv * 2 >= written) {
2405 xmlBufferGrow(out, out->size + toconv * 2);
2406 written = out->size - out->use - 1;
2407 }
2408 ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
2409 in->content, &toconv);
2410 xmlBufferShrink(in, toconv);
2411 out->use += written;
2412 out->content[out->use] = 0;
2413
2414 return (written? written : ret);
2415}
2416
2417#ifdef LIBXML_OUTPUT_ENABLED
2418/**

Callers 2

xmlCharEncFirstLineFunction · 0.85
launchTestsFunction · 0.85

Calls 3

xmlBufferGrowFunction · 0.85
xmlEncInputChunkFunction · 0.85
xmlBufferShrinkFunction · 0.85

Tested by 1

launchTestsFunction · 0.68