From Olivier Jacques: Add #defines to disable XML validation.
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 18 Oct 2004 14:58:32 +0000 (14:58 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 18 Oct 2004 14:58:32 +0000 (14:58 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12340 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-diameter.c
xmlstub.c
xmlstub.h

index 3e33e243ca62d43ff9d7bca462488aa127241f5f..a8258ff31fe4fa33828fc16586028a58c40281b5 100644 (file)
@@ -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 */
 
index c64bdd02afbc6e04b18eca7bd6cfc6748458337b..6ceb9c32beb0e49be652695b77e5d6a10af40781 100644 (file)
--- a/xmlstub.c
+++ b/xmlstub.c
@@ -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.
index 54532dcaf057b34cd2487303d827813978665c64..47a6d0a0ef216f36459fabe402df763922af5f55 100644 (file)
--- a/xmlstub.h
+++ b/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;