From d9d32aebd3d09df9431859c3d9e7f7de781c73d4 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sat, 5 Jul 2003 20:32:43 +0000 Subject: [PATCH] use the character() SAX callback if the cdataBlock ain't defined. fix bug * parser.c HTMLparser.c: use the character() SAX callback if the cdataBlock ain't defined. * xpath.c: fix bug #115349 allowing compilation when configured with --without-xpath since the Schemas code needs NAN and co. Daniel --- ChangeLog | 7 +++++++ HTMLparser.c | 6 ++++++ parser.c | 10 +++++++++- xpath.c | 54 ++++++++++++++++++++++++++-------------------------- 4 files changed, 49 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f347853..16751867 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Jul 5 22:30:25 CEST 2003 Daniel Veillard + + * parser.c HTMLparser.c: use the character() SAX callback + if the cdataBlock ain't defined. + * xpath.c: fix bug #115349 allowing compilation when configured + with --without-xpath since the Schemas code needs NAN and co. + Sat Jul 5 00:51:30 HKT 2003 William Brack Fixed problem with multi-threading, shown by the test program diff --git a/HTMLparser.c b/HTMLparser.c index 7f3ed471..d07cd460 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -2688,6 +2688,8 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { * Insert as CDATA, which is the same as HTML_PRESERVE_NODE */ ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); } } nbchar = 0; @@ -2712,6 +2714,8 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { * Insert as CDATA, which is the same as HTML_PRESERVE_NODE */ ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); } nbchar = 0; } @@ -2732,6 +2736,8 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { * Insert as CDATA, which is the same as HTML_PRESERVE_NODE */ ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); + } else if (ctxt->sax->characters != NULL) { + ctxt->sax->characters(ctxt->userData, buf, nbchar); } } } diff --git a/parser.c b/parser.c index 1e10569c..a4430b9e 100644 --- a/parser.c +++ b/parser.c @@ -8790,7 +8790,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { if (avail >= XML_PARSER_BIG_BUFFER_SIZE + 2) { if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { if (ctxt->sax->cdataBlock != NULL) - ctxt->sax->cdataBlock(ctxt->userData, ctxt->input->cur, + ctxt->sax->cdataBlock(ctxt->userData, + ctxt->input->cur, + XML_PARSER_BIG_BUFFER_SIZE); + else if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, + ctxt->input->cur, XML_PARSER_BIG_BUFFER_SIZE); } SKIP(XML_PARSER_BIG_BUFFER_SIZE); @@ -8803,6 +8808,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { if (ctxt->sax->cdataBlock != NULL) ctxt->sax->cdataBlock(ctxt->userData, ctxt->input->cur, base); + else if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, + ctxt->input->cur, base); } SKIP(base + 3); ctxt->checkIndex = 0; diff --git a/xpath.c b/xpath.c index 67d835be..e6e3e1ee 100644 --- a/xpath.c +++ b/xpath.c @@ -16,7 +16,6 @@ #define IN_LIBXML #include "libxml.h" -#ifdef LIBXML_XPATH_ENABLED #include @@ -53,32 +52,6 @@ #include #include -/* - * TODO: when compatibility allows remove all "fake node libxslt" strings - * the test should just be name[0] = ' ' - */ -/* #define DEBUG */ -/* #define DEBUG_STEP */ -/* #define DEBUG_STEP_NTH */ -/* #define DEBUG_EXPR */ -/* #define DEBUG_EVAL_COUNTS */ - -static xmlNs xmlXPathXMLNamespaceStruct = { - NULL, - XML_NAMESPACE_DECL, - XML_XML_NAMESPACE, - BAD_CAST "xml", - NULL -}; -static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct; -#ifndef LIBXML_THREAD_ENABLED -/* - * Optimizer is disabled only when threaded apps are detected while - * the library ain't compiled for thread safety. - */ -static int xmlXPathDisableOptimizer = 0; -#endif - /************************************************************************ * * * Floating point stuff * @@ -162,6 +135,33 @@ xmlXPathGetSign(double val) { } +#ifdef LIBXML_XPATH_ENABLED +/* + * TODO: when compatibility allows remove all "fake node libxslt" strings + * the test should just be name[0] = ' ' + */ +/* #define DEBUG */ +/* #define DEBUG_STEP */ +/* #define DEBUG_STEP_NTH */ +/* #define DEBUG_EXPR */ +/* #define DEBUG_EVAL_COUNTS */ + +static xmlNs xmlXPathXMLNamespaceStruct = { + NULL, + XML_NAMESPACE_DECL, + XML_XML_NAMESPACE, + BAD_CAST "xml", + NULL +}; +static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct; +#ifndef LIBXML_THREAD_ENABLED +/* + * Optimizer is disabled only when threaded apps are detected while + * the library ain't compiled for thread safety. + */ +static int xmlXPathDisableOptimizer = 0; +#endif + /************************************************************************ * * * Parser Types *