include: Convert some macros to enums

This commit is contained in:
Nick Wellnhofer 2025-03-13 23:20:16 +01:00
parent 1078dc8233
commit fd1b939168
12 changed files with 134 additions and 97 deletions

View File

@ -527,15 +527,11 @@
<description>Interfaces, constants and types related to the XML parser </description> <description>Interfaces, constants and types related to the XML parser </description>
<author>Daniel Veillard </author> <author>Daniel Veillard </author>
<exports symbol='XML_DEFAULT_VERSION' type='macro'/> <exports symbol='XML_DEFAULT_VERSION' type='macro'/>
<exports symbol='XML_INPUT_BUF_STATIC' type='macro'/>
<exports symbol='XML_INPUT_BUF_ZERO_TERMINATED' type='macro'/>
<exports symbol='XML_INPUT_NETWORK' type='macro'/>
<exports symbol='XML_INPUT_UNZIP' type='macro'/>
<exports symbol='XML_SAX2_MAGIC' type='macro'/> <exports symbol='XML_SAX2_MAGIC' type='macro'/>
<exports symbol='XML_STATUS_CATASTROPHIC_ERROR' type='macro'/> <exports symbol='XML_INPUT_BUF_STATIC' type='enum'/>
<exports symbol='XML_STATUS_DTD_VALIDATION_FAILED' type='macro'/> <exports symbol='XML_INPUT_BUF_ZERO_TERMINATED' type='enum'/>
<exports symbol='XML_STATUS_NOT_NS_WELL_FORMED' type='macro'/> <exports symbol='XML_INPUT_NETWORK' type='enum'/>
<exports symbol='XML_STATUS_NOT_WELL_FORMED' type='macro'/> <exports symbol='XML_INPUT_UNZIP' type='enum'/>
<exports symbol='XML_PARSER_ATTRIBUTE_VALUE' type='enum'/> <exports symbol='XML_PARSER_ATTRIBUTE_VALUE' type='enum'/>
<exports symbol='XML_PARSER_CDATA_SECTION' type='enum'/> <exports symbol='XML_PARSER_CDATA_SECTION' type='enum'/>
<exports symbol='XML_PARSER_COMMENT' type='enum'/> <exports symbol='XML_PARSER_COMMENT' type='enum'/>
@ -595,6 +591,10 @@
<exports symbol='XML_RESOURCE_UNKNOWN' type='enum'/> <exports symbol='XML_RESOURCE_UNKNOWN' type='enum'/>
<exports symbol='XML_RESOURCE_XINCLUDE' type='enum'/> <exports symbol='XML_RESOURCE_XINCLUDE' type='enum'/>
<exports symbol='XML_RESOURCE_XINCLUDE_TEXT' type='enum'/> <exports symbol='XML_RESOURCE_XINCLUDE_TEXT' type='enum'/>
<exports symbol='XML_STATUS_CATASTROPHIC_ERROR' type='enum'/>
<exports symbol='XML_STATUS_DTD_VALIDATION_FAILED' type='enum'/>
<exports symbol='XML_STATUS_NOT_NS_WELL_FORMED' type='enum'/>
<exports symbol='XML_STATUS_NOT_WELL_FORMED' type='enum'/>
<exports symbol='XML_WITH_AUTOMATA' type='enum'/> <exports symbol='XML_WITH_AUTOMATA' type='enum'/>
<exports symbol='XML_WITH_C14N' type='enum'/> <exports symbol='XML_WITH_C14N' type='enum'/>
<exports symbol='XML_WITH_CATALOG' type='enum'/> <exports symbol='XML_WITH_CATALOG' type='enum'/>
@ -632,6 +632,7 @@
<exports symbol='XML_WITH_ZLIB' type='enum'/> <exports symbol='XML_WITH_ZLIB' type='enum'/>
<exports symbol='xmlAttrHashBucket' type='typedef'/> <exports symbol='xmlAttrHashBucket' type='typedef'/>
<exports symbol='xmlFeature' type='typedef'/> <exports symbol='xmlFeature' type='typedef'/>
<exports symbol='xmlParserInputFlags' type='typedef'/>
<exports symbol='xmlParserInputState' type='typedef'/> <exports symbol='xmlParserInputState' type='typedef'/>
<exports symbol='xmlParserMode' type='typedef'/> <exports symbol='xmlParserMode' type='typedef'/>
<exports symbol='xmlParserNodeInfo' type='typedef'/> <exports symbol='xmlParserNodeInfo' type='typedef'/>
@ -640,6 +641,7 @@
<exports symbol='xmlParserNodeInfoSeqPtr' type='typedef'/> <exports symbol='xmlParserNodeInfoSeqPtr' type='typedef'/>
<exports symbol='xmlParserNsData' type='typedef'/> <exports symbol='xmlParserNsData' type='typedef'/>
<exports symbol='xmlParserOption' type='typedef'/> <exports symbol='xmlParserOption' type='typedef'/>
<exports symbol='xmlParserStatus' type='typedef'/>
<exports symbol='xmlResourceType' type='typedef'/> <exports symbol='xmlResourceType' type='typedef'/>
<exports symbol='xmlSAXHandlerV1' type='typedef'/> <exports symbol='xmlSAXHandlerV1' type='typedef'/>
<exports symbol='xmlSAXHandlerV1Ptr' type='typedef'/> <exports symbol='xmlSAXHandlerV1Ptr' type='typedef'/>
@ -3799,14 +3801,6 @@
<macro name='XML_GET_LINE' file='tree'> <macro name='XML_GET_LINE' file='tree'>
<info>Macro to extract the line number of an element node.</info> <info>Macro to extract the line number of an element node.</info>
</macro> </macro>
<macro name='XML_INPUT_BUF_STATIC' file='parser'>
</macro>
<macro name='XML_INPUT_BUF_ZERO_TERMINATED' file='parser'>
</macro>
<macro name='XML_INPUT_NETWORK' file='parser'>
</macro>
<macro name='XML_INPUT_UNZIP' file='parser'>
</macro>
<macro name='XML_LOCAL_NAMESPACE' file='tree'> <macro name='XML_LOCAL_NAMESPACE' file='tree'>
<info>A namespace declaration node.</info> <info>A namespace declaration node.</info>
</macro> </macro>
@ -4077,14 +4071,6 @@
<macro name='XML_SCHEMAS_WILDCARD_COMPLETE' file='schemasInternals'> <macro name='XML_SCHEMAS_WILDCARD_COMPLETE' file='schemasInternals'>
<info>If the wildcard is complete.</info> <info>If the wildcard is complete.</info>
</macro> </macro>
<macro name='XML_STATUS_CATASTROPHIC_ERROR' file='parser'>
</macro>
<macro name='XML_STATUS_DTD_VALIDATION_FAILED' file='parser'>
</macro>
<macro name='XML_STATUS_NOT_NS_WELL_FORMED' file='parser'>
</macro>
<macro name='XML_STATUS_NOT_WELL_FORMED' file='parser'>
</macro>
<macro name='XML_SUBSTITUTE_BOTH' file='parserInternals'> <macro name='XML_SUBSTITUTE_BOTH' file='parserInternals'>
<info>Both general and parameter entities need to be substituted.</info> <info>Both general and parameter entities need to be substituted.</info>
</macro> </macro>
@ -4699,6 +4685,10 @@ and not by parsing an instance'/>
<enum name='XML_I18N_NO_HANDLER' file='xmlerror' value='6001' type='xmlParserErrors' info='6001'/> <enum name='XML_I18N_NO_HANDLER' file='xmlerror' value='6001' type='xmlParserErrors' info='6001'/>
<enum name='XML_I18N_NO_NAME' file='xmlerror' value='6000' type='xmlParserErrors'/> <enum name='XML_I18N_NO_NAME' file='xmlerror' value='6000' type='xmlParserErrors'/>
<enum name='XML_I18N_NO_OUTPUT' file='xmlerror' value='6004' type='xmlParserErrors' info='6004'/> <enum name='XML_I18N_NO_OUTPUT' file='xmlerror' value='6004' type='xmlParserErrors' info='6004'/>
<enum name='XML_INPUT_BUF_STATIC' file='parser' value='2' type='xmlParserInputFlags'/>
<enum name='XML_INPUT_BUF_ZERO_TERMINATED' file='parser' value='4' type='xmlParserInputFlags'/>
<enum name='XML_INPUT_NETWORK' file='parser' value='16' type='xmlParserInputFlags'/>
<enum name='XML_INPUT_UNZIP' file='parser' value='8' type='xmlParserInputFlags'/>
<enum name='XML_INTERNAL_GENERAL_ENTITY' file='entities' value='1' type='xmlEntityType'/> <enum name='XML_INTERNAL_GENERAL_ENTITY' file='entities' value='1' type='xmlEntityType'/>
<enum name='XML_INTERNAL_PARAMETER_ENTITY' file='entities' value='4' type='xmlEntityType'/> <enum name='XML_INTERNAL_PARAMETER_ENTITY' file='entities' value='4' type='xmlEntityType'/>
<enum name='XML_INTERNAL_PREDEFINED_ENTITY' file='entities' value='6' type='xmlEntityType'/> <enum name='XML_INTERNAL_PREDEFINED_ENTITY' file='entities' value='6' type='xmlEntityType'/>
@ -5455,6 +5445,10 @@ crash if you try to modify the tree)'/>
<enum name='XML_SCHEMA_WHITESPACE_PRESERVE' file='xmlschemastypes' value='1' type='xmlSchemaWhitespaceValueType'/> <enum name='XML_SCHEMA_WHITESPACE_PRESERVE' file='xmlschemastypes' value='1' type='xmlSchemaWhitespaceValueType'/>
<enum name='XML_SCHEMA_WHITESPACE_REPLACE' file='xmlschemastypes' value='2' type='xmlSchemaWhitespaceValueType'/> <enum name='XML_SCHEMA_WHITESPACE_REPLACE' file='xmlschemastypes' value='2' type='xmlSchemaWhitespaceValueType'/>
<enum name='XML_SCHEMA_WHITESPACE_UNKNOWN' file='xmlschemastypes' value='0' type='xmlSchemaWhitespaceValueType'/> <enum name='XML_SCHEMA_WHITESPACE_UNKNOWN' file='xmlschemastypes' value='0' type='xmlSchemaWhitespaceValueType'/>
<enum name='XML_STATUS_CATASTROPHIC_ERROR' file='parser' value='8' type='xmlParserStatus'/>
<enum name='XML_STATUS_DTD_VALIDATION_FAILED' file='parser' value='4' type='xmlParserStatus'/>
<enum name='XML_STATUS_NOT_NS_WELL_FORMED' file='parser' value='2' type='xmlParserStatus'/>
<enum name='XML_STATUS_NOT_WELL_FORMED' file='parser' value='1' type='xmlParserStatus'/>
<enum name='XML_TEXTREADER_MODE_CLOSED' file='xmlreader' value='4' type='xmlTextReaderMode'/> <enum name='XML_TEXTREADER_MODE_CLOSED' file='xmlreader' value='4' type='xmlTextReaderMode'/>
<enum name='XML_TEXTREADER_MODE_EOF' file='xmlreader' value='3' type='xmlTextReaderMode'/> <enum name='XML_TEXTREADER_MODE_EOF' file='xmlreader' value='3' type='xmlTextReaderMode'/>
<enum name='XML_TEXTREADER_MODE_ERROR' file='xmlreader' value='2' type='xmlTextReaderMode'/> <enum name='XML_TEXTREADER_MODE_ERROR' file='xmlreader' value='2' type='xmlTextReaderMode'/>
@ -6091,6 +6085,7 @@ crash if you try to modify the tree)'/>
<field name='rawconsumed' type='unsigned long'/> <field name='rawconsumed' type='unsigned long'/>
</struct> </struct>
<typedef name='xmlParserInputBufferPtr' file='tree' type='xmlParserInputBuffer *'/> <typedef name='xmlParserInputBufferPtr' file='tree' type='xmlParserInputBuffer *'/>
<typedef name='xmlParserInputFlags' file='parser' type='enum'/>
<typedef name='xmlParserInputPtr' file='tree' type='xmlParserInput *'/> <typedef name='xmlParserInputPtr' file='tree' type='xmlParserInput *'/>
<typedef name='xmlParserInputState' file='parser' type='enum'/> <typedef name='xmlParserInputState' file='parser' type='enum'/>
<typedef name='xmlParserMode' file='parser' type='enum'/> <typedef name='xmlParserMode' file='parser' type='enum'/>
@ -6112,6 +6107,7 @@ crash if you try to modify the tree)'/>
<typedef name='xmlParserOption' file='parser' type='enum'/> <typedef name='xmlParserOption' file='parser' type='enum'/>
<typedef name='xmlParserProperties' file='xmlreader' type='enum'/> <typedef name='xmlParserProperties' file='xmlreader' type='enum'/>
<typedef name='xmlParserSeverities' file='xmlreader' type='enum'/> <typedef name='xmlParserSeverities' file='xmlreader' type='enum'/>
<typedef name='xmlParserStatus' file='parser' type='enum'/>
<struct name='xmlPattern' file='pattern' type='struct _xmlPattern'/> <struct name='xmlPattern' file='pattern' type='struct _xmlPattern'/>
<typedef name='xmlPatternFlags' file='pattern' type='enum'/> <typedef name='xmlPatternFlags' file='pattern' type='enum'/>
<typedef name='xmlPatternPtr' file='pattern' type='xmlPattern *'/> <typedef name='xmlPatternPtr' file='pattern' type='xmlPattern *'/>
@ -8504,7 +8500,7 @@ crash if you try to modify the tree)'/>
</function> </function>
<function name='xmlCtxtGetStatus' file='parser' module='parserInternals'> <function name='xmlCtxtGetStatus' file='parser' module='parserInternals'>
<info>Get well-formedness and validation status after parsing. Also reports catastrophic errors which are not related to parsing like out-of-memory, I/O or other errors. Available since 2.14.0.</info> <info>Get well-formedness and validation status after parsing. Also reports catastrophic errors which are not related to parsing like out-of-memory, I/O or other errors. Available since 2.14.0.</info>
<return type='int' info='a bitmask of XML_STATUS_* flags ORed together.'/> <return type='xmlParserStatus' info='a bitmask of XML_STATUS_* flags ORed together.'/>
<arg name='ctxt' type='xmlParserCtxt *' info='an XML parser context'/> <arg name='ctxt' type='xmlParserCtxt *' info='an XML parser context'/>
</function> </function>
<function name='xmlCtxtGetValidCtxt' file='parser' module='parserInternals'> <function name='xmlCtxtGetValidCtxt' file='parser' module='parserInternals'>
@ -10589,7 +10585,7 @@ crash if you try to modify the tree)'/>
<return type='xmlParserInputPtr' info='a new parser input or NULL if a memory allocation failed.'/> <return type='xmlParserInputPtr' info='a new parser input or NULL if a memory allocation failed.'/>
<arg name='url' type='const char *' info='base URL (optional)'/> <arg name='url' type='const char *' info='base URL (optional)'/>
<arg name='fd' type='int' info='file descriptor'/> <arg name='fd' type='int' info='file descriptor'/>
<arg name='flags' type='int' info='input flags'/> <arg name='flags' type='xmlParserInputFlags' info='input flags'/>
</function> </function>
<function name='xmlNewInputFromFile' file='parserInternals' module='parserInternals'> <function name='xmlNewInputFromFile' file='parserInternals' module='parserInternals'>
<info>DEPRECATED: Use xmlNewInputFromUrl. Create a new input stream based on a file or an URL.</info> <info>DEPRECATED: Use xmlNewInputFromUrl. Create a new input stream based on a file or an URL.</info>
@ -10604,7 +10600,7 @@ crash if you try to modify the tree)'/>
<arg name='ioRead' type='xmlInputReadCallback' info='read callback'/> <arg name='ioRead' type='xmlInputReadCallback' info='read callback'/>
<arg name='ioClose' type='xmlInputCloseCallback' info='close callback (optional)'/> <arg name='ioClose' type='xmlInputCloseCallback' info='close callback (optional)'/>
<arg name='ioCtxt' type='void *' info='IO context'/> <arg name='ioCtxt' type='void *' info='IO context'/>
<arg name='flags' type='int' info='unused, pass 0'/> <arg name='flags' type='xmlParserInputFlags' info='unused, pass 0'/>
</function> </function>
<function name='xmlNewInputFromMemory' file='parser' module='parserInternals'> <function name='xmlNewInputFromMemory' file='parser' module='parserInternals'>
<info>Creates a new parser input to read from a memory area. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the memory area must stay unchanged until parsing has finished. This can avoid temporary copies. If the XML_INPUT_BUF_ZERO_TERMINATED flag is set, the memory area must contain a zero byte after the buffer at position @size. This can avoid temporary copies. Available since 2.14.0.</info> <info>Creates a new parser input to read from a memory area. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the memory area must stay unchanged until parsing has finished. This can avoid temporary copies. If the XML_INPUT_BUF_ZERO_TERMINATED flag is set, the memory area must contain a zero byte after the buffer at position @size. This can avoid temporary copies. Available since 2.14.0.</info>
@ -10612,20 +10608,20 @@ crash if you try to modify the tree)'/>
<arg name='url' type='const char *' info='base URL (optional)'/> <arg name='url' type='const char *' info='base URL (optional)'/>
<arg name='mem' type='const void *' info='pointer to char array'/> <arg name='mem' type='const void *' info='pointer to char array'/>
<arg name='size' type='size_t' info='size of array'/> <arg name='size' type='size_t' info='size of array'/>
<arg name='flags' type='int' info='optimization hints'/> <arg name='flags' type='xmlParserInputFlags' info='optimization hints'/>
</function> </function>
<function name='xmlNewInputFromString' file='parser' module='parserInternals'> <function name='xmlNewInputFromString' file='parser' module='parserInternals'>
<info>Creates a new parser input to read from a zero-terminated string. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the string must stay unchanged until parsing has finished. This can avoid temporary copies. Available since 2.14.0.</info> <info>Creates a new parser input to read from a zero-terminated string. @url is used as base to resolve external entities and for error reporting. If the XML_INPUT_BUF_STATIC flag is set, the string must stay unchanged until parsing has finished. This can avoid temporary copies. Available since 2.14.0.</info>
<return type='xmlParserInputPtr' info='a new parser input or NULL if a memory allocation failed.'/> <return type='xmlParserInputPtr' info='a new parser input or NULL if a memory allocation failed.'/>
<arg name='url' type='const char *' info='base URL (optional)'/> <arg name='url' type='const char *' info='base URL (optional)'/>
<arg name='str' type='const char *' info='zero-terminated string'/> <arg name='str' type='const char *' info='zero-terminated string'/>
<arg name='flags' type='int' info='optimization hints'/> <arg name='flags' type='xmlParserInputFlags' info='optimization hints'/>
</function> </function>
<function name='xmlNewInputFromUrl' file='parser' module='parserInternals'> <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> <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='int' info='an xmlParserErrors code.'/>
<arg name='filename' type='const char *' info='the filename to use as entity'/> <arg name='filename' type='const char *' info='the filename to use as entity'/>
<arg name='flags' type='int' info='XML_INPUT flags'/> <arg name='flags' type='xmlParserInputFlags' info='XML_INPUT flags'/>
<arg name='out' type='xmlParserInputPtr *' info='pointer to new parser input'/> <arg name='out' type='xmlParserInputPtr *' info='pointer to new parser input'/>
</function> </function>
<function name='xmlNewInputStream' file='parserInternals' module='parserInternals'> <function name='xmlNewInputStream' file='parserInternals' module='parserInternals'>
@ -12284,7 +12280,7 @@ crash if you try to modify the tree)'/>
<arg name='url' type='const char *' info='URL to load'/> <arg name='url' type='const char *' info='URL to load'/>
<arg name='publicId' type='const char *' info='publid ID from DTD (optional)'/> <arg name='publicId' type='const char *' info='publid ID from DTD (optional)'/>
<arg name='type' type='xmlResourceType' info='resource type'/> <arg name='type' type='xmlResourceType' info='resource type'/>
<arg name='flags' type='int' info='flags'/> <arg name='flags' type='xmlParserInputFlags' info='flags'/>
<arg name='out' type='xmlParserInputPtr *' info='result pointer'/> <arg name='out' type='xmlParserInputPtr *' info='result pointer'/>
</functype> </functype>
<function name='xmlSAX2AttributeDecl' file='SAX2' module='SAX2'> <function name='xmlSAX2AttributeDecl' file='SAX2' module='SAX2'>

View File

@ -461,7 +461,8 @@ int
xmlFuzzResourceLoader(void *data ATTRIBUTE_UNUSED, const char *URL, xmlFuzzResourceLoader(void *data ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED, const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED, xmlResourceType type ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED, xmlParserInputPtr *out) { xmlParserInputFlags flags ATTRIBUTE_UNUSED,
xmlParserInputPtr *out) {
xmlParserInputPtr input; xmlParserInputPtr input;
xmlFuzzEntityInfo *entity; xmlFuzzEntityInfo *entity;

View File

@ -137,7 +137,8 @@ xmlFuzzSecondaryEntity(size_t *size);
int int
xmlFuzzResourceLoader(void *data, const char *URL, const char *ID, xmlFuzzResourceLoader(void *data, const char *URL, const char *ID,
xmlResourceType type, int flags, xmlParserInputPtr *out); xmlResourceType type, xmlParserInputFlags flags,
xmlParserInputPtr *out);
char * char *
xmlSlurpFile(const char *path, size_t *size); xmlSlurpFile(const char *path, size_t *size);

View File

@ -57,7 +57,8 @@ static struct {
static int static int
fuzzResourceRecorder(void *data ATTRIBUTE_UNUSED, const char *URL, fuzzResourceRecorder(void *data ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED, const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED, int flags, xmlResourceType type ATTRIBUTE_UNUSED,
xmlParserInputFlags flags,
xmlParserInputPtr *out) { xmlParserInputPtr *out) {
xmlParserInputPtr in; xmlParserInputPtr in;
static const int chunkSize = 16384; static const int chunkSize = 16384;

View File

@ -40,10 +40,12 @@ extern "C" {
*/ */
#define XML_DEFAULT_VERSION "1.0" #define XML_DEFAULT_VERSION "1.0"
#define XML_STATUS_NOT_WELL_FORMED (1 << 0) typedef enum {
#define XML_STATUS_NOT_NS_WELL_FORMED (1 << 1) XML_STATUS_NOT_WELL_FORMED = (1 << 0),
#define XML_STATUS_DTD_VALIDATION_FAILED (1 << 2) XML_STATUS_NOT_NS_WELL_FORMED = (1 << 1),
#define XML_STATUS_CATASTROPHIC_ERROR (1 << 3) XML_STATUS_DTD_VALIDATION_FAILED = (1 << 2),
XML_STATUS_CATASTROPHIC_ERROR = (1 << 3)
} xmlParserStatus;
typedef enum { typedef enum {
XML_RESOURCE_UNKNOWN = 0, XML_RESOURCE_UNKNOWN = 0,
@ -55,6 +57,13 @@ typedef enum {
XML_RESOURCE_XINCLUDE_TEXT XML_RESOURCE_XINCLUDE_TEXT
} xmlResourceType; } xmlResourceType;
typedef enum {
XML_INPUT_BUF_STATIC = (1 << 1),
XML_INPUT_BUF_ZERO_TERMINATED = (1 << 2),
XML_INPUT_UNZIP = (1 << 3),
XML_INPUT_NETWORK = (1 << 4)
} xmlParserInputFlags;
/** /**
* xmlParserInput: * xmlParserInput:
* *
@ -213,7 +222,8 @@ typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
*/ */
typedef int typedef int
(*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId, (*xmlResourceLoader)(void *ctxt, const char *url, const char *publicId,
xmlResourceType type, int flags, xmlParserInputPtr *out); xmlResourceType type, xmlParserInputFlags flags,
xmlParserInputPtr *out);
/** /**
* xmlParserCtxt: * xmlParserCtxt:
@ -1456,7 +1466,7 @@ XMLPUBFUN const xmlChar *
xmlCtxtGetDeclaredEncoding(xmlParserCtxtPtr ctxt); xmlCtxtGetDeclaredEncoding(xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLPUBFUN int
xmlCtxtGetStandalone (xmlParserCtxtPtr ctxt); xmlCtxtGetStandalone (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLPUBFUN xmlParserStatus
xmlCtxtGetStatus (xmlParserCtxtPtr ctxt); xmlCtxtGetStatus (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLPUBFUN void
xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt, xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
@ -1545,23 +1555,21 @@ XMLPUBFUN xmlDocPtr
* New input API * New input API
*/ */
#define XML_INPUT_BUF_STATIC (1 << 1)
#define XML_INPUT_BUF_ZERO_TERMINATED (1 << 2)
#define XML_INPUT_UNZIP (1 << 3)
#define XML_INPUT_NETWORK (1 << 4)
XMLPUBFUN int XMLPUBFUN int
xmlNewInputFromUrl(const char *url, int flags, xmlParserInputPtr *out); xmlNewInputFromUrl(const char *url, xmlParserInputFlags flags,
xmlParserInputPtr *out);
XMLPUBFUN xmlParserInputPtr XMLPUBFUN xmlParserInputPtr
xmlNewInputFromMemory(const char *url, const void *mem, size_t size, xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
int flags); xmlParserInputFlags flags);
XMLPUBFUN xmlParserInputPtr XMLPUBFUN xmlParserInputPtr
xmlNewInputFromString(const char *url, const char *str, int flags); xmlNewInputFromString(const char *url, const char *str,
xmlParserInputFlags flags);
XMLPUBFUN xmlParserInputPtr XMLPUBFUN xmlParserInputPtr
xmlNewInputFromFd(const char *url, int fd, int flags); xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags);
XMLPUBFUN xmlParserInputPtr XMLPUBFUN xmlParserInputPtr
xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead, xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, void *ioCtxt, int flags); xmlInputCloseCallback ioClose, void *ioCtxt,
xmlParserInputFlags flags);
XMLPUBFUN int XMLPUBFUN int
xmlInputSetEncodingHandler(xmlParserInputPtr input, xmlInputSetEncodingHandler(xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler); xmlCharEncodingHandlerPtr handler);

View File

@ -23,16 +23,17 @@ xmlNoNetExists(const char *filename);
XML_HIDDEN int XML_HIDDEN int
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc, xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
int flags, xmlParserInputBufferPtr *out); xmlParserInputFlags flags,
xmlParserInputBufferPtr *out);
XML_HIDDEN xmlParserInputBufferPtr XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferString(const char *str, int flags); xmlNewInputBufferString(const char *str, xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputBufferPtr XML_HIDDEN xmlParserInputBufferPtr
xmlNewInputBufferMemory(const void *mem, size_t size, int flags, xmlNewInputBufferMemory(const void *mem, size_t size,
xmlCharEncoding enc); xmlParserInputFlags flags, xmlCharEncoding enc);
XML_HIDDEN int XML_HIDDEN int
xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, int unzip); xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, xmlParserInputFlags flags);
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
XML_HIDDEN void XML_HIDDEN void

View File

@ -21,6 +21,9 @@
*/ */
#define XML_VCTXT_USE_PCTXT (1u << 1) #define XML_VCTXT_USE_PCTXT (1u << 1)
/*
* TODO: Rename to avoid confusion with xmlParserInputFlags
*/
#define XML_INPUT_HAS_ENCODING (1u << 0) #define XML_INPUT_HAS_ENCODING (1u << 0)
#define XML_INPUT_AUTO_ENCODING (7u << 1) #define XML_INPUT_AUTO_ENCODING (7u << 1)
#define XML_INPUT_AUTO_UTF8 (1u << 1) #define XML_INPUT_AUTO_UTF8 (1u << 1)
@ -116,23 +119,26 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
xmlResourceType type); xmlResourceType type);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url,
const char *publicId, const char *encoding, int flags); const char *publicId, const char *encoding,
xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size, const void *mem, size_t size,
const char *encoding, int flags); const char *encoding,
xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags); const char *str, const char *encoding,
xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *filename, int fd, xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *filename, int fd,
const char *encoding, int flags); const char *encoding, xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, xmlInputCloseCallback ioClose,
void *ioCtxt, void *ioCtxt,
const char *encoding, int flags); const char *encoding, xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr XML_HIDDEN xmlParserInputPtr
xmlNewPushInput(const char *url, const char *chunk, int size); xmlNewPushInput(const char *url, const char *chunk, int size);

View File

@ -443,9 +443,9 @@ xmlCtxtErr(xmlParserCtxtPtr ctxt, xmlNodePtr node, xmlErrorDomain domain,
* *
* Returns a bitmask of XML_STATUS_* flags ORed together. * Returns a bitmask of XML_STATUS_* flags ORed together.
*/ */
int xmlParserStatus
xmlCtxtGetStatus(xmlParserCtxt *ctxt) { xmlCtxtGetStatus(xmlParserCtxt *ctxt) {
int bits = 0; xmlParserStatus bits = 0;
if (xmlCtxtIsCatastrophicError(ctxt)) { if (xmlCtxtIsCatastrophicError(ctxt)) {
bits |= XML_STATUS_CATASTROPHIC_ERROR | bits |= XML_STATUS_CATASTROPHIC_ERROR |
@ -1798,7 +1798,7 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
xmlParserInputPtr xmlParserInputPtr
xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url,
const char *publicId, const char *encoding, const char *publicId, const char *encoding,
int flags ATTRIBUTE_UNUSED) { xmlParserInputFlags flags ATTRIBUTE_UNUSED) {
xmlParserInputPtr input; xmlParserInputPtr input;
if ((ctxt == NULL) || (url == NULL)) if ((ctxt == NULL) || (url == NULL))
@ -1876,7 +1876,7 @@ xmlNewInputInternal(xmlParserInputBufferPtr buf, const char *filename) {
*/ */
xmlParserInputPtr xmlParserInputPtr
xmlNewInputFromMemory(const char *url, const void *mem, size_t size, xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
int flags) { xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
if (mem == NULL) if (mem == NULL)
@ -1903,7 +1903,7 @@ xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
xmlParserInputPtr xmlParserInputPtr
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size, const void *mem, size_t size,
const char *encoding, int flags) { const char *encoding, xmlParserInputFlags flags) {
xmlParserInputPtr input; xmlParserInputPtr input;
if ((ctxt == NULL) || (mem == NULL)) if ((ctxt == NULL) || (mem == NULL))
@ -1941,7 +1941,8 @@ xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
* Returns a new parser input or NULL if a memory allocation failed. * Returns a new parser input or NULL if a memory allocation failed.
*/ */
xmlParserInputPtr xmlParserInputPtr
xmlNewInputFromString(const char *url, const char *str, int flags) { xmlNewInputFromString(const char *url, const char *str,
xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
if (str == NULL) if (str == NULL)
@ -1966,7 +1967,8 @@ xmlNewInputFromString(const char *url, const char *str, int flags) {
*/ */
xmlParserInputPtr xmlParserInputPtr
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags) { const char *str, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input; xmlParserInputPtr input;
if ((ctxt == NULL) || (str == NULL)) if ((ctxt == NULL) || (str == NULL))
@ -2006,7 +2008,7 @@ xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
* Returns a new parser input or NULL if a memory allocation failed. * Returns a new parser input or NULL if a memory allocation failed.
*/ */
xmlParserInputPtr xmlParserInputPtr
xmlNewInputFromFd(const char *url, int fd, int flags) { xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
if (fd < 0) if (fd < 0)
@ -2036,7 +2038,8 @@ xmlNewInputFromFd(const char *url, int fd, int flags) {
*/ */
xmlParserInputPtr xmlParserInputPtr
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url,
int fd, const char *encoding, int flags) { int fd, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input; xmlParserInputPtr input;
if ((ctxt == NULL) || (fd < 0)) if ((ctxt == NULL) || (fd < 0))
@ -2086,7 +2089,7 @@ xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url,
xmlParserInputPtr xmlParserInputPtr
xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead, xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, void *ioCtxt, xmlInputCloseCallback ioClose, void *ioCtxt,
int flags ATTRIBUTE_UNUSED) { xmlParserInputFlags flags ATTRIBUTE_UNUSED) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
if (ioRead == NULL) if (ioRead == NULL)
@ -2122,7 +2125,8 @@ xmlParserInputPtr
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url, xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, xmlInputCloseCallback ioClose,
void *ioCtxt, const char *encoding, int flags) { void *ioCtxt, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input; xmlParserInputPtr input;
if ((ctxt == NULL) || (ioRead == NULL)) if ((ctxt == NULL) || (ioRead == NULL))
@ -2475,7 +2479,8 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
* Returns an xmlParserErrors code. * Returns an xmlParserErrors code.
*/ */
int int
xmlNewInputFromUrl(const char *filename, int flags, xmlParserInputPtr *out) { xmlNewInputFromUrl(const char *filename, xmlParserInputFlags flags,
xmlParserInputPtr *out) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
xmlParserInputPtr input; xmlParserInputPtr input;
int code = XML_ERR_OK; int code = XML_ERR_OK;
@ -2528,7 +2533,7 @@ xmlNewInputFromUrl(const char *filename, int flags, xmlParserInputPtr *out) {
xmlParserInputPtr xmlParserInputPtr
xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
xmlParserInputPtr input; xmlParserInputPtr input;
int flags = 0; xmlParserInputFlags flags = 0;
int code; int code;
if ((ctxt == NULL) || (filename == NULL)) if ((ctxt == NULL) || (filename == NULL))
@ -2697,7 +2702,7 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
if ((ctxt != NULL) && (ctxt->resourceLoader != NULL)) { if ((ctxt != NULL) && (ctxt->resourceLoader != NULL)) {
char *resource = NULL; char *resource = NULL;
int flags = 0; xmlParserInputFlags flags = 0;
int code; int code;
#ifdef LIBXML_CATALOG_ENABLED #ifdef LIBXML_CATALOG_ENABLED

View File

@ -245,7 +245,8 @@ static int
testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL, testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED, const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED, xmlResourceType type ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED, xmlParserInputPtr *out) { xmlParserInputFlags flags ATTRIBUTE_UNUSED,
xmlParserInputPtr *out) {
int i; int i;
for (i = 0; i < nb_entities; i++) { for (i = 0; i < nb_entities; i++) {

View File

@ -1107,6 +1107,21 @@ static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNU
static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
} }
#define gen_nb_xmlParserInputFlags 4
static xmlParserInputFlags gen_xmlParserInputFlags(int no, int nr ATTRIBUTE_UNUSED) {
if (no == 1) return(XML_INPUT_BUF_STATIC);
if (no == 2) return(XML_INPUT_BUF_ZERO_TERMINATED);
if (no == 3) return(XML_INPUT_NETWORK);
if (no == 4) return(XML_INPUT_UNZIP);
return(0);
}
static void des_xmlParserInputFlags(int no ATTRIBUTE_UNUSED, xmlParserInputFlags val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
static void desret_xmlParserStatus(xmlParserStatus val ATTRIBUTE_UNUSED) {
}
#ifdef LIBXML_SCHEMAS_ENABLED #ifdef LIBXML_SCHEMAS_ENABLED
#define gen_nb_xmlSchemaValType 4 #define gen_nb_xmlSchemaValType 4
static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
@ -12095,7 +12110,7 @@ test_xmlCtxtGetStatus(void) {
int test_ret = 0; int test_ret = 0;
int mem_base; int mem_base;
int ret_val; xmlParserStatus ret_val;
xmlParserCtxt * ctxt; /* an XML parser context */ xmlParserCtxt * ctxt; /* an XML parser context */
int n_ctxt; int n_ctxt;
@ -12104,7 +12119,7 @@ test_xmlCtxtGetStatus(void) {
ctxt = gen_xmlParserCtxt_ptr(n_ctxt, 0); ctxt = gen_xmlParserCtxt_ptr(n_ctxt, 0);
ret_val = xmlCtxtGetStatus(ctxt); ret_val = xmlCtxtGetStatus(ctxt);
desret_int(ret_val); desret_xmlParserStatus(ret_val);
call_tests++; call_tests++;
des_xmlParserCtxt_ptr(n_ctxt, ctxt, 0); des_xmlParserCtxt_ptr(n_ctxt, ctxt, 0);
xmlResetLastError(); xmlResetLastError();
@ -13408,23 +13423,23 @@ test_xmlNewInputFromFd(void) {
int n_url; int n_url;
int fd; /* file descriptor */ int fd; /* file descriptor */
int n_fd; int n_fd;
int flags; /* input flags */ xmlParserInputFlags flags; /* input flags */
int n_flags; int n_flags;
for (n_url = 0;n_url < gen_nb_filepath;n_url++) { for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) {
mem_base = xmlMemBlocks(); mem_base = xmlMemBlocks();
url = gen_filepath(n_url, 0); url = gen_filepath(n_url, 0);
fd = gen_int(n_fd, 1); fd = gen_int(n_fd, 1);
flags = gen_int(n_flags, 2); flags = gen_xmlParserInputFlags(n_flags, 2);
ret_val = xmlNewInputFromFd(url, fd, flags); ret_val = xmlNewInputFromFd(url, fd, flags);
desret_xmlParserInputPtr(ret_val); desret_xmlParserInputPtr(ret_val);
call_tests++; call_tests++;
des_filepath(n_url, url, 0); des_filepath(n_url, url, 0);
des_int(n_fd, fd, 1); des_int(n_fd, fd, 1);
des_int(n_flags, flags, 2); des_xmlParserInputFlags(n_flags, flags, 2);
xmlResetLastError(); xmlResetLastError();
if (mem_base != xmlMemBlocks()) { if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNewInputFromFd", printf("Leak of %d blocks found in xmlNewInputFromFd",
@ -13474,23 +13489,23 @@ test_xmlNewInputFromString(void) {
int n_url; int n_url;
const char * str; /* zero-terminated string */ const char * str; /* zero-terminated string */
int n_str; int n_str;
int flags; /* optimization hints */ xmlParserInputFlags flags; /* optimization hints */
int n_flags; int n_flags;
for (n_url = 0;n_url < gen_nb_filepath;n_url++) { for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) {
mem_base = xmlMemBlocks(); mem_base = xmlMemBlocks();
url = gen_filepath(n_url, 0); url = gen_filepath(n_url, 0);
str = gen_const_char_ptr(n_str, 1); str = gen_const_char_ptr(n_str, 1);
flags = gen_int(n_flags, 2); flags = gen_xmlParserInputFlags(n_flags, 2);
ret_val = xmlNewInputFromString(url, str, flags); ret_val = xmlNewInputFromString(url, str, flags);
desret_xmlParserInputPtr(ret_val); desret_xmlParserInputPtr(ret_val);
call_tests++; call_tests++;
des_filepath(n_url, url, 0); des_filepath(n_url, url, 0);
des_const_char_ptr(n_str, str, 1); des_const_char_ptr(n_str, str, 1);
des_int(n_flags, flags, 2); des_xmlParserInputFlags(n_flags, flags, 2);
xmlResetLastError(); xmlResetLastError();
if (mem_base != xmlMemBlocks()) { if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNewInputFromString", printf("Leak of %d blocks found in xmlNewInputFromString",
@ -13522,24 +13537,24 @@ test_xmlNewInputFromUrl(void) {
int ret_val; int ret_val;
const char * filename; /* the filename to use as entity */ const char * filename; /* the filename to use as entity */
int n_filename; int n_filename;
int flags; /* XML_INPUT flags */ xmlParserInputFlags flags; /* XML_INPUT flags */
int n_flags; int n_flags;
xmlParserInputPtr * out; /* pointer to new parser input */ xmlParserInputPtr * out; /* pointer to new parser input */
int n_out; int n_out;
for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) {
for (n_out = 0;n_out < gen_nb_xmlParserInputPtr_ptr;n_out++) { for (n_out = 0;n_out < gen_nb_xmlParserInputPtr_ptr;n_out++) {
mem_base = xmlMemBlocks(); mem_base = xmlMemBlocks();
filename = gen_filepath(n_filename, 0); filename = gen_filepath(n_filename, 0);
flags = gen_int(n_flags, 1); flags = gen_xmlParserInputFlags(n_flags, 1);
out = gen_xmlParserInputPtr_ptr(n_out, 2); out = gen_xmlParserInputPtr_ptr(n_out, 2);
ret_val = xmlNewInputFromUrl(filename, flags, out); ret_val = xmlNewInputFromUrl(filename, flags, out);
desret_int(ret_val); desret_int(ret_val);
call_tests++; call_tests++;
des_filepath(n_filename, filename, 0); des_filepath(n_filename, filename, 0);
des_int(n_flags, flags, 1); des_xmlParserInputFlags(n_flags, flags, 1);
des_xmlParserInputPtr_ptr(n_out, out, 2); des_xmlParserInputPtr_ptr(n_out, out, 2);
xmlResetLastError(); xmlResetLastError();
if (mem_base != xmlMemBlocks()) { if (mem_base != xmlMemBlocks()) {

14
xmlIO.c
View File

@ -1049,7 +1049,8 @@ xmlIODefaultMatch(const char *filename ATTRIBUTE_UNUSED) {
* Returns an xmlParserError code. * Returns an xmlParserError code.
*/ */
int int
xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, int flags) { xmlInputFromFd(xmlParserInputBufferPtr buf, int fd,
xmlParserInputFlags flags) {
xmlFdIOCtxt *fdctxt; xmlFdIOCtxt *fdctxt;
int copy; int copy;
@ -1161,7 +1162,7 @@ xmlInputFromFd(xmlParserInputBufferPtr buf, int fd, int flags) {
*/ */
static int static int
xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename, xmlInputDefaultOpen(xmlParserInputBufferPtr buf, const char *filename,
int flags) { xmlParserInputFlags flags) {
int ret; int ret;
int fd; int fd;
@ -1455,7 +1456,8 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
*/ */
int int
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc, xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
int flags, xmlParserInputBufferPtr *out) { xmlParserInputFlags flags,
xmlParserInputBufferPtr *out) {
xmlParserInputBufferPtr buf; xmlParserInputBufferPtr buf;
int ret; int ret;
int i; int i;
@ -1862,8 +1864,8 @@ xmlMemClose(void *vctxt) {
* Returns the new input buffer or NULL. * Returns the new input buffer or NULL.
*/ */
xmlParserInputBufferPtr xmlParserInputBufferPtr
xmlNewInputBufferMemory(const void *mem, size_t size, int flags, xmlNewInputBufferMemory(const void *mem, size_t size,
xmlCharEncoding enc) { xmlParserInputFlags flags, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret; xmlParserInputBufferPtr ret;
if ((flags & XML_INPUT_BUF_STATIC) && if ((flags & XML_INPUT_BUF_STATIC) &&
@ -1978,7 +1980,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
* Returns the new input buffer or NULL. * Returns the new input buffer or NULL.
*/ */
xmlParserInputBufferPtr xmlParserInputBufferPtr
xmlNewInputBufferString(const char *str, int flags) { xmlNewInputBufferString(const char *str, xmlParserInputFlags flags) {
xmlParserInputBufferPtr ret; xmlParserInputBufferPtr ret;
ret = xmlMalloc(sizeof(*ret)); ret = xmlMalloc(sizeof(*ret));

View File

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