1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-27 18:50:07 +03:00

include: Change some return types from int to enum

This also affects some new functions from 2.13.
This commit is contained in:
Nick Wellnhofer 2025-03-14 00:01:11 +01:00
parent fd1b939168
commit b349225952
21 changed files with 172 additions and 165 deletions

View File

@ -337,7 +337,7 @@ htmlIsBooleanAttr(const xmlChar *name)
* *
************************************************************************/
static int
static xmlParserErrors
htmlFindOutputEncoder(const char *encoding, xmlCharEncodingHandler **out) {
/*
* Fallback to HTML if the encoding is unspecified

4
buf.c
View File

@ -1092,7 +1092,7 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
* Add a string range to an XML buffer. if len == -1, the length of
* str is recomputed.
*
* Returns a xmlParserError code.
* Returns a xmlParserErrors code.
*/
int
xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
@ -1124,7 +1124,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
* Add a string range to the beginning of an XML buffer.
* if len == -1, the length of @str is recomputed.
*
* Returns a xmlParserError code.
* Returns a xmlParserErrors code.
*/
int
xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {

View File

@ -7764,14 +7764,14 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlBufferAdd' file='tree' module='buf'>
<info>Add a string range to an XML buffer. if len == -1, the length of str is recomputed.</info>
<return type='int' info='a xmlParserError code.'/>
<return type='int' info='a xmlParserErrors code.'/>
<arg name='buf' type='xmlBufferPtr' info='the buffer to dump'/>
<arg name='str' type='const xmlChar *' info='the #xmlChar string'/>
<arg name='len' type='int' info='the number of #xmlChar to add'/>
</function>
<function name='xmlBufferAddHead' file='tree' module='buf'>
<info>Add a string range to the beginning of an XML buffer. if len == -1, the length of @str is recomputed.</info>
<return type='int' info='a xmlParserError code.'/>
<return type='int' info='a xmlParserErrors code.'/>
<arg name='buf' type='xmlBufferPtr' info='the buffer'/>
<arg name='str' type='const xmlChar *' info='the #xmlChar string'/>
<arg name='len' type='int' info='the number of #xmlChar to add'/>
@ -8110,7 +8110,7 @@ crash if you try to modify the tree)'/>
</functype>
<functype name='xmlCharEncConvFunc' file='encoding' module='encoding'>
<info>Convert between character encodings. The value of @inlen after return is the number of bytes consumed and @outlen is the number of bytes produced. If the converter can consume partial multi-byte sequences, the @flush flag can be used to detect truncated sequences at EOF. Otherwise, the flag can be ignored.</info>
<return type='int' info='a non-negative number on success or an XML_ENC_ERR code.'/>
<return type='xmlCharEncError' info='an XML_ENC_ERR code.'/>
<arg name='vctxt' type='void *' info='conversion context'/>
<arg name='out' type='unsigned char *' info='a pointer to an array of bytes to store the result'/>
<arg name='outlen' type='int *' info='the length of @out'/>
@ -8120,7 +8120,7 @@ crash if you try to modify the tree)'/>
</functype>
<functype name='xmlCharEncConvImpl' file='encoding' module='encoding'>
<info>If this function returns XML_ERR_OK, it must fill the @out pointer with an encoding handler. The handler can be obtained from xmlCharEncNewCustomHandler. @flags can contain XML_ENC_INPUT, XML_ENC_OUTPUT or both.</info>
<return type='int' info='an xmlParserErrors code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='vctxt' type='void *' info='user data'/>
<arg name='name' type='const char *' info='encoding name'/>
<arg name='flags' type='xmlCharEncFlags' info='bit mask of flags'/>
@ -8142,7 +8142,7 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlCharEncNewCustomHandler' file='encoding' module='encoding'>
<info>Create a custom xmlCharEncodingHandler.</info>
<return type='int' info='an xmlParserError code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='name' type='const char *' info='the encoding name'/>
<arg name='input' type='xmlCharEncConvFunc' info='input callback which converts to UTF-8'/>
<arg name='output' type='xmlCharEncConvFunc' info='output callback which converts from UTF-8'/>
@ -8371,7 +8371,7 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlCreateCharEncodingHandler' file='encoding' module='encoding'>
<info>Find or create a handler matching the encoding. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - Custom implementation if provided - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with xmlCharEncCloseFunc. If the encoding is UTF-8, a NULL handler and no error code will be returned. @flags can contain XML_ENC_INPUT, XML_ENC_OUTPUT or both. Available since 2.14.0.</info>
<return type='int' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<return type='xmlParserErrors' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<arg name='name' type='const char *' info='a string describing the char encoding.'/>
<arg name='flags' type='xmlCharEncFlags' info='bit mask of flags'/>
<arg name='impl' type='xmlCharEncConvImpl' info='a conversion implementation (optional)'/>
@ -9865,7 +9865,7 @@ crash if you try to modify the tree)'/>
</functype>
<function name='xmlInputSetEncodingHandler' file='parser' module='parserInternals'>
<info>Use encoding handler to decode input data. Closes the handler on error.</info>
<return type='int' info='an xmlParserErrors code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='input' type='xmlParserInputPtr' info='the input stream'/>
<arg name='handler' type='xmlCharEncodingHandlerPtr' info='the encoding handler'/>
</function>
@ -10168,7 +10168,7 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlLookupCharEncodingHandler' file='encoding' module='encoding'>
<info>Find or create a handler matching the encoding. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with xmlCharEncCloseFunc. If the encoding is UTF-8, a NULL handler and no error code will be returned. Available since 2.13.0.</info>
<return type='int' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<return type='xmlParserErrors' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<arg name='enc' type='xmlCharEncoding' info='an xmlCharEncoding value.'/>
<arg name='out' type='xmlCharEncodingHandler **' info='pointer to result'/>
</function>
@ -10619,7 +10619,7 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlNewInputFromUrl' file='parser' module='parserInternals'>
<info>Create a new input stream based on a file or a URL. The flag XML_INPUT_UNZIP allows decompression. The flag XML_INPUT_NETWORK allows network access. The following resource loaders will be called if they were registered (in order of precedence): - the per-thread xmlParserInputBufferCreateFilenameFunc set with xmlParserInputBufferCreateFilenameDefault (deprecated) - the default loader which will return - the result from a matching global input callback set with xmlRegisterInputCallbacks (deprecated) - a HTTP resource if support is compiled in. - a file opened from the filesystem, with automatic detection of compressed files if support is compiled in. Available since 2.14.0.</info>
<return type='int' info='an xmlParserErrors code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='filename' type='const char *' info='the filename to use as entity'/>
<arg name='flags' type='xmlParserInputFlags' info='XML_INPUT flags'/>
<arg name='out' type='xmlParserInputPtr *' info='pointer to new parser input'/>
@ -10947,7 +10947,7 @@ crash if you try to modify the tree)'/>
</function>
<function name='xmlOpenCharEncodingHandler' file='encoding' module='encoding'>
<info>Find or create a handler matching the encoding. The following converters are looked up in order: - Built-in handler (UTF-8, UTF-16, ISO-8859-1, ASCII) - User-registered global handler (deprecated) - iconv if enabled - ICU if enabled The handler must be closed with xmlCharEncCloseFunc. If the encoding is UTF-8, a NULL handler and no error code will be returned. Available since 2.13.0.</info>
<return type='int' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<return type='xmlParserErrors' info='XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another xmlParserErrors error code.'/>
<arg name='name' type='const char *' info='a string describing the char encoding.'/>
<arg name='output' type='int' info='boolean, use handler for output'/>
<arg name='out' type='xmlCharEncodingHandler **' info='pointer to result'/>
@ -12275,7 +12275,7 @@ crash if you try to modify the tree)'/>
</function>
<functype name='xmlResourceLoader' file='parser' module='parser'>
<info>Callback for custom resource loaders. @flags can contain XML_INPUT_UNZIP and XML_INPUT_NETWORK. On success, @out should be set to a new parser input object and XML_ERR_OK should be returned.</info>
<return type='int' info='an xmlParserError code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='ctxt' type='void *' info='parser context'/>
<arg name='url' type='const char *' info='URL to load'/>
<arg name='publicId' type='const char *' info='publid ID from DTD (optional)'/>
@ -12628,7 +12628,7 @@ crash if you try to modify the tree)'/>
<function name='xmlSaveFinish' file='xmlsave' module='xmlsave'>
<cond>defined(LIBXML_OUTPUT_ENABLED)</cond>
<info>Close a document saving context, i.e. make sure that all bytes have been output and free the associated data. Available since 2.13.0.</info>
<return type='int' info='an xmlParserErrors code.'/>
<return type='xmlParserErrors' info='an xmlParserErrors code.'/>
<arg name='ctxt' type='xmlSaveCtxtPtr' info='a document saving context'/>
</function>
<function name='xmlSaveFlush' file='xmlsave' module='xmlsave'>

View File

@ -112,34 +112,34 @@ static const xmlEncTableEntry xmlEncTable[] = {
{ "UTF8", XML_CHAR_ENCODING_UTF8 }
};
static int
static xmlCharEncError
asciiToAscii(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF8ToUTF8(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* inb, int *inlenb, int flush);
static int
static xmlCharEncError
latin1ToUTF8(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF16LEToUTF8(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* inb, int *inlenb, int flush);
static int
static xmlCharEncError
UTF16BEToUTF8(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* inb, int *inlenb, int flush);
#ifdef LIBXML_OUTPUT_ENABLED
static int
static xmlCharEncError
UTF8ToLatin1(void *vctxt, unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF8ToUTF16(void *vctxt, unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF8ToUTF16LE(void *vctxt, unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF8ToUTF16BE(void *vctxt, unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen, int flush);
@ -153,7 +153,7 @@ UTF8ToUTF16BE(void *vctxt, unsigned char* outb, int *outlen,
#endif /* LIBXML_OUTPUT_ENABLED */
#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTML_ENABLED)
static int
static xmlCharEncError
UTF8ToHtmlWrapper(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush);
#else
@ -165,10 +165,10 @@ UTF8ToHtmlWrapper(void *vctxt, unsigned char *out, int *outlen,
#include "iso8859x.inc"
static int
static xmlCharEncError
ISO8859xToUTF8(void *vctxt, unsigned char* out, int *outlen,
const unsigned char* in, int *inlen, int flush);
static int
static xmlCharEncError
UTF8ToISO8859x(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush);
@ -238,13 +238,13 @@ static xmlCharEncodingHandlerPtr *globalHandlers = NULL;
static int nbCharEncodingHandler = 0;
#ifdef LIBXML_ICONV_ENABLED
static int
static xmlParserErrors
xmlCharEncIconv(const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out);
#endif
#ifdef LIBXML_ICU_ENABLED
static int
static xmlParserErrors
xmlCharEncUconv(const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out);
#endif
@ -655,9 +655,9 @@ xmlNewCharEncodingHandler(const char *name,
*
* Create a custom xmlCharEncodingHandler.
*
* Returns an xmlParserError code.
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlCharEncNewCustomHandler(const char *name,
xmlCharEncConvFunc input, xmlCharEncConvFunc output,
xmlCharEncConvCtxtDtor ctxtDtor,
@ -805,7 +805,7 @@ free_handler:
*
* Returns an xmlParserErrors error code.
*/
static int
static xmlParserErrors
xmlFindExtraHandler(const char *norig, const char *name, xmlCharEncFlags flags,
xmlCharEncConvImpl impl, void *implCtxt,
xmlCharEncodingHandler **out) {
@ -886,7 +886,7 @@ xmlFindExtraHandler(const char *norig, const char *name, xmlCharEncFlags flags,
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlParserErrors
xmlLookupCharEncodingHandler(xmlCharEncoding enc,
xmlCharEncodingHandler **out) {
const xmlCharEncodingHandler *handler;
@ -969,7 +969,7 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlParserErrors
xmlCreateCharEncodingHandler(const char *name, xmlCharEncFlags flags,
xmlCharEncConvImpl impl, void *implCtxt,
xmlCharEncodingHandler **out) {
@ -1031,7 +1031,7 @@ xmlCreateCharEncodingHandler(const char *name, xmlCharEncFlags flags,
* Returns XML_ERR_OK, XML_ERR_UNSUPPORTED_ENCODING or another
* xmlParserErrors error code.
*/
int
xmlParserErrors
xmlOpenCharEncodingHandler(const char *name, int output,
xmlCharEncodingHandler **out) {
xmlCharEncFlags flags = output ? XML_ENC_OUTPUT : XML_ENC_INPUT;
@ -1094,13 +1094,13 @@ typedef struct {
* @inlen: the length of @in
* @flush: end of input
*
* Returns an XML_ENC_ERR code.
*
* The value of @inlen after return is the number of octets consumed
* as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of octets produced.
*
* Returns an XML_ENC_ERR code.
*/
static int
static xmlCharEncError
xmlIconvConvert(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
int flush ATTRIBUTE_UNUSED) {
@ -1185,14 +1185,14 @@ xmlEncodingMatch(const char *name1, const char *name2) {
}
#endif /* FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
static int
static xmlParserErrors
xmlCharEncIconv(const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out) {
xmlCharEncConvFunc inFunc = NULL, outFunc = NULL;
xmlIconvCtxt *inputCtxt = NULL, *outputCtxt = NULL;
iconv_t icv_in;
iconv_t icv_out;
int ret;
xmlParserErrors ret;
/*
* POSIX allows "indicator suffixes" like "//IGNORE" to be
@ -1334,7 +1334,7 @@ struct _uconv_t {
* as the return value is positive, else unpredictable.
* The value of @outlen after return is the number of octets produced.
*/
static int
static xmlCharEncError
xmlUconvConvert(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush) {
xmlUconvCtxt *cd = vctxt;
@ -1406,7 +1406,7 @@ xmlUconvConvert(void *vctxt, unsigned char *out, int *outlen,
return(ret);
}
static int
static xmlParserErrors
openIcuConverter(const char* name, int isInput, xmlUconvCtxt **out)
{
UErrorCode status;
@ -1445,7 +1445,7 @@ openIcuConverter(const char* name, int isInput, xmlUconvCtxt **out)
goto error;
*out = conv;
return(0);
return(XML_ERR_OK);
error:
if (conv->uconv)
@ -1474,7 +1474,7 @@ xmlUconvFree(void *vctxt) {
closeIcuConverter(vctxt);
}
static int
static xmlParserErrors
xmlCharEncUconv(const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out) {
xmlCharEncConvFunc inFunc = NULL, outFunc = NULL;
@ -1520,9 +1520,9 @@ error:
*
* Convert XML_ENC_ERR to libxml2 error codes.
*/
static int
xmlEncConvertError(int code) {
int ret;
static xmlParserErrors
xmlEncConvertError(xmlCharEncError code) {
xmlParserErrors ret;
switch (code) {
case XML_ENC_ERR_SUCCESS:
@ -1557,11 +1557,11 @@ xmlEncConvertError(int code) {
*
* Returns an XML_ENC_ERR code.
*/
int
xmlCharEncError
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen,
int flush) {
int ret;
xmlCharEncError ret;
if (handler->flags & XML_HANDLER_LEGACY) {
xmlCharEncodingInputFunc func = handler->input.legacyFunc;
@ -1613,10 +1613,10 @@ xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
* as the return value is 0, else unpredictable.
* The value of @outlen after return is the number of octets produced.
*/
static int
static xmlCharEncError
xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen) {
int ret;
xmlCharEncError ret;
if (handler->flags & XML_HANDLER_LEGACY) {
xmlCharEncodingOutputFunc func = handler->output.legacyFunc;
@ -1675,7 +1675,7 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
*
* Returns an XML_ENC_ERR code.
*/
int
xmlCharEncError
xmlCharEncInput(xmlParserInputBufferPtr input, size_t *sizeOut, int flush)
{
xmlBufPtr out, in;
@ -1683,7 +1683,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input, size_t *sizeOut, int flush)
size_t availIn;
size_t maxOut;
size_t totalIn, totalOut;
int ret;
xmlCharEncError ret;
out = input->buffer;
in = input->raw;
@ -1763,7 +1763,7 @@ xmlCharEncInput(xmlParserInputBufferPtr input, size_t *sizeOut, int flush)
input->rawconsumed += totalIn;
*sizeOut = totalOut;
return(XML_ERR_OK);
return(XML_ENC_ERR_SUCCESS);
}
/**
@ -2126,7 +2126,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) {
* *
************************************************************************/
static int
static xmlCharEncError
asciiToAscii(void *vctxt ATTRIBUTE_UNUSED,
unsigned char* out, int *poutlen,
const unsigned char* in, int *pinlen,
@ -2171,7 +2171,7 @@ asciiToAscii(void *vctxt ATTRIBUTE_UNUSED,
return(ret);
}
static int
static xmlCharEncError
latin1ToUTF8(void *vctxt ATTRIBUTE_UNUSED,
unsigned char* out, int *outlen,
const unsigned char* in, int *inlen,
@ -2236,7 +2236,7 @@ xmlIsolat1ToUTF8(unsigned char* out, int *outlen,
/* flush */ 0));
}
static int
static xmlCharEncError
UTF8ToUTF8(void *vctxt ATTRIBUTE_UNUSED,
unsigned char* out, int *outlen,
const unsigned char* in, int *inlen,
@ -2267,7 +2267,7 @@ UTF8ToUTF8(void *vctxt ATTRIBUTE_UNUSED,
#ifdef LIBXML_OUTPUT_ENABLED
static int
static xmlCharEncError
UTF8ToLatin1(void *vctxt ATTRIBUTE_UNUSED,
unsigned char* out, int *outlen,
const unsigned char* in, int *inlen,
@ -2346,7 +2346,7 @@ xmlUTF8ToIsolat1(unsigned char* out, int *outlen,
}
#endif /* LIBXML_OUTPUT_ENABLED */
static int
static xmlCharEncError
UTF16LEToUTF8(void *vctxt ATTRIBUTE_UNUSED,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2416,7 +2416,7 @@ done:
}
#ifdef LIBXML_OUTPUT_ENABLED
static int
static xmlCharEncError
UTF8ToUTF16LE(void *vctxt ATTRIBUTE_UNUSED,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2519,7 +2519,7 @@ done:
return(ret);
}
static int
static xmlCharEncError
UTF8ToUTF16(void *vctxt,
unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen,
@ -2543,7 +2543,7 @@ UTF8ToUTF16(void *vctxt,
}
#endif /* LIBXML_OUTPUT_ENABLED */
static int
static xmlCharEncError
UTF16BEToUTF8(void *vctxt ATTRIBUTE_UNUSED,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2613,7 +2613,7 @@ done:
}
#ifdef LIBXML_OUTPUT_ENABLED
static int
static xmlCharEncError
UTF8ToUTF16BE(void *vctxt ATTRIBUTE_UNUSED,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2717,7 +2717,7 @@ done:
#endif /* LIBXML_OUTPUT_ENABLED */
#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTML_ENABLED)
static int
static xmlCharEncError
UTF8ToHtmlWrapper(void *vctxt ATTRIBUTE_UNUSED,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2729,7 +2729,7 @@ UTF8ToHtmlWrapper(void *vctxt ATTRIBUTE_UNUSED,
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) && \
defined(LIBXML_ISO8859X_ENABLED)
static int
static xmlCharEncError
UTF8ToISO8859x(void *vctxt,
unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
@ -2811,7 +2811,7 @@ done:
return(ret);
}
static int
static xmlCharEncError
ISO8859xToUTF8(void *vctxt,
unsigned char* out, int *outlen,
const unsigned char* in, int *inlen,

View File

@ -30,7 +30,7 @@ typedef struct {
UChar pivot_buf[ICU_PIVOT_BUF_SIZE];
} myConvCtxt;
static int
static xmlCharEncError
icuConvert(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush) {
myConvCtxt *cd = vctxt;
@ -102,7 +102,7 @@ icuConvert(void *vctxt, unsigned char *out, int *outlen,
return ret;
}
static int
static xmlParserErrors
icuOpen(const char* name, int isInput, myConvCtxt **out)
{
UErrorCode status;
@ -170,13 +170,13 @@ icuConvCtxtDtor(void *vctxt) {
icuClose(vctxt);
}
static int
static xmlParserErrors
icuConvImpl(void *vctxt, const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **result) {
xmlCharEncConvFunc inFunc = NULL, outFunc = NULL;
myConvCtxt *inputCtxt = NULL;
myConvCtxt *outputCtxt = NULL;
int ret;
xmlParserErrors ret;
if (flags & XML_ENC_INPUT) {
ret = icuOpen(name, 1, &inputCtxt);

View File

@ -457,7 +457,7 @@ xmlFuzzSecondaryEntity(size_t *size) {
*
* The resource loader for fuzz data.
*/
int
xmlParserErrors
xmlFuzzResourceLoader(void *data ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED,

View File

@ -135,7 +135,7 @@ xmlFuzzSecondaryUrl(void);
const char *
xmlFuzzSecondaryEntity(size_t *size);
int
xmlParserErrors
xmlFuzzResourceLoader(void *data, const char *URL, const char *ID,
xmlResourceType type, xmlParserInputFlags flags,
xmlParserInputPtr *out);

View File

@ -54,7 +54,7 @@ static struct {
* A custom resource loader that writes all external DTDs or entities to a
* single file in the format expected by xmlFuzzResourceLoader.
*/
static int
static xmlParserErrors
fuzzResourceRecorder(void *data ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED,

View File

@ -23,6 +23,7 @@
#define __XML_CHAR_ENCODING_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#ifdef __cplusplus
extern "C" {
@ -142,9 +143,9 @@ typedef int (*xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
* @flush flag can be used to detect truncated sequences at EOF.
* Otherwise, the flag can be ignored.
*
* Returns a non-negative number on success or an XML_ENC_ERR code.
* Returns an XML_ENC_ERR code.
*/
typedef int
typedef xmlCharEncError
(*xmlCharEncConvFunc)(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush);
@ -195,7 +196,7 @@ struct _xmlCharEncodingHandler {
*
* Returns an xmlParserErrors code.
*/
typedef int
typedef xmlParserErrors
(*xmlCharEncConvImpl)(void *vctxt, const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out);
@ -210,14 +211,14 @@ XMLPUBFUN void
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlLookupCharEncodingHandler (xmlCharEncoding enc,
xmlCharEncodingHandlerPtr *out);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlOpenCharEncodingHandler (const char *name,
int output,
xmlCharEncodingHandlerPtr *out);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlCreateCharEncodingHandler (const char *name,
xmlCharEncFlags flags,
xmlCharEncConvImpl impl,
@ -231,7 +232,7 @@ XMLPUBFUN xmlCharEncodingHandlerPtr
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlCharEncNewCustomHandler (const char *name,
xmlCharEncConvFunc input,
xmlCharEncConvFunc output,

View File

@ -218,9 +218,9 @@ typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
* On success, @out should be set to a new parser input object and
* XML_ERR_OK should be returned.
*
* Returns an xmlParserError code.
* Returns an xmlParserErrors code.
*/
typedef int
typedef xmlParserErrors
(*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
xmlResourceType type, xmlParserInputFlags flags,
xmlParserInputPtr *out);
@ -1555,7 +1555,7 @@ XMLPUBFUN xmlDocPtr
* New input API
*/
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags,
xmlParserInputPtr *out);
XMLPUBFUN xmlParserInputPtr
@ -1570,7 +1570,7 @@ XMLPUBFUN xmlParserInputPtr
xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, void *ioCtxt,
xmlParserInputFlags flags);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlInputSetEncodingHandler(xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);

View File

@ -77,7 +77,7 @@ XMLPUBFUN int
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int
xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int
XMLPUBFUN xmlParserErrors
xmlSaveFinish (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int
xmlSaveSetIndentString (xmlSaveCtxtPtr ctxt,

View File

@ -7,11 +7,11 @@
XML_HIDDEN void
xmlInitEncodingInternal(void);
XML_HIDDEN int
XML_HIDDEN xmlCharEncError
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen,
int flush);
XML_HIDDEN int
XML_HIDDEN xmlCharEncError
xmlCharEncInput(xmlParserInputBufferPtr input, size_t *sizeOut, int flush);
XML_HIDDEN int
xmlCharEncOutput(xmlOutputBufferPtr output, int init);

View File

@ -21,7 +21,7 @@ xmlInitIOCallbacks(void);
XML_HIDDEN int
xmlNoNetExists(const char *filename);
XML_HIDDEN int
XML_HIDDEN xmlParserErrors
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
xmlParserInputFlags flags,
xmlParserInputBufferPtr *out);
@ -32,7 +32,7 @@ XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferMemory(const void *mem, size_t size,
xmlParserInputFlags flags, xmlCharEncoding enc);
XML_HIDDEN int
XML_HIDDEN xmlParserErrors
xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, xmlParserInputFlags flags);
#ifdef LIBXML_OUTPUT_ENABLED

View File

@ -621,14 +621,14 @@ xmlParserCheckEOF(xmlParserCtxtPtr ctxt, xmlParserErrors code) {
if ((buf != NULL) && (buf->encoder != NULL)) {
size_t curBase = in->cur - in->base;
size_t sizeOut = 64;
int ret;
xmlCharEncError ret;
/*
* Check for truncated multi-byte sequence
*/
ret = xmlCharEncInput(buf, &sizeOut, /* flush */ 1);
xmlBufUpdateInput(buf->buffer, in, curBase);
if (ret < 0) {
if (ret != XML_ENC_ERR_SUCCESS) {
xmlCtxtErrIO(ctxt, buf->error, NULL);
return;
}
@ -1129,12 +1129,14 @@ xmlCtxtSetCharEncConvImpl(xmlParserCtxtPtr ctxt, xmlCharEncConvImpl impl,
ctxt->convCtxt = vctxt;
}
static int
static xmlParserErrors
xmlDetectEBCDIC(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr *hout) {
xmlChar out[200];
xmlParserInputPtr input = ctxt->input;
xmlCharEncodingHandlerPtr handler;
int inlen, outlen, res, i;
int inlen, outlen, i;
xmlParserErrors code;
xmlCharEncError res;
*hout = NULL;
@ -1142,10 +1144,10 @@ xmlDetectEBCDIC(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr *hout) {
* To detect the EBCDIC code page, we convert the first 200 bytes
* to IBM037 (EBCDIC-US) and try to find the encoding declaration.
*/
res = xmlCreateCharEncodingHandler("IBM037", XML_ENC_INPUT,
code = xmlCreateCharEncodingHandler("IBM037", XML_ENC_INPUT,
ctxt->convImpl, ctxt->convCtxt, &handler);
if (res != 0)
return(res);
if (code != XML_ERR_OK)
return(code);
outlen = sizeof(out) - 1;
inlen = input->end - input->cur;
res = xmlEncInputChunk(handler, out, &outlen, input->cur, &inlen,
@ -1187,13 +1189,13 @@ xmlDetectEBCDIC(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr *hout) {
break;
out[i] = 0;
xmlCharEncCloseFunc(handler);
res = xmlCreateCharEncodingHandler((char *) out + start,
code = xmlCreateCharEncodingHandler((char *) out + start,
XML_ENC_INPUT, ctxt->convImpl, ctxt->convCtxt,
&handler);
if (res != 0)
return(res);
if (code != XML_ERR_OK)
return(code);
*hout = handler;
return(0);
return(XML_ERR_OK);
}
}
@ -1202,12 +1204,12 @@ done:
* Encoding handlers are stateful, so we have to recreate them.
*/
xmlCharEncCloseFunc(handler);
res = xmlCreateCharEncodingHandler("IBM037", XML_ENC_INPUT,
code = xmlCreateCharEncodingHandler("IBM037", XML_ENC_INPUT,
ctxt->convImpl, ctxt->convCtxt, &handler);
if (res != 0)
return(res);
if (code != XML_ERR_OK)
return(code);
*hout = handler;
return(0);
return(XML_ERR_OK);
}
/**
@ -1228,14 +1230,14 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
{
xmlCharEncodingHandlerPtr handler = NULL;
int ret;
int res;
xmlParserErrors code;
if ((ctxt == NULL) || (ctxt->input == NULL))
return(-1);
res = xmlLookupCharEncodingHandler(enc, &handler);
if (res != 0) {
xmlFatalErr(ctxt, res, NULL);
code = xmlLookupCharEncodingHandler(enc, &handler);
if (code != 0) {
xmlFatalErr(ctxt, code, NULL);
return(-1);
}
@ -1260,7 +1262,7 @@ static int
xmlSwitchInputEncodingName(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
const char *encoding) {
xmlCharEncodingHandlerPtr handler;
int res;
xmlParserErrors res;
if (encoding == NULL)
return(-1);
@ -1319,12 +1321,12 @@ xmlSwitchEncodingName(xmlParserCtxtPtr ctxt, const char *encoding) {
*
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlInputSetEncodingHandler(xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler) {
xmlParserInputBufferPtr in;
xmlBufPtr buf;
int code = XML_ERR_OK;
xmlParserErrors code = XML_ERR_OK;
if ((input == NULL) || (input->buf == NULL)) {
xmlCharEncCloseFunc(handler);
@ -1377,7 +1379,7 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
if (input->end > input->base) {
size_t processed;
size_t nbchars;
int res;
xmlCharEncError res;
/*
* Shrink the current input buffer.
@ -1399,7 +1401,7 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
else
nbchars = 4000 /* MINLEN */;
res = xmlCharEncInput(in, &nbchars, /* flush */ 0);
if (res < 0)
if (res != XML_ENC_ERR_SUCCESS)
code = in->error;
}
@ -1423,7 +1425,7 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
int
xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler) {
int code = xmlInputSetEncodingHandler(input, handler);
xmlParserErrors code = xmlInputSetEncodingHandler(input, handler);
if (code != XML_ERR_OK) {
xmlCtxtErrIO(ctxt, code, NULL);
@ -1448,7 +1450,7 @@ xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
int
xmlSwitchToEncoding(xmlParserCtxtPtr ctxt, xmlCharEncodingHandlerPtr handler)
{
int code;
xmlParserErrors code;
if (ctxt == NULL)
return(-1);
@ -1579,7 +1581,7 @@ xmlDetectEncoding(xmlParserCtxtPtr ctxt) {
if (enc == XML_CHAR_ENCODING_EBCDIC) {
xmlCharEncodingHandlerPtr handler;
int res;
xmlParserErrors res;
res = xmlDetectEBCDIC(ctxt, &handler);
if (res != XML_ERR_OK) {
@ -1610,7 +1612,7 @@ xmlSetDeclaredEncoding(xmlParserCtxtPtr ctxt, xmlChar *encoding) {
if (((ctxt->input->flags & XML_INPUT_HAS_ENCODING) == 0) &&
((ctxt->options & XML_PARSE_IGNORE_ENC) == 0)) {
xmlCharEncodingHandlerPtr handler;
int res;
xmlParserErrors res;
/*
* xmlSwitchEncodingName treats unsupported encodings as
@ -2018,7 +2020,7 @@ xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags) {
if (buf == NULL)
return(NULL);
if (xmlInputFromFd(buf, fd, flags) < 0) {
if (xmlInputFromFd(buf, fd, flags) != XML_ERR_OK) {
xmlFreeParserInputBuffer(buf);
return(NULL);
}
@ -2367,7 +2369,7 @@ xmlResolveResourceFromCatalog(const char *URL, const char *ID,
#endif
#ifdef LIBXML_HTTP_ENABLED
static int
static xmlParserErrors
xmlCheckHTTPInputInternal(xmlParserInputPtr input) {
const char *encoding;
const char *redir;
@ -2391,7 +2393,7 @@ xmlCheckHTTPInputInternal(xmlParserInputPtr input) {
encoding = xmlNanoHTTPEncoding(input->buf->context);
if (encoding != NULL) {
xmlCharEncodingHandlerPtr handler;
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 0,
&handler);
@ -2478,12 +2480,12 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
*
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlNewInputFromUrl(const char *filename, xmlParserInputFlags flags,
xmlParserInputPtr *out) {
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
int code = XML_ERR_OK;
xmlParserErrors code = XML_ERR_OK;
if (out == NULL)
return(XML_ERR_ARGUMENT);
@ -2534,7 +2536,7 @@ xmlParserInputPtr
xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
xmlParserInputPtr input;
xmlParserInputFlags flags = 0;
int code;
xmlParserErrors code;
if ((ctxt == NULL) || (filename == NULL))
return(NULL);

View File

@ -241,7 +241,7 @@ static int addEntity(char *name, char *content) {
return(0);
}
static int
static xmlParserErrors
testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED,

View File

@ -13222,7 +13222,7 @@ test_xmlInputSetEncodingHandler(void) {
int test_ret = 0;
int mem_base;
int ret_val;
xmlParserErrors ret_val;
xmlParserInputPtr input; /* the input stream */
int n_input;
xmlCharEncodingHandlerPtr handler; /* the encoding handler */
@ -13235,7 +13235,7 @@ test_xmlInputSetEncodingHandler(void) {
handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
ret_val = xmlInputSetEncodingHandler(input, handler);
desret_int(ret_val);
desret_xmlParserErrors(ret_val);
call_tests++;
des_xmlParserInputPtr(n_input, input, 0);
des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
@ -13534,7 +13534,7 @@ test_xmlNewInputFromUrl(void) {
int test_ret = 0;
int mem_base;
int ret_val;
xmlParserErrors ret_val;
const char * filename; /* the filename to use as entity */
int n_filename;
xmlParserInputFlags flags; /* XML_INPUT flags */
@ -13551,7 +13551,7 @@ test_xmlNewInputFromUrl(void) {
out = gen_xmlParserInputPtr_ptr(n_out, 2);
ret_val = xmlNewInputFromUrl(filename, flags, out);
desret_int(ret_val);
desret_xmlParserErrors(ret_val);
call_tests++;
des_filepath(n_filename, filename, 0);
des_xmlParserInputFlags(n_flags, flags, 1);
@ -33991,7 +33991,7 @@ test_xmlSaveFinish(void) {
#if defined(LIBXML_OUTPUT_ENABLED)
int mem_base;
int ret_val;
xmlParserErrors ret_val;
xmlSaveCtxtPtr ctxt; /* a document saving context */
int n_ctxt;
@ -34000,7 +34000,7 @@ test_xmlSaveFinish(void) {
ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
ret_val = xmlSaveFinish(ctxt);
desret_int(ret_val);
desret_xmlParserErrors(ret_val);
call_tests++;
des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
xmlResetLastError();

View File

@ -1030,7 +1030,7 @@ testTruncatedMultiByte(void) {
static int charEncConvImplError;
static int
static xmlCharEncError
rot13Convert(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen,
int flush ATTRIBUTE_UNUSED) {
@ -1063,7 +1063,7 @@ rot13ConvCtxtDtor(void *vctxt) {
xmlFree(vctxt);
}
static int
static xmlParserErrors
rot13ConvImpl(void *vctxt ATTRIBUTE_UNUSED, const char *name,
xmlCharEncFlags flags, xmlCharEncodingHandler **out) {
int *inputCtxt;

View File

@ -1398,18 +1398,20 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
encoding = xmlXIncludeGetProp(ctxt, ref->elem, XINCLUDE_PARSE_ENCODING);
}
if (encoding != NULL) {
res = xmlOpenCharEncodingHandler((const char *) encoding,
/* output */ 0, &handler);
xmlParserErrors code;
if (res != 0) {
if (res == XML_ERR_NO_MEMORY) {
code = xmlOpenCharEncodingHandler((const char *) encoding,
/* output */ 0, &handler);
if (code != XML_ERR_OK) {
if (code == XML_ERR_NO_MEMORY) {
xmlXIncludeErrMemory(ctxt);
} else if (res == XML_ERR_UNSUPPORTED_ENCODING) {
} else if (code == XML_ERR_UNSUPPORTED_ENCODING) {
xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_UNKNOWN_ENCODING,
"encoding %s not supported\n", encoding);
goto error;
} else {
xmlXIncludeErr(ctxt, ref->elem, res,
xmlXIncludeErr(ctxt, ref->elem, code,
"unexpected error from iconv or ICU\n", NULL);
goto error;
}

40
xmlIO.c
View File

@ -122,10 +122,10 @@ static int xmlOutputCallbackNr;
*
* Returns an xmlParserErrors code.
*/
static int
static xmlParserErrors
xmlIOErr(int err)
{
int code;
xmlParserErrors code;
if (err == 0) code = XML_IO_UNKNOWN;
#ifdef EACCES
@ -449,12 +449,12 @@ typedef struct {
*
* Returns an xmlParserErrors code
*/
static int
static xmlParserErrors
xmlFdOpen(const char *filename, int write, int *out) {
char *fromUri = NULL;
int flags;
int fd;
int ret;
xmlParserErrors ret;
*out = -1;
if (filename == NULL)
@ -628,13 +628,13 @@ xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) {
*
* input from FILE *
*
* Returns an I/O context or NULL in case of error
* Returns an xmlParserErrors code
*/
static int
static xmlParserErrors
xmlFileOpenSafe(const char *filename, int write, void **out) {
char *fromUri = NULL;
FILE *fd;
int ret = XML_ERR_OK;
xmlParserErrors ret = XML_ERR_OK;
*out = NULL;
if (filename == NULL)
@ -1046,9 +1046,9 @@ xmlIODefaultMatch(const char *filename ATTRIBUTE_UNUSED) {
* Update the buffer to read from @fd. Supports the XML_INPUT_UNZIP
* flag.
*
* Returns an xmlParserError code.
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlInputFromFd(xmlParserInputBufferPtr buf, int fd,
xmlParserInputFlags flags) {
xmlFdIOCtxt *fdctxt;
@ -1160,10 +1160,10 @@ xmlInputFromFd(xmlParserInputBufferPtr buf, int fd,
*
* Returns an xmlParserErrors code.
*/
static int
static xmlParserErrors
xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename,
xmlParserInputFlags flags) {
int ret;
xmlParserErrors ret;
int fd;
#ifdef LIBXML_HTTP_ENABLED
@ -1205,7 +1205,7 @@ xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename,
*
* Returns an xmlParserErrors code.
*/
static int
static xmlParserErrors
xmlOutputDefaultOpen(xmlOutputBufferPtr buf, const char *filename,
int compression) {
xmlFdIOCtxt *fdctxt;
@ -1290,7 +1290,7 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
return(NULL);
}
if (enc != XML_CHAR_ENCODING_NONE) {
if (xmlLookupCharEncodingHandler(enc, &ret->encoder) != 0) {
if (xmlLookupCharEncodingHandler(enc, &ret->encoder) != XML_ERR_OK) {
/* We can't handle errors properly here. */
xmlFreeParserInputBuffer(ret);
return(NULL);
@ -1454,12 +1454,12 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
*
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
xmlParserInputFlags flags,
xmlParserInputBufferPtr *out) {
xmlParserInputBufferPtr buf;
int ret;
xmlParserErrors ret;
int i;
xmlInitParser();
@ -1534,7 +1534,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr
xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int code;
xmlParserErrors code;
if (xmlParserInputBufferCreateFilenameValue != NULL)
return(xmlParserInputBufferCreateFilenameValue(URI, enc));
@ -1601,7 +1601,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
*/
for (i = xmlOutputCallbackNr - 1; i >= 0; i--) {
xmlOutputCallback *cb = &xmlOutputCallbackTable[i];
int code;
xmlParserErrors code;
if (cb->matchcallback == xmlIODefaultMatch) {
code = xmlOutputDefaultOpen(ret, URI, compression);
@ -2203,7 +2203,8 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
* convert as much as possible to the parser reading buffer.
*/
nbchars = SIZE_MAX;
if (xmlCharEncInput(in, &nbchars, /* flush */ 0) < 0)
if (xmlCharEncInput(in, &nbchars, /* flush */ 0) !=
XML_ENC_ERR_SUCCESS)
return(-1);
if (nbchars > INT_MAX)
nbchars = INT_MAX;
@ -2314,7 +2315,8 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
else
sizeOut = SIZE_MAX;
if (xmlCharEncInput(in, &sizeOut, /* flush */ 0) < 0)
if (xmlCharEncInput(in, &sizeOut, /* flush */ 0) !=
XML_ENC_ERR_SUCCESS)
return(-1);
res = sizeOut;
}

View File

@ -253,12 +253,12 @@ parsePath(xmllintState *lint, const xmlChar *path) {
}
}
static int
static xmlParserErrors
xmllintResourceLoader(void *ctxt, const char *URL,
const char *ID, xmlResourceType type,
xmlParserInputFlags flags, xmlParserInputPtr *out) {
xmllintState *lint = ctxt;
int code;
xmlParserErrors code;
int i;
const char *lastsegment = URL;
const char *iter = URL;

View File

@ -319,7 +319,7 @@ xmlNewSaveCtxt(const char *encoding, int options)
memset(ret, 0, sizeof(xmlSaveCtxt));
if (encoding != NULL) {
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 1,
&ret->handler);
@ -771,7 +771,7 @@ static int xmlSaveSwitchEncoding(xmlSaveCtxtPtr ctxt, const char *encoding) {
if ((encoding != NULL) && (buf->encoder == NULL) && (buf->conv == NULL)) {
xmlCharEncodingHandler *handler;
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 1, &handler);
if (res != XML_ERR_OK) {
@ -2196,7 +2196,7 @@ xmlSaveClose(xmlSaveCtxtPtr ctxt)
*
* Returns an xmlParserErrors code.
*/
int
xmlParserErrors
xmlSaveFinish(xmlSaveCtxtPtr ctxt)
{
int ret;
@ -2549,7 +2549,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
if (txt_encoding == NULL)
txt_encoding = (const char *) out_doc->encoding;
if (txt_encoding != NULL) {
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(txt_encoding, /* output */ 1,
&conv_hdlr);
@ -2671,7 +2671,7 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) {
encoding = (const char *) cur->encoding;
if (encoding != NULL) {
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 1, &handler);
if (res != XML_ERR_OK) {
@ -2817,7 +2817,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
encoding = (const char *) cur->encoding;
if (encoding != NULL) {
int res;
xmlParserErrors res;
res = xmlOpenCharEncodingHandler(encoding, /* output */ 1, &handler);
if (res != XML_ERR_OK)