summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-03-24 17:00:36 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-03-24 17:00:36 +0000
commit56a4cb8c4d3eab4ab3295a61c87e8e92483922c6 (patch)
tree24cdc196bdb98eb6980c2d27e405fc7e1f1d7bdf
parentc7ad7ce598261a447cfceb7837219fcd93151336 (diff)
downloadlibxml2-56a4cb8c4d3eab4ab3295a61c87e8e92483922c6.tar.gz
Huge cleanup, I switched to compile with
-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline - HTMLparser.[ch] HTMLtree.c SAX.c debugXML.c encoding.[ch] encoding.h entities.c error.c list.[ch] nanoftp.c nanohttp.c parser.[ch] parserInternals.[ch] testHTML.c testSAX.c testURI.c testXPath.c tree.[ch] uri.c valid.[ch] xinclude.c xmlIO.[ch] xmllint.c xmlmemory.c xpath.c xpathInternals.h xpointer.[ch] example/gjobread.c: Cleanup, staticfied a number of non-exported functions, detected and cleaned up a dozen of problem found this way, avoided a lot of public function name/typedef/system names clashes - doc/xml.html: updated - configure.in: switched private flags to the really pedantic ones. Daniel
-rw-r--r--ChangeLog19
-rw-r--r--HTMLparser.c318
-rw-r--r--HTMLparser.h4
-rw-r--r--HTMLtree.c20
-rw-r--r--SAX.c22
-rw-r--r--configure.in3
-rw-r--r--debugXML.c114
-rw-r--r--doc/xml.html13
-rw-r--r--encoding.c22
-rw-r--r--encoding.h11
-rw-r--r--entities.c65
-rw-r--r--error.c11
-rw-r--r--example/gjobread.c26
-rw-r--r--include/libxml/HTMLparser.h4
-rw-r--r--include/libxml/encoding.h11
-rw-r--r--include/libxml/list.h11
-rw-r--r--include/libxml/parser.h3
-rw-r--r--include/libxml/parserInternals.h11
-rw-r--r--include/libxml/tree.h6
-rw-r--r--include/libxml/valid.h3
-rw-r--r--include/libxml/xmlIO.h16
-rw-r--r--include/libxml/xpathInternals.h38
-rw-r--r--include/libxml/xpointer.h20
-rw-r--r--list.c2
-rw-r--r--list.h11
-rw-r--r--nanoftp.c101
-rw-r--r--nanohttp.c103
-rw-r--r--parser.c123
-rw-r--r--parser.h3
-rw-r--r--parserInternals.c117
-rw-r--r--parserInternals.h11
-rw-r--r--testHTML.c128
-rw-r--r--testSAX.c178
-rw-r--r--testURI.c2
-rw-r--r--testXPath.c22
-rw-r--r--tree.c58
-rw-r--r--tree.h6
-rw-r--r--uri.c32
-rw-r--r--valid.c83
-rw-r--r--valid.h3
-rw-r--r--xinclude.c33
-rw-r--r--xmlIO.c193
-rw-r--r--xmlIO.h16
-rw-r--r--xmllint.c24
-rw-r--r--xmlmemory.c30
-rw-r--r--xpath.c155
-rw-r--r--xpathInternals.h38
-rw-r--r--xpointer.c178
-rw-r--r--xpointer.h20
49 files changed, 1258 insertions, 1183 deletions
diff --git a/ChangeLog b/ChangeLog
index 3961d741..da3c051a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+Sat Mar 24 17:45:36 CET 2001
+ Huge cleanup, I switched to compile with
+ -Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit
+ -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat
+ -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow
+ -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return
+ -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline
+ * HTMLparser.[ch] HTMLtree.c SAX.c debugXML.c encoding.[ch]
+ encoding.h entities.c error.c list.[ch] nanoftp.c
+ nanohttp.c parser.[ch] parserInternals.[ch] testHTML.c
+ testSAX.c testURI.c testXPath.c tree.[ch] uri.c
+ valid.[ch] xinclude.c xmlIO.[ch] xmllint.c xmlmemory.c
+ xpath.c xpathInternals.h xpointer.[ch] example/gjobread.c:
+ Cleanup, staticfied a number of non-exported functions,
+ detected and cleaned up a dozen of problem found this way,
+ avoided a lot of public function name/typedef/system names clashes
+ * doc/xml.html: updated
+ * configure.in: switched private flags to the really pedantic ones.
+
Thu Mar 22 22:44:15 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* configure.in: 2.3.5
diff --git a/HTMLparser.c b/HTMLparser.c
index a83b669b..49b02641 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -41,6 +41,7 @@
#include <libxml/parserInternals.h>
#include <libxml/xmlerror.h>
#include <libxml/HTMLparser.h>
+#include <libxml/HTMLtree.h>
#include <libxml/entities.h>
#include <libxml/encoding.h>
#include <libxml/valid.h>
@@ -57,6 +58,21 @@ int htmlOmittedDefaultValue = 1;
/************************************************************************
* *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+xmlChar * htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
+ xmlChar end, xmlChar end2, xmlChar end3);
+
+/************************************************************************
+ * *
* Parser stacks related functions and macros *
* *
************************************************************************/
@@ -95,8 +111,8 @@ scope type html##name##Pop(htmlParserCtxtPtr ctxt) { \
return(ret); \
} \
-PUSH_AND_POP(extern, xmlNodePtr, node)
-PUSH_AND_POP(extern, xmlChar*, name)
+/* PUSH_AND_POP(static, xmlNodePtr, node) */
+PUSH_AND_POP(static, xmlChar*, name)
/*
* Macros for accessing the content. Those should be used only by the parser,
@@ -189,7 +205,7 @@ PUSH_AND_POP(extern, xmlChar*, name)
* Returns the current char value and its lenght
*/
-int
+static int
htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
if (ctxt->instate == XML_PARSER_EOF)
return(0);
@@ -306,31 +322,6 @@ encoding_error:
}
/**
- * htmlNextChar:
- * @ctxt: the HTML parser context
- *
- * Skip to the next char input char.
- */
-
-void
-htmlNextChar(htmlParserCtxtPtr ctxt) {
- if (ctxt->instate == XML_PARSER_EOF)
- return;
- if ((*ctxt->input->cur == 0) &&
- (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) {
- xmlPopInput(ctxt);
- } else {
- if (*(ctxt->input->cur) == '\n') {
- ctxt->input->line++; ctxt->input->col = 1;
- } else ctxt->input->col++;
- ctxt->input->cur++;
- ctxt->nbChars++;
- if (*ctxt->input->cur == 0)
- xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
- }
-}
-
-/**
* htmlSkipBlankChars:
* @ctxt: the HTML parser context
*
@@ -339,7 +330,7 @@ htmlNextChar(htmlParserCtxtPtr ctxt) {
* Returns the number of space chars skipped
*/
-int
+static int
htmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
int res = 0;
@@ -478,7 +469,7 @@ htmlElemDesc html40ElementTable[] = {
* any tag of each line implies the end of the current element if the type of
* that element is in the same line
*/
-char *htmlEquEnd[] = {
+const char *htmlEquEnd[] = {
"dt", "dd", "li", "option", NULL,
"h1", "h2", "h3", "h4", "h5", "h6", NULL,
"ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL,
@@ -493,7 +484,7 @@ NULL
/*
* start tags that imply the end of current element
*/
-char *htmlStartClose[] = {
+const char *htmlStartClose[] = {
"form", "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
"dl", "ul", "ol", "menu", "dir", "address", "pre",
"listing", "xmp", "head", NULL,
@@ -557,7 +548,7 @@ NULL
* TODO: extend that list by reading the HTML SGML DtD on
* implied paragraph
*/
-static char *htmlNoContentElements[] = {
+static const char *htmlNoContentElements[] = {
"html",
"head",
"body",
@@ -569,7 +560,7 @@ static char *htmlNoContentElements[] = {
* NOTE: when adding ones, check htmlIsScriptAttribute() since
* it assumes the name starts with 'on'
*/
-static char *htmlScriptAttributes[] = {
+static const char *htmlScriptAttributes[] = {
"onclick",
"ondblclick",
"onmousedown",
@@ -591,7 +582,7 @@ static char *htmlScriptAttributes[] = {
};
-static char** htmlStartCloseIndex[100];
+static const char** htmlStartCloseIndex[100];
static int htmlStartCloseIndexinitialized = 0;
/************************************************************************
@@ -609,14 +600,14 @@ static int htmlStartCloseIndexinitialized = 0;
*/
void
htmlInitAutoClose(void) {
- int index, i = 0;
+ int indx, i = 0;
if (htmlStartCloseIndexinitialized) return;
- for (index = 0;index < 100;index ++) htmlStartCloseIndex[index] = NULL;
- index = 0;
- while ((htmlStartClose[i] != NULL) && (index < 100 - 1)) {
- htmlStartCloseIndex[index++] = &htmlStartClose[i];
+ for (indx = 0;indx < 100;indx ++) htmlStartCloseIndex[indx] = NULL;
+ indx = 0;
+ while ((htmlStartClose[i] != NULL) && (indx < 100 - 1)) {
+ htmlStartCloseIndex[indx++] = &htmlStartClose[i];
while (htmlStartClose[i] != NULL) i++;
i++;
}
@@ -633,7 +624,7 @@ htmlInitAutoClose(void) {
*/
htmlElemDescPtr
htmlTagLookup(const xmlChar *tag) {
- int i;
+ unsigned int i;
for (i = 0; i < (sizeof(html40ElementTable) /
sizeof(html40ElementTable[0]));i++) {
@@ -653,21 +644,21 @@ htmlTagLookup(const xmlChar *tag) {
*
* Returns 0 if no, 1 if yes.
*/
-int
+static int
htmlCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
- int i, index;
- char **close = NULL;
+ int i, indx;
+ const char **closed = NULL;
if (htmlStartCloseIndexinitialized == 0) htmlInitAutoClose();
/* inefficient, but not a big deal */
- for (index = 0; index < 100;index++) {
- close = htmlStartCloseIndex[index];
- if (close == NULL) return(0);
- if (xmlStrEqual(BAD_CAST *close, newtag)) break;
+ for (indx = 0; indx < 100;indx++) {
+ closed = htmlStartCloseIndex[indx];
+ if (closed == NULL) return(0);
+ if (xmlStrEqual(BAD_CAST *closed, newtag)) break;
}
- i = close - htmlStartClose;
+ i = closed - htmlStartClose;
i++;
while (htmlStartClose[i] != NULL) {
if (xmlStrEqual(BAD_CAST htmlStartClose[i], oldtag)) {
@@ -685,7 +676,7 @@ htmlCheckAutoClose(const xmlChar *newtag, const xmlChar *oldtag) {
*
* The HTmL DtD allows an ending tag to implicitely close other tags.
*/
-void
+static void
htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
htmlElemDescPtr info;
xmlChar *oldname;
@@ -739,7 +730,7 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
* If newtag is NULL this mean we are at the end of the resource
* and we should check
*/
-void
+static void
htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
xmlChar *oldname;
while ((newtag != NULL) && (ctxt->name != NULL) &&
@@ -843,7 +834,7 @@ htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) {
* called when a new tag has been detected and generates the
* appropriates implicit tags if missing
*/
-void
+static void
htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
if (!htmlOmittedDefaultValue)
return;
@@ -909,7 +900,7 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) {
* in case of error.
*/
-int
+static int
htmlCheckParagraph(htmlParserCtxtPtr ctxt) {
const xmlChar *tag;
int i;
@@ -953,7 +944,7 @@ htmlCheckParagraph(htmlParserCtxtPtr ctxt) {
*/
int
htmlIsScriptAttribute(const xmlChar *name) {
- int i;
+ unsigned int i;
if (name == NULL)
return(0);
@@ -1113,7 +1104,7 @@ htmlEntityDesc html40EntitiesTable[] = {
{ 920, "Theta","greek capital letter theta, U+0398 ISOgrk3" },
{ 921, "Iota", "greek capital letter iota, U+0399" },
{ 922, "Kappa","greek capital letter kappa, U+039A" },
-{ 923, "Lambda""greek capital letter lambda, U+039B ISOgrk3" },
+{ 923, "Lambda", "greek capital letter lambda, U+039B ISOgrk3" },
{ 924, "Mu", "greek capital letter mu, U+039C" },
{ 925, "Nu", "greek capital letter nu, U+039D" },
{ 926, "Xi", "greek capital letter xi, U+039E ISOgrk3" },
@@ -1291,7 +1282,7 @@ htmlEntityDesc html40EntitiesTable[] = {
*/
htmlEntityDescPtr
htmlEntityLookup(const xmlChar *name) {
- int i;
+ unsigned int i;
for (i = 0;i < (sizeof(html40EntitiesTable)/
sizeof(html40EntitiesTable[0]));i++) {
@@ -1316,16 +1307,16 @@ htmlEntityLookup(const xmlChar *name) {
* Returns the associated htmlEntityDescPtr if found, NULL otherwise.
*/
htmlEntityDescPtr
-htmlEntityValueLookup(int value) {
- int i;
+htmlEntityValueLookup(unsigned int value) {
+ unsigned int i;
#ifdef DEBUG
int lv = 0;
#endif
for (i = 0;i < (sizeof(html40EntitiesTable)/
sizeof(html40EntitiesTable[0]));i++) {
- if ((unsigned int) html40EntitiesTable[i].value >= value) {
- if ((unsigned int) html40EntitiesTable[i].value > value)
+ if (html40EntitiesTable[i].value >= value) {
+ if (html40EntitiesTable[i].value > value)
break;
#ifdef DEBUG
xmlGenericError(xmlGenericErrorContext,"Found entity %s\n", html40EntitiesTable[i].name);
@@ -1503,7 +1494,8 @@ htmlEncodeEntities(unsigned char* out, int *outlen,
}
/* assertion: c is a single UTF-4 value */
- if (c < 0x80 && c != quoteChar && c != '&' && c != '<' && c != '>') {
+ if ((c < 0x80) && (c != (unsigned int) quoteChar) &&
+ (c != '&') && (c != '<') && (c != '>')) {
if (out >= outend)
break;
*out++ = c;
@@ -1554,8 +1546,16 @@ htmlEncodeEntities(unsigned char* out, int *outlen,
* must deallocate it !
*/
xmlChar *
-htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
- xmlChar end, xmlChar end2, xmlChar end3) {
+htmlDecodeEntities(htmlParserCtxtPtr ctxt UNUSED, int len UNUSED,
+ xmlChar end UNUSED, xmlChar end2 UNUSED, xmlChar end3 UNUSED) {
+ static int deprecated = 0;
+ if (!deprecated) {
+ xmlGenericError(xmlGenericErrorContext,
+ "htmlDecodeEntities() deprecated function reached\n");
+ deprecated = 1;
+ }
+ return(NULL);
+#if 0
xmlChar *name = NULL;
xmlChar *buffer = NULL;
unsigned int buffer_size = 0;
@@ -1627,6 +1627,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
}
buffer[nbchars++] = 0;
return(buffer);
+#endif
}
/************************************************************************
@@ -1636,33 +1637,13 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len,
************************************************************************/
/**
- * htmlFreeInputStream:
- * @input: an htmlParserInputPtr
- *
- * Free up an input stream.
- */
-void
-htmlFreeInputStream(htmlParserInputPtr input) {
- if (input == NULL) return;
-
- if (input->filename != NULL) xmlFree((char *) input->filename);
- if (input->directory != NULL) xmlFree((char *) input->directory);
- if ((input->free != NULL) && (input->base != NULL))
- input->free((xmlChar *) input->base);
- if (input->buf != NULL)
- xmlFreeParserInputBuffer(input->buf);
- MEM_CLEANUP(input, sizeof(htmlParserInput));
- xmlFree(input);
-}
-
-/**
* htmlNewInputStream:
* @ctxt: an HTML parser context
*
* Create a new input stream structure
* Returns the new input stream or NULL
*/
-htmlParserInputPtr
+static htmlParserInputPtr
htmlNewInputStream(htmlParserCtxtPtr ctxt) {
htmlParserInputPtr input;
@@ -1742,37 +1723,6 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
}
/**
- * htmlHandleEntity:
- * @ctxt: an HTML parser context
- * @entity: an XML entity pointer.
- *
- * Default handling of an HTML entity, call the parser with the
- * substitution string
- */
-
-void
-htmlHandleEntity(htmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
- int len;
-
- if (entity->content == NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "htmlHandleEntity %s: content == NULL\n",
- entity->name);
- ctxt->wellFormed = 0;
- return;
- }
- len = xmlStrlen(entity->content);
-
- /*
- * Just handle the content as a set of chars.
- */
- htmlCheckParagraph(ctxt);
- if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, entity->content, len);
-
-}
-
-/**
* htmlNewDocNoDtD:
* @URI: URI for the dtd, or NULL
* @ExternalID: the external ID of the DTD, or NULL
@@ -1857,7 +1807,7 @@ htmlNewDoc(const xmlChar *URI, const xmlChar *ExternalID) {
* Returns the Tag Name parsed or NULL
*/
-xmlChar *
+static xmlChar *
htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
xmlChar *ret = NULL;
int i = 0;
@@ -1890,7 +1840,7 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) {
* Returns the Name parsed or NULL
*/
-xmlChar *
+static xmlChar *
htmlParseName(htmlParserCtxtPtr ctxt) {
xmlChar buf[HTML_MAX_NAMELEN];
int len = 0;
@@ -1933,7 +1883,7 @@ htmlParseName(htmlParserCtxtPtr ctxt) {
* Returns the attribute parsed or NULL
*/
-xmlChar *
+static xmlChar *
htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
xmlChar *buffer = NULL;
int buffer_size = 0;
@@ -1982,20 +1932,20 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
if (name == NULL) {
*out++ = '&';
if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ int indx = out - buffer;
growBuffer(buffer);
- out = &buffer[index];
+ out = &buffer[indx];
}
} else if (ent == NULL) {
*out++ = '&';
cur = name;
while (*cur != 0) {
if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ int indx = out - buffer;
growBuffer(buffer);
- out = &buffer[index];
+ out = &buffer[indx];
}
*out++ = *cur++;
}
@@ -2005,10 +1955,10 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
int bits;
if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ int indx = out - buffer;
growBuffer(buffer);
- out = &buffer[index];
+ out = &buffer[indx];
}
c = (xmlChar)ent->value;
if (c < 0x80)
@@ -2031,10 +1981,10 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
int bits, l;
if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ int indx = out - buffer;
growBuffer(buffer);
- out = &buffer[index];
+ out = &buffer[indx];
}
c = CUR_CHAR(l);
if (c < 0x80)
@@ -2057,43 +2007,6 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) {
}
/**
- * htmlParseNmtoken:
- * @ctxt: an HTML parser context
- *
- * parse an HTML Nmtoken.
- *
- * Returns the Nmtoken parsed or NULL
- */
-
-xmlChar *
-htmlParseNmtoken(htmlParserCtxtPtr ctxt) {
- xmlChar buf[HTML_MAX_NAMELEN];
- int len = 0;
-
- GROW;
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR))) {
- buf[len++] = CUR;
- NEXT;
- if (len >= HTML_MAX_NAMELEN) {
- xmlGenericError(xmlGenericErrorContext,
- "htmlParseNmtoken: reached HTML_MAX_NAMELEN limit\n");
- while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) ||
- (CUR == '.') || (CUR == '-') ||
- (CUR == '_') || (CUR == ':') ||
- (IS_COMBINING(CUR)) ||
- (IS_EXTENDER(CUR)))
- NEXT;
- break;
- }
- }
- return(xmlStrndup(buf, len));
-}
-
-/**
* htmlParseEntityRef:
* @ctxt: an HTML parser context
* @str: location to store the entity name
@@ -2152,7 +2065,7 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, xmlChar **str) {
* Returns the AttValue parsed or NULL.
*/
-xmlChar *
+static xmlChar *
htmlParseAttValue(htmlParserCtxtPtr ctxt) {
xmlChar *ret = NULL;
@@ -2199,7 +2112,7 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) {
* Returns the SystemLiteral parsed or NULL
*/
-xmlChar *
+static xmlChar *
htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
const xmlChar *q;
xmlChar *ret = NULL;
@@ -2251,7 +2164,7 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) {
* Returns the PubidLiteral parsed or NULL.
*/
-xmlChar *
+static xmlChar *
htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
const xmlChar *q;
xmlChar *ret = NULL;
@@ -2313,7 +2226,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
* as CDATA but SGML allows entities references in attributes so their
* processing is identical as other attributes
*/
-void
+static void
htmlParseScript(htmlParserCtxtPtr ctxt) {
xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 1];
int nbchar = 0;
@@ -2368,7 +2281,6 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
/**
* htmlParseCharData:
* @ctxt: an HTML parser context
- * @cdata: int indicating whether we are within a CDATA section
*
* parse a CharData section.
* if we are within a CDATA section ']]>' marks an end of section.
@@ -2376,8 +2288,8 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
* [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
*/
-void
-htmlParseCharData(htmlParserCtxtPtr ctxt, int cdata) {
+static void
+htmlParseCharData(htmlParserCtxtPtr ctxt) {
xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5];
int nbchar = 0;
int cur, l;
@@ -2429,14 +2341,9 @@ htmlParseCharData(htmlParserCtxtPtr ctxt, int cdata) {
* htmlParseExternalID:
* @ctxt: an HTML parser context
* @publicID: a xmlChar** receiving PubidLiteral
- * @strict: indicate whether we should restrict parsing to only
- * production [75], see NOTE below
*
* Parse an External ID or a Public ID
*
- * NOTE: Productions [75] and [83] interract badly since [75] can generate
- * 'PUBLIC' S PubidLiteral S SystemLiteral
- *
* [75] ExternalID ::= 'SYSTEM' S SystemLiteral
* | 'PUBLIC' S PubidLiteral S SystemLiteral
*
@@ -2447,8 +2354,8 @@ htmlParseCharData(htmlParserCtxtPtr ctxt, int cdata) {
* it is possible to return NULL and have publicID set.
*/
-xmlChar *
-htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
+static xmlChar *
+htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID) {
xmlChar *URI = NULL;
if ((UPPER == 'S') && (UPP(1) == 'Y') &&
@@ -2503,7 +2410,7 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) {
*
* [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
*/
-void
+static void
htmlParseComment(htmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len;
@@ -2662,7 +2569,7 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) {
* ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
*/
-void
+static void
htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
xmlChar *name;
xmlChar *ExternalID = NULL;
@@ -2693,7 +2600,7 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
/*
* Check for SystemID and ExternalID
*/
- URI = htmlParseExternalID(ctxt, &ExternalID, 0);
+ URI = htmlParseExternalID(ctxt, &ExternalID);
SKIP_BLANKS;
/*
@@ -2743,7 +2650,7 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) {
* Returns the attribute name, and the value in *value.
*/
-xmlChar *
+static xmlChar *
htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
xmlChar *name, *val = NULL;
@@ -2786,7 +2693,7 @@ htmlParseAttribute(htmlParserCtxtPtr ctxt, xmlChar **value) {
* If a new encoding is detected the parser is switched to decode
* it and pass UTF8
*/
-void
+static void
htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
const xmlChar *encoding;
@@ -2869,7 +2776,7 @@ htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
*
* Checks an attributes from a Meta tag
*/
-void
+static void
htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) {
int i;
const xmlChar *att, *value;
@@ -2914,7 +2821,7 @@ htmlCheckMeta(htmlParserCtxtPtr ctxt, const xmlChar **atts) {
*
*/
-void
+static void
htmlParseStartTag(htmlParserCtxtPtr ctxt) {
xmlChar *name;
xmlChar *attname;
@@ -2975,9 +2882,9 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
return;
}
if (xmlStrEqual(name, BAD_CAST"body")) {
- int i;
- for (i = 0;i < ctxt->nameNr;i++) {
- if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) {
+ int indx;
+ for (indx = 0;indx < ctxt->nameNr;indx++) {
+ if (xmlStrEqual(ctxt->nameTab[indx], BAD_CAST"body")) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
"htmlParseStartTag: misplaced <body> tag\n");
@@ -3108,7 +3015,7 @@ failed:
* [NS 9] ETag ::= '</' QName S? '>'
*/
-void
+static void
htmlParseEndTag(htmlParserCtxtPtr ctxt) {
xmlChar *name;
xmlChar *oldname;
@@ -3213,7 +3120,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt) {
* this will end-up in a call to character() since this is either a
* CharRef, or a predefined entity.
*/
-void
+static void
htmlParseReference(htmlParserCtxtPtr ctxt) {
htmlEntityDescPtr ent;
xmlChar out[6];
@@ -3292,7 +3199,7 @@ htmlParseReference(htmlParserCtxtPtr ctxt) {
*
*/
-void
+static void
htmlParseContent(htmlParserCtxtPtr ctxt) {
xmlChar *currentNode;
int depth;
@@ -3381,7 +3288,7 @@ htmlParseContent(htmlParserCtxtPtr ctxt) {
* Last case, text. Note that References are handled directly.
*/
else {
- htmlParseCharData(ctxt, 0);
+ htmlParseCharData(ctxt);
}
if (cons == ctxt->nbChars) {
@@ -3592,7 +3499,7 @@ htmlParseElement(htmlParserCtxtPtr ctxt) {
* as a result of the parsing.
*/
-int
+static int
htmlParseDocument(htmlParserCtxtPtr ctxt) {
xmlDtdPtr dtd;
@@ -3696,7 +3603,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
* Initialize a parser context
*/
-void
+static void
htmlInitParserCtxt(htmlParserCtxtPtr ctxt)
{
htmlSAXHandler *sax;
@@ -3806,10 +3713,12 @@ htmlFreeParserCtxt(htmlParserCtxtPtr ctxt)
*
* Create a parser context for an HTML document.
*
+ * TODO: check the need to add encoding handling there
+ *
* Returns the new parser context or NULL
*/
-htmlParserCtxtPtr
-htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding) {
+static htmlParserCtxtPtr
+htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding UNUSED) {
htmlParserCtxtPtr ctxt;
htmlParserInputPtr input;
/* htmlCharEncoding enc; */
@@ -3860,7 +3769,7 @@ htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding) {
* Returns the index to the current parsing point if the full sequence
* is available, -1 otherwise.
*/
-int
+static int
htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
xmlChar next, xmlChar third) {
int base, len;
@@ -3933,7 +3842,7 @@ htmlParseLookupSequence(htmlParserCtxtPtr ctxt, xmlChar first,
*
* Returns zero if no parsing was possible
*/
-int
+static int
htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
int ret = 0;
htmlParserInputPtr in;
@@ -4158,7 +4067,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
goto done;
cur = in->cur[0];
if (IS_BLANK(cur)) {
- htmlParseCharData(ctxt, 0);
+ htmlParseCharData(ctxt);
goto done;
}
if (avail < 2)
@@ -4466,7 +4375,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
xmlGenericError(xmlGenericErrorContext,
"HPP: Parsing char data\n");
#endif
- htmlParseCharData(ctxt, 0);
+ htmlParseCharData(ctxt);
}
}
if (cons == ctxt->nbChars) {
@@ -4622,19 +4531,6 @@ done:
}
/**
- * htmlParseTry:
- * @ctxt: an HTML parser context
- *
- * Try to progress on parsing
- *
- * Returns zero if no parsing was possible
- */
-int
-htmlParseTry(htmlParserCtxtPtr ctxt) {
- return(htmlParseTryOrFinish(ctxt, 0));
-}
-
-/**
* htmlParseChunk:
* @ctxt: an XML parser context
* @chunk: an char array
diff --git a/HTMLparser.h b/HTMLparser.h
index c79ad09c..b129175a 100644
--- a/HTMLparser.h
+++ b/HTMLparser.h
@@ -49,7 +49,7 @@ struct _htmlElemDesc {
typedef struct _htmlEntityDesc htmlEntityDesc;
typedef htmlEntityDesc *htmlEntityDescPtr;
struct _htmlEntityDesc {
- int value; /* the UNICODE value for the character */
+ unsigned int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
@@ -59,7 +59,7 @@ struct _htmlEntityDesc {
*/
htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
-htmlEntityDescPtr htmlEntityValueLookup(int value);
+htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
int htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
diff --git a/HTMLtree.c b/HTMLtree.c
index bc328fc8..a542a579 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -36,6 +36,18 @@
/************************************************************************
* *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+/************************************************************************
+ * *
* Getting/Setting encoding meta tags *
* *
************************************************************************/
@@ -680,10 +692,13 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
* @doc: the document
* @encoding: the encoding string
*
+ * TODO: check whether encoding is needed
+ *
* Dump the HTML document DTD, if any.
*/
static void
-htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding) {
+htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
+ const char *encoding UNUSED) {
xmlDtdPtr cur = doc->intSubset;
if (cur == NULL) {
@@ -717,7 +732,8 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, const char *encoding) {
* Dump an HTML attribute
*/
static void
-htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, const char *encoding) {
+htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
+ const char *encoding UNUSED) {
xmlChar *value;
if (cur == NULL) {
diff --git a/SAX.c b/SAX.c
index 9d6218fa..ef5801bd 100644
--- a/SAX.c
+++ b/SAX.c
@@ -31,6 +31,16 @@
/* #define DEBUG_SAX */
/* #define DEBUG_SAX_TREE */
+#ifdef __GNUC__
+#ifndef DEBUG_SAX
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+#else
+#define UNUSED
+#endif
+
/**
* getPublicId:
* @ctx: the user data (XML parser context)
@@ -40,7 +50,7 @@
* Returns a xmlChar *
*/
const xmlChar *
-getPublicId(void *ctx)
+getPublicId(void *ctx UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
return(NULL);
@@ -59,7 +69,7 @@ const xmlChar *
getSystemId(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
- return(BAD_CAST ctxt->input->filename);
+ return((const xmlChar *) ctxt->input->filename);
}
/**
@@ -648,7 +658,7 @@ unparsedEntityDecl(void *ctx, const xmlChar *name,
* Everything is available on the context, so this is useless in our case.
*/
void
-setDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
+setDocumentLocator(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
@@ -693,7 +703,7 @@ startDocument(void *ctx)
}
if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) &&
(ctxt->input != NULL) && (ctxt->input->filename != NULL)) {
- ctxt->myDoc->URL = xmlStrdup((xmlChar *) ctxt->input->filename);
+ ctxt->myDoc->URL = xmlStrdup((const xmlChar *) ctxt->input->filename);
}
}
@@ -1082,7 +1092,7 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
* called when the end of an element has been detected.
*/
void
-endElement(void *ctx, const xmlChar *name)
+endElement(void *ctx, const xmlChar *name UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserNodeInfo node_info;
@@ -1261,7 +1271,7 @@ characters(void *ctx, const xmlChar *ch, int len)
* Question: how much at a time ???
*/
void
-ignorableWhitespace(void *ctx, const xmlChar *ch, int len)
+ignorableWhitespace(void *ctx UNUSED, const xmlChar *ch UNUSED, int len UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
diff --git a/configure.in b/configure.in
index 4a73b3dd..ccdc2dbc 100644
--- a/configure.in
+++ b/configure.in
@@ -237,7 +237,8 @@ dnl fi
if test "${with_xptr}" = "" ; then
with_xptr="yes"
fi
- CFLAGS="-Wall -g -pedantic"
+ CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
+dnl -Wcast-qual
fi
dnl
dnl Aloow to disable various pieces
diff --git a/debugXML.c b/debugXML.c
index 65d703d6..73429c32 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -33,6 +33,18 @@
#include <libxml/HTMLparser.h>
#include <libxml/xmlerror.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
#define IS_BLANK(c) \
(((c) == '\n') || ((c) == '\r') || ((c) == '\t') || ((c) == ' '))
@@ -51,7 +63,8 @@ void xmlDebugDumpString(FILE *output, const xmlChar *str) {
fprintf(output, "...");
}
-void xmlDebugDumpDtd(FILE *output, xmlDtdPtr dtd, int depth) {
+static void
+xmlDebugDumpDtdNode(FILE *output, xmlDtdPtr dtd, int depth) {
int i;
char shift[100];
@@ -99,7 +112,8 @@ void xmlDebugDumpDtd(FILE *output, xmlDtdPtr dtd, int depth) {
}
}
-void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
+static void
+xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
int i;
char shift[100];
@@ -154,11 +168,11 @@ void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
break;
}
if (attr->tree != NULL) {
- int i;
+ int indx;
xmlEnumerationPtr cur = attr->tree;
- for (i = 0;i < 5; i++) {
- if (i != 0)
+ for (indx = 0;indx < 5; indx++) {
+ if (indx != 0)
fprintf(output, "|%s", cur->name);
else
fprintf(output, " (%s", cur->name);
@@ -215,7 +229,8 @@ void xmlDebugDumpAttrDecl(FILE *output, xmlAttributePtr attr, int depth) {
}
}
-void xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
+static void
+xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
int i;
char shift[100];
@@ -284,7 +299,8 @@ void xmlDebugDumpElemDecl(FILE *output, xmlElementPtr elem, int depth) {
}
}
-void xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
+static void
+xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
int i;
char shift[100];
@@ -368,7 +384,8 @@ void xmlDebugDumpEntityDecl(FILE *output, xmlEntityPtr ent, int depth) {
}
}
-void xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
+static void
+xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
int i;
char shift[100];
@@ -397,14 +414,16 @@ void xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
}
}
-void xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) {
+static void
+xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) {
while (ns != NULL) {
xmlDebugDumpNamespace(output, ns, depth);
ns = ns->next;
}
}
-void xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) {
+static void
+xmlDebugDumpEntity(FILE *output, xmlEntityPtr ent, int depth) {
int i;
char shift[100];
@@ -563,7 +582,7 @@ void xmlDebugDumpOneNode(FILE *output, xmlNodePtr node, int depth) {
fprintf(output, "NOTATION\n");
break;
case XML_DTD_NODE:
- xmlDebugDumpDtd(output, (xmlDtdPtr) node, depth);
+ xmlDebugDumpDtdNode(output, (xmlDtdPtr) node, depth);
return;
case XML_ELEMENT_DECL:
xmlDebugDumpElemDecl(output, (xmlElementPtr) node, depth);
@@ -786,8 +805,8 @@ void xmlDebugDumpDTD(FILE *output, xmlDtdPtr dtd) {
xmlDebugDumpNodeList(output, dtd->children, 1);
}
-void xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output,
- const xmlChar *name) {
+static void
+xmlDebugDumpEntityCallback(xmlEntityPtr cur, FILE *output) {
fprintf(output, "%s : ", cur->name);
switch (cur->etype) {
case XML_INTERNAL_GENERAL_ENTITY:
@@ -1067,9 +1086,9 @@ void xmlLsOneNode(FILE *output, xmlNodePtr node) {
*
* Returns 0
*/
-int
-xmlShellList(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellList(xmlShellCtxtPtr ctxt UNUSED , char *arg UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 UNUSED) {
xmlNodePtr cur;
if ((node->type == XML_DOCUMENT_NODE) ||
@@ -1100,9 +1119,9 @@ xmlShellList(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
*
* Returns 0
*/
-int
-xmlShellDir(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellDir(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 UNUSED) {
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE)) {
xmlDebugDumpDocumentHead(stdout, (xmlDocPtr) node);
@@ -1126,9 +1145,9 @@ xmlShellDir(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
*
* Returns 0
*/
-int
-xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellCat(xmlShellCtxtPtr ctxt, char *arg UNUSED, xmlNodePtr node,
+ xmlNodePtr node2 UNUSED) {
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
#ifdef LIBXML_HTML_ENABLED
if (node->type == XML_HTML_DOCUMENT_NODE)
@@ -1163,9 +1182,9 @@ xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
*
* Returns 0 or -1 if loading failed
*/
-int
-xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED,
+ xmlNodePtr node2 UNUSED) {
xmlDocPtr doc;
int html = 0;
@@ -1215,9 +1234,9 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
*
* Returns 0 or -1 in case of error
*/
-int
+static int
xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
- xmlNodePtr node2) {
+ xmlNodePtr node2 UNUSED) {
if (node == NULL)
return(-1);
if ((filename == NULL) || (filename[0] == 0)) {
@@ -1283,9 +1302,9 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
*
* Returns 0 or -1 in case of error
*/
-int
-xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node UNUSED,
+ xmlNodePtr node2 UNUSED) {
if (ctxt->doc == NULL)
return(-1);
if ((filename == NULL) || (filename[0] == 0))
@@ -1339,9 +1358,9 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
*
* Returns 0 or -1 in case of error
*/
-int
-xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node UNUSED,
+ xmlNodePtr node2 UNUSED) {
xmlValidCtxt vctxt;
int res = -1;
@@ -1377,9 +1396,9 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node,
*
* Returns 0 or -1 in case of error
*/
-int
-xmlShellDu(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree,
- xmlNodePtr node2) {
+static int
+xmlShellDu(xmlShellCtxtPtr ctxt UNUSED, char *arg UNUSED, xmlNodePtr tree,
+ xmlNodePtr node2 UNUSED) {
xmlNodePtr node;
int indent = 0,i;
@@ -1453,9 +1472,9 @@ xmlShellDu(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree,
*
* Returns 0 or -1 in case of error
*/
-int
-xmlShellPwd(xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node,
- xmlNodePtr node2) {
+static int
+xmlShellPwd(xmlShellCtxtPtr ctxt UNUSED, char *buffer, xmlNodePtr node,
+ xmlNodePtr node2 UNUSED) {
xmlNodePtr cur, tmp, next;
char buf[500];
char sep;
@@ -1605,6 +1624,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
* Parse the command itself
*/
cur = cmdline;
+ nbargs = 0;
while ((*cur == ' ') || (*cur == '\t')) cur++;
i = 0;
while ((*cur != ' ') && (*cur != '\t') &&
@@ -1685,15 +1705,16 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
"%s: no such node\n", arg);
break;
case XPATH_NODESET: {
- int i;
+ int indx;
- for (i = 0;i < list->nodesetval->nodeNr;i++) {
+ for (indx = 0;indx < list->nodesetval->nodeNr;
+ indx++) {
if (dir)
xmlShellDir(ctxt, NULL,
- list->nodesetval->nodeTab[i], NULL);
+ list->nodesetval->nodeTab[indx], NULL);
else
xmlShellList(ctxt, NULL,
- list->nodesetval->nodeTab[i], NULL);
+ list->nodesetval->nodeTab[indx], NULL);
}
break;
}
@@ -1819,12 +1840,13 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
"%s: no such node\n", arg);
break;
case XPATH_NODESET: {
- int i;
+ int indx;
- for (i = 0;i < list->nodesetval->nodeNr;i++) {
+ for (indx = 0;indx < list->nodesetval->nodeNr;
+ indx++) {
if (i > 0) printf(" -------\n");
xmlShellCat(ctxt, NULL,
- list->nodesetval->nodeTab[i], NULL);
+ list->nodesetval->nodeTab[indx], NULL);
}
break;
}
diff --git a/doc/xml.html b/doc/xml.html
index fece34f1..f7b1ccd0 100644
--- a/doc/xml.html
+++ b/doc/xml.html
@@ -1,5 +1,3 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>The XML C library for Gnome</title>
@@ -246,6 +244,15 @@ you want to test those</p>
docs</li>
</ul>
+<h3>2.3.5: Mar 23 2001</h3>
+<ul>
+ <li>Biggest change is separate parsing and evaluation of XPath expressions,
+ there is some new APIs for this too</li>
+ <li>included a number of bug fixes(XML push parser, 51876, notations,
+ 52299)</li>
+ <li>Fixed some portability issues</li>
+</ul>
+
<h3>2.3.4: Mar 10 2001</h3>
<ul>
<li>Fixed bugs #51860 and #51861</li>
@@ -1481,6 +1488,6 @@ Gnome CVS base under gnome-xml/example</p>
<p><a href="mailto:Daniel.Veillard@imag.fr">Daniel Veillard</a></p>
-<p>$Id: xml.html,v 1.74 2001/03/10 12:32:02 veillard Exp $</p>
+<p>$Id: xml.html,v 1.75 2001/03/21 10:28:36 veillard Exp $</p>
</body>
</html>
diff --git a/encoding.c b/encoding.c
index fab241e6..41f23254 100644
--- a/encoding.c
+++ b/encoding.c
@@ -91,7 +91,7 @@ static int xmlLittleEndian = 1;
* Returns the char value or -1 in case of error and update @len with the
* number of bytes used
*/
-int
+static int
xmlGetUTF8Char(const unsigned char *utf, int *len) {
unsigned int c;
@@ -206,7 +206,7 @@ xmlCheckUTF8(const unsigned char *utf)
* as the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of ocetes consumed.
*/
-int
+static int
asciiToUTF8(unsigned char* out, int *outlen,
const unsigned char* in, int *inlen) {
unsigned char* outstart = out;
@@ -258,7 +258,7 @@ asciiToUTF8(unsigned char* out, int *outlen,
* as the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of ocetes consumed.
*/
-int
+static int
UTF8Toascii(unsigned char* out, int *outlen,
const unsigned char* in, int *inlen) {
const unsigned char* processed = in;
@@ -478,7 +478,7 @@ UTF8Toisolat1(unsigned char* out, int *outlen,
* The value of *inlen after return is the number of octets consumed
* as the return value is positive, else unpredictiable.
*/
-int
+static int
UTF16LEToUTF8(unsigned char* out, int *outlen,
const unsigned char* inb, int *inlenb)
{
@@ -562,7 +562,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
* Returns the number of byte written, or -1 by lack of space, or -2
* if the transcoding failed.
*/
-int
+static int
UTF8ToUTF16LE(unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen)
{
@@ -685,7 +685,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
* The value of *inlen after return is the number of octets consumed
* as the return value is positive, else unpredictiable.
*/
-int
+static int
UTF16BEToUTF8(unsigned char* out, int *outlen,
const unsigned char* inb, int *inlenb)
{
@@ -773,7 +773,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
* Returns the number of byte written, or -1 by lack of space, or -2
* if the transcoding failed.
*/
-int
+static int
UTF8ToUTF16BE(unsigned char* outb, int *outlen,
const unsigned char* in, int *inlen)
{
@@ -1247,7 +1247,7 @@ static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
* Create and registers an xmlCharEncodingHandler.
* Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error).
*/
-xmlCharEncodingHandlerPtr
+static xmlCharEncodingHandlerPtr
xmlNewCharEncodingHandler(const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output) {
@@ -1662,9 +1662,7 @@ xmlIconvWrapper(iconv_t cd,
char *icv_out = (char *) out;
int ret;
- ret = iconv(cd,
- &icv_in, &icv_inlen,
- &icv_out, &icv_outlen);
+ ret = iconv(cd, &icv_in, &icv_inlen, &icv_out, &icv_outlen);
if (in != NULL) {
*inlen -= icv_inlen;
*outlen -= icv_outlen;
@@ -1672,7 +1670,7 @@ xmlIconvWrapper(iconv_t cd,
*inlen = 0;
*outlen = 0;
}
- if (icv_inlen != 0 || ret == (size_t) -1) {
+ if ((icv_inlen != 0) || (ret == -1)) {
#ifdef EILSEQ
if (errno == EILSEQ) {
return -2;
diff --git a/encoding.h b/encoding.h
index 62e81e3d..527a08cb 100644
--- a/encoding.h
+++ b/encoding.h
@@ -180,6 +180,17 @@ int xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr in);
int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
+/*
+ * Export a few useful functions
+ */
+int UTF8Toisolat1 (unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen);
+int isolat1ToUTF8 (unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen);
#ifdef __cplusplus
}
#endif
diff --git a/entities.c b/entities.c
index 8885c89b..3eea5f10 100644
--- a/entities.c
+++ b/entities.c
@@ -24,23 +24,6 @@
#include <libxml/xmlerror.h>
#define DEBUG_ENT_REF /* debugging of cross entities dependancies */
-#define ENTITY_HASH_SIZE 256 /* modify xmlEntityComputeHash accordingly */
-
-/*
- * xmlEntityComputeHash:
- *
- * Computes the hash value for this given entity
- */
-int
-xmlEntityComputeHash(const xmlChar *name) {
- register const unsigned char *cur = (const unsigned char *) name;
- register unsigned char val = 0;
-
- if (name == NULL)
- return(val);
- while (*cur) val += *cur++;
- return(val);
-}
/*
* The XML predefined entities.
@@ -67,7 +50,7 @@ xmlHashTablePtr xmlPredefinedEntities = NULL;
/*
* xmlFreeEntity : clean-up an entity record.
*/
-void xmlFreeEntity(xmlEntityPtr entity) {
+static void xmlFreeEntity(xmlEntityPtr entity) {
if (entity == NULL) return;
if (entity->children)
@@ -166,7 +149,7 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type,
* Set up the predefined entities.
*/
void xmlInitializePredefinedEntities(void) {
- int i;
+ unsigned int i;
xmlChar name[50];
xmlChar value[50];
const char *in;
@@ -326,7 +309,7 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type,
*
* Returns A pointer to the entity structure or NULL if not found.
*/
-xmlEntityPtr
+static xmlEntityPtr
xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name) {
return((xmlEntityPtr) xmlHashLookup(table, name));
}
@@ -428,13 +411,13 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
/*
* A buffer used for converting entities to their equivalent and back.
*/
-static int buffer_size = 0;
-static xmlChar *buffer = NULL;
+static int static_buffer_size = 0;
+static xmlChar *static_buffer = NULL;
-int growBuffer(void) {
- buffer_size *= 2;
- buffer = (xmlChar *) xmlRealloc(buffer, buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
+static int growBuffer(void) {
+ static_buffer_size *= 2;
+ static_buffer = (xmlChar *) xmlRealloc(static_buffer, static_buffer_size * sizeof(xmlChar));
+ if (static_buffer == NULL) {
perror("realloc failed");
return(-1);
}
@@ -461,7 +444,7 @@ int growBuffer(void) {
const xmlChar *
xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
const xmlChar *cur = input;
- xmlChar *out = buffer;
+ xmlChar *out = static_buffer;
static int warning = 1;
int html = 0;
@@ -478,21 +461,21 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
if (doc != NULL)
html = (doc->type == XML_HTML_DOCUMENT_NODE);
- if (buffer == NULL) {
- buffer_size = 1000;
- buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
- if (buffer == NULL) {
+ if (static_buffer == NULL) {
+ static_buffer_size = 1000;
+ static_buffer = (xmlChar *) xmlMalloc(static_buffer_size * sizeof(xmlChar));
+ if (static_buffer == NULL) {
perror("malloc failed");
return(NULL);
}
- out = buffer;
+ out = static_buffer;
}
while (*cur != '\0') {
- if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ if (out - static_buffer > static_buffer_size - 100) {
+ int indx = out - static_buffer;
growBuffer();
- out = &buffer[index];
+ out = &static_buffer[indx];
}
/*
@@ -572,7 +555,7 @@ xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
cur++;
}
*out++ = 0;
- return(buffer);
+ return(static_buffer);
}
/*
@@ -626,10 +609,10 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
while (*cur != '\0') {
if (out - buffer > buffer_size - 100) {
- int index = out - buffer;
+ int indx = out - buffer;
growBufferReentrant();
- out = &buffer[index];
+ out = &buffer[indx];
}
/*
@@ -819,10 +802,10 @@ xmlEncodeSpecialChars(xmlDocPtr doc, const xmlChar *input) {
while (*cur != '\0') {
if (out - buffer > buffer_size - 10) {
- int index = out - buffer;
+ int indx = out - buffer;
growBufferReentrant();
- out = &buffer[index];
+ out = &buffer[indx];
}
/*
@@ -895,7 +878,7 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) {
*
* Returns the new xmlEntitiesPtr or NULL in case of error.
*/
-xmlEntityPtr
+static xmlEntityPtr
xmlCopyEntity(xmlEntityPtr ent) {
xmlEntityPtr cur;
diff --git a/error.c b/error.c
index 25066ea1..cf1c1a54 100644
--- a/error.c
+++ b/error.c
@@ -18,6 +18,11 @@
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
/************************************************************************
* *
* Handling of out of context errors *
@@ -32,8 +37,8 @@
*
* Default handler for out of context error messages.
*/
-void
-xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...) {
+static void
+xmlGenericErrorDefaultFunc(void *ctx UNUSED, const char *msg, ...) {
va_list args;
if (xmlGenericErrorContext == NULL)
@@ -146,7 +151,7 @@ xmlParserPrintFileContext(xmlParserInputPtr input) {
* Get an arbitrary-sized string for an error argument
* The caller must free() the returned string
*/
-char *
+static char *
xmlGetVarStr(const char * msg, va_list args) {
int size;
int length;
diff --git a/example/gjobread.c b/example/gjobread.c
index e4151739..fd83c13c 100644
--- a/example/gjobread.c
+++ b/example/gjobread.c
@@ -42,7 +42,8 @@ typedef struct person {
/*
* And the code needed to parse it
*/
-personPtr parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
+static personPtr
+parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
personPtr ret = NULL;
DEBUG("parsePerson\n");
@@ -75,7 +76,8 @@ DEBUG("parsePerson\n");
/*
* and to print it
*/
-void printPerson(personPtr cur) {
+static void
+printPerson(personPtr cur) {
if (cur == NULL) return;
printf("------ Person\n");
if (cur->name) printf(" name: %s\n", cur->name);
@@ -103,7 +105,8 @@ typedef struct job {
/*
* And the code needed to parse it
*/
-jobPtr parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
+static jobPtr
+parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
jobPtr ret = NULL;
DEBUG("parseJob\n");
@@ -148,7 +151,8 @@ DEBUG("parseJob\n");
/*
* and to print it
*/
-void printJob(jobPtr cur) {
+static void
+printJob(jobPtr cur) {
int i;
if (cur == NULL) return;
@@ -172,10 +176,11 @@ typedef struct gjob {
} gJob, *gJobPtr;
-gJobPtr parseGjobFile(char *filename) {
+static gJobPtr
+parseGjobFile(char *filename) {
xmlDocPtr doc;
gJobPtr ret;
- jobPtr job;
+ jobPtr curjob;
xmlNsPtr ns;
xmlNodePtr cur;
@@ -247,9 +252,9 @@ gJobPtr parseGjobFile(char *filename) {
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *) "Job")) &&
(cur->ns == ns)) {
- job = parseJob(doc, ns, cur);
- if (job != NULL)
- ret->jobs[ret->nbJobs++] = job;
+ curjob = parseJob(doc, ns, cur);
+ if (curjob != NULL)
+ ret->jobs[ret->nbJobs++] = curjob;
if (ret->nbJobs >= 500) break;
}
cur = cur->next;
@@ -258,7 +263,8 @@ gJobPtr parseGjobFile(char *filename) {
return(ret);
}
-void handleGjob(gJobPtr cur) {
+static void
+handleGjob(gJobPtr cur) {
int i;
/*
diff --git a/include/libxml/HTMLparser.h b/include/libxml/HTMLparser.h
index c79ad09c..b129175a 100644
--- a/include/libxml/HTMLparser.h
+++ b/include/libxml/HTMLparser.h
@@ -49,7 +49,7 @@ struct _htmlElemDesc {
typedef struct _htmlEntityDesc htmlEntityDesc;
typedef htmlEntityDesc *htmlEntityDescPtr;
struct _htmlEntityDesc {
- int value; /* the UNICODE value for the character */
+ unsigned int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
@@ -59,7 +59,7 @@ struct _htmlEntityDesc {
*/
htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
-htmlEntityDescPtr htmlEntityValueLookup(int value);
+htmlEntityDescPtr htmlEntityValueLookup(unsigned int value);
int htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h
index 62e81e3d..527a08cb 100644
--- a/include/libxml/encoding.h
+++ b/include/libxml/encoding.h
@@ -180,6 +180,17 @@ int xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr in);
int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
+/*
+ * Export a few useful functions
+ */
+int UTF8Toisolat1 (unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen);
+int isolat1ToUTF8 (unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen);
#ifdef __cplusplus
}
#endif
diff --git a/include/libxml/list.h b/include/libxml/list.h
index a708ef20..d4c1ec59 100644
--- a/include/libxml/list.h
+++ b/include/libxml/list.h
@@ -15,6 +15,13 @@
* Author: Gary.Pennington@uk.sun.com
*/
+#ifndef __XML_LINK_INCLUDE__
+#define __XML_LINK_INCLUDE__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
@@ -78,4 +85,8 @@ void * xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */
/* xmlListSwap */
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_LINK_INCLUDE__ */
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
index 0c82ce42..1820af94 100644
--- a/include/libxml/parser.h
+++ b/include/libxml/parser.h
@@ -338,6 +338,9 @@ int xmlParserInputGrow (xmlParserInputPtr in,
xmlChar * xmlStrdup (const xmlChar *cur);
xmlChar * xmlStrndup (const xmlChar *cur,
int len);
+xmlChar * xmlCharStrndup (const char *cur,
+ int len);
+xmlChar * xmlCharStrdup (const char *cur);
xmlChar * xmlStrsub (const xmlChar *str,
int start,
int len);
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
index 3fdb8f6e..f343cdbd 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -14,6 +14,7 @@
#define __XML_PARSER_INTERNALS_H__
#include <libxml/parser.h>
+#include <libxml/HTMLparser.h>
#ifdef __cplusplus
extern "C" {
@@ -157,6 +158,8 @@ void xmlHandleEntity (xmlParserCtxtPtr ctxt,
/**
* Input Streams
*/
+xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
+ const xmlChar *buffer);
xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
void xmlPushInput (xmlParserCtxtPtr ctxt,
@@ -278,6 +281,9 @@ xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
+xmlChar *namePop (xmlParserCtxtPtr ctxt);
+int namePush (xmlParserCtxtPtr ctxt,
+ xmlChar *value);
/*
* other comodities shared between parser.c and parserInternals
@@ -288,7 +294,6 @@ int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
-xmlChar *namePop (xmlParserCtxtPtr ctxt);
int xmlCheckLanguageID (const xmlChar *lang);
/*
@@ -296,6 +301,8 @@ int xmlCheckLanguageID (const xmlChar *lang);
*/
int xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
+int xmlCopyCharMultiByte (xmlChar *out,
+ int val);
int xmlCopyChar (int len,
xmlChar *out,
int val);
@@ -307,6 +314,8 @@ void xmlParserInputShrink (xmlParserInputPtr in);
* Actually comes from the HTML parser but launched from the init stuff
*/
void htmlInitAutoClose (void);
+htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
+ const char *encoding);
#endif
#ifdef __cplusplus
}
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index dbba4d71..cd24ed10 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -394,8 +394,13 @@ LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
* Handling Buffers.
*/
+void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
+xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
+
xmlBufferPtr xmlBufferCreate (void);
xmlBufferPtr xmlBufferCreateSize (size_t size);
+int xmlBufferResize (xmlBufferPtr buf,
+ unsigned int size);
void xmlBufferFree (xmlBufferPtr buf);
int xmlBufferDump (FILE *file,
xmlBufferPtr buf);
@@ -440,6 +445,7 @@ xmlNsPtr xmlNewNs (xmlNodePtr node,
const xmlChar *href,
const xmlChar *prefix);
void xmlFreeNs (xmlNsPtr cur);
+void xmlFreeNsList (xmlNsPtr cur);
xmlDocPtr xmlNewDoc (const xmlChar *version);
void xmlFreeDoc (xmlDocPtr cur);
xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
index a7eb675d..2df3c583 100644
--- a/include/libxml/valid.h
+++ b/include/libxml/valid.h
@@ -11,6 +11,7 @@
#define __XML_VALID_H__
#include <libxml/tree.h>
+#include <libxml/list.h>
#ifdef __cplusplus
extern "C" {
@@ -167,6 +168,8 @@ int xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr);
+xmlListPtr xmlGetRefs (xmlDocPtr doc,
+ const xmlChar *ID);
/**
* The public function calls related to validity checking
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index ecff73bc..fee5b9b3 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -112,10 +112,10 @@ int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
char * xmlParserGetDirectory (const char *filename);
-int xmlRegisterInputCallbacks (xmlInputMatchCallback match,
- xmlInputOpenCallback open,
- xmlInputReadCallback read,
- xmlInputCloseCallback close);
+int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
+ xmlInputOpenCallback openFunc,
+ xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc);
/*
* Interfaces for output
*/
@@ -151,10 +151,10 @@ int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
int xmlOutputBufferFlush (xmlOutputBufferPtr out);
int xmlOutputBufferClose (xmlOutputBufferPtr out);
-int xmlRegisterOutputCallbacks (xmlOutputMatchCallback match,
- xmlOutputOpenCallback open,
- xmlOutputWriteCallback write,
- xmlOutputCloseCallback close);
+int xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
+ xmlOutputOpenCallback openFunc,
+ xmlOutputWriteCallback writeFunc,
+ xmlOutputCloseCallback closeFunc);
/*
* This save function are part of tree.h and HTMLtree.h actually
diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h
index 51f6ad55..cb2f3b42 100644
--- a/include/libxml/xpathInternals.h
+++ b/include/libxml/xpathInternals.h
@@ -79,7 +79,9 @@ void xmlXPatherror (xmlXPathParserContextPtr ctxt,
void xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
int depth);
-
+void xmlXPathDebugDumpCompExpr(FILE *output,
+ xmlXPathCompExprPtr comp,
+ int depth);
/**
* Extending a context
*/
@@ -139,7 +141,9 @@ xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val);
void xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val);
-
+void xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
+ xmlNodePtr val);
+void xmlXPathNodeSetSort (xmlNodeSetPtr set);
void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
int nargs);
@@ -193,13 +197,37 @@ void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
+int xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines
*/
-xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
-xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
-xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
+xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
/*
* The official core of XPath functions
*/
diff --git a/include/libxml/xpointer.h b/include/libxml/xpointer.h
index 255f826e..45efd791 100644
--- a/include/libxml/xpointer.h
+++ b/include/libxml/xpointer.h
@@ -38,11 +38,31 @@ xmlLocationSetPtr xmlXPtrLocationSetCreate(xmlXPathObjectPtr val);
void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
+xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start,
+ int startindex,
+ xmlNodePtr end,
+ int endindex);
+xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
+ xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewRangeNodePoint(xmlNodePtr start,
+ xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewRangePointNode(xmlXPathObjectPtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewLocationSetNodes(xmlNodePtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
xmlXPathObjectPtr xmlXPtrNewRangeNodeObject(xmlNodePtr start,
xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewCollapsedRange(xmlNodePtr start);
void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
+void xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
+ xmlXPathObjectPtr val);
+void xmlXPtrLocationSetRemove(xmlLocationSetPtr cur,
+ int val);
/*
* Functions
diff --git a/list.c b/list.c
index bbe6144e..cbeedf8c 100644
--- a/list.c
+++ b/list.c
@@ -155,7 +155,7 @@ xmlListLinkSearch(xmlListPtr l, void *data)
*
* Returns the link containing the data or NULL
*/
-xmlLinkPtr
+static xmlLinkPtr
xmlListLinkReverseSearch(xmlListPtr l, void *data)
{
xmlLinkPtr lk;
diff --git a/list.h b/list.h
index a708ef20..d4c1ec59 100644
--- a/list.h
+++ b/list.h
@@ -15,6 +15,13 @@
* Author: Gary.Pennington@uk.sun.com
*/
+#ifndef __XML_LINK_INCLUDE__
+#define __XML_LINK_INCLUDE__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
@@ -78,4 +85,8 @@ void * xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */
/* xmlListSwap */
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_LINK_INCLUDE__ */
diff --git a/nanoftp.c b/nanoftp.c
index 3d7ce53a..0b0954db 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -237,7 +237,7 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
const char *cur = URL;
char buf[4096];
- int index = 0;
+ int indx = 0;
int port = 0;
if (ctxt->protocol != NULL) {
@@ -253,25 +253,25 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) {
ctxt->path = NULL;
}
if (URL == NULL) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (*cur != 0) {
if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->protocol = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 3;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (1) {
if (cur[0] == ':') {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->hostname = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 1;
while ((*cur >= '0') && (*cur <= '9')) {
port *= 10;
@@ -284,21 +284,21 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) {
break;
}
if ((*cur == '/') || (*cur == 0)) {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->hostname = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0)
ctxt->path = xmlMemStrdup("/");
else {
- index = 0;
- buf[index] = 0;
+ indx = 0;
+ buf[indx] = 0;
while (*cur != 0)
- buf[index++] = *cur++;
- buf[index] = 0;
+ buf[indx++] = *cur++;
+ buf[indx] = 0;
ctxt->path = xmlMemStrdup(buf);
}
}
@@ -322,7 +322,7 @@ xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
const char *cur = URL;
char buf[4096];
- int index = 0;
+ int indx = 0;
int port = 0;
if (URL == NULL)
@@ -333,28 +333,28 @@ xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
return(-1);
if (ctxt->hostname == NULL)
return(-1);
- buf[index] = 0;
+ buf[indx] = 0;
while (*cur != 0) {
if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[index] = 0;
+ buf[indx] = 0;
if (strcmp(ctxt->protocol, buf))
return(-1);
- index = 0;
+ indx = 0;
cur += 3;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0)
return(-1);
- buf[index] = 0;
+ buf[indx] = 0;
while (1) {
if (cur[0] == ':') {
- buf[index] = 0;
+ buf[indx] = 0;
if (strcmp(ctxt->hostname, buf))
return(-1);
- index = 0;
+ indx = 0;
cur += 1;
while ((*cur >= '0') && (*cur <= '9')) {
port *= 10;
@@ -368,13 +368,13 @@ xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
break;
}
if ((*cur == '/') || (*cur == 0)) {
- buf[index] = 0;
+ buf[indx] = 0;
if (strcmp(ctxt->hostname, buf))
return(-1);
- index = 0;
+ indx = 0;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (ctxt->path != NULL) {
xmlFree(ctxt->path);
@@ -384,11 +384,11 @@ xmlNanoFTPUpdateURL(void *ctx, const char *URL) {
if (*cur == 0)
ctxt->path = xmlMemStrdup("/");
else {
- index = 0;
- buf[index] = 0;
+ indx = 0;
+ buf[indx] = 0;
while (*cur != 0)
- buf[index++] = *cur++;
- buf[index] = 0;
+ buf[indx++] = *cur++;
+ buf[indx] = 0;
ctxt->path = xmlMemStrdup(buf);
}
return(0);
@@ -408,7 +408,7 @@ void
xmlNanoFTPScanProxy(const char *URL) {
const char *cur = URL;
char buf[4096];
- int index = 0;
+ int indx = 0;
int port = 0;
if (proxy != NULL) {
@@ -425,24 +425,24 @@ xmlNanoFTPScanProxy(const char *URL) {
xmlGenericError(xmlGenericErrorContext, "Using FTP proxy %s\n", URL);
#endif
if (URL == NULL) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (*cur != 0) {
if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[index] = 0;
- index = 0;
+ buf[indx] = 0;
+ indx = 0;
cur += 3;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (1) {
if (cur[0] == ':') {
- buf[index] = 0;
+ buf[indx] = 0;
proxy = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 1;
while ((*cur >= '0') && (*cur <= '9')) {
port *= 10;
@@ -455,12 +455,12 @@ xmlNanoFTPScanProxy(const char *URL) {
break;
}
if ((*cur == '/') || (*cur == 0)) {
- buf[index] = 0;
+ buf[indx] = 0;
proxy = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
}
@@ -517,7 +517,6 @@ xmlNanoFTPFreeCtxt(void * ctx) {
/**
* xmlNanoFTPParseResponse:
- * @ctx: the FTP connection context
* @buf: the buffer containing the response
* @len: the buffer length
*
@@ -528,7 +527,7 @@ xmlNanoFTPFreeCtxt(void * ctx) {
* -XXX for response to be continued
*/
static int
-xmlNanoFTPParseResponse(void *ctx, char *buf, int len) {
+xmlNanoFTPParseResponse(char *buf, int len) {
int val = 0;
if (len < 3) return(-1);
@@ -663,7 +662,7 @@ get_more:
"\n<<<\n%s\n--\n", ptr);
#endif
while (ptr < end) {
- cur = xmlNanoFTPParseResponse(ctxt, ptr, end - ptr);
+ cur = xmlNanoFTPParseResponse(ptr, end - ptr);
if (cur > 0) {
/*
* Successfully scanned the control code, scratch
@@ -1572,7 +1571,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[4096 + 1];
int len, res;
- int index = 0, base;
+ int indx = 0, base;
fd_set rfd, efd;
struct timeval tv;
@@ -1643,7 +1642,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
continue;
}
- if ((len = recv(ctxt->dataFd, &buf[index], sizeof(buf) - (index + 1), 0)) < 0) {
+ if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) {
#ifdef DEBUG_FTP
perror("recv");
#endif
@@ -1652,18 +1651,18 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
return(-1);
}
#ifdef DEBUG_FTP
- write(1, &buf[index], len);
+ write(1, &buf[indx], len);
#endif
- index += len;
- buf[index] = 0;
+ indx += len;
+ buf[indx] = 0;
base = 0;
do {
res = xmlNanoFTPParseList(&buf[base], callback, userData);
base += res;
} while (res > 0);
- memmove(&buf[0], &buf[base], index - base);
- index -= base;
+ memmove(&buf[0], &buf[base], indx - base);
+ indx -= base;
} while (len != 0);
xmlNanoFTPCloseConnection(ctxt);
return(0);
diff --git a/nanohttp.c b/nanohttp.c
index cf30c530..9c1de2bc 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -126,7 +126,7 @@ static unsigned int timeout = 60;/* the select() timeout in seconds */
/**
* A portability function
*/
-int socket_errno(void) {
+static int socket_errno(void) {
#ifdef _WINSOCKAPI_
return(WSAGetLastError());
#else
@@ -195,19 +195,6 @@ xmlNanoHTTPCleanup(void) {
}
/**
- * xmlNanoHTTPTimeout:
- * @delay: the delay in seconds
- *
- * Set the HTTP timeout, (default is 60secs). 0 means immediate
- * return, while -1 infinite.
- */
-
-void
-xmlNanoHTTPTimeout(int delay) {
- timeout = (unsigned int) delay;
-}
-
-/**
* xmlNanoHTTPScanURL:
* @ctxt: an HTTP context
* @URL: The URL used to initialize the context
@@ -220,7 +207,7 @@ static void
xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
const char *cur = URL;
char buf[4096];
- int index = 0;
+ int indx = 0;
int port = 0;
if (ctxt->protocol != NULL) {
@@ -236,25 +223,25 @@ xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
ctxt->path = NULL;
}
if (URL == NULL) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (*cur != 0) {
if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->protocol = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 3;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (1) {
if (cur[0] == ':') {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->hostname = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 1;
while ((*cur >= '0') && (*cur <= '9')) {
port *= 10;
@@ -267,21 +254,21 @@ xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) {
break;
}
if ((*cur == '/') || (*cur == 0)) {
- buf[index] = 0;
+ buf[indx] = 0;
ctxt->hostname = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0)
ctxt->path = xmlMemStrdup("/");
else {
- index = 0;
- buf[index] = 0;
+ indx = 0;
+ buf[indx] = 0;
while (*cur != 0)
- buf[index++] = *cur++;
- buf[index] = 0;
+ buf[indx++] = *cur++;
+ buf[indx] = 0;
ctxt->path = xmlMemStrdup(buf);
}
}
@@ -300,7 +287,7 @@ void
xmlNanoHTTPScanProxy(const char *URL) {
const char *cur = URL;
char buf[4096];
- int index = 0;
+ int indx = 0;
int port = 0;
if (proxy != NULL) {
@@ -319,24 +306,24 @@ xmlNanoHTTPScanProxy(const char *URL) {
"Using HTTP proxy %s\n", URL);
#endif
if (URL == NULL) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (*cur != 0) {
if ((cur[0] == ':') && (cur[1] == '/') && (cur[2] == '/')) {
- buf[index] = 0;
- index = 0;
+ buf[indx] = 0;
+ indx = 0;
cur += 3;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
if (*cur == 0) return;
- buf[index] = 0;
+ buf[indx] = 0;
while (1) {
if (cur[0] == ':') {
- buf[index] = 0;
+ buf[indx] = 0;
proxy = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
cur += 1;
while ((*cur >= '0') && (*cur <= '9')) {
port *= 10;
@@ -349,12 +336,12 @@ xmlNanoHTTPScanProxy(const char *URL) {
break;
}
if ((*cur == '/') || (*cur == 0)) {
- buf[index] = 0;
+ buf[indx] = 0;
proxy = xmlMemStrdup(buf);
- index = 0;
+ indx = 0;
break;
}
- buf[index++] = *cur++;
+ buf[indx++] = *cur++;
}
}
@@ -418,14 +405,13 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
static void
xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt) {
if (ctxt->state & XML_NANO_HTTP_WRITE) {
- int total_sent = 0;
+ unsigned int total_sent = 0;
while (total_sent <strlen(ctxt->outptr)) {
- int nsent = send(ctxt->fd, ctxt->outptr+total_sent,
- strlen(ctxt->outptr)-total_sent, 0);
+ unsigned int nsent = send(ctxt->fd, ctxt->outptr+total_sent,
+ strlen(ctxt->outptr)-total_sent, 0);
if (nsent>0)
total_sent += nsent;
-}
-
+ }
ctxt->last = total_sent;
}
}
@@ -636,8 +622,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
/**
* xmlNanoHTTPConnectAttempt:
- * @ia: an internet adress structure
- * @port: the port number
+ * @addr: a socket adress structure
*
* Attempt a connection to the given IP:port endpoint. It forces
* non-blocking semantic on the socket, and allow 60 seconds for
@@ -647,7 +632,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
*/
static int
-xmlNanoHTTPConnectAttempt(struct sockaddr *addr, int port)
+xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
{
SOCKET s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
fd_set wfd;
@@ -765,10 +750,10 @@ xmlNanoHTTPConnectHost(const char *host, int port)
struct hostent *h;
struct sockaddr *addr;
struct in_addr ia;
- struct sockaddr_in sin;
+ struct sockaddr_in sockin;
#ifdef SUPPORT_IP6
struct in6_addr ia6;
- struct sockaddr_in6 sin6;
+ struct sockaddr_in6 sockin6;
#endif
int i;
int s;
@@ -792,23 +777,23 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (h->h_addrtype == AF_INET) {
/* A records (IPv4) */
memcpy(&ia, h->h_addr_list[i], h->h_length);
- sin.sin_family = h->h_addrtype;
- sin.sin_addr = ia;
- sin.sin_port = htons(port);
- addr = (struct sockaddr *)&sin;
+ sockin.sin_family = h->h_addrtype;
+ sockin.sin_addr = ia;
+ sockin.sin_port = htons(port);
+ addr = (struct sockaddr *)&sockin;
#ifdef SUPPORT_IP6
} else if (h->h_addrtype == AF_INET6) {
/* AAAA records (IPv6) */
memcpy(&ia6, h->h_addr_list[i], h->h_length);
- sin6.sin_family = h->h_addrtype;
- sin6.sin_addr = ia6;
- sin6.sin_port = htons(port);
- addr = (struct sockaddr *)&sin6;
+ sockin6.sin_family = h->h_addrtype;
+ sockin6.sin_addr = ia6;
+ sockin6.sin_port = htons(port);
+ addr = (struct sockaddr *)&sockin6;
#endif
} else
break; /* for */
- s = xmlNanoHTTPConnectAttempt(addr, port);
+ s = xmlNanoHTTPConnectAttempt(addr);
if (s != -1)
return(s);
}
diff --git a/parser.c b/parser.c
index c967768e..4b8adba0 100644
--- a/parser.c
+++ b/parser.c
@@ -160,7 +160,7 @@ PUSH_AND_POP(extern, xmlParserInputPtr, input)
PUSH_AND_POP(extern, xmlNodePtr, node)
PUSH_AND_POP(extern, xmlChar*, name)
-int spacePush(xmlParserCtxtPtr ctxt, int val) {
+static int spacePush(xmlParserCtxtPtr ctxt, int val) {
if (ctxt->spaceNr >= ctxt->spaceMax) {
ctxt->spaceMax *= 2;
ctxt->spaceTab = (int *) xmlRealloc(ctxt->spaceTab,
@@ -176,7 +176,7 @@ int spacePush(xmlParserCtxtPtr ctxt, int val) {
return(ctxt->spaceNr++);
}
-int spacePop(xmlParserCtxtPtr ctxt) {
+static int spacePop(xmlParserCtxtPtr ctxt) {
int ret;
if (ctxt->spaceNr <= 0) return(0);
ctxt->spaceNr--;
@@ -274,7 +274,7 @@ int spacePop(xmlParserCtxtPtr ctxt) {
#define COPY_BUF(l,b,i,v) \
if (l == 1) b[i++] = (xmlChar) v; \
- else i += xmlCopyChar(l,&b[i],v)
+ else i += xmlCopyCharMultiByte(&b[i],v)
/**
* xmlSkipBlankChars:
@@ -493,7 +493,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) {
* Returns the value parsed (as an int), 0 in case of error, str will be
* updated to the current value of the index
*/
-int
+static int
xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
const xmlChar *ptr;
xmlChar cur;
@@ -1741,7 +1741,7 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
* is updated to the current location in the string.
*/
-xmlChar *
+static xmlChar *
xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
xmlChar buf[XML_MAX_NAMELEN + 5];
const xmlChar *cur = *str;
@@ -4253,7 +4253,7 @@ xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, xmlChar *name,
ctxt->errNo = XML_ERR_ELEMCONTENT_NOT_STARTED;
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
- "xmlParseElementContentDecl : '(' expected\n");
+ "xmlParseElementContentDecl : %s '(' expected\n", name);
ctxt->wellFormed = 0;
ctxt->disableSAX = 1;
return(-1);
@@ -4566,7 +4566,7 @@ xmlParseTextDecl(xmlParserCtxtPtr ctxt) {
* [65] Ignore ::= Char* - (Char* ('<![' | ']]>') Char*)
*/
-void
+static void
xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
SKIP(3);
SKIP_BLANKS;
@@ -4824,7 +4824,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
int i = 0;
xmlChar out[10];
int hex = NXT(2);
- int val = xmlParseCharRef(ctxt);
+ int value = xmlParseCharRef(ctxt);
if (ctxt->charset != XML_CHAR_ENCODING_UTF8) {
/*
@@ -4832,17 +4832,17 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
* Check that the char fit on 8bits, if not
* generate a CharRef.
*/
- if (val <= 0xFF) {
- out[0] = val;
+ if (value <= 0xFF) {
+ out[0] = value;
out[1] = 0;
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) &&
(!ctxt->disableSAX))
ctxt->sax->characters(ctxt->userData, out, 1);
} else {
if ((hex == 'x') || (hex == 'X'))
- sprintf((char *)out, "#x%X", val);
+ sprintf((char *)out, "#x%X", value);
else
- sprintf((char *)out, "#%d", val);
+ sprintf((char *)out, "#%d", value);
if ((ctxt->sax != NULL) && (ctxt->sax->reference != NULL) &&
(!ctxt->disableSAX))
ctxt->sax->reference(ctxt->userData, out);
@@ -4851,7 +4851,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
/*
* Just encode the value in UTF-8
*/
- COPY_BUF(0 ,out, i, val);
+ COPY_BUF(0 ,out, i, value);
out[i] = 0;
if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL) &&
(!ctxt->disableSAX))
@@ -5765,7 +5765,7 @@ xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt) {
* [28 end] ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
*/
-void
+static void
xmlParseInternalSubset(xmlParserCtxtPtr ctxt) {
/*
* Is there any DTD definition ?
@@ -7381,7 +7381,7 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) {
* Returns the index to the current parsing point if the full sequence
* is available, -1 otherwise.
*/
-int
+static int
xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
xmlChar next, xmlChar third) {
int base, len;
@@ -7454,7 +7454,7 @@ xmlParseLookupSequence(xmlParserCtxtPtr ctxt, xmlChar first,
*
* Returns zero if no parsing was possible
*/
-int
+static int
xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
int ret = 0;
int avail;
@@ -7932,12 +7932,12 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
* Handle preparsed entities and charRef
*/
if (ctxt->token != 0) {
- xmlChar cur[2] = { 0 , 0 } ;
+ xmlChar current[2] = { 0 , 0 } ;
- cur[0] = (xmlChar) ctxt->token;
+ current[0] = (xmlChar) ctxt->token;
if ((ctxt->sax != NULL) && (!ctxt->disableSAX) &&
(ctxt->sax->characters != NULL))
- ctxt->sax->characters(ctxt->userData, cur, 1);
+ ctxt->sax->characters(ctxt->userData, current, 1);
ctxt->token = 0;
}
if ((avail < 2) && (ctxt->inputNr == 1))
@@ -8252,19 +8252,6 @@ done:
}
/**
- * xmlParseTry:
- * @ctxt: an XML parser context
- *
- * Try to progress on parsing
- *
- * Returns zero if no parsing was possible
- */
-int
-xmlParseTry(xmlParserCtxtPtr ctxt) {
- return(xmlParseTryOrFinish(ctxt, 0));
-}
-
-/**
* xmlParseChunk:
* @ctxt: an XML parser context
* @chunk: an char array
@@ -8696,78 +8683,6 @@ xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) {
************************************************************************/
/**
- * xmlSAXParseBalancedChunk:
- * @ctx: an XML parser context (possibly NULL)
- * @sax: the SAX handler bloc (possibly NULL)
- * @user_data: The user data returned on SAX callbacks (possibly NULL)
- * @input: a parser input stream
- * @enc: the encoding
- *
- * Parse a well-balanced chunk of an XML document
- * The user has to provide SAX callback block whose routines will be
- * called by the parser
- * The allowed sequence for the Well Balanced Chunk is the one defined by
- * the content production in the XML grammar:
- *
- * [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)*
- *
- * Returns 0 if the chunk is well balanced, -1 in case of args problem and
- * the error code otherwise
- */
-
-int
-xmlSAXParseBalancedChunk(xmlParserCtxtPtr ctx, xmlSAXHandlerPtr sax,
- void *user_data, xmlParserInputPtr input,
- xmlCharEncoding enc) {
- xmlParserCtxtPtr ctxt;
- int ret;
-
- if (input == NULL) return(-1);
-
- if (ctx != NULL)
- ctxt = ctx;
- else {
- ctxt = xmlNewParserCtxt();
- if (ctxt == NULL)
- return(-1);
- if (sax == NULL)
- ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
- }
-
- /*
- * Set-up the SAX context
- */
- if (sax != NULL) {
- if (ctxt->sax != NULL)
- xmlFree(ctxt->sax);
- ctxt->sax = sax;
- ctxt->userData = user_data;
- }
-
- /*
- * plug some encoding conversion routines here.
- */
- xmlPushInput(ctxt, input);
- if (enc != XML_CHAR_ENCODING_NONE)
- xmlSwitchEncoding(ctxt, enc);
-
- /*
- * let's parse that entity knowing it's an external subset.
- */
- xmlParseContent(ctxt);
- ret = ctxt->errNo;
-
- if (ctx == NULL) {
- if (sax != NULL)
- ctxt->sax = NULL;
- else
- xmlFreeDoc(ctxt->myDoc);
- xmlFreeParserCtxt(ctxt);
- }
- return(ret);
-}
-
-/**
* xmlParseCtxtExternalEntity:
* @ctx: the existing parsing context
* @URL: the URL for the entity to load
diff --git a/parser.h b/parser.h
index 0c82ce42..1820af94 100644
--- a/parser.h
+++ b/parser.h
@@ -338,6 +338,9 @@ int xmlParserInputGrow (xmlParserInputPtr in,
xmlChar * xmlStrdup (const xmlChar *cur);
xmlChar * xmlStrndup (const xmlChar *cur,
int len);
+xmlChar * xmlCharStrndup (const char *cur,
+ int len);
+xmlChar * xmlCharStrdup (const char *cur);
xmlChar * xmlStrsub (const xmlChar *str,
int start,
int len);
diff --git a/parserInternals.c b/parserInternals.c
index 281b75f4..0f6dfccc 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -48,6 +48,19 @@
#include <libxml/xmlIO.h>
#include <libxml/uri.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+void xmlUpgradeOldNs(xmlDocPtr doc);
/************************************************************************
* *
@@ -932,7 +945,7 @@ int
xmlParserInputRead(xmlParserInputPtr in, int len) {
int ret;
int used;
- int index;
+ int indx;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Read\n");
@@ -956,9 +969,9 @@ xmlParserInputRead(xmlParserInputPtr in, int len) {
/*
* the buffer has been realloced
*/
- index = in->cur - in->base;
+ indx = in->cur - in->base;
in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[index];
+ in->cur = &in->buf->buffer->content[indx];
}
in->end = &in->buf->buffer->content[in->buf->buffer->use];
@@ -981,7 +994,7 @@ xmlParserInputRead(xmlParserInputPtr in, int len) {
int
xmlParserInputGrow(xmlParserInputPtr in, int len) {
int ret;
- int index;
+ int indx;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Grow\n");
@@ -993,8 +1006,8 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
CHECK_BUFFER(in);
- index = in->cur - in->base;
- if (in->buf->buffer->use > (unsigned int) index + INPUT_CHUNK) {
+ indx = in->cur - in->base;
+ if (in->buf->buffer->use > (unsigned int) indx + INPUT_CHUNK) {
CHECK_BUFFER(in);
@@ -1015,9 +1028,9 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
/*
* the buffer has been realloced
*/
- index = in->cur - in->base;
+ indx = in->cur - in->base;
in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[index];
+ in->cur = &in->buf->buffer->content[indx];
}
in->end = &in->buf->buffer->content[in->buf->buffer->use];
@@ -1036,7 +1049,7 @@ void
xmlParserInputShrink(xmlParserInputPtr in) {
int used;
int ret;
- int index;
+ int indx;
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext, "Shrink\n");
@@ -1053,7 +1066,7 @@ xmlParserInputShrink(xmlParserInputPtr in) {
* Do not shrink on large buffers whose only a tiny fraction
* was consumned
*/
- if (in->buf->buffer->use > used + 2 * INPUT_CHUNK)
+ if ((int) in->buf->buffer->use > used + 2 * INPUT_CHUNK)
return;
if (used > INPUT_CHUNK) {
ret = xmlBufferShrink(in->buf->buffer, used - LINE_LEN);
@@ -1074,9 +1087,9 @@ xmlParserInputShrink(xmlParserInputPtr in) {
/*
* the buffer has been realloced
*/
- index = in->cur - in->base;
+ indx = in->cur - in->base;
in->base = in->buf->buffer->content;
- in->cur = &in->buf->buffer->content[index];
+ in->cur = &in->buf->buffer->content[indx];
}
in->end = &in->buf->buffer->content[in->buf->buffer->use];
@@ -1481,18 +1494,16 @@ encoding_error:
}
/**
- * xmlCopyChar:
- * @len: pointer to the length of the char read (or zero)
- * @array: pointer to an arry of xmlChar
+ * xmlCopyCharMultiByte:
+ * @out: pointer to an arry of xmlChar
* @val: the char value
*
* append the char value in the array
*
* Returns the number of xmlChar written
*/
-
int
-xmlCopyChar(int len, xmlChar *out, int val) {
+xmlCopyCharMultiByte(xmlChar *out, int val) {
/*
* We are supposed to handle UTF8, check it's valid
* From rfc2044: encoding of the Unicode values on UTF-8:
@@ -1502,34 +1513,45 @@ xmlCopyChar(int len, xmlChar *out, int val) {
* 0000 0080-0000 07FF 110xxxxx 10xxxxxx
* 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx
*/
- if (len == 0) {
- if (val < 0) len = 0;
- else if (val < 0x80) len = 1;
- else if (val < 0x800) len = 2;
- else if (val < 0x10000) len = 3;
- else if (val < 0x110000) len = 4;
- if (len == 0) {
+ if (val >= 0x80) {
+ xmlChar *savedout = out;
+ int bits;
+ if (val < 0x800) { *out++= (val >> 6) | 0xC0; bits= 0; }
+ else if (val < 0x10000) { *out++= (val >> 12) | 0xE0; bits= 6;}
+ else if (val < 0x110000) { *out++= (val >> 18) | 0xF0; bits= 12; }
+ else {
xmlGenericError(xmlGenericErrorContext,
"Internal error, xmlCopyChar 0x%X out of bound\n",
val);
return(0);
}
+ for ( ; bits >= 0; bits-= 6)
+ *out++= ((val >> bits) & 0x3F) | 0x80 ;
+ return (out - savedout);
}
- if (len > 1) {
- int bits;
+ *out = (xmlChar) val;
+ return 1;
+}
- if (val < 0x80) { *out++= val; bits= -6; }
- else if (val < 0x800) { *out++= (val >> 6) | 0xC0; bits= 0; }
- else if (val < 0x10000) { *out++= (val >> 12) | 0xE0; bits= 6; }
- else { *out++= (val >> 18) | 0xF0; bits= 12; }
-
- for ( ; bits >= 0; bits-= 6)
- *out++= ((val >> bits) & 0x3F) | 0x80 ;
+/**
+ * xmlCopyChar:
+ * @len: Ignored, compatibility
+ * @out: pointer to an arry of xmlChar
+ * @val: the char value
+ *
+ * append the char value in the array
+ *
+ * Returns the number of xmlChar written
+ */
- return(len);
+int
+xmlCopyChar(int len UNUSED, xmlChar *out, int val) {
+ /* the len parameter is ignored */
+ if (val >= 0x80) {
+ return(xmlCopyCharMultiByte (out, val));
}
*out = (xmlChar) val;
- return(1);
+ return 1;
}
/************************************************************************
@@ -2575,8 +2597,8 @@ xmlCheckLanguageID(const xmlChar *lang) {
* must deallocate it !
*/
xmlChar *
-xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what,
- xmlChar end, xmlChar end2, xmlChar end3) {
+xmlDecodeEntities(xmlParserCtxtPtr ctxt UNUSED, int len UNUSED, int what UNUSED,
+ xmlChar end UNUSED, xmlChar end2 UNUSED, xmlChar end3 UNUSED) {
#if 0
xmlChar *buffer = NULL;
unsigned int buffer_size = 0;
@@ -2709,7 +2731,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what,
*/
xmlChar *
-xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt) {
+xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt UNUSED) {
#if 0
xmlChar buf[XML_MAX_NAMELEN + 5];
int len = 0, l;
@@ -2778,7 +2800,7 @@ xmlGenericError(xmlGenericErrorContext,
*/
xmlChar *
-xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, xmlChar **prefix) {
+xmlNamespaceParseQName(xmlParserCtxtPtr ctxt UNUSED, xmlChar **prefix UNUSED) {
static int deprecated = 0;
if (!deprecated) {
@@ -2820,7 +2842,7 @@ xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, xmlChar **prefix) {
*/
xmlChar *
-xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt) {
+xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -2855,7 +2877,7 @@ xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt) {
* Returns the string parser or NULL.
*/
xmlChar *
-xmlParseQuotedString(xmlParserCtxtPtr ctxt) {
+xmlParseQuotedString(xmlParserCtxtPtr ctxt UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -2953,7 +2975,7 @@ xmlGenericError(xmlGenericErrorContext,
*/
void
-xmlParseNamespace(xmlParserCtxtPtr ctxt) {
+xmlParseNamespace(xmlParserCtxtPtr ctxt UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3080,7 +3102,7 @@ xmlGenericError(xmlGenericErrorContext,
*/
xmlChar *
-xmlScanName(xmlParserCtxtPtr ctxt) {
+xmlScanName(xmlParserCtxtPtr ctxt UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3153,7 +3175,7 @@ xmlScanName(xmlParserCtxtPtr ctxt) {
* http://www.w3.org/TR/REC-xml#entproc
*/
void
-xmlParserHandleReference(xmlParserCtxtPtr ctxt) {
+xmlParserHandleReference(xmlParserCtxtPtr ctxt UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3399,7 +3421,7 @@ xmlGenericError(xmlGenericErrorContext,
*/
void
-xmlHandleEntity(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
+xmlHandleEntity(xmlParserCtxtPtr ctxt UNUSED, xmlEntityPtr entity UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3452,7 +3474,8 @@ handle_as_char:
* Returns NULL this functionnality had been removed
*/
xmlNsPtr
-xmlNewGlobalNs(xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix) {
+xmlNewGlobalNs(xmlDocPtr doc UNUSED, const xmlChar *href UNUSED,
+ const xmlChar *prefix UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
@@ -3513,7 +3536,7 @@ xmlNewGlobalNs(xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix) {
* DEPRECATED
*/
void
-xmlUpgradeOldNs(xmlDocPtr doc) {
+xmlUpgradeOldNs(xmlDocPtr doc UNUSED) {
static int deprecated = 0;
if (!deprecated) {
xmlGenericError(xmlGenericErrorContext,
diff --git a/parserInternals.h b/parserInternals.h
index 3fdb8f6e..f343cdbd 100644
--- a/parserInternals.h
+++ b/parserInternals.h
@@ -14,6 +14,7 @@
#define __XML_PARSER_INTERNALS_H__
#include <libxml/parser.h>
+#include <libxml/HTMLparser.h>
#ifdef __cplusplus
extern "C" {
@@ -157,6 +158,8 @@ void xmlHandleEntity (xmlParserCtxtPtr ctxt,
/**
* Input Streams
*/
+xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
+ const xmlChar *buffer);
xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
void xmlPushInput (xmlParserCtxtPtr ctxt,
@@ -278,6 +281,9 @@ xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
+xmlChar *namePop (xmlParserCtxtPtr ctxt);
+int namePush (xmlParserCtxtPtr ctxt,
+ xmlChar *value);
/*
* other comodities shared between parser.c and parserInternals
@@ -288,7 +294,6 @@ int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
-xmlChar *namePop (xmlParserCtxtPtr ctxt);
int xmlCheckLanguageID (const xmlChar *lang);
/*
@@ -296,6 +301,8 @@ int xmlCheckLanguageID (const xmlChar *lang);
*/
int xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
+int xmlCopyCharMultiByte (xmlChar *out,
+ int val);
int xmlCopyChar (int len,
xmlChar *out,
int val);
@@ -307,6 +314,8 @@ void xmlParserInputShrink (xmlParserInputPtr in);
* Actually comes from the HTML parser but launched from the init stuff
*/
void htmlInitAutoClose (void);
+htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename,
+ const char *encoding);
#endif
#ifdef __cplusplus
}
diff --git a/testHTML.c b/testHTML.c
index 63ba2375..dcea309d 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -43,6 +43,18 @@
#include <libxml/debugXML.h>
#include <libxml/xmlerror.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
#ifdef LIBXML_DEBUG_ENABLED
static int debug = 0;
#endif
@@ -79,6 +91,8 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* xmlParserError */
NULL, /* xmlParserError */
NULL, /* getParameterEntity */
+ NULL, /* cdataBlock */
+ NULL /* externalSubset */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
@@ -98,8 +112,8 @@ extern xmlSAXHandlerPtr debugSAXHandler;
*
* Returns 1 if true
*/
-int
-isStandaloneDebug(void *ctx)
+static int
+isStandaloneDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.isStandalone()\n");
return(0);
@@ -113,8 +127,8 @@ isStandaloneDebug(void *ctx)
*
* Returns 1 if true
*/
-int
-hasInternalSubsetDebug(void *ctx)
+static int
+hasInternalSubsetDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.hasInternalSubset()\n");
return(0);
@@ -128,8 +142,8 @@ hasInternalSubsetDebug(void *ctx)
*
* Returns 1 if true
*/
-int
-hasExternalSubsetDebug(void *ctx)
+static int
+hasExternalSubsetDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.hasExternalSubset()\n");
return(0);
@@ -141,8 +155,8 @@ hasExternalSubsetDebug(void *ctx)
*
* Does this document has an internal subset
*/
-void
-internalSubsetDebug(void *ctx, const xmlChar *name,
+static void
+internalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID)
{
fprintf(stdout, "SAX.internalSubset(%s,", name);
@@ -170,8 +184,8 @@ internalSubsetDebug(void *ctx, const xmlChar *name,
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
-xmlParserInputPtr
-resolveEntityDebug(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
+static xmlParserInputPtr
+resolveEntityDebug(void *ctx UNUSED, const xmlChar *publicId, const xmlChar *systemId)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
@@ -202,8 +216,8 @@ resolveEntityDebug(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
-xmlEntityPtr
-getEntityDebug(void *ctx, const xmlChar *name)
+static xmlEntityPtr
+getEntityDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getEntity(%s)\n", name);
return(NULL);
@@ -218,8 +232,8 @@ getEntityDebug(void *ctx, const xmlChar *name)
*
* Returns the xmlParserInputPtr
*/
-xmlEntityPtr
-getParameterEntityDebug(void *ctx, const xmlChar *name)
+static xmlEntityPtr
+getParameterEntityDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
return(NULL);
@@ -237,8 +251,8 @@ getParameterEntityDebug(void *ctx, const xmlChar *name)
*
* An entity definition has been parsed
*/
-void
-entityDeclDebug(void *ctx, const xmlChar *name, int type,
+static void
+entityDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
{
fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@@ -253,10 +267,10 @@ entityDeclDebug(void *ctx, const xmlChar *name, int type,
*
* An attribute definition has been parsed
*/
-void
-attributeDeclDebug(void *ctx, const xmlChar *elem, const xmlChar *name,
+static void
+attributeDeclDebug(void *ctx UNUSED, const xmlChar *elem, const xmlChar *name,
int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree)
+ xmlEnumerationPtr tree UNUSED)
{
fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
elem, name, type, def, defaultValue);
@@ -271,9 +285,9 @@ attributeDeclDebug(void *ctx, const xmlChar *elem, const xmlChar *name,
*
* An element definition has been parsed
*/
-void
-elementDeclDebug(void *ctx, const xmlChar *name, int type,
- xmlElementContentPtr content)
+static void
+elementDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
+ xmlElementContentPtr content UNUSED)
{
fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
@@ -288,8 +302,8 @@ elementDeclDebug(void *ctx, const xmlChar *name, int type,
*
* What to do when a notation declaration has been parsed.
*/
-void
-notationDeclDebug(void *ctx, const xmlChar *name,
+static void
+notationDeclDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId)
{
fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
@@ -306,8 +320,8 @@ notationDeclDebug(void *ctx, const xmlChar *name,
*
* What to do when an unparsed entity declaration is parsed
*/
-void
-unparsedEntityDeclDebug(void *ctx, const xmlChar *name,
+static void
+unparsedEntityDeclDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId,
const xmlChar *notationName)
{
@@ -324,8 +338,8 @@ unparsedEntityDeclDebug(void *ctx, const xmlChar *name,
* Receive the document locator at startup, actually xmlDefaultSAXLocator
* Everything is available on the context, so this is useless in our case.
*/
-void
-setDocumentLocatorDebug(void *ctx, xmlSAXLocatorPtr loc)
+static void
+setDocumentLocatorDebug(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
{
fprintf(stdout, "SAX.setDocumentLocator()\n");
}
@@ -336,8 +350,8 @@ setDocumentLocatorDebug(void *ctx, xmlSAXLocatorPtr loc)
*
* called when the document start being processed.
*/
-void
-startDocumentDebug(void *ctx)
+static void
+startDocumentDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.startDocument()\n");
}
@@ -348,8 +362,8 @@ startDocumentDebug(void *ctx)
*
* called when the document end has been detected.
*/
-void
-endDocumentDebug(void *ctx)
+static void
+endDocumentDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.endDocument()\n");
}
@@ -361,8 +375,8 @@ endDocumentDebug(void *ctx)
*
* called when an opening tag has been processed.
*/
-void
-startElementDebug(void *ctx, const xmlChar *name, const xmlChar **atts)
+static void
+startElementDebug(void *ctx UNUSED, const xmlChar *name, const xmlChar **atts)
{
int i;
@@ -395,8 +409,8 @@ startElementDebug(void *ctx, const xmlChar *name, const xmlChar **atts)
*
* called when the end of an element has been detected.
*/
-void
-endElementDebug(void *ctx, const xmlChar *name)
+static void
+endElementDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
}
@@ -410,8 +424,8 @@ endElementDebug(void *ctx, const xmlChar *name)
* receiving some chars from the parser.
* Question: how much at a time ???
*/
-void
-charactersDebug(void *ctx, const xmlChar *ch, int len)
+static void
+charactersDebug(void *ctx UNUSED, const xmlChar *ch, int len)
{
unsigned char output[40];
int inlen = len, outlen = 30;
@@ -431,8 +445,8 @@ charactersDebug(void *ctx, const xmlChar *ch, int len)
* receiving some cdata chars from the parser.
* Question: how much at a time ???
*/
-void
-cdataDebug(void *ctx, const xmlChar *ch, int len)
+static void
+cdataDebug(void *ctx UNUSED, const xmlChar *ch, int len)
{
unsigned char output[40];
int inlen = len, outlen = 30;
@@ -450,8 +464,8 @@ cdataDebug(void *ctx, const xmlChar *ch, int len)
*
* called when an entity reference is detected.
*/
-void
-referenceDebug(void *ctx, const xmlChar *name)
+static void
+referenceDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.reference(%s)\n", name);
}
@@ -466,8 +480,8 @@ referenceDebug(void *ctx, const xmlChar *name)
* receiving some ignorable whitespaces from the parser.
* Question: how much at a time ???
*/
-void
-ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)
+static void
+ignorableWhitespaceDebug(void *ctx UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -488,8 +502,8 @@ ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)
*
* A processing instruction has been parsed.
*/
-void
-processingInstructionDebug(void *ctx, const xmlChar *target,
+static void
+processingInstructionDebug(void *ctx UNUSED, const xmlChar *target,
const xmlChar *data)
{
fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
@@ -503,8 +517,8 @@ processingInstructionDebug(void *ctx, const xmlChar *target,
*
* A comment has been parsed.
*/
-void
-commentDebug(void *ctx, const xmlChar *value)
+static void
+commentDebug(void *ctx UNUSED, const xmlChar *value)
{
fprintf(stdout, "SAX.comment(%s)\n", value);
}
@@ -518,8 +532,8 @@ commentDebug(void *ctx, const xmlChar *value)
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
-void
-warningDebug(void *ctx, const char *msg, ...)
+static void
+warningDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -538,8 +552,8 @@ warningDebug(void *ctx, const char *msg, ...)
* Display and format a error messages, gives file, line, position and
* extra parameters.
*/
-void
-errorDebug(void *ctx, const char *msg, ...)
+static void
+errorDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -558,8 +572,8 @@ errorDebug(void *ctx, const char *msg, ...)
* Display and format a fatalError messages, gives file, line, position and
* extra parameters.
*/
-void
-fatalErrorDebug(void *ctx, const char *msg, ...)
+static void
+fatalErrorDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -606,7 +620,8 @@ xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
* *
************************************************************************/
-void parseSAXFile(char *filename) {
+static void
+parseSAXFile(char *filename) {
htmlDocPtr doc = NULL;
/*
@@ -687,7 +702,8 @@ void parseSAXFile(char *filename) {
}
}
-void parseAndPrintFile(char *filename) {
+static void
+parseAndPrintFile(char *filename) {
htmlDocPtr doc = NULL, tmp;
/*
diff --git a/testSAX.c b/testSAX.c
index ff96e4bd..51def378 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -44,6 +44,18 @@
#include <libxml/debugXML.h>
#include <libxml/xmlmemory.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
static int debug = 0;
static int copy = 0;
static int recovery = 0;
@@ -77,6 +89,7 @@ xmlSAXHandler emptySAXHandlerStruct = {
NULL, /* xmlParserError */
NULL, /* getParameterEntity */
NULL, /* cdataBlock; */
+ NULL /* externalSubset; */
};
xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
@@ -96,8 +109,8 @@ extern xmlSAXHandlerPtr debugSAXHandler;
*
* Returns 1 if true
*/
-int
-isStandaloneDebug(void *ctx)
+static int
+isStandaloneDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.isStandalone()\n");
return(0);
@@ -111,8 +124,8 @@ isStandaloneDebug(void *ctx)
*
* Returns 1 if true
*/
-int
-hasInternalSubsetDebug(void *ctx)
+static int
+hasInternalSubsetDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.hasInternalSubset()\n");
return(0);
@@ -126,8 +139,8 @@ hasInternalSubsetDebug(void *ctx)
*
* Returns 1 if true
*/
-int
-hasExternalSubsetDebug(void *ctx)
+static int
+hasExternalSubsetDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.hasExternalSubset()\n");
return(0);
@@ -139,8 +152,8 @@ hasExternalSubsetDebug(void *ctx)
*
* Does this document has an internal subset
*/
-void
-internalSubsetDebug(void *ctx, const xmlChar *name,
+static void
+internalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *ExternalID, const xmlChar *SystemID)
{
fprintf(stdout, "SAX.internalSubset(%s,", name);
@@ -155,6 +168,27 @@ internalSubsetDebug(void *ctx, const xmlChar *name,
}
/**
+ * externalSubsetDebug:
+ * @ctxt: An XML parser context
+ *
+ * Does this document has an external subset
+ */
+static void
+externalSubsetDebug(void *ctx UNUSED, const xmlChar *name,
+ const xmlChar *ExternalID, const xmlChar *SystemID)
+{
+ fprintf(stdout, "SAX.externalSubset(%s,", name);
+ if (ExternalID == NULL)
+ fprintf(stdout, " ,");
+ else
+ fprintf(stdout, " %s,", ExternalID);
+ if (SystemID == NULL)
+ fprintf(stdout, " )\n");
+ else
+ fprintf(stdout, " %s)\n", SystemID);
+}
+
+/**
* resolveEntityDebug:
* @ctxt: An XML parser context
* @publicId: The public ID of the entity
@@ -168,8 +202,8 @@ internalSubsetDebug(void *ctx, const xmlChar *name,
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
-xmlParserInputPtr
-resolveEntityDebug(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
+static xmlParserInputPtr
+resolveEntityDebug(void *ctx UNUSED, const xmlChar *publicId, const xmlChar *systemId)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
@@ -200,8 +234,8 @@ resolveEntityDebug(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
-xmlEntityPtr
-getEntityDebug(void *ctx, const xmlChar *name)
+static xmlEntityPtr
+getEntityDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getEntity(%s)\n", name);
return(NULL);
@@ -216,8 +250,8 @@ getEntityDebug(void *ctx, const xmlChar *name)
*
* Returns the xmlParserInputPtr
*/
-xmlEntityPtr
-getParameterEntityDebug(void *ctx, const xmlChar *name)
+static xmlEntityPtr
+getParameterEntityDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.getParameterEntity(%s)\n", name);
return(NULL);
@@ -235,8 +269,8 @@ getParameterEntityDebug(void *ctx, const xmlChar *name)
*
* An entity definition has been parsed
*/
-void
-entityDeclDebug(void *ctx, const xmlChar *name, int type,
+static void
+entityDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
{
fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@@ -251,10 +285,10 @@ entityDeclDebug(void *ctx, const xmlChar *name, int type,
*
* An attribute definition has been parsed
*/
-void
-attributeDeclDebug(void *ctx, const xmlChar *elem, const xmlChar *name,
+static void
+attributeDeclDebug(void *ctx UNUSED, const xmlChar *elem, const xmlChar *name,
int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree)
+ xmlEnumerationPtr tree UNUSED)
{
if (defaultValue == NULL)
fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n",
@@ -273,9 +307,9 @@ attributeDeclDebug(void *ctx, const xmlChar *elem, const xmlChar *name,
*
* An element definition has been parsed
*/
-void
-elementDeclDebug(void *ctx, const xmlChar *name, int type,
- xmlElementContentPtr content)
+static void
+elementDeclDebug(void *ctx UNUSED, const xmlChar *name, int type,
+ xmlElementContentPtr content UNUSED)
{
fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
@@ -290,8 +324,8 @@ elementDeclDebug(void *ctx, const xmlChar *name, int type,
*
* What to do when a notation declaration has been parsed.
*/
-void
-notationDeclDebug(void *ctx, const xmlChar *name,
+static void
+notationDeclDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId)
{
fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
@@ -308,8 +342,8 @@ notationDeclDebug(void *ctx, const xmlChar *name,
*
* What to do when an unparsed entity declaration is parsed
*/
-void
-unparsedEntityDeclDebug(void *ctx, const xmlChar *name,
+static void
+unparsedEntityDeclDebug(void *ctx UNUSED, const xmlChar *name,
const xmlChar *publicId, const xmlChar *systemId,
const xmlChar *notationName)
{
@@ -326,8 +360,8 @@ unparsedEntityDeclDebug(void *ctx, const xmlChar *name,
* Receive the document locator at startup, actually xmlDefaultSAXLocator
* Everything is available on the context, so this is useless in our case.
*/
-void
-setDocumentLocatorDebug(void *ctx, xmlSAXLocatorPtr loc)
+static void
+setDocumentLocatorDebug(void *ctx UNUSED, xmlSAXLocatorPtr loc UNUSED)
{
fprintf(stdout, "SAX.setDocumentLocator()\n");
}
@@ -338,8 +372,8 @@ setDocumentLocatorDebug(void *ctx, xmlSAXLocatorPtr loc)
*
* called when the document start being processed.
*/
-void
-startDocumentDebug(void *ctx)
+static void
+startDocumentDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.startDocument()\n");
}
@@ -350,8 +384,8 @@ startDocumentDebug(void *ctx)
*
* called when the document end has been detected.
*/
-void
-endDocumentDebug(void *ctx)
+static void
+endDocumentDebug(void *ctx UNUSED)
{
fprintf(stdout, "SAX.endDocument()\n");
}
@@ -363,8 +397,8 @@ endDocumentDebug(void *ctx)
*
* called when an opening tag has been processed.
*/
-void
-startElementDebug(void *ctx, const xmlChar *name, const xmlChar **atts)
+static void
+startElementDebug(void *ctx UNUSED, const xmlChar *name, const xmlChar **atts)
{
int i;
@@ -386,8 +420,8 @@ startElementDebug(void *ctx, const xmlChar *name, const xmlChar **atts)
*
* called when the end of an element has been detected.
*/
-void
-endElementDebug(void *ctx, const xmlChar *name)
+static void
+endElementDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
}
@@ -401,8 +435,8 @@ endElementDebug(void *ctx, const xmlChar *name)
* receiving some chars from the parser.
* Question: how much at a time ???
*/
-void
-charactersDebug(void *ctx, const xmlChar *ch, int len)
+static void
+charactersDebug(void *ctx UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -421,8 +455,8 @@ charactersDebug(void *ctx, const xmlChar *ch, int len)
*
* called when an entity reference is detected.
*/
-void
-referenceDebug(void *ctx, const xmlChar *name)
+static void
+referenceDebug(void *ctx UNUSED, const xmlChar *name)
{
fprintf(stdout, "SAX.reference(%s)\n", name);
}
@@ -437,8 +471,8 @@ referenceDebug(void *ctx, const xmlChar *name)
* receiving some ignorable whitespaces from the parser.
* Question: how much at a time ???
*/
-void
-ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)
+static void
+ignorableWhitespaceDebug(void *ctx UNUSED, const xmlChar *ch, int len)
{
char output[40];
int i;
@@ -458,8 +492,8 @@ ignorableWhitespaceDebug(void *ctx, const xmlChar *ch, int len)
*
* A processing instruction has been parsed.
*/
-void
-processingInstructionDebug(void *ctx, const xmlChar *target,
+static void
+processingInstructionDebug(void *ctx UNUSED, const xmlChar *target,
const xmlChar *data)
{
fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
@@ -474,8 +508,8 @@ processingInstructionDebug(void *ctx, const xmlChar *target,
*
* called when a pcdata block has been parsed
*/
-void
-cdataBlockDebug(void *ctx, const xmlChar *value, int len)
+static void
+cdataBlockDebug(void *ctx UNUSED, const xmlChar *value, int len)
{
fprintf(stdout, "SAX.pcdata(%.20s, %d)\n",
(char *) value, len);
@@ -488,8 +522,8 @@ cdataBlockDebug(void *ctx, const xmlChar *value, int len)
*
* A comment has been parsed.
*/
-void
-commentDebug(void *ctx, const xmlChar *value)
+static void
+commentDebug(void *ctx UNUSED, const xmlChar *value)
{
fprintf(stdout, "SAX.comment(%s)\n", value);
}
@@ -503,8 +537,8 @@ commentDebug(void *ctx, const xmlChar *value)
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
-void
-warningDebug(void *ctx, const char *msg, ...)
+static void
+warningDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -523,8 +557,8 @@ warningDebug(void *ctx, const char *msg, ...)
* Display and format a error messages, gives file, line, position and
* extra parameters.
*/
-void
-errorDebug(void *ctx, const char *msg, ...)
+static void
+errorDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -543,8 +577,8 @@ errorDebug(void *ctx, const char *msg, ...)
* Display and format a fatalError messages, gives file, line, position and
* extra parameters.
*/
-void
-fatalErrorDebug(void *ctx, const char *msg, ...)
+static void
+fatalErrorDebug(void *ctx UNUSED, const char *msg, ...)
{
va_list args;
@@ -580,7 +614,8 @@ xmlSAXHandler debugSAXHandlerStruct = {
errorDebug,
fatalErrorDebug,
getParameterEntityDebug,
- cdataBlockDebug
+ cdataBlockDebug,
+ externalSubsetDebug
};
xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
@@ -591,7 +626,8 @@ xmlSAXHandlerPtr debugSAXHandler = &debugSAXHandlerStruct;
* *
************************************************************************/
-void parseAndPrintFile(char *filename) {
+static void
+parseAndPrintFile(char *filename) {
int res;
if (push) {
@@ -602,16 +638,16 @@ void parseAndPrintFile(char *filename) {
*/
f = fopen(filename, "r");
if (f != NULL) {
- int res;
+ int ret;
char chars[10];
xmlParserCtxtPtr ctxt;
- res = fread(chars, 1, 4, f);
- if (res > 0) {
+ ret = fread(chars, 1, 4, f);
+ if (ret > 0) {
ctxt = xmlCreatePushParserCtxt(emptySAXHandler, NULL,
- chars, res, filename);
- while ((res = fread(chars, 1, 3, f)) > 0) {
- xmlParseChunk(ctxt, chars, res, 0);
+ chars, ret, filename);
+ while ((ret = fread(chars, 1, 3, f)) > 0) {
+ xmlParseChunk(ctxt, chars, ret, 0);
}
xmlParseChunk(ctxt, chars, 0, 1);
xmlFreeParserCtxt(ctxt);
@@ -626,22 +662,22 @@ void parseAndPrintFile(char *filename) {
*/
f = fopen(filename, "r");
if (f != NULL) {
- int res;
+ int ret;
char chars[10];
xmlParserCtxtPtr ctxt;
- res = fread(chars, 1, 4, f);
- if (res > 0) {
+ ret = fread(chars, 1, 4, f);
+ if (ret > 0) {
ctxt = xmlCreatePushParserCtxt(debugSAXHandler, NULL,
- chars, res, filename);
- while ((res = fread(chars, 1, 3, f)) > 0) {
- xmlParseChunk(ctxt, chars, res, 0);
+ chars, ret, filename);
+ while ((ret = fread(chars, 1, 3, f)) > 0) {
+ xmlParseChunk(ctxt, chars, ret, 0);
}
- res = xmlParseChunk(ctxt, chars, 0, 1);
+ ret = xmlParseChunk(ctxt, chars, 0, 1);
xmlFreeParserCtxt(ctxt);
- if (res != 0) {
+ if (ret != 0) {
fprintf(stdout,
- "xmlSAXUserParseFile returned error %d\n", res);
+ "xmlSAXUserParseFile returned error %d\n", ret);
}
}
fclose(f);
diff --git a/testURI.c b/testURI.c
index 5ec8157c..51817cc6 100644
--- a/testURI.c
+++ b/testURI.c
@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
const char *base = NULL;
xmlChar *composite;
- if ((argv[arg] != NULL) &&
+ if ((argc > 1) && (argv[arg] != NULL) &&
((!strcmp(argv[arg], "-base")) || (!strcmp(argv[arg], "--base")))) {
arg++;
base = argv[arg];
diff --git a/testXPath.c b/testXPath.c
index 2bd5eb59..d7f2a976 100644
--- a/testXPath.c
+++ b/testXPath.c
@@ -87,7 +87,8 @@ static xmlChar buffer[] =
";
-void testXPath(const char *str) {
+static void
+testXPath(const char *str) {
xmlXPathObjectPtr res;
xmlXPathContextPtr ctxt;
@@ -111,9 +112,10 @@ void testXPath(const char *str) {
xmlXPathFreeContext(ctxt);
}
-void testXPathFile(const char *filename) {
+static void
+testXPathFile(const char *filename) {
FILE *input;
- char expr[5000];
+ char expression[5000];
int len;
input = fopen(filename, "r");
@@ -122,16 +124,16 @@ void testXPathFile(const char *filename) {
"Cannot open %s for reading\n", filename);
return;
}
- while (fgets(expr, 4500, input) != NULL) {
- len = strlen(expr);
+ while (fgets(expression, 4500, input) != NULL) {
+ len = strlen(expression);
len--;
while ((len >= 0) &&
- ((expr[len] == '\n') || (expr[len] == '\t') ||
- (expr[len] == '\r') || (expr[len] == ' '))) len--;
- expr[len + 1] = 0;
+ ((expression[len] == '\n') || (expression[len] == '\t') ||
+ (expression[len] == '\r') || (expression[len] == ' '))) len--;
+ expression[len + 1] = 0;
if (len >= 0) {
- printf("\n========================\nExpression: %s\n", expr) ;
- testXPath(expr);
+ printf("\n========================\nExpression: %s\n", expression) ;
+ testXPath(expression);
}
}
diff --git a/tree.c b/tree.c
index a30bc0e1..c68d7732 100644
--- a/tree.c
+++ b/tree.c
@@ -37,6 +37,26 @@
#include <libxml/valid.h>
#include <libxml/xmlerror.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
+
+/************************************************************************
+ * *
+ * A few static variables and macros *
+ * *
+ ************************************************************************/
+
xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
xmlChar xmlStringTextNoenc[] =
{ 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
@@ -99,7 +119,7 @@ xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme) {
* Returns the current allocation scheme
*/
xmlBufferAllocationScheme
-xmlGetBufferAllocationScheme() {
+xmlGetBufferAllocationScheme(void) {
return xmlBufferAllocScheme;
}
@@ -1686,6 +1706,7 @@ xmlNewCDataBlock(xmlDocPtr doc, const xmlChar *content, int len) {
}
memset(cur, 0, sizeof(xmlNode));
cur->type = XML_CDATA_SECTION_NODE;
+ cur->doc = doc;
if (content != NULL) {
#ifndef XML_USE_BUFFER_CONTENT
@@ -3080,34 +3101,6 @@ xmlNodeSetBase(xmlNodePtr cur, xmlChar* uri) {
}
/**
- * xmlDocumentGetBase:
- * @doc: the document
- *
- * Searches for the Document BASE URL. The code should work on both XML
- * and HTML document.
- * It returns the base as defined in RFC 2396 section
- * 5.1.3. Base URI from the Retrieval URI
- * However it does not return the computed base (5.1.1 and 5.1.2), use
- * xmlNodeGetBase() for this
- *
- * Returns a pointer to the base URL, or NULL if not found
- * It's up to the caller to free the memory.
- */
-xmlChar *
-xmlDocumentGetBase(xmlDocPtr doc) {
- if (doc == NULL)
- return(NULL);
- if (doc->type == XML_HTML_DOCUMENT_NODE) {
- if (doc->URL != NULL)
- return(xmlStrdup(doc->URL));
- return(NULL);
- }
- if (doc->URL != NULL)
- return(xmlStrdup(doc->URL));
- return(NULL);
-}
-
-/**
* xmlNodeGetBase:
* @doc: the document the node pertains to
* @cur: the node being checked
@@ -3627,7 +3620,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
* namespace if defined
*/
xmlNsPtr *
-xmlGetNsList(xmlDocPtr doc, xmlNodePtr node) {
+xmlGetNsList(xmlDocPtr doc UNUSED, xmlNodePtr node) {
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
int nbns = 0;
@@ -5448,7 +5441,7 @@ xmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDtdPtr dtd, const char *encoding) {
*/
static void
xmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
- const char *encoding) {
+ const char *encoding UNUSED) {
xmlChar *value;
if (cur == NULL) {
@@ -5804,7 +5797,8 @@ xmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur,
void
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
- int * doc_txt_len, const char * txt_encoding, int format) {
+ int * doc_txt_len, const char * txt_encoding,
+ int format UNUSED) {
int dummy = 0;
xmlCharEncoding doc_charset;
diff --git a/tree.h b/tree.h
index dbba4d71..cd24ed10 100644
--- a/tree.h
+++ b/tree.h
@@ -394,8 +394,13 @@ LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
* Handling Buffers.
*/
+void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
+xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
+
xmlBufferPtr xmlBufferCreate (void);
xmlBufferPtr xmlBufferCreateSize (size_t size);
+int xmlBufferResize (xmlBufferPtr buf,
+ unsigned int size);
void xmlBufferFree (xmlBufferPtr buf);
int xmlBufferDump (FILE *file,
xmlBufferPtr buf);
@@ -440,6 +445,7 @@ xmlNsPtr xmlNewNs (xmlNodePtr node,
const xmlChar *href,
const xmlChar *prefix);
void xmlFreeNs (xmlNsPtr cur);
+void xmlFreeNsList (xmlNsPtr cur);
xmlDocPtr xmlNewDoc (const xmlChar *version);
void xmlFreeDoc (xmlDocPtr cur);
xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
diff --git a/uri.c b/uri.c
index 2334ec9c..183bef33 100644
--- a/uri.c
+++ b/uri.c
@@ -556,7 +556,7 @@ xmlPrintURI(FILE *stream, xmlURIPtr uri) {
*
* Make sure the xmlURI struct is free of content
*/
-void
+static void
xmlCleanURI(xmlURIPtr uri) {
if (uri == NULL) return;
@@ -1064,7 +1064,7 @@ xmlURIEscape(const xmlChar *str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIFragment(xmlURIPtr uri, const char **str) {
const char *cur = *str;
@@ -1090,7 +1090,7 @@ xmlParseURIFragment(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIQuery(xmlURIPtr uri, const char **str) {
const char *cur = *str;
@@ -1116,7 +1116,7 @@ xmlParseURIQuery(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIScheme(xmlURIPtr uri, const char **str) {
const char *cur;
@@ -1148,7 +1148,7 @@ xmlParseURIScheme(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIOpaquePart(xmlURIPtr uri, const char **str) {
const char *cur;
@@ -1190,7 +1190,7 @@ xmlParseURIOpaquePart(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIServer(xmlURIPtr uri, const char **str) {
const char *cur;
const char *host, *tmp;
@@ -1324,7 +1324,7 @@ host_done:
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIRelSegment(xmlURIPtr uri, const char **str) {
const char *cur;
@@ -1359,7 +1359,7 @@ xmlParseURIRelSegment(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) {
const char *cur;
@@ -1439,7 +1439,7 @@ xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIAuthority(xmlURIPtr uri, const char **str) {
const char *cur;
int ret;
@@ -1489,7 +1489,7 @@ xmlParseURIAuthority(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseURIHierPart(xmlURIPtr uri, const char **str) {
int ret;
const char *cur;
@@ -1538,7 +1538,7 @@ xmlParseURIHierPart(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
int ret;
@@ -1570,7 +1570,7 @@ xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) {
*
* Returns 0 or the error code
*/
-int
+static int
xmlParseRelativeURI(xmlURIPtr uri, const char **str) {
int ret = 0;
const char *cur;
@@ -1712,7 +1712,7 @@ xmlParseURI(const char *str) {
xmlChar *
xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
xmlChar *val = NULL;
- int ret, len, index, cur, out;
+ int ret, len, indx, cur, out;
xmlURIPtr ref = NULL;
xmlURIPtr bas = NULL;
xmlURIPtr res = NULL;
@@ -1908,14 +1908,14 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
* string.
*/
if (ref->path != NULL && ref->path[0] != 0) {
- index = 0;
+ indx = 0;
/*
* Ensure the path includes a '/'
*/
if ((out == 0) && (bas->server != NULL))
res->path[out++] = '/';
- while (ref->path[index] != 0) {
- res->path[out++] = ref->path[index++];
+ while (ref->path[indx] != 0) {
+ res->path[out++] = ref->path[indx++];
}
}
res->path[out] = 0;
diff --git a/valid.c b/valid.c
index 79387094..3ae61e22 100644
--- a/valid.c
+++ b/valid.c
@@ -28,6 +28,18 @@
#include <libxml/xmlerror.h>
#include <libxml/list.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
/*
* Generic function for accessing stacks in the Validity Context
*/
@@ -333,7 +345,7 @@ xmlFreeElementContent(xmlElementContentPtr cur) {
*
* This will dump the content of the element table as an XML DTD definition
*/
-void
+static void
xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) {
if (content == NULL) return;
@@ -466,7 +478,7 @@ xmlSprintfElementContent(char *buf, xmlElementContentPtr content, int glob) {
*
* Returns the xmlElementTablePtr just created or NULL in case of error.
*/
-xmlElementTablePtr
+static xmlElementTablePtr
xmlCreateElementTable(void) {
return(xmlHashCreate(0));
}
@@ -477,7 +489,7 @@ xmlCreateElementTable(void) {
*
* Deallocate the memory used by an element definition
*/
-void
+static void
xmlFreeElement(xmlElementPtr elem) {
if (elem == NULL) return;
xmlUnlinkNode((xmlNodePtr) elem);
@@ -646,7 +658,7 @@ xmlFreeElementTable(xmlElementTablePtr table) {
*
* Returns the new xmlElementPtr or NULL in case of error.
*/
-xmlElementPtr
+static xmlElementPtr
xmlCopyElement(xmlElementPtr elem) {
xmlElementPtr cur;
@@ -814,7 +826,7 @@ xmlCopyEnumeration(xmlEnumerationPtr cur) {
*
* This will dump the content of the enumeration
*/
-void
+static void
xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) {
if (cur == NULL) return;
@@ -835,7 +847,7 @@ xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) {
* Returns the xmlAttributeTablePtr just created or NULL in case
* of error.
*/
-xmlAttributeTablePtr
+static xmlAttributeTablePtr
xmlCreateAttributeTable(void) {
return(xmlHashCreate(0));
}
@@ -848,9 +860,9 @@ xmlCreateAttributeTable(void) {
* Callback called by xmlScanAttributeDecl when a new attribute
* has to be entered in the list.
*/
-void
+static void
xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list,
- const xmlChar* name) {
+ const xmlChar* name UNUSED) {
attr->nexth = *list;
*list = attr;
}
@@ -901,7 +913,7 @@ xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) {
*
* Returns the number of ID attributes found.
*/
-int
+static int
xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
xmlAttributePtr cur;
int ret = 0;
@@ -927,7 +939,7 @@ xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
*
* Deallocate the memory used by an attribute definition
*/
-void
+static void
xmlFreeAttribute(xmlAttributePtr attr) {
if (attr == NULL) return;
xmlUnlinkNode((xmlNodePtr) attr);
@@ -1127,7 +1139,7 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) {
*
* Returns the new xmlAttributePtr or NULL in case of error.
*/
-xmlAttributePtr
+static xmlAttributePtr
xmlCopyAttribute(xmlAttributePtr attr) {
xmlAttributePtr cur;
@@ -1269,7 +1281,7 @@ xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) {
* Returns the xmlNotationTablePtr just created or NULL in case
* of error.
*/
-xmlNotationTablePtr
+static xmlNotationTablePtr
xmlCreateNotationTable(void) {
return(xmlHashCreate(0));
}
@@ -1280,7 +1292,7 @@ xmlCreateNotationTable(void) {
*
* Deallocate the memory used by an notation definition
*/
-void
+static void
xmlFreeNotation(xmlNotationPtr nota) {
if (nota == NULL) return;
if (nota->name != NULL)
@@ -1307,7 +1319,8 @@ xmlFreeNotation(xmlNotationPtr nota) {
* Returns NULL if not, othervise the entity
*/
xmlNotationPtr
-xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
+xmlAddNotationDecl(xmlValidCtxtPtr ctxt UNUSED, xmlDtdPtr dtd,
+ const xmlChar *name,
const xmlChar *PublicID, const xmlChar *SystemID) {
xmlNotationPtr ret;
xmlNotationTablePtr table;
@@ -1388,7 +1401,7 @@ xmlFreeNotationTable(xmlNotationTablePtr table) {
*
* Returns the new xmlNotationPtr or NULL in case of error.
*/
-xmlNotationPtr
+static xmlNotationPtr
xmlCopyNotation(xmlNotationPtr nota) {
xmlNotationPtr cur;
@@ -1477,7 +1490,7 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
* Returns the xmlIDTablePtr just created or NULL in case
* of error.
*/
-xmlIDTablePtr
+static xmlIDTablePtr
xmlCreateIDTable(void) {
return(xmlHashCreate(0));
}
@@ -1488,7 +1501,7 @@ xmlCreateIDTable(void) {
*
* Deallocate the memory used by an id definition
*/
-void
+static void
xmlFreeID(xmlIDPtr id) {
if (id == NULL) return;
if (id->value != NULL)
@@ -1714,7 +1727,7 @@ typedef xmlValidateMemo *xmlValidateMemoPtr;
* Returns the xmlRefTablePtr just created or NULL in case
* of error.
*/
-xmlRefTablePtr
+static xmlRefTablePtr
xmlCreateRefTable(void) {
return(xmlHashCreate(0));
}
@@ -1780,7 +1793,7 @@ xmlWalkRemoveRef(const void *data, const void *user)
* Returns NULL if not, othervise the new xmlRefPtr
*/
xmlRefPtr
-xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
+xmlAddRef(xmlValidCtxtPtr ctxt UNUSED, xmlDocPtr doc, const xmlChar *value,
xmlAttrPtr attr) {
xmlRefPtr ret;
xmlRefTablePtr table;
@@ -2029,7 +2042,7 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
* returns the xmlElementPtr if found or NULL
*/
-xmlElementPtr
+static xmlElementPtr
xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name,
const xmlChar *prefix) {
xmlElementTablePtr table;
@@ -2090,7 +2103,7 @@ xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) {
* returns the xmlAttributePtr if found or NULL
*/
-xmlAttributePtr
+static xmlAttributePtr
xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name,
const xmlChar *prefix) {
xmlAttributeTablePtr table;
@@ -2198,7 +2211,7 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) {
* returns 1 if valid or 0 otherwise
*/
-int
+static int
xmlValidateNameValue(const xmlChar *value) {
const xmlChar *cur;
@@ -2231,7 +2244,7 @@ xmlValidateNameValue(const xmlChar *value) {
* returns 1 if valid or 0 otherwise
*/
-int
+static int
xmlValidateNamesValue(const xmlChar *value) {
const xmlChar *cur;
@@ -2282,7 +2295,7 @@ xmlValidateNamesValue(const xmlChar *value) {
* returns 1 if valid or 0 otherwise
*/
-int
+static int
xmlValidateNmtokenValue(const xmlChar *value) {
const xmlChar *cur;
@@ -2319,7 +2332,7 @@ xmlValidateNmtokenValue(const xmlChar *value) {
* returns 1 if valid or 0 otherwise
*/
-int
+static int
xmlValidateNmtokensValue(const xmlChar *value) {
const xmlChar *cur;
@@ -2381,8 +2394,8 @@ xmlValidateNmtokensValue(const xmlChar *value) {
*/
int
-xmlValidateNotationDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
- xmlNotationPtr nota) {
+xmlValidateNotationDecl(xmlValidCtxtPtr ctxt UNUSED, xmlDocPtr doc UNUSED,
+ xmlNotationPtr nota UNUSED) {
int ret = 1;
return(ret);
@@ -2464,7 +2477,7 @@ xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) {
* returns 1 if valid or 0 otherwise
*/
-int
+static int
xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
const xmlChar *name, xmlAttributeType type, const xmlChar *value) {
int ret = 1;
@@ -2618,9 +2631,9 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
return(ret);
}
-void
+static void
xmlValidateAttributeIdCallback(xmlAttributePtr attr, int *count,
- const xmlChar* name) {
+ const xmlChar* name UNUSED) {
if (attr->atype == XML_ATTRIBUTE_ID) (*count)++;
}
@@ -3066,7 +3079,7 @@ int xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
* also update child value in-situ.
*/
-int
+static int
xmlValidateElementTypeExpr(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
xmlElementContentPtr cont) {
xmlNodePtr cur;
@@ -3262,7 +3275,7 @@ xmlValidateElementTypeElement(xmlValidCtxtPtr ctxt, xmlNodePtr *child,
* This will dump the list of childs to the buffer
* Intended just for the debug routine
*/
-void
+static void
xmlSprintfElementChilds(char *buf, xmlNodePtr node, int glob) {
xmlNodePtr cur;
@@ -3728,7 +3741,7 @@ xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
* @name: Name of ID we are searching for
*
*/
-void
+static void
xmlValidateRef(xmlRefPtr ref, xmlValidCtxtPtr ctxt,
const xmlChar *name) {
xmlAttrPtr id;
@@ -3896,9 +3909,9 @@ xmlValidateDtd(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd) {
return(ret);
}
-void
+static void
xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt,
- const xmlChar *name) {
+ const xmlChar *name UNUSED) {
if (cur == NULL)
return;
switch (cur->atype) {
diff --git a/valid.h b/valid.h
index a7eb675d..2df3c583 100644
--- a/valid.h
+++ b/valid.h
@@ -11,6 +11,7 @@
#define __XML_VALID_H__
#include <libxml/tree.h>
+#include <libxml/list.h>
#ifdef __cplusplus
extern "C" {
@@ -167,6 +168,8 @@ int xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr);
+xmlListPtr xmlGetRefs (xmlDocPtr doc,
+ const xmlChar *ID);
/**
* The public function calls related to validity checking
diff --git a/xinclude.c b/xinclude.c
index 3c203638..b27773f5 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -79,7 +79,7 @@ struct _xmlXIncludeCtxt {
*
* Add a new node to process to an XInclude context
*/
-void
+static void
xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
if (ctxt->incMax == 0) {
ctxt->incMax = 4;
@@ -128,7 +128,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
*
* Add a new document to the list
*/
-void
+static void
xmlXIncludeAddDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, const xmlURL url) {
if (ctxt->docMax == 0) {
ctxt->docMax = 4;
@@ -177,7 +177,7 @@ xmlXIncludeAddDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, const xmlURL url) {
*
* Add a new txtument to the list
*/
-void
+static void
xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
if (ctxt->txtMax == 0) {
ctxt->txtMax = 4;
@@ -226,7 +226,7 @@ xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) {
*
* Returns the new set
*/
-xmlXIncludeCtxtPtr
+static xmlXIncludeCtxtPtr
xmlXIncludeNewContext(xmlDocPtr doc) {
xmlXIncludeCtxtPtr ret;
@@ -254,7 +254,7 @@ xmlXIncludeNewContext(xmlDocPtr doc) {
*
* Free an XInclude context
*/
-void
+static void
xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
int i;
@@ -299,7 +299,7 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) {
*
* Load the document, and store the result in the XInclude context
*/
-void
+static void
xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlDocPtr doc;
xmlURIPtr uri;
@@ -417,7 +417,7 @@ loaded:
*
* Load the content, and store the result in the XInclude context
*/
-void
+static void
xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
xmlParserInputBufferPtr buf;
xmlNodePtr node;
@@ -529,7 +529,7 @@ loaded:
*
* Returns the result list or NULL in case of error
*/
-xmlNodePtr
+static xmlNodePtr
xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
xmlXIncludeAddNode(ctxt, node);
return(0);
@@ -544,7 +544,7 @@ xmlXIncludePreProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) {
*
* Returns 0 if substition succeeded, -1 if some processing failed
*/
-int
+static int
xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr cur;
xmlChar *href;
@@ -668,7 +668,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) {
*
* Returns 0 if substition succeeded, -1 if some processing failed
*/
-int
+static int
xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
xmlNodePtr cur, end, list;
@@ -710,15 +710,14 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
/**
* xmlXIncludeTestNode:
- * @doc: an XML document
* @node: an XInclude node
*
* test if the node is an XInclude node
*
* Returns 1 true, 0 otherwise
*/
-int
-xmlXIncludeTestNode(xmlDocPtr doc, xmlNodePtr node) {
+static int
+xmlXIncludeTestNode(xmlNodePtr node) {
if (node == NULL)
return(0);
if (node->ns == NULL)
@@ -754,18 +753,18 @@ xmlXIncludeProcess(xmlDocPtr doc) {
* First phase: lookup the elements in the document
*/
cur = xmlDocGetRootElement(doc);
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
while (cur != NULL) {
/* TODO: need to work on entities -> stack */
if ((cur->children != NULL) &&
(cur->children->type != XML_ENTITY_DECL)) {
cur = cur->children;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
} else if (cur->next != NULL) {
cur = cur->next;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
} else {
do {
@@ -773,7 +772,7 @@ xmlXIncludeProcess(xmlDocPtr doc) {
if (cur == NULL) break; /* do */
if (cur->next != NULL) {
cur = cur->next;
- if (xmlXIncludeTestNode(doc, cur))
+ if (xmlXIncludeTestNode(cur))
xmlXIncludePreProcessNode(ctxt, cur);
break; /* do */
}
diff --git a/xmlIO.c b/xmlIO.c
index 9860ef66..5e72400d 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -120,6 +120,18 @@ int xmlOutputCallbackInitialized = 0;
/************************************************************************
* *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+/************************************************************************
+ * *
* Standard I/O for file accesses *
* *
************************************************************************/
@@ -159,95 +171,12 @@ xmlCheckFilename (const char *path)
return 1;
}
-int
+static int
xmlNop(void) {
return(0);
}
/**
- * xmlFdMatch:
- * @filename: the URI for matching
- *
- * input from file descriptor
- *
- * Returns 1 if matches, 0 otherwise
- */
-int
-xmlFdMatch (const char *filename) {
- return(1);
-}
-
-/**
- * xmlFdOpen:
- * @filename: the URI for matching
- *
- * input from file descriptor, supports compressed input
- * if @filename is "-" then the standard input is used
- *
- * Returns an I/O context or NULL in case of error
- */
-void *
-xmlFdOpen (const char *filename) {
- const char *path = NULL;
- int fd;
-
- if (!strcmp(filename, "-")) {
- fd = 0;
- return((void *) fd);
- }
-
- if (!strncmp(filename, "file://localhost", 16))
- path = &filename[16];
- else if (!strncmp(filename, "file:///", 8))
- path = &filename[8];
- else if (filename[0] == '/')
- path = filename;
- if (path == NULL)
- return(NULL);
-
-#ifdef WIN32
- fd = _open (path, O_RDONLY | _O_BINARY);
-#else
- fd = open (path, O_RDONLY);
-#endif
-
- return((void *) fd);
-}
-
-/**
- * xmlFdOpenW:
- * @filename: the URI for matching
- *
- * input from file descriptor,
- * if @filename is "-" then the standard output is used
- *
- * Returns an I/O context or NULL in case of error
- */
-void *
-xmlFdOpenW (const char *filename) {
- const char *path = NULL;
- int fd;
-
- if (!strcmp(filename, "-")) {
- fd = 1;
- return((void *) fd);
- }
-
- if (!strncmp(filename, "file://localhost", 16))
- path = &filename[16];
- else if (!strncmp(filename, "file:///", 8))
- path = &filename[8];
- else if (filename[0] == '/')
- path = filename;
- if (path == NULL)
- return(NULL);
-
- fd = open (path, O_WRONLY);
-
- return((void *) fd);
-}
-
-/**
* xmlFdRead:
* @context: the I/O context
* @buffer: where to drop data
@@ -257,7 +186,7 @@ xmlFdOpenW (const char *filename) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlFdRead (void * context, char * buffer, int len) {
return(read((int) context, &buffer[0], len));
}
@@ -272,7 +201,7 @@ xmlFdRead (void * context, char * buffer, int len) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlFdWrite (void * context, const char * buffer, int len) {
return(write((int) context, &buffer[0], len));
}
@@ -283,7 +212,7 @@ xmlFdWrite (void * context, const char * buffer, int len) {
*
* Close an I/O channel
*/
-void
+static void
xmlFdClose (void * context) {
close((int) context);
}
@@ -296,8 +225,8 @@ xmlFdClose (void * context) {
*
* Returns 1 if matches, 0 otherwise
*/
-int
-xmlFileMatch (const char *filename) {
+static int
+xmlFileMatch (const char *filename UNUSED) {
return(1);
}
@@ -310,7 +239,7 @@ xmlFileMatch (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlFileOpen (const char *filename) {
const char *path = NULL;
FILE *fd;
@@ -349,7 +278,7 @@ xmlFileOpen (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlFileOpenW (const char *filename) {
const char *path = NULL;
FILE *fd;
@@ -383,7 +312,7 @@ xmlFileOpenW (const char *filename) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlFileRead (void * context, char * buffer, int len) {
return(fread(&buffer[0], 1, len, (FILE *) context));
}
@@ -398,7 +327,7 @@ xmlFileRead (void * context, char * buffer, int len) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlFileWrite (void * context, const char * buffer, int len) {
return(fwrite(&buffer[0], 1, len, (FILE *) context));
}
@@ -409,7 +338,7 @@ xmlFileWrite (void * context, const char * buffer, int len) {
*
* Close an I/O channel
*/
-void
+static void
xmlFileClose (void * context) {
fclose((FILE *) context);
}
@@ -420,7 +349,7 @@ xmlFileClose (void * context) {
*
* Flush an I/O channel
*/
-void
+static void
xmlFileFlush (void * context) {
fflush((FILE *) context);
}
@@ -439,8 +368,8 @@ xmlFileFlush (void * context) {
*
* Returns 1 if matches, 0 otherwise
*/
-int
-xmlGzfileMatch (const char *filename) {
+static int
+xmlGzfileMatch (const char *filename UNUSED) {
return(1);
}
@@ -453,7 +382,7 @@ xmlGzfileMatch (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlGzfileOpen (const char *filename) {
const char *path = NULL;
gzFile fd;
@@ -489,7 +418,7 @@ xmlGzfileOpen (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlGzfileOpenW (const char *filename, int compression) {
const char *path = NULL;
char mode[15];
@@ -525,7 +454,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlGzfileRead (void * context, char * buffer, int len) {
return(gzread((gzFile) context, &buffer[0], len));
}
@@ -540,7 +469,7 @@ xmlGzfileRead (void * context, char * buffer, int len) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlGzfileWrite (void * context, const char * buffer, int len) {
return(gzwrite((gzFile) context, (char *) &buffer[0], len));
}
@@ -551,7 +480,7 @@ xmlGzfileWrite (void * context, const char * buffer, int len) {
*
* Close a compressed I/O channel
*/
-void
+static void
xmlGzfileClose (void * context) {
gzclose((gzFile) context);
}
@@ -571,7 +500,7 @@ xmlGzfileClose (void * context) {
*
* Returns 1 if matches, 0 otherwise
*/
-int
+static int
xmlIOHTTPMatch (const char *filename) {
if (!strncmp(filename, "http://", 7))
return(1);
@@ -586,7 +515,7 @@ xmlIOHTTPMatch (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlIOHTTPOpen (const char *filename) {
return(xmlNanoHTTPOpen(filename, NULL));
}
@@ -601,7 +530,7 @@ xmlIOHTTPOpen (const char *filename) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlIOHTTPRead(void * context, char * buffer, int len) {
return(xmlNanoHTTPRead(context, &buffer[0], len));
}
@@ -612,7 +541,7 @@ xmlIOHTTPRead(void * context, char * buffer, int len) {
*
* Close an HTTP I/O channel
*/
-void
+static void
xmlIOHTTPClose (void * context) {
xmlNanoHTTPClose(context);
}
@@ -632,7 +561,7 @@ xmlIOHTTPClose (void * context) {
*
* Returns 1 if matches, 0 otherwise
*/
-int
+static int
xmlIOFTPMatch (const char *filename) {
if (!strncmp(filename, "ftp://", 6))
return(1);
@@ -647,7 +576,7 @@ xmlIOFTPMatch (const char *filename) {
*
* Returns an I/O context or NULL in case of error
*/
-void *
+static void *
xmlIOFTPOpen (const char *filename) {
return(xmlNanoFTPOpen(filename));
}
@@ -662,7 +591,7 @@ xmlIOFTPOpen (const char *filename) {
*
* Returns the number of bytes written
*/
-int
+static int
xmlIOFTPRead(void * context, char * buffer, int len) {
return(xmlNanoFTPRead(context, &buffer[0], len));
}
@@ -673,7 +602,7 @@ xmlIOFTPRead(void * context, char * buffer, int len) {
*
* Close an FTP I/O channel
*/
-void
+static void
xmlIOFTPClose (void * context) {
xmlNanoFTPClose(context);
}
@@ -682,51 +611,51 @@ xmlIOFTPClose (void * context) {
/**
* xmlRegisterInputCallbacks:
- * @match: the xmlInputMatchCallback
- * @open: the xmlInputOpenCallback
- * @read: the xmlInputReadCallback
- * @close: the xmlInputCloseCallback
+ * @matchFunc: the xmlInputMatchCallback
+ * @openFunc: the xmlInputOpenCallback
+ * @readFunc: the xmlInputReadCallback
+ * @closeFunc: the xmlInputCloseCallback
*
* Register a new set of I/O callback for handling parser input.
*
* Returns the registered handler number or -1 in case of error
*/
int
-xmlRegisterInputCallbacks(xmlInputMatchCallback match,
- xmlInputOpenCallback open, xmlInputReadCallback read,
- xmlInputCloseCallback close) {
+xmlRegisterInputCallbacks(xmlInputMatchCallback matchFunc,
+ xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc) {
if (xmlInputCallbackNr >= MAX_INPUT_CALLBACK) {
return(-1);
}
- xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = match;
- xmlInputCallbackTable[xmlInputCallbackNr].opencallback = open;
- xmlInputCallbackTable[xmlInputCallbackNr].readcallback = read;
- xmlInputCallbackTable[xmlInputCallbackNr].closecallback = close;
+ xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = matchFunc;
+ xmlInputCallbackTable[xmlInputCallbackNr].opencallback = openFunc;
+ xmlInputCallbackTable[xmlInputCallbackNr].readcallback = readFunc;
+ xmlInputCallbackTable[xmlInputCallbackNr].closecallback = closeFunc;
return(xmlInputCallbackNr++);
}
/**
* xmlRegisterOutputCallbacks:
- * @match: the xmlOutputMatchCallback
- * @open: the xmlOutputOpenCallback
- * @write: the xmlOutputWriteCallback
- * @close: the xmlOutputCloseCallback
+ * @matchFunc: the xmlOutputMatchCallback
+ * @openFunc: the xmlOutputOpenCallback
+ * @writeFunc: the xmlOutputWriteCallback
+ * @closeFunc: the xmlOutputCloseCallback
*
* Register a new set of I/O callback for handling output.
*
* Returns the registered handler number or -1 in case of error
*/
int
-xmlRegisterOutputCallbacks(xmlOutputMatchCallback match,
- xmlOutputOpenCallback open, xmlOutputWriteCallback write,
- xmlOutputCloseCallback close) {
+xmlRegisterOutputCallbacks(xmlOutputMatchCallback matchFunc,
+ xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc,
+ xmlOutputCloseCallback closeFunc) {
if (xmlOutputCallbackNr >= MAX_INPUT_CALLBACK) {
return(-1);
}
- xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = match;
- xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = open;
- xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = write;
- xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = close;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = matchFunc;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].opencallback = openFunc;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].writecallback = writeFunc;
+ xmlOutputCallbackTable[xmlOutputCallbackNr].closecallback = closeFunc;
return(xmlOutputCallbackNr++);
}
diff --git a/xmlIO.h b/xmlIO.h
index ecff73bc..fee5b9b3 100644
--- a/xmlIO.h
+++ b/xmlIO.h
@@ -112,10 +112,10 @@ int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
char * xmlParserGetDirectory (const char *filename);
-int xmlRegisterInputCallbacks (xmlInputMatchCallback match,
- xmlInputOpenCallback open,
- xmlInputReadCallback read,
- xmlInputCloseCallback close);
+int xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
+ xmlInputOpenCallback openFunc,
+ xmlInputReadCallback readFunc,
+ xmlInputCloseCallback closeFunc);
/*
* Interfaces for output
*/
@@ -151,10 +151,10 @@ int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
int xmlOutputBufferFlush (xmlOutputBufferPtr out);
int xmlOutputBufferClose (xmlOutputBufferPtr out);
-int xmlRegisterOutputCallbacks (xmlOutputMatchCallback match,
- xmlOutputOpenCallback open,
- xmlOutputWriteCallback write,
- xmlOutputCloseCallback close);
+int xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
+ xmlOutputOpenCallback openFunc,
+ xmlOutputWriteCallback writeFunc,
+ xmlOutputCloseCallback closeFunc);
/*
* This save function are part of tree.h and HTMLtree.h actually
diff --git a/xmllint.c b/xmllint.c
index 332146a2..dfe1e690 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -109,7 +109,7 @@ extern int xmlGetWarningsDefaultValue;
************************************************************************/
char buffer[50000];
-void
+static void
xmlHTMLEncodeSend(void) {
char *result;
@@ -128,7 +128,7 @@ xmlHTMLEncodeSend(void) {
* Displays the associated file and line informations for the current input
*/
-void
+static void
xmlHTMLPrintFileInfo(xmlParserInputPtr input) {
xmlGenericError(xmlGenericErrorContext, "<p>");
if (input != NULL) {
@@ -149,7 +149,7 @@ xmlHTMLPrintFileInfo(xmlParserInputPtr input) {
* Displays current context within the input content for error tracking
*/
-void
+static void
xmlHTMLPrintFileContext(xmlParserInputPtr input) {
const xmlChar *cur, *base;
int n;
@@ -194,7 +194,7 @@ xmlHTMLPrintFileContext(xmlParserInputPtr input) {
* Display and format an error messages, gives file, line, position and
* extra parameters.
*/
-void
+static void
xmlHTMLError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -231,7 +231,7 @@ xmlHTMLError(void *ctx, const char *msg, ...)
* Display and format a warning messages, gives file, line, position and
* extra parameters.
*/
-void
+static void
xmlHTMLWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -269,7 +269,7 @@ xmlHTMLWarning(void *ctx, const char *msg, ...)
* Display and format an validity error messages, gives file,
* line, position and extra parameters.
*/
-void
+static void
xmlHTMLValidityError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -303,7 +303,7 @@ xmlHTMLValidityError(void *ctx, const char *msg, ...)
* Display and format a validity warning messages, gives file, line,
* position and extra parameters.
*/
-void
+static void
xmlHTMLValidityWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
@@ -342,7 +342,7 @@ xmlHTMLValidityWarning(void *ctx, const char *msg, ...)
* Returns a pointer to it or NULL on EOF the caller is expected to
* free the returned string.
*/
-char *
+static char *
xmlShellReadline(char *prompt) {
#ifdef HAVE_LIBREADLINE
char *line_read;
@@ -373,10 +373,10 @@ xmlShellReadline(char *prompt) {
* *
************************************************************************/
-int myRead(FILE *f, char * buffer, int len) {
- return(fread(buffer, 1, len, f));
+static int myRead(FILE *f, char * buf, int len) {
+ return(fread(buf, 1, len, f));
}
-void myClose(FILE *f) {
+static void myClose(FILE *f) {
if (f != stdin) {
fclose(f);
}
@@ -387,7 +387,7 @@ void myClose(FILE *f) {
* Test processing *
* *
************************************************************************/
-void parseAndPrintFile(char *filename) {
+static void parseAndPrintFile(char *filename) {
xmlDocPtr doc = NULL, tmp;
if ((timing) && (!repeat))
diff --git a/xmlmemory.c b/xmlmemory.c
index 4cf16031..dd695da1 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -33,6 +33,32 @@
#include <libxml/xmlmemory.h>
#include <libxml/xmlerror.h>
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
+void xmlMallocBreakpoint(void);
+void * xmlMemMalloc(int size);
+void * xmlMallocLoc(int size, const char * file, int line);
+void * xmlMemRealloc(void *ptr,int size);
+void xmlMemFree(void *ptr);
+char * xmlMemoryStrdup(const char *str);
+
+/************************************************************************
+ * *
+ * Macros, variables and associated types *
+ * *
+ ************************************************************************/
+
+
#ifdef xmlMalloc
#undef xmlMalloc
#endif
@@ -384,7 +410,7 @@ xmlMemUsed(void) {
* tries to show some content from the memory block
*/
-void
+static void
xmlMemContentShow(FILE *fp, MEMHDR *p)
{
int i,j,len = p->mh_size;
@@ -498,7 +524,7 @@ xmlMemDisplay(FILE *fp)
currentTime = time(NULL);
tstruct = localtime(&currentTime);
- strftime(buf, sizeof(buf) - 1, "%c", tstruct);
+ strftime(buf, sizeof(buf) - 1, "%I:%M:%S %p", tstruct);
fprintf(fp," %s\n\n", buf);
#endif
diff --git a/xpath.c b/xpath.c
index 32ecbb22..fd760e5a 100644
--- a/xpath.c
+++ b/xpath.c
@@ -276,7 +276,7 @@ struct _xmlXPathCompExpr {
*
* Returns the newly allocated xmlXPathCompExprPtr or NULL in case of error
*/
-xmlXPathCompExprPtr
+static xmlXPathCompExprPtr
xmlXPathNewCompExpr(void) {
xmlXPathCompExprPtr cur;
@@ -350,7 +350,7 @@ xmlXPathFreeCompExpr(xmlXPathCompExprPtr comp) {
*
* Returns -1 in case of failure, the index otherwise
*/
-int
+static int
xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2,
xmlXPathOp op, int value,
int value2, int value3, void *value4, void *value5) {
@@ -410,7 +410,8 @@ xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), (val), (val2), 0 ,NULL ,NULL
__FILE__, __LINE__);
#ifdef LIBXML_DEBUG_ENABLED
-void xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
+static void
+xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
int i;
char shift[100];
@@ -433,7 +434,8 @@ void xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) {
else
xmlDebugDumpOneNode(output, cur, depth);
}
-void xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
+static void
+xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
xmlNodePtr tmp;
int i;
char shift[100];
@@ -455,7 +457,8 @@ void xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) {
}
}
-void xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
+static void
+xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
int i;
char shift[100];
@@ -478,7 +481,8 @@ void xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) {
}
}
-void xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
+static void
+xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
int i;
char shift[100];
@@ -499,7 +503,8 @@ void xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) {
}
#if defined(LIBXML_XPTR_ENABLED)
void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth);
-void xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
+static void
+xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) {
int i;
char shift[100];
@@ -617,7 +622,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) {
}
}
-void xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
+static void
+xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp,
xmlXPathStepOpPtr op, int depth) {
int i;
char shift[100];
@@ -788,8 +794,10 @@ finish:
if (op->ch2 >= 0)
xmlXPathDebugDumpStepOp(output, comp, &comp->steps[op->ch2], depth + 1);
}
-void xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
- int depth) {
+
+void
+xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp,
+ int depth) {
int i;
char shift[100];
@@ -933,7 +941,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
int is_negative;
int use_scientific;
int exponent;
- int index;
+ int indx;
int count;
double n;
@@ -964,8 +972,8 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
} else {
n = number;
for (i = 1; i < INTEGER_DIGITS - 1; i++) {
- index = (int)n % 10;
- *(--pointer) = "0123456789"[index];
+ indx = (int)n % 10;
+ *(--pointer) = "0123456789"[indx];
n /= 10.0;
if (n < 1.0)
break;
@@ -989,10 +997,10 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
while (i < FRACTION_DIGITS) {
n -= floor(n);
n *= 10.0;
- index = (int)n % 10;
- *(pointer++) = "0123456789"[index];
+ indx = (int)n % 10;
+ *(pointer++) = "0123456789"[indx];
i++;
- if ((index != 0) || (count > 0))
+ if ((indx != 0) || (count > 0))
count++;
if ((n > 10.0) || (count > FRACTION_DIGITS / 2))
break;
@@ -1494,7 +1502,7 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) {
* Free the NodeSet compound and the actual tree, this is different
* from xmlXPathFreeNodeSet()
*/
-void
+static void
xmlXPathFreeValueTree(xmlNodeSetPtr obj) {
int i;
@@ -2326,7 +2334,7 @@ xmlXPathNewParserContext(const xmlChar *str, xmlXPathContextPtr ctxt) {
*
* Returns the xmlXPathParserContext just allocated.
*/
-xmlXPathParserContextPtr
+static xmlXPathParserContextPtr
xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) {
xmlXPathParserContextPtr ret;
@@ -2420,7 +2428,7 @@ void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathCompareNodeSetFloat(xmlXPathParserContextPtr ctxt, int inf, int strict,
xmlXPathObjectPtr arg, xmlXPathObjectPtr f) {
int i, ret = 0;
@@ -2473,7 +2481,7 @@ xmlXPathCompareNodeSetFloat(xmlXPathParserContextPtr ctxt, int inf, int strict,
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict,
xmlXPathObjectPtr arg, xmlXPathObjectPtr s) {
int i, ret = 0;
@@ -2506,7 +2514,6 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict,
/**
* xmlXPathCompareNodeSets:
- * @ctxt: the XPath Parser context
* @op: less than (-1), equal (0) or greater than (1)
* @strict: is the comparison strict
* @arg1: the fist node set object
@@ -2533,8 +2540,8 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict,
* Conclusion all nodes need to be converted first to their string value
* and then the comparison must be done when possible
*/
-int
-xmlXPathCompareNodeSets(xmlXPathParserContextPtr ctxt, int inf, int strict,
+static int
+xmlXPathCompareNodeSets(int inf, int strict,
xmlXPathObjectPtr arg1, xmlXPathObjectPtr arg2) {
int i, j, init = 0;
double val1;
@@ -2624,7 +2631,7 @@ xmlXPathCompareNodeSets(xmlXPathParserContextPtr ctxt, int inf, int strict,
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
xmlXPathObjectPtr arg, xmlXPathObjectPtr val) {
if ((val == NULL) || (arg == NULL) ||
@@ -2636,7 +2643,7 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
return(xmlXPathCompareNodeSetFloat(ctxt, inf, strict, arg, val));
case XPATH_NODESET:
case XPATH_XSLT_TREE:
- return(xmlXPathCompareNodeSets(ctxt, inf, strict, arg, val));
+ return(xmlXPathCompareNodeSets(inf, strict, arg, val));
case XPATH_STRING:
return(xmlXPathCompareNodeSetString(ctxt, inf, strict, arg, val));
case XPATH_BOOLEAN:
@@ -2664,7 +2671,7 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar *str) {
int i;
xmlNodeSetPtr ns;
@@ -2702,7 +2709,7 @@ xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar *str) {
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathEqualNodeSetFloat(xmlXPathObjectPtr arg, double f) {
char buf[100] = "";
@@ -2730,7 +2737,7 @@ xmlXPathEqualNodeSetFloat(xmlXPathObjectPtr arg, double f) {
*
* Returns 0 or 1 depending on the results of the test.
*/
-int
+static int
xmlXPathEqualNodeSets(xmlXPathObjectPtr arg1, xmlXPathObjectPtr arg2) {
int i, j;
xmlChar **values1;
@@ -3034,7 +3041,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) {
if ((arg2->type == XPATH_NODESET) || (arg1->type == XPATH_NODESET)) {
if ((arg2->type == XPATH_NODESET) && (arg1->type == XPATH_NODESET)) {
- ret = xmlXPathCompareNodeSets(ctxt, inf, strict, arg1, arg2);
+ ret = xmlXPathCompareNodeSets(inf, strict, arg1, arg2);
} else {
if (arg1->type == XPATH_NODESET) {
ret = xmlXPathCompareNodeSetValue(ctxt, inf, strict,
@@ -3468,9 +3475,9 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
return((xmlNodePtr) ctxt->context->doc);
return(ctxt->context->node->parent);
case XML_ATTRIBUTE_NODE: {
- xmlAttrPtr cur = (xmlAttrPtr) ctxt->context->node;
+ xmlAttrPtr tmp = (xmlAttrPtr) ctxt->context->node;
- return(cur->parent);
+ return(tmp->parent);
}
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
@@ -3756,7 +3763,7 @@ xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
*
* Returns the new NodeSet resulting from the search.
*/
-void
+static void
xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathAxisVal axis,
xmlXPathTestVal test, xmlXPathTypeVal type,
const xmlChar *prefix, const xmlChar *name) {
@@ -4393,7 +4400,7 @@ xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) {
* Libxml keep the original prefix so the "real qualified name" used is
* returned.
*/
-void
+static void
xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr cur;
@@ -4457,7 +4464,7 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*/
xmlXPathObjectPtr
xmlXPathConvertString(xmlXPathObjectPtr val) {
- xmlXPathObjectPtr ret;
+ xmlXPathObjectPtr ret = NULL;
if (val == NULL)
return(xmlXPathNewCString(""));
@@ -5183,7 +5190,7 @@ not_equal:
*/
xmlXPathObjectPtr
xmlXPathConvertNumber(xmlXPathObjectPtr val) {
- xmlXPathObjectPtr ret;
+ xmlXPathObjectPtr ret = NULL;
double res;
if (val == NULL)
@@ -5447,7 +5454,7 @@ xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) {
* to get the Prefix if any.
*/
-xmlChar *
+static xmlChar *
xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) {
xmlChar *ret = NULL;
@@ -5884,7 +5891,7 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) {
* Returns the Name parsed or NULL
*/
-xmlChar *
+static xmlChar *
xmlXPathScanName(xmlXPathParserContextPtr ctxt) {
xmlChar buf[XML_MAX_NAMELEN];
int len = 0;
@@ -6405,7 +6412,7 @@ xmlXPathCompPredicate(xmlXPathParserContextPtr ctxt) {
*
* Returns the name found and update @test, @type and @prefix appropriately
*/
-xmlChar *
+static xmlChar *
xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
xmlXPathTypeVal *type, const xmlChar **prefix,
xmlChar *name) {
@@ -6463,8 +6470,6 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
/*
* Specific case: search a PI by name.
*/
- xmlXPathObjectPtr cur;
-
if (name != NULL)
xmlFree(name);
@@ -6539,7 +6544,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
*
* Returns the axis or 0
*/
-xmlXPathAxisVal
+static xmlXPathAxisVal
xmlXPathIsAxisName(const xmlChar *name) {
xmlXPathAxisVal ret = 0;
switch (name[0]) {
@@ -6588,41 +6593,6 @@ xmlXPathIsAxisName(const xmlChar *name) {
}
/**
- * xmlXPathCompAxisSpecifier:
- * @ctxt: the XPath Parser context
- *
- * Parse an axis value
- *
- * Returns the axis found
- */
-xmlXPathAxisVal
-xmlXPathCompAxisSpecifier(xmlXPathParserContextPtr ctxt) {
- xmlXPathAxisVal ret = AXIS_CHILD;
- int blank = 0;
- xmlChar *name;
-
- if (CUR == '@') {
- NEXT;
- return(AXIS_ATTRIBUTE);
- } else {
- name = xmlXPathParseNCName(ctxt);
- if (name == NULL) {
- XP_ERROR0(XPATH_EXPR_ERROR);
- }
- if (IS_BLANK(CUR))
- blank = 1;
- SKIP_BLANKS;
- if ((CUR == ':') && (NXT(1) == ':')) {
- ret = xmlXPathIsAxisName(name);
- } else if ((blank) && (CUR == ':'))
- XP_ERROR0(XPATH_EXPR_ERROR);
-
- xmlFree(name);
- }
- return(ret);
-}
-
-/**
* xmlXPathCompStep:
* @ctxt: the XPath Parser context
*
@@ -7047,20 +7017,20 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
* Hum are we filtering the result of an XPointer expression
*/
if (ctxt->value->type == XPATH_LOCATIONSET) {
- xmlLocationSetPtr newset = NULL;
- xmlLocationSetPtr oldset;
+ xmlLocationSetPtr newlocset = NULL;
+ xmlLocationSetPtr oldlocset;
/*
- * Extract the old set, and then evaluate the result of the
- * expression for all the element in the set. use it to grow
- * up a new set.
+ * Extract the old locset, and then evaluate the result of the
+ * expression for all the element in the locset. use it to grow
+ * up a new locset.
*/
CHECK_TYPE(XPATH_LOCATIONSET);
obj = valuePop(ctxt);
- oldset = obj->user;
+ oldlocset = obj->user;
ctxt->context->node = NULL;
- if ((oldset == NULL) || (oldset->locNr == 0)) {
+ if ((oldlocset == NULL) || (oldlocset->locNr == 0)) {
ctxt->context->contextSize = 0;
ctxt->context->proximityPosition = 0;
if (op->ch2 != -1)
@@ -7072,17 +7042,17 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
CHECK_ERROR;
return;
}
- newset = xmlXPtrLocationSetCreate(NULL);
+ newlocset = xmlXPtrLocationSetCreate(NULL);
- for (i = 0; i < oldset->locNr; i++) {
+ for (i = 0; i < oldlocset->locNr; i++) {
/*
* Run the evaluation with a node list made of a
- * single item in the nodeset.
+ * single item in the nodelocset.
*/
- ctxt->context->node = oldset->locTab[i]->user;
+ ctxt->context->node = oldlocset->locTab[i]->user;
tmp = xmlXPathNewNodeSet(ctxt->context->node);
valuePush(ctxt, tmp);
- ctxt->context->contextSize = oldset->locNr;
+ ctxt->context->contextSize = oldlocset->locNr;
ctxt->context->proximityPosition = i + 1;
if (op->ch2 != -1)
@@ -7095,8 +7065,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
*/
res = valuePop(ctxt);
if (xmlXPathEvaluatePredicateResult(ctxt, res)) {
- xmlXPtrLocationSetAdd(newset,
- xmlXPathObjectCopy(oldset->locTab[i]));
+ xmlXPtrLocationSetAdd(newlocset,
+ xmlXPathObjectCopy(oldlocset->locTab[i]));
}
/*
@@ -7113,13 +7083,13 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) {
}
/*
- * The result is used as the new evaluation set.
+ * The result is used as the new evaluation locset.
*/
xmlXPathFreeObject(obj);
ctxt->context->node = NULL;
ctxt->context->contextSize = -1;
ctxt->context->proximityPosition = -1;
- valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
+ valuePush(ctxt, xmlXPtrWrapLocationSet(newlocset));
ctxt->context->node = oldnode;
return;
}
@@ -7464,7 +7434,6 @@ xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) {
xmlGenericError(xmlGenericErrorContext,
"xmlXPathEval: %d object left on the stack\n",
stack);
- xmlXPathDebugDumpCompExpr(stdout, ctxt->comp, 0);
}
if (ctxt->error != XPATH_EXPRESSION_OK) {
xmlXPathFreeObject(res);
diff --git a/xpathInternals.h b/xpathInternals.h
index 51f6ad55..cb2f3b42 100644
--- a/xpathInternals.h
+++ b/xpathInternals.h
@@ -79,7 +79,9 @@ void xmlXPatherror (xmlXPathParserContextPtr ctxt,
void xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
int depth);
-
+void xmlXPathDebugDumpCompExpr(FILE *output,
+ xmlXPathCompExprPtr comp,
+ int depth);
/**
* Extending a context
*/
@@ -139,7 +141,9 @@ xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val);
void xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val);
-
+void xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
+ xmlNodePtr val);
+void xmlXPathNodeSetSort (xmlNodeSetPtr set);
void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
int nargs);
@@ -193,13 +197,37 @@ void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
+int xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines
*/
-xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
-xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
-xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
+xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
+xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
+ xmlNodePtr cur);
/*
* The official core of XPath functions
*/
diff --git a/xpointer.c b/xpointer.c
index 37c13a6a..cfd3ee43 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -15,6 +15,18 @@
#include "config.h"
#endif
+/************************************************************************
+ * *
+ * When running GCC in vaacum cleaner mode *
+ * *
+ ************************************************************************/
+
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
/**
* TODO: better handling of error cases, the full expression should
* be parsed beforehand instead of a progressive evaluation
@@ -66,7 +78,7 @@ xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur);
*
* Returns the number of child for an element, -1 in case of error
*/
-int
+static int
xmlXPtrGetArity(xmlNodePtr cur) {
int i;
if (cur == NULL)
@@ -89,7 +101,7 @@ xmlXPtrGetArity(xmlNodePtr cur) {
* Returns the index of the node in its parent children list, -1
* in case of error
*/
-int
+static int
xmlXPtrGetIndex(xmlNodePtr cur) {
int i;
if (cur == NULL)
@@ -111,7 +123,7 @@ xmlXPtrGetIndex(xmlNodePtr cur) {
*
* Returns the @no'th element child of @cur or NULL
*/
-xmlNodePtr
+static xmlNodePtr
xmlXPtrGetNthChild(xmlNodePtr cur, int no) {
int i;
if (cur == NULL)
@@ -149,7 +161,7 @@ xmlXPtrGetNthChild(xmlNodePtr cur, int no) {
* Returns -2 in case of error 1 if first point < second point, 0 if
* that's the same point, -1 otherwise
*/
-int
+static int
xmlXPtrCmpPoints(xmlNodePtr node1, int index1, xmlNodePtr node2, int index2) {
if ((node1 == NULL) || (node2 == NULL))
return(-2);
@@ -169,19 +181,19 @@ xmlXPtrCmpPoints(xmlNodePtr node1, int index1, xmlNodePtr node2, int index2) {
/**
* xmlXPtrNewPoint:
* @node: the xmlNodePtr
- * @index: the index within the node
+ * @indx: the indx within the node
*
* Create a new xmlXPathObjectPtr of type point
*
* Returns the newly created object.
*/
-xmlXPathObjectPtr
-xmlXPtrNewPoint(xmlNodePtr node, int index) {
+static xmlXPathObjectPtr
+xmlXPtrNewPoint(xmlNodePtr node, int indx) {
xmlXPathObjectPtr ret;
if (node == NULL)
return(NULL);
- if (index < 0)
+ if (indx < 0)
return(NULL);
ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject));
@@ -193,7 +205,7 @@ xmlXPtrNewPoint(xmlNodePtr node, int index) {
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
ret->type = XPATH_POINT;
ret->user = (void *) node;
- ret->index = index;
+ ret->index = indx;
return(ret);
}
@@ -203,7 +215,7 @@ xmlXPtrNewPoint(xmlNodePtr node, int index) {
*
* Make sure the points in the range are in the right order
*/
-void
+static void
xmlXPtrRangeCheckOrder(xmlXPathObjectPtr range) {
int tmp;
xmlNodePtr tmp2;
@@ -234,7 +246,7 @@ xmlXPtrRangeCheckOrder(xmlXPathObjectPtr range) {
*
* Return 1 if equal, 0 otherwise
*/
-int
+static int
xmlXPtrRangesEqual(xmlXPathObjectPtr range1, xmlXPathObjectPtr range2) {
if (range1 == range2)
return(1);
@@ -862,8 +874,8 @@ xmlXPtrWrapLocationSet(xmlLocationSetPtr val) {
* Move the current node of the nodeset on the stack to the
* given child if found
*/
-void
-xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int index) {
+static void
+xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) {
xmlNodePtr cur = NULL;
xmlXPathObjectPtr obj;
xmlNodeSetPtr oldset;
@@ -871,12 +883,12 @@ xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int index) {
CHECK_TYPE(XPATH_NODESET);
obj = valuePop(ctxt);
oldset = obj->nodesetval;
- if ((index <= 0) || (oldset == NULL) || (oldset->nodeNr != 1)) {
+ if ((indx <= 0) || (oldset == NULL) || (oldset->nodeNr != 1)) {
xmlXPathFreeObject(obj);
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
return;
}
- cur = xmlXPtrGetNthChild(oldset->nodeTab[0], index);
+ cur = xmlXPtrGetNthChild(oldset->nodeTab[0], indx);
if (cur == NULL) {
xmlXPathFreeObject(obj);
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
@@ -920,7 +932,7 @@ xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int index) {
* TODO: there is no new scheme registration mechanism
*/
-void
+static void
xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
xmlChar *buffer, *cur;
int len;
@@ -1062,7 +1074,7 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
* Parse and evaluate a Full XPtr i.e. possibly a cascade of XPath based
* expressions or other shemes.
*/
-void
+static void
xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
if (name == NULL)
name = xmlXPathParseName(ctxt);
@@ -1130,7 +1142,7 @@ xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
* Parse and evaluate a Child Sequence. This routine also handle the
* case of a Bare Name used to get a document ID.
*/
-void
+static void
xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
/*
* XPointer don't allow by syntax to adress in mutirooted trees
@@ -1171,7 +1183,7 @@ xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) {
*
* Parse and evaluate an XPointer
*/
-void
+static void
xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) {
if (ctxt->valueTab == NULL) {
/* Allocate the value stack */
@@ -1346,13 +1358,13 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) {
* Returns an xmlNodePtr list or NULL.
* the caller has to free the node tree.
*/
-xmlNodePtr
+static xmlNodePtr
xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
/* pointers to generated nodes */
xmlNodePtr list = NULL, last = NULL, parent = NULL, tmp;
/* pointers to traversal nodes */
xmlNodePtr start, cur, end;
- int index, index2;
+ int index1, index2;
if (range == NULL)
return(NULL);
@@ -1367,7 +1379,7 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
return(xmlCopyNode(start, 1));
cur = start;
- index = range->index;
+ index1 = range->index;
index2 = range->index2;
while (cur != NULL) {
if (cur == end) {
@@ -1379,10 +1391,10 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
tmp = xmlNewTextLen(NULL, 0);
} else {
len = index2;
- if ((cur == start) && (index > 1)) {
- content += (index - 1);
- len -= (index - 1);
- index = 0;
+ if ((cur == start) && (index1 > 1)) {
+ content += (index1 - 1);
+ len -= (index1 - 1);
+ index1 = 0;
} else {
len = index2;
}
@@ -1414,9 +1426,9 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
end = xmlXPtrGetNthChild(cur, index2 - 1);
index2 = 0;
}
- if ((cur == start) && (index > 1)) {
- cur = xmlXPtrGetNthChild(cur, index - 1);
- index = 0;
+ if ((cur == start) && (index1 > 1)) {
+ cur = xmlXPtrGetNthChild(cur, index1 - 1);
+ index1 = 0;
} else {
cur = cur->children;
}
@@ -1433,20 +1445,20 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
if (content == NULL) {
tmp = xmlNewTextLen(NULL, 0);
} else {
- if (index > 1) {
- content += (index - 1);
+ if (index1 > 1) {
+ content += (index1 - 1);
}
tmp = xmlNewText(content);
}
last = list = tmp;
} else {
- if ((cur == start) && (index > 1)) {
+ if ((cur == start) && (index1 > 1)) {
tmp = xmlCopyNode(cur, 0);
list = tmp;
parent = tmp;
last = NULL;
- cur = xmlXPtrGetNthChild(cur, index - 1);
- index = 0;
+ cur = xmlXPtrGetNthChild(cur, index1 - 1);
+ index1 = 0;
/*
* Now gather the remaining nodes from cur to end
*/
@@ -1580,7 +1592,7 @@ xmlXPtrBuildNodeList(xmlXPathObjectPtr obj) {
*
* Returns the number of location children
*/
-int
+static int
xmlXPtrNbLocChildren(xmlNodePtr node) {
int ret = 0;
if (node == NULL)
@@ -1619,12 +1631,15 @@ xmlXPtrNbLocChildren(xmlNodePtr node) {
/**
* xmlXPtrHereFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing here() operation
* as described in 5.4.3
*/
void
xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+ CHECK_ARITY(0);
+
if (ctxt->context->here == NULL)
XP_ERROR(XPTR_SYNTAX_ERROR);
@@ -1634,12 +1649,15 @@ xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) {
/**
* xmlXPtrOriginFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing origin() operation
* as described in 5.4.3
*/
void
xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
+ CHECK_ARITY(0);
+
if (ctxt->context->origin == NULL)
XP_ERROR(XPTR_SYNTAX_ERROR);
@@ -1649,6 +1667,7 @@ xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) {
/**
* xmlXPtrStartPointFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing start-point() operation
* as described in 5.4.3
@@ -1740,6 +1759,7 @@ xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
/**
* xmlXPtrEndPointFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing end-point() operation
* as described in 5.4.3
@@ -1841,7 +1861,7 @@ xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*
* Returns a new location or NULL in case of error
*/
-xmlXPathObjectPtr
+static xmlXPathObjectPtr
xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
if (loc == NULL)
return(NULL);
@@ -1876,11 +1896,11 @@ xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
case XML_DOCUMENT_NODE:
case XML_NOTATION_NODE:
case XML_HTML_DOCUMENT_NODE: {
- int index = xmlXPtrGetIndex(node);
+ int indx = xmlXPtrGetIndex(node);
node = node->parent;
- return(xmlXPtrNewRange(node, index - 1,
- node, index + 1));
+ return(xmlXPtrNewRange(node, indx - 1,
+ node, indx + 1));
}
default:
return(NULL);
@@ -1896,6 +1916,7 @@ xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
/**
* xmlXPtrRangeFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing the range() function 5.4.3
* location-set range(location-set )
@@ -1956,7 +1977,7 @@ xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
*
* Returns a new location or NULL in case of error
*/
-xmlXPathObjectPtr
+static xmlXPathObjectPtr
xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
if (loc == NULL)
return(NULL);
@@ -2044,6 +2065,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
/**
* xmlXPtrRangeInsideFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing the range-inside() function 5.4.3
* location-set range-inside(location-set )
@@ -2105,6 +2127,7 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) {
/**
* xmlXPtrRangeToFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Implement the range-to() XPointer function
*/
@@ -2225,25 +2248,25 @@ found:
/**
* xmlXPtrAdvanceChar:
* @node: the node
- * @index: the index
+ * @indx: the indx
* @bytes: the number of bytes
*
* Advance a point of the associated number of bytes (not UTF8 chars)
*
* Returns -1 in case of failure, 0 otherwise
*/
-int
-xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
+static int
+xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) {
xmlNodePtr cur;
int pos;
int len;
- if ((node == NULL) || (index == NULL))
+ if ((node == NULL) || (indx == NULL))
return(-1);
cur = *node;
if (cur == NULL)
return(-1);
- pos = *index;
+ pos = *indx;
while (bytes >= 0) {
/*
@@ -2265,7 +2288,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
if (cur == NULL) {
*node = NULL;
- *index = 0;
+ *indx = 0;
return(-1);
}
@@ -2275,7 +2298,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
if (pos == 0) pos = 1;
if (bytes == 0) {
*node = cur;
- *index = pos;
+ *indx = pos;
return(0);
}
/*
@@ -2290,7 +2313,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
#endif
}
if (pos > len) {
- /* Strange, the index in the text node is greater than it's len */
+ /* Strange, the indx in the text node is greater than it's len */
STRANGE
pos = len;
}
@@ -2301,7 +2324,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
} else if (pos + bytes < len) {
pos += bytes;
*node = cur;
- *index = pos;
+ *indx = pos;
return(0);
}
}
@@ -2324,7 +2347,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *index, int bytes) {
* of the range and (@end, @endindex) will endicate the end
* of the range
*/
-int
+static int
xmlXPtrMatchString(const xmlChar *string, xmlNodePtr start, int startindex,
xmlNodePtr *end, int *endindex) {
xmlNodePtr cur;
@@ -2422,7 +2445,7 @@ xmlXPtrMatchString(const xmlChar *string, xmlNodePtr start, int startindex,
* of the range and (@end, @endindex) will endicate the end
* of the range
*/
-int
+static int
xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex,
xmlNodePtr *end, int *endindex) {
xmlNodePtr cur;
@@ -2519,15 +2542,15 @@ xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex,
*
* Returns -1 in case of failure, 0 otherwise
*/
-int
-xmlXPtrGetLastChar(xmlNodePtr *node, int *index) {
+static int
+xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) {
xmlNodePtr cur;
int pos, len = 0;
- if ((node == NULL) || (index == NULL))
+ if ((node == NULL) || (indx == NULL))
return(-1);
cur = *node;
- pos = *index;
+ pos = *indx;
if (cur == NULL)
return(-1);
@@ -2557,7 +2580,7 @@ xmlXPtrGetLastChar(xmlNodePtr *node, int *index) {
if (cur == NULL)
return(-1);
*node = cur;
- *index = len;
+ *indx = len;
return(0);
}
@@ -2565,31 +2588,31 @@ xmlXPtrGetLastChar(xmlNodePtr *node, int *index) {
* xmlXPtrGetStartPoint:
* @obj: an range
* @node: the resulting node
- * @index: the resulting index
+ * @indx: the resulting index
*
* read the object and return the start point coordinates.
*
* Returns -1 in case of failure, 0 otherwise
*/
-int
-xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *index) {
- if ((obj == NULL) || (node == NULL) || (index == NULL))
+static int
+xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
+ if ((obj == NULL) || (node == NULL) || (indx == NULL))
return(-1);
switch (obj->type) {
case XPATH_POINT:
*node = obj->user;
if (obj->index <= 0)
- *index = 0;
+ *indx = 0;
else
- *index = obj->index;
+ *indx = obj->index;
return(0);
case XPATH_RANGE:
*node = obj->user;
if (obj->index <= 0)
- *index = 0;
+ *indx = 0;
else
- *index = obj->index;
+ *indx = obj->index;
return(0);
default:
return(-1);
@@ -2601,31 +2624,31 @@ xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *index) {
* xmlXPtrGetEndPoint:
* @obj: an range
* @node: the resulting node
- * @index: the resulting index
+ * @indx: the resulting indx
*
* read the object and return the end point coordinates.
*
* Returns -1 in case of failure, 0 otherwise
*/
-int
-xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *index) {
- if ((obj == NULL) || (node == NULL) || (index == NULL))
+static int
+xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
+ if ((obj == NULL) || (node == NULL) || (indx == NULL))
return(-1);
switch (obj->type) {
case XPATH_POINT:
*node = obj->user;
if (obj->index <= 0)
- *index = 0;
+ *indx = 0;
else
- *index = obj->index;
+ *indx = obj->index;
return(0);
case XPATH_RANGE:
*node = obj->user;
if (obj->index <= 0)
- *index = 0;
+ *indx = 0;
else
- *index = obj->index;
+ *indx = obj->index;
return(0);
default:
return(-1);
@@ -2636,6 +2659,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *index) {
/**
* xmlXPtrStringRangeFunction:
* @ctxt: the XPointer Parser context
+ * @nargs: the number of args
*
* Function implementing the string-range() function
* range as described in 5.4.2
@@ -2678,7 +2702,7 @@ xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
xmlXPathObjectPtr string;
xmlXPathObjectPtr position = NULL;
xmlXPathObjectPtr number = NULL;
- int found, pos, num;
+ int found, pos = 0, num = 0;
/*
* Grab the arguments
@@ -2755,15 +2779,15 @@ xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) {
} else if (xmlXPtrAdvanceChar(&start, &startindex,
pos - 1) == 0) {
if ((number != NULL) && (num > 0)) {
- int rindex;
+ int rindx;
xmlNodePtr rend;
rend = start;
- rindex = startindex - 1;
- if (xmlXPtrAdvanceChar(&rend, &rindex,
+ rindx = startindex - 1;
+ if (xmlXPtrAdvanceChar(&rend, &rindx,
num) == 0) {
xmlXPtrLocationSetAdd(newset,
xmlXPtrNewRange(start, startindex,
- rend, rindex));
+ rend, rindx));
}
} else if ((number != NULL) && (num <= 0)) {
xmlXPtrLocationSetAdd(newset,
diff --git a/xpointer.h b/xpointer.h
index 255f826e..45efd791 100644
--- a/xpointer.h
+++ b/xpointer.h
@@ -38,11 +38,31 @@ xmlLocationSetPtr xmlXPtrLocationSetCreate(xmlXPathObjectPtr val);
void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
+xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start,
+ int startindex,
+ xmlNodePtr end,
+ int endindex);
+xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
+ xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewRangeNodePoint(xmlNodePtr start,
+ xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewRangePointNode(xmlXPathObjectPtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewLocationSetNodes(xmlNodePtr start,
+ xmlNodePtr end);
+xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
xmlXPathObjectPtr xmlXPtrNewRangeNodeObject(xmlNodePtr start,
xmlXPathObjectPtr end);
+xmlXPathObjectPtr xmlXPtrNewCollapsedRange(xmlNodePtr start);
void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
+void xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
+ xmlXPathObjectPtr val);
+void xmlXPtrLocationSetRemove(xmlLocationSetPtr cur,
+ int val);
/*
* Functions