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

Function xmlEncInputChunk

ThirdParty/libxml2/vtklibxml2/encoding.c:2179–2223  ·  view source on GitHub ↗

* xmlEncInputChunk: * @handler: encoding handler * @out: a pointer to an array of bytes to store the result * @outlen: the length of @out * @in: a pointer to an array of input bytes * @inlen: the length of @in * * The value of @inlen after return is the number of octets consumed * as the return value is 0, else unpredictable. * The value of @outlen after return is the number of o

Source from the content-addressed store, hash-verified

2177 * Returns an XML_ENC_ERR code.
2178 */
2179int
2180xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
2181 int *outlen, const unsigned char *in, int *inlen) {
2182 int ret;
2183
2184 if (handler->input != NULL) {
2185 int oldinlen = *inlen;
2186
2187 ret = handler->input(out, outlen, in, inlen);
2188 if (ret >= 0) {
2189 /*
2190 * The built-in converters don't signal XML_ENC_ERR_SPACE.
2191 */
2192 if (*inlen < oldinlen) {
2193 if (*outlen > 0)
2194 ret = XML_ENC_ERR_SPACE;
2195 else
2196 ret = XML_ENC_ERR_PARTIAL;
2197 } else {
2198 ret = XML_ENC_ERR_SUCCESS;
2199 }
2200 }
2201 }
2202#ifdef LIBXML_ICONV_ENABLED
2203 else if (handler->iconv_in != NULL) {
2204 ret = xmlIconvWrapper(handler->iconv_in, out, outlen, in, inlen);
2205 }
2206#endif /* LIBXML_ICONV_ENABLED */
2207#ifdef LIBXML_ICU_ENABLED
2208 else if (handler->uconv_in != NULL) {
2209 ret = xmlUconvWrapper(handler->uconv_in, 1, out, outlen, in, inlen);
2210 }
2211#endif /* LIBXML_ICU_ENABLED */
2212 else {
2213 *outlen = 0;
2214 *inlen = 0;
2215 ret = XML_ENC_ERR_INTERNAL;
2216 }
2217
2218 /* Ignore partial errors when reading. */
2219 if (ret == XML_ENC_ERR_PARTIAL)
2220 ret = XML_ENC_ERR_SUCCESS;
2221
2222 return(ret);
2223}
2224
2225/**
2226 * xmlEncOutputChunk:

Callers 3

xmlDetectEBCDICFunction · 0.85
xmlCharEncInputFunction · 0.85
xmlCharEncInFuncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected