From 7cfce324d84603dec97d3a6bcafdaec53785e90a Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 4 Oct 2000 12:40:27 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ include/libxml/xmlIO.h | 2 ++ parser.c | 9 +++++++++ xmlIO.c | 8 ++++++++ xmlIO.h | 2 ++ 5 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index c9b34868..70c747d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 4 14:39:01 CEST 2000 Daniel Veillard + + * 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 * HTMLparser.c: Doohhh, attribute name parsing was still case diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index e7b5f768..ff0114d5 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -71,6 +71,7 @@ struct _xmlOutputBuffer { * Interfaces for input */ +void xmlRegisterDefaultInputCallbacks (void); xmlParserInputBufferPtr xmlAllocParserInputBuffer (xmlCharEncoding enc); @@ -108,6 +109,7 @@ int xmlRegisterInputCallbacks (xmlInputMatchCallback match, /* * Interfaces for output */ +void xmlRegisterDefaultOutputCallbacks(void); xmlOutputBufferPtr xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); diff --git a/parser.c b/parser.c index 0522adb7..ff0c4f7a 100644 --- a/parser.c +++ b/parser.c @@ -9499,6 +9499,10 @@ xmlParseDoc(xmlChar *cur) { * * ************************************************************************/ +#ifdef LIBXML_XPATH_ENABLED +#include +#endif + static int xmlParserInitialized = 0; /** @@ -9516,9 +9520,14 @@ xmlInitParser(void) { 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 7240f2ce..f9302b0f 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -644,6 +644,9 @@ xmlRegisterOutputCallbacks(xmlOutputMatchCallback match, */ void xmlRegisterDefaultInputCallbacks(void) { + if (xmlInputCallbackInitialized) + return; + xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, xmlFileRead, xmlFileClose); #ifdef HAVE_ZLIB_H @@ -660,6 +663,7 @@ xmlRegisterDefaultInputCallbacks(void) { xmlRegisterInputCallbacks(xmlIOFTPMatch, xmlIOFTPOpen, xmlIOFTPRead, xmlIOFTPClose); #endif /* LIBXML_FTP_ENABLED */ + xmlInputCallbackInitialized = 1; } /** @@ -669,6 +673,9 @@ xmlRegisterDefaultInputCallbacks(void) { */ void xmlRegisterDefaultOutputCallbacks(void) { + if (xmlOutputCallbackInitialized) + return; + xmlRegisterOutputCallbacks(xmlFileMatch, xmlFileOpenW, xmlFileWrite, xmlFileClose); /********************************* @@ -693,6 +700,7 @@ xmlRegisterDefaultOutputCallbacks(void) { xmlIOFTPWrite, xmlIOFTPClose); #endif **********************************/ + xmlOutputCallbackInitialized = 1; } /** diff --git a/xmlIO.h b/xmlIO.h index e7b5f768..ff0114d5 100644 --- a/xmlIO.h +++ b/xmlIO.h @@ -71,6 +71,7 @@ struct _xmlOutputBuffer { * Interfaces for input */ +void xmlRegisterDefaultInputCallbacks (void); xmlParserInputBufferPtr xmlAllocParserInputBuffer (xmlCharEncoding enc); @@ -108,6 +109,7 @@ int xmlRegisterInputCallbacks (xmlInputMatchCallback match, /* * Interfaces for output */ +void xmlRegisterDefaultOutputCallbacks(void); xmlOutputBufferPtr xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);