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

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>
<author>Daniel Veillard </author>
<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_STATUS_CATASTROPHIC_ERROR' type='macro'/>
<exports symbol='XML_STATUS_DTD_VALIDATION_FAILED' type='macro'/>
<exports symbol='XML_STATUS_NOT_NS_WELL_FORMED' type='macro'/>
<exports symbol='XML_STATUS_NOT_WELL_FORMED' type='macro'/>
<exports symbol='XML_INPUT_BUF_STATIC' type='enum'/>
<exports symbol='XML_INPUT_BUF_ZERO_TERMINATED' type='enum'/>
<exports symbol='XML_INPUT_NETWORK' type='enum'/>
<exports symbol='XML_INPUT_UNZIP' type='enum'/>
<exports symbol='XML_PARSER_ATTRIBUTE_VALUE' type='enum'/>
<exports symbol='XML_PARSER_CDATA_SECTION' type='enum'/>
<exports symbol='XML_PARSER_COMMENT' type='enum'/>
@ -595,6 +591,10 @@
<exports symbol='XML_RESOURCE_UNKNOWN' type='enum'/>
<exports symbol='XML_RESOURCE_XINCLUDE' 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_C14N' type='enum'/>
<exports symbol='XML_WITH_CATALOG' type='enum'/>
@ -632,6 +632,7 @@
<exports symbol='XML_WITH_ZLIB' type='enum'/>
<exports symbol='xmlAttrHashBucket' type='typedef'/>
<exports symbol='xmlFeature' type='typedef'/>
<exports symbol='xmlParserInputFlags' type='typedef'/>
<exports symbol='xmlParserInputState' type='typedef'/>
<exports symbol='xmlParserMode' type='typedef'/>
<exports symbol='xmlParserNodeInfo' type='typedef'/>
@ -640,6 +641,7 @@
<exports symbol='xmlParserNodeInfoSeqPtr' type='typedef'/>
<exports symbol='xmlParserNsData' type='typedef'/>
<exports symbol='xmlParserOption' type='typedef'/>
<exports symbol='xmlParserStatus' type='typedef'/>
<exports symbol='xmlResourceType' type='typedef'/>
<exports symbol='xmlSAXHandlerV1' type='typedef'/>
<exports symbol='xmlSAXHandlerV1Ptr' type='typedef'/>
@ -3799,14 +3801,6 @@
<macro name='XML_GET_LINE' file='tree'>
<info>Macro to extract the line number of an element node.</info>
</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'>
<info>A namespace declaration node.</info>
</macro>
@ -4077,14 +4071,6 @@
<macro name='XML_SCHEMAS_WILDCARD_COMPLETE' file='schemasInternals'>
<info>If the wildcard is complete.</info>
</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'>
<info>Both general and parameter entities need to be substituted.</info>
</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_NAME' file='xmlerror' value='6000' type='xmlParserErrors'/>
<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_PARAMETER_ENTITY' file='entities' value='4' 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_REPLACE' file='xmlschemastypes' value='2' 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_EOF' file='xmlreader' value='3' 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'/>
</struct>
<typedef name='xmlParserInputBufferPtr' file='tree' type='xmlParserInputBuffer *'/>
<typedef name='xmlParserInputFlags' file='parser' type='enum'/>
<typedef name='xmlParserInputPtr' file='tree' type='xmlParserInput *'/>
<typedef name='xmlParserInputState' 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='xmlParserProperties' 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'/>
<typedef name='xmlPatternFlags' file='pattern' type='enum'/>
<typedef name='xmlPatternPtr' file='pattern' type='xmlPattern *'/>
@ -8504,7 +8500,7 @@ crash if you try to modify the tree)'/>
</function>
<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>
<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'/>
</function>
<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.'/>
<arg name='url' type='const char *' info='base URL (optional)'/>
<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 name='xmlNewInputFromFile' file='parserInternals' module='parserInternals'>
<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='ioClose' type='xmlInputCloseCallback' info='close callback (optional)'/>
<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 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>
@ -10612,20 +10608,20 @@ crash if you try to modify the tree)'/>
<arg name='url' type='const char *' info='base URL (optional)'/>
<arg name='mem' type='const void *' info='pointer to char 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 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>
<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='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 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.'/>
<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'/>
</function>
<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='publicId' type='const char *' info='publid ID from DTD (optional)'/>
<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'/>
</functype>
<function name='xmlSAX2AttributeDecl' file='SAX2' module='SAX2'>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,9 @@
*/
#define XML_VCTXT_USE_PCTXT (1u << 1)
/*
* TODO: Rename to avoid confusion with xmlParserInputFlags
*/
#define XML_INPUT_HAS_ENCODING (1u << 0)
#define XML_INPUT_AUTO_ENCODING (7u << 1)
#define XML_INPUT_AUTO_UTF8 (1u << 1)
@ -116,23 +119,26 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
xmlResourceType type);
XML_HIDDEN xmlParserInputPtr
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
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size,
const char *encoding, int flags);
const char *encoding,
xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr
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
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *filename, int fd,
const char *encoding, int flags);
const char *encoding, xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void *ioCtxt,
const char *encoding, int flags);
const char *encoding, xmlParserInputFlags flags);
XML_HIDDEN xmlParserInputPtr
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.
*/
int
xmlParserStatus
xmlCtxtGetStatus(xmlParserCtxt *ctxt) {
int bits = 0;
xmlParserStatus bits = 0;
if (xmlCtxtIsCatastrophicError(ctxt)) {
bits |= XML_STATUS_CATASTROPHIC_ERROR |
@ -1798,7 +1798,7 @@ xmlNewInputStream(xmlParserCtxtPtr ctxt) {
xmlParserInputPtr
xmlCtxtNewInputFromUrl(xmlParserCtxtPtr ctxt, const char *url,
const char *publicId, const char *encoding,
int flags ATTRIBUTE_UNUSED) {
xmlParserInputFlags flags ATTRIBUTE_UNUSED) {
xmlParserInputPtr input;
if ((ctxt == NULL) || (url == NULL))
@ -1876,7 +1876,7 @@ xmlNewInputInternal(xmlParserInputBufferPtr buf, const char *filename) {
*/
xmlParserInputPtr
xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
int flags) {
xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf;
if (mem == NULL)
@ -1903,7 +1903,7 @@ xmlNewInputFromMemory(const char *url, const void *mem, size_t size,
xmlParserInputPtr
xmlCtxtNewInputFromMemory(xmlParserCtxtPtr ctxt, const char *url,
const void *mem, size_t size,
const char *encoding, int flags) {
const char *encoding, xmlParserInputFlags flags) {
xmlParserInputPtr input;
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.
*/
xmlParserInputPtr
xmlNewInputFromString(const char *url, const char *str, int flags) {
xmlNewInputFromString(const char *url, const char *str,
xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf;
if (str == NULL)
@ -1966,7 +1967,8 @@ xmlNewInputFromString(const char *url, const char *str, int flags) {
*/
xmlParserInputPtr
xmlCtxtNewInputFromString(xmlParserCtxtPtr ctxt, const char *url,
const char *str, const char *encoding, int flags) {
const char *str, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input;
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.
*/
xmlParserInputPtr
xmlNewInputFromFd(const char *url, int fd, int flags) {
xmlNewInputFromFd(const char *url, int fd, xmlParserInputFlags flags) {
xmlParserInputBufferPtr buf;
if (fd < 0)
@ -2036,7 +2038,8 @@ xmlNewInputFromFd(const char *url, int fd, int flags) {
*/
xmlParserInputPtr
xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url,
int fd, const char *encoding, int flags) {
int fd, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input;
if ((ctxt == NULL) || (fd < 0))
@ -2086,7 +2089,7 @@ xmlCtxtNewInputFromFd(xmlParserCtxtPtr ctxt, const char *url,
xmlParserInputPtr
xmlNewInputFromIO(const char *url, xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose, void *ioCtxt,
int flags ATTRIBUTE_UNUSED) {
xmlParserInputFlags flags ATTRIBUTE_UNUSED) {
xmlParserInputBufferPtr buf;
if (ioRead == NULL)
@ -2122,7 +2125,8 @@ xmlParserInputPtr
xmlCtxtNewInputFromIO(xmlParserCtxtPtr ctxt, const char *url,
xmlInputReadCallback ioRead,
xmlInputCloseCallback ioClose,
void *ioCtxt, const char *encoding, int flags) {
void *ioCtxt, const char *encoding,
xmlParserInputFlags flags) {
xmlParserInputPtr input;
if ((ctxt == NULL) || (ioRead == NULL))
@ -2475,7 +2479,8 @@ xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) {
* Returns an xmlParserErrors code.
*/
int
xmlNewInputFromUrl(const char *filename, int flags, xmlParserInputPtr *out) {
xmlNewInputFromUrl(const char *filename, xmlParserInputFlags flags,
xmlParserInputPtr *out) {
xmlParserInputBufferPtr buf;
xmlParserInputPtr input;
int code = XML_ERR_OK;
@ -2528,7 +2533,7 @@ xmlNewInputFromUrl(const char *filename, int flags, xmlParserInputPtr *out) {
xmlParserInputPtr
xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
xmlParserInputPtr input;
int flags = 0;
xmlParserInputFlags flags = 0;
int code;
if ((ctxt == NULL) || (filename == NULL))
@ -2697,7 +2702,7 @@ xmlLoadResource(xmlParserCtxtPtr ctxt, const char *url, const char *publicId,
if ((ctxt != NULL) && (ctxt->resourceLoader != NULL)) {
char *resource = NULL;
int flags = 0;
xmlParserInputFlags flags = 0;
int code;
#ifdef LIBXML_CATALOG_ENABLED

View File

@ -245,7 +245,8 @@ static int
testResourceLoader(void *vctxt ATTRIBUTE_UNUSED, const char *URL,
const char *ID ATTRIBUTE_UNUSED,
xmlResourceType type ATTRIBUTE_UNUSED,
int flags ATTRIBUTE_UNUSED, xmlParserInputPtr *out) {
xmlParserInputFlags flags ATTRIBUTE_UNUSED,
xmlParserInputPtr *out) {
int 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) {
}
#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
#define gen_nb_xmlSchemaValType 4
static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
@ -12095,7 +12110,7 @@ test_xmlCtxtGetStatus(void) {
int test_ret = 0;
int mem_base;
int ret_val;
xmlParserStatus ret_val;
xmlParserCtxt * ctxt; /* an XML parser context */
int n_ctxt;
@ -12104,7 +12119,7 @@ test_xmlCtxtGetStatus(void) {
ctxt = gen_xmlParserCtxt_ptr(n_ctxt, 0);
ret_val = xmlCtxtGetStatus(ctxt);
desret_int(ret_val);
desret_xmlParserStatus(ret_val);
call_tests++;
des_xmlParserCtxt_ptr(n_ctxt, ctxt, 0);
xmlResetLastError();
@ -13408,23 +13423,23 @@ test_xmlNewInputFromFd(void) {
int n_url;
int fd; /* file descriptor */
int n_fd;
int flags; /* input flags */
xmlParserInputFlags flags; /* input flags */
int n_flags;
for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
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();
url = gen_filepath(n_url, 0);
fd = gen_int(n_fd, 1);
flags = gen_int(n_flags, 2);
flags = gen_xmlParserInputFlags(n_flags, 2);
ret_val = xmlNewInputFromFd(url, fd, flags);
desret_xmlParserInputPtr(ret_val);
call_tests++;
des_filepath(n_url, url, 0);
des_int(n_fd, fd, 1);
des_int(n_flags, flags, 2);
des_xmlParserInputFlags(n_flags, flags, 2);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNewInputFromFd",
@ -13474,23 +13489,23 @@ test_xmlNewInputFromString(void) {
int n_url;
const char * str; /* zero-terminated string */
int n_str;
int flags; /* optimization hints */
xmlParserInputFlags flags; /* optimization hints */
int n_flags;
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_flags = 0;n_flags < gen_nb_int;n_flags++) {
for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) {
mem_base = xmlMemBlocks();
url = gen_filepath(n_url, 0);
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);
desret_xmlParserInputPtr(ret_val);
call_tests++;
des_filepath(n_url, url, 0);
des_const_char_ptr(n_str, str, 1);
des_int(n_flags, flags, 2);
des_xmlParserInputFlags(n_flags, flags, 2);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNewInputFromString",
@ -13522,24 +13537,24 @@ test_xmlNewInputFromUrl(void) {
int ret_val;
const char * filename; /* the filename to use as entity */
int n_filename;
int flags; /* XML_INPUT flags */
xmlParserInputFlags flags; /* XML_INPUT flags */
int n_flags;
xmlParserInputPtr * out; /* pointer to new parser input */
int n_out;
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++) {
mem_base = xmlMemBlocks();
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);
ret_val = xmlNewInputFromUrl(filename, flags, out);
desret_int(ret_val);
call_tests++;
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);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {

14
xmlIO.c
View File

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

View File

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