From Olivier Jacques: Add #defines to disable XML validation.
svn path=/trunk/; revision=12340
This commit is contained in:
parent
d6a2182535
commit
d7d9c6be54
|
@ -311,13 +311,17 @@ static xmlDocPtr
|
|||
xmlParseFilePush( char *filename, int checkValid) {
|
||||
FILE *f;
|
||||
xmlDocPtr doc=NULL;
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
int valid=0;
|
||||
#endif
|
||||
int res, size = 1024;
|
||||
char chars[1024];
|
||||
xmlParserCtxtPtr ctxt;
|
||||
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
/* I wonder what kind of a performance hit this is? */
|
||||
*XmlStub.xmlDoValidityCheckingDefaultValue = checkValid;
|
||||
#endif
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (f == NULL) {
|
||||
|
@ -334,17 +338,22 @@ xmlParseFilePush( char *filename, int checkValid) {
|
|||
}
|
||||
XmlStub.xmlParseChunk(ctxt, chars, 0, 1);
|
||||
doc = ctxt->myDoc;
|
||||
valid=ctxt->valid;
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
valid=ctxt->valid;
|
||||
#endif
|
||||
XmlStub.xmlFreeParserCtxt(ctxt);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
/* Check valid */
|
||||
if (!valid) {
|
||||
report_failure( "Error! Invalid xml in %s! Failed DTD check!",
|
||||
filename);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return doc;
|
||||
} /* xmlParseFilePush */
|
||||
|
||||
|
|
|
@ -145,11 +145,13 @@ loadLibXML(void)
|
|||
}
|
||||
XmlStub.xmlSubstituteEntitiesDefault=(int(*)(int))symbol;
|
||||
|
||||
if (!g_module_symbol(handle, "xmlDoValidityCheckingDefaultValue", &symbol)) {
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
if (!g_module_symbol(handle, "xmlDoValidityCheckingDefaultValue", &symbol)) {
|
||||
g_warning("Unable to find \"xmlDoValidityCheckingDefaultValue\"");
|
||||
error=TRUE;
|
||||
}
|
||||
XmlStub.xmlDoValidityCheckingDefaultValue = (int *)symbol;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return if any of the above functions set our error flag.
|
||||
|
|
14
xmlstub.h
14
xmlstub.h
|
@ -8,6 +8,13 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
/****************** specific to ethereal ********************************/
|
||||
/*
|
||||
* Uncomment the following line to restore XML_DO_VALIDITY_CHECKING
|
||||
* behavior which is causing issues on WIN32 platforms. See:
|
||||
* http://www.ethereal.com/lists/ethereal-dev/200410/msg00194.html
|
||||
*/
|
||||
/* #define ETHEREAL_XML_DO_VALIDITY_CHECKING */
|
||||
/****************** From xml headers ************************************/
|
||||
|
||||
/*
|
||||
|
@ -1088,10 +1095,9 @@ typedef struct {
|
|||
char *(*xmlGetProp)(xmlNodePtr, char *);
|
||||
int (*xmlKeepBlanksDefault)(int);
|
||||
int (*xmlSubstituteEntitiesDefault)(int);
|
||||
|
||||
/* Variables */
|
||||
int *xmlDoValidityCheckingDefaultValue;
|
||||
|
||||
#ifdef ETHEREAL_XML_DO_VALIDITY_CHECKING
|
||||
int *xmlDoValidityCheckingDefaultValue;
|
||||
#endif
|
||||
} XML_STUB;
|
||||
|
||||
XML_EXTERN XML_STUB XmlStub;
|
||||
|
|
Loading…
Reference in New Issue