Bugfix - parser.c xmlIO.c xmlIO.h: fixed bug 26650, and improved the
Bugfix
- parser.c xmlIO.c xmlIO.h: fixed bug 26650, and improved the global
init function.
Daniel
diff --git a/ChangeLog b/ChangeLog
index c9b3486..70c747d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Oct 4 14:39:01 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * parser.c xmlIO.c xmlIO.h: fixed bug 26650, and improved
+ the global init function.
+
Tue Oct 3 11:28:52 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* HTMLparser.c: Doohhh, attribute name parsing was still case
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index e7b5f76..ff0114d 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -71,6 +71,7 @@
* Interfaces for input
*/
+void xmlRegisterDefaultInputCallbacks (void);
xmlParserInputBufferPtr
xmlAllocParserInputBuffer (xmlCharEncoding enc);
@@ -108,6 +109,7 @@
/*
* Interfaces for output
*/
+void xmlRegisterDefaultOutputCallbacks(void);
xmlOutputBufferPtr
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
diff --git a/parser.c b/parser.c
index 0522adb..ff0c4f7 100644
--- a/parser.c
+++ b/parser.c
@@ -9499,6 +9499,10 @@
* *
************************************************************************/
+#ifdef LIBXML_XPATH_ENABLED
+#include <libxml/xpath.h>
+#endif
+
static int xmlParserInitialized = 0;
/**
@@ -9516,10 +9520,15 @@
xmlInitCharEncodingHandlers();
xmlInitializePredefinedEntities();
xmlDefaultSAXHandlerInit();
+ xmlRegisterDefaultInputCallbacks();
+ xmlRegisterDefaultOutputCallbacks();
#ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose();
htmlDefaultSAXHandlerInit();
#endif
+#ifdef LIBXML_XPATH_ENABLED
+ xmlXPathInit();
+#endif
xmlParserInitialized = 1;
}
diff --git a/xmlIO.c b/xmlIO.c
index 7240f2c..f9302b0 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -644,6 +644,9 @@
*/
void
xmlRegisterDefaultInputCallbacks(void) {
+ if (xmlInputCallbackInitialized)
+ return;
+
xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
xmlFileRead, xmlFileClose);
#ifdef HAVE_ZLIB_H
@@ -660,6 +663,7 @@
xmlRegisterInputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen,
xmlIOFTPRead, xmlIOFTPClose);
#endif /* LIBXML_FTP_ENABLED */
+ xmlInputCallbackInitialized = 1;
}
/**
@@ -669,6 +673,9 @@
*/
void
xmlRegisterDefaultOutputCallbacks(void) {
+ if (xmlOutputCallbackInitialized)
+ return;
+
xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW,
xmlFileWrite, xmlFileClose);
/*********************************
@@ -693,6 +700,7 @@
xmlIOFTPWrite, xmlIOFTPClose);
#endif
**********************************/
+ xmlOutputCallbackInitialized = 1;
}
/**
diff --git a/xmlIO.h b/xmlIO.h
index e7b5f76..ff0114d 100644
--- a/xmlIO.h
+++ b/xmlIO.h
@@ -71,6 +71,7 @@
* Interfaces for input
*/
+void xmlRegisterDefaultInputCallbacks (void);
xmlParserInputBufferPtr
xmlAllocParserInputBuffer (xmlCharEncoding enc);
@@ -108,6 +109,7 @@
/*
* Interfaces for output
*/
+void xmlRegisterDefaultOutputCallbacks(void);
xmlOutputBufferPtr
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);