mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
build: Fix build when certain modules are disabled
This commit is contained in:
4
SAX2.c
4
SAX2.c
@@ -1715,10 +1715,8 @@ void
|
|||||||
xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
|
xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||||
xmlNodePtr cur;
|
|
||||||
|
|
||||||
if (ctx == NULL) return;
|
if (ctx == NULL) return;
|
||||||
cur = ctxt->node;
|
|
||||||
|
|
||||||
ctxt->nodemem = -1;
|
ctxt->nodemem = -1;
|
||||||
|
|
||||||
@@ -1726,7 +1724,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
|
|||||||
if (ctxt->validate && ctxt->wellFormed &&
|
if (ctxt->validate && ctxt->wellFormed &&
|
||||||
ctxt->myDoc && ctxt->myDoc->intSubset)
|
ctxt->myDoc && ctxt->myDoc->intSubset)
|
||||||
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
|
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
|
||||||
cur);
|
ctxt->node);
|
||||||
#endif /* LIBXML_VALID_ENABLED */
|
#endif /* LIBXML_VALID_ENABLED */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ extern "C" {
|
|||||||
defined(LIBXML_READER_ENABLED)
|
defined(LIBXML_READER_ENABLED)
|
||||||
#define HAVE_XML_FUZZER
|
#define HAVE_XML_FUZZER
|
||||||
#endif
|
#endif
|
||||||
#if defined(LIBXML_XPATH_ENABLED)
|
#if defined(LIBXML_XPTR_ENABLED)
|
||||||
#define HAVE_XPATH_FUZZER
|
#define HAVE_XPATH_FUZZER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|||||||
size_t maxAlloc, docSize, consumed, chunkSize;
|
size_t maxAlloc, docSize, consumed, chunkSize;
|
||||||
int opts;
|
int opts;
|
||||||
|
|
||||||
|
(void) maxChunkSize;
|
||||||
|
(void) ctxt;
|
||||||
|
(void) consumed;
|
||||||
|
(void) chunkSize;
|
||||||
|
|
||||||
xmlFuzzDataInit(data, size);
|
xmlFuzzDataInit(data, size);
|
||||||
opts = (int) xmlFuzzReadInt(4);
|
opts = (int) xmlFuzzReadInt(4);
|
||||||
maxAlloc = xmlFuzzReadInt(4) % (size + 1);
|
maxAlloc = xmlFuzzReadInt(4) % (size + 1);
|
||||||
@@ -60,6 +65,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|||||||
|
|
||||||
/* Push parser */
|
/* Push parser */
|
||||||
|
|
||||||
|
#ifdef LIBXML_PUSH_ENABLED
|
||||||
xmlFuzzMemSetLimit(maxAlloc);
|
xmlFuzzMemSetLimit(maxAlloc);
|
||||||
ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL,
|
ctxt = htmlCreatePushParserCtxt(NULL, NULL, NULL, 0, NULL,
|
||||||
XML_CHAR_ENCODING_NONE);
|
XML_CHAR_ENCODING_NONE);
|
||||||
@@ -78,6 +84,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|||||||
xmlFreeDoc(ctxt->myDoc);
|
xmlFreeDoc(ctxt->myDoc);
|
||||||
htmlFreeParserCtxt(ctxt);
|
htmlFreeParserCtxt(ctxt);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|||||||
|
|
||||||
/* Push parser */
|
/* Push parser */
|
||||||
|
|
||||||
|
#ifdef LIBXML_PUSH_ENABLED
|
||||||
xmlFuzzMemSetLimit(maxAlloc);
|
xmlFuzzMemSetLimit(maxAlloc);
|
||||||
ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, docUrl);
|
ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, docUrl);
|
||||||
if (ctxt == NULL)
|
if (ctxt == NULL)
|
||||||
@@ -70,6 +71,7 @@ LLVMFuzzerTestOneInput(const char *data, size_t size) {
|
|||||||
chunkSize = maxChunkSize;
|
chunkSize = maxChunkSize;
|
||||||
xmlParseChunk(ctxt, docBuffer + consumed, chunkSize, 0);
|
xmlParseChunk(ctxt, docBuffer + consumed, chunkSize, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
xmlParseChunk(ctxt, NULL, 0, 1);
|
xmlParseChunk(ctxt, NULL, 0, 1);
|
||||||
xmlFreeDoc(ctxt->myDoc);
|
xmlFreeDoc(ctxt->myDoc);
|
||||||
|
|||||||
@@ -80,8 +80,12 @@ struct _htmlEntityDesc {
|
|||||||
const char *desc; /* the description */
|
const char *desc; /* the description */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define XML_GLOBALS_HTML \
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
#define XML_GLOBALS_HTML \
|
||||||
XML_OP(htmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED)
|
XML_OP(htmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED)
|
||||||
|
#else
|
||||||
|
#define XML_GLOBALS_HTML
|
||||||
|
#endif
|
||||||
|
|
||||||
#define XML_OP XML_DECLARE_GLOBAL
|
#define XML_OP XML_DECLARE_GLOBAL
|
||||||
XML_GLOBALS_HTML
|
XML_GLOBALS_HTML
|
||||||
|
|||||||
@@ -818,9 +818,8 @@ XMLPUBVAR const char *const xmlParserVersion;
|
|||||||
XMLPUBFUN const char *const *__xmlParserVersion(void);
|
XMLPUBFUN const char *const *__xmlParserVersion(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define XML_GLOBALS_PARSER \
|
#define XML_GLOBALS_PARSER_CORE \
|
||||||
XML_OP(oldXMLWDcompatibility, int, XML_DEPRECATED) \
|
XML_OP(oldXMLWDcompatibility, int, XML_DEPRECATED) \
|
||||||
XML_OP(xmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED) \
|
|
||||||
XML_OP(xmlDefaultSAXLocator, xmlSAXLocator, XML_DEPRECATED) \
|
XML_OP(xmlDefaultSAXLocator, xmlSAXLocator, XML_DEPRECATED) \
|
||||||
XML_OP(xmlDoValidityCheckingDefaultValue, int, XML_DEPRECATED) \
|
XML_OP(xmlDoValidityCheckingDefaultValue, int, XML_DEPRECATED) \
|
||||||
XML_OP(xmlGetWarningsDefaultValue, int, XML_DEPRECATED) \
|
XML_OP(xmlGetWarningsDefaultValue, int, XML_DEPRECATED) \
|
||||||
@@ -831,6 +830,17 @@ XMLPUBFUN const char *const *__xmlParserVersion(void);
|
|||||||
XML_OP(xmlPedanticParserDefaultValue, int, XML_DEPRECATED) \
|
XML_OP(xmlPedanticParserDefaultValue, int, XML_DEPRECATED) \
|
||||||
XML_OP(xmlSubstituteEntitiesDefaultValue, int, XML_DEPRECATED)
|
XML_OP(xmlSubstituteEntitiesDefaultValue, int, XML_DEPRECATED)
|
||||||
|
|
||||||
|
#ifdef LIBXML_SAX1_ENABLED
|
||||||
|
#define XML_GLOBALS_PARSER_SAX1 \
|
||||||
|
XML_OP(xmlDefaultSAXHandler, xmlSAXHandlerV1, XML_DEPRECATED)
|
||||||
|
#else
|
||||||
|
#define XML_GLOBALS_PARSER_SAX1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define XML_GLOBALS_PARSER \
|
||||||
|
XML_GLOBALS_PARSER_CORE \
|
||||||
|
XML_GLOBALS_PARSER_SAX1
|
||||||
|
|
||||||
#define XML_OP XML_DECLARE_GLOBAL
|
#define XML_OP XML_DECLARE_GLOBAL
|
||||||
XML_GLOBALS_PARSER
|
XML_GLOBALS_PARSER
|
||||||
#undef XML_OP
|
#undef XML_OP
|
||||||
|
|||||||
@@ -2470,6 +2470,7 @@ errParseTest(const char *filename, const char *result, const char *err,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
||||||
/**
|
/**
|
||||||
* fdParseTest:
|
* fdParseTest:
|
||||||
* @filename: the file to parse
|
* @filename: the file to parse
|
||||||
@@ -2534,7 +2535,7 @@ fdParseTest(const char *filename, const char *result, const char *err,
|
|||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef LIBXML_READER_ENABLED
|
#ifdef LIBXML_READER_ENABLED
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
|
|
||||||
#ifdef LIBXML_XPATH_ENABLED
|
#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -594,7 +594,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
|
|||||||
#else /* ! LIBXML_XPATH_ENABLED */
|
#else /* ! LIBXML_XPATH_ENABLED */
|
||||||
int
|
int
|
||||||
main(int argc ATTRIBUTE_UNUSED, char **argv) {
|
main(int argc ATTRIBUTE_UNUSED, char **argv) {
|
||||||
fprintf(stderr, "%s need XPath support\n", argv[0]);
|
fprintf(stderr, "%s need XPath and validation support\n", argv[0]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2256,6 +2256,8 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
|
|||||||
int is_xhtml = 0;
|
int is_xhtml = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void) doc;
|
||||||
|
|
||||||
xmlInitParser();
|
xmlInitParser();
|
||||||
|
|
||||||
if ((buf == NULL) || (cur == NULL)) return;
|
if ((buf == NULL) || (cur == NULL)) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user