1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

xml2: Import upstream release 2.11.4.

This commit is contained in:
Alexandre Julliard 2023-06-05 12:52:01 +02:00
parent 6b678a4e9b
commit ad7b9726cb
94 changed files with 6898 additions and 7108 deletions

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,10 @@
#include <libxml/globals.h>
#include <libxml/uri.h>
#include "buf.h"
#include "private/buf.h"
#include "private/error.h"
#include "private/io.h"
#include "private/save.h"
/************************************************************************
* *
@ -328,11 +331,6 @@ htmlIsBooleanAttr(const xmlChar *name)
}
#ifdef LIBXML_OUTPUT_ENABLED
/*
* private routine exported from xmlIO.c
*/
xmlOutputBufferPtr
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
/************************************************************************
* *
* Output error handlers *
@ -417,7 +415,7 @@ htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur,
htmlSaveErrMemory("allocating HTML output buffer");
return (-1);
}
memset(outbuf, 0, (size_t) sizeof(xmlOutputBuffer));
memset(outbuf, 0, sizeof(xmlOutputBuffer));
outbuf->buffer = buf;
outbuf->encoder = NULL;
outbuf->writecallback = NULL;
@ -622,8 +620,6 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) {
* *
************************************************************************/
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
/**
* htmlDtdDumpOutput:
* @buf: the HTML buffer output
@ -705,10 +701,15 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) {
while (IS_BLANK_CH(*tmp)) tmp++;
/*
* the < and > have already been escaped at the entity level
* And doing so here breaks server side includes
* Angle brackets are technically illegal in URIs, but they're
* used in server side includes, for example. Curly brackets
* are illegal as well and often used in templates.
* Don't escape non-whitespace, printable ASCII chars for
* improved interoperability. Only escape space, control
* and non-ASCII chars.
*/
escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>");
escaped = xmlURIEscapeStr(tmp,
BAD_CAST "\"#$%&+,/:;<=>?@[\\]^`{|}");
if (escaped != NULL) {
xmlBufWriteQuotedString(buf->buffer, escaped);
xmlFree(escaped);

View file

@ -28,6 +28,10 @@
#include <libxml/HTMLtree.h>
#include <libxml/globals.h>
#include "private/error.h"
#include "private/parser.h"
#include "private/tree.h"
/* #define DEBUG_SAX2 */
/* #define DEBUG_SAX2_TREE */
@ -383,6 +387,9 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
xmlCharEncoding enc;
int oldcharset;
const xmlChar *oldencoding;
int oldprogressive;
unsigned long consumed;
size_t buffered;
/*
* Ask the Entity resolver to load the damn thing
@ -405,18 +412,22 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
oldinputTab = ctxt->inputTab;
oldcharset = ctxt->charset;
oldencoding = ctxt->encoding;
oldprogressive = ctxt->progressive;
ctxt->encoding = NULL;
ctxt->progressive = 0;
ctxt->inputTab = (xmlParserInputPtr *)
xmlMalloc(5 * sizeof(xmlParserInputPtr));
if (ctxt->inputTab == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset");
xmlFreeInputStream(input);
ctxt->input = oldinput;
ctxt->inputNr = oldinputNr;
ctxt->inputMax = oldinputMax;
ctxt->inputTab = oldinputTab;
ctxt->charset = oldcharset;
ctxt->encoding = oldencoding;
ctxt->progressive = oldprogressive;
return;
}
ctxt->inputNr = 0;
@ -451,6 +462,18 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
while (ctxt->inputNr > 1)
xmlPopInput(ctxt);
consumed = ctxt->input->consumed;
buffered = ctxt->input->cur - ctxt->input->base;
if (buffered > ULONG_MAX - consumed)
consumed = ULONG_MAX;
else
consumed += buffered;
if (consumed > ULONG_MAX - ctxt->sizeentities)
ctxt->sizeentities = ULONG_MAX;
else
ctxt->sizeentities += consumed;
xmlFreeInputStream(ctxt->input);
xmlFree(ctxt->inputTab);
@ -467,6 +490,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
(!xmlDictOwns(ctxt->dict, ctxt->encoding))))
xmlFree((xmlChar *) ctxt->encoding);
ctxt->encoding = oldencoding;
ctxt->progressive = oldprogressive;
/* ctxt->wellFormed = oldwellFormed; */
}
}
@ -1311,25 +1335,25 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL);
if (ret == NULL)
goto error;
if (ret != NULL) {
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
xmlNodePtr tmp;
if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
xmlNodePtr tmp;
ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
tmp = ret->children;
while (tmp != NULL) {
tmp->parent = (xmlNodePtr) ret;
if (tmp->next == NULL)
ret->last = tmp;
tmp = tmp->next;
}
} else if (value != NULL) {
ret->children = xmlNewDocText(ctxt->myDoc, value);
ret->last = ret->children;
if (ret->children != NULL)
ret->children->parent = (xmlNodePtr) ret;
}
ret->children = xmlStringGetNodeList(ctxt->myDoc, value);
tmp = ret->children;
while (tmp != NULL) {
tmp->parent = (xmlNodePtr) ret;
if (tmp->next == NULL)
ret->last = tmp;
tmp = tmp->next;
}
} else if (value != NULL) {
ret->children = xmlNewDocText(ctxt->myDoc, value);
ret->last = ret->children;
if (ret->children != NULL)
ret->children->parent = (xmlNodePtr) ret;
}
#ifdef LIBXML_VALID_ENABLED
@ -1608,12 +1632,15 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
ctxt->validate = 0;
}
/*
* Split the full name into a namespace prefix and the tag name
*/
name = xmlSplitQName(ctxt, fullname, &prefix);
if (ctxt->html) {
prefix = NULL;
name = xmlStrdup(fullname);
} else {
/*
* Split the full name into a namespace prefix and the tag name
*/
name = xmlSplitQName(ctxt, fullname, &prefix);
}
/*
* Note : the namespace resolution is deferred until the end of the
@ -1638,8 +1665,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
ctxt->nodemem = -1;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@ -1803,13 +1830,6 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", name);
#endif
/* Capture end position and add node */
if (cur != NULL && ctxt->record_info) {
ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base;
ctxt->nodeInfo->end_line = ctxt->input->line;
ctxt->nodeInfo->node = cur;
xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo);
}
ctxt->nodemem = -1;
#ifdef LIBXML_VALID_ENABLED
@ -1903,8 +1923,8 @@ skip:
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
ret->line = ctxt->input->line;
else {
ret->line = USHRT_MAX;
if (ctxt->options & XML_PARSE_BIG_LINES)
@ -2260,6 +2280,7 @@ xmlSAX2StartElementNs(void *ctx,
ret->name = lname;
if (ret->name == NULL) {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
xmlFree(ret);
return;
}
}
@ -2281,8 +2302,8 @@ xmlSAX2StartElementNs(void *ctx,
}
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@ -2451,24 +2472,15 @@ xmlSAX2EndElementNs(void *ctx,
const xmlChar * URI ATTRIBUTE_UNUSED)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserNodeInfo node_info;
xmlNodePtr cur;
if (ctx == NULL) return;
cur = ctxt->node;
/* Capture end position and add node */
if ((ctxt->record_info) && (cur != NULL)) {
node_info.end_pos = ctxt->input->cur - ctxt->input->base;
node_info.end_line = ctxt->input->line;
node_info.node = cur;
xmlParserAddNodeInfo(ctxt, &node_info);
}
ctxt->nodemem = -1;
#ifdef LIBXML_VALID_ENABLED
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, cur);
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
ctxt->node);
#endif /* LIBXML_VALID_ENABLED */
/*
@ -2631,7 +2643,8 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
/* Mixed content, first time */
if (type == XML_TEXT_NODE) {
lastChild = xmlSAX2TextNode(ctxt, ch, len);
lastChild->doc = ctxt->myDoc;
if (lastChild != NULL)
lastChild->doc = ctxt->myDoc;
} else
lastChild = xmlNewCDataBlock(ctxt->myDoc, ch, len);
if (lastChild != NULL) {
@ -2706,8 +2719,8 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@ -2766,8 +2779,8 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
if (ret == NULL) return;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
if ((unsigned) ctxt->input->line < (unsigned) USHRT_MAX)
ret->line = ctxt->input->line;
else
ret->line = USHRT_MAX;
}
@ -2825,6 +2838,8 @@ static int xmlSAX2DefaultVersionValue = 2;
* xmlSAXDefaultVersion:
* @version: the version, 1 or 2
*
* DEPRECATED: Use parser option XML_PARSE_SAX1.
*
* Set the default version of SAX used globally by the library.
* By default, during initialization the default is set to 2.
* Note that it is generally a better coding style to use
@ -2925,7 +2940,7 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
/**
* xmlDefaultSAXHandlerInit:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* DEPRECATED: This function is a no-op. Call xmlInitParser to
* initialize the library.
*
* Initialize the default SAX2 handler
@ -2933,9 +2948,6 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
void
xmlDefaultSAXHandlerInit(void)
{
#ifdef LIBXML_SAX1_ENABLED
xmlSAXVersion((xmlSAXHandlerPtr) &xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
}
#ifdef LIBXML_HTML_ENABLED
@ -2986,15 +2998,12 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
/**
* htmlDefaultSAXHandlerInit:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* DEPRECATED: This function is a no-op. Call xmlInitParser to
* initialize the library.
*
* Initialize the default SAX handler
*/
void
htmlDefaultSAXHandlerInit(void)
{
xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
}
#endif /* LIBXML_HTML_ENABLED */

View file

@ -24,7 +24,9 @@
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
#include "buf.h"
#include "private/buf.h"
#include "private/error.h"
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) -1)
@ -133,7 +135,7 @@ xmlBufCreate(void) {
ret->size = xmlDefaultBufferSize;
UPDATE_COMPAT(ret);
ret->alloc = xmlBufferAllocScheme;
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlBufMemoryError(ret, "creating buffer");
xmlFree(ret);
@ -169,7 +171,7 @@ xmlBufCreateSize(size_t size) {
ret->size = (size ? size + 1 : 0); /* +1 for ending null */
UPDATE_COMPAT(ret);
if (ret->size){
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlBufMemoryError(ret, "creating buffer");
xmlFree(ret);
@ -198,8 +200,6 @@ xmlBufDetach(xmlBufPtr buf) {
if (buf == NULL)
return(NULL);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
return(NULL);
if (buf->buffer != NULL)
return(NULL);
if (buf->error)
@ -214,40 +214,6 @@ xmlBufDetach(xmlBufPtr buf) {
return ret;
}
/**
* xmlBufCreateStatic:
* @mem: the memory area
* @size: the size in byte
*
* routine to create an XML buffer from an immutable memory area.
* The area won't be modified nor copied, and is expected to be
* present until the end of the buffer lifetime.
*
* returns the new structure.
*/
xmlBufPtr
xmlBufCreateStatic(void *mem, size_t size) {
xmlBufPtr ret;
if (mem == NULL)
return(NULL);
ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));
if (ret == NULL) {
xmlBufMemoryError(NULL, "creating buffer");
return(NULL);
}
ret->use = size;
ret->size = size;
UPDATE_COMPAT(ret);
ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
ret->content = (xmlChar *) mem;
ret->error = 0;
ret->buffer = NULL;
return(ret);
}
/**
* xmlBufGetAllocationScheme:
* @buf: the buffer
@ -287,13 +253,11 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
#endif
return(-1);
}
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
(buf->alloc == XML_BUFFER_ALLOC_IO))
if (buf->alloc == XML_BUFFER_ALLOC_IO)
return(-1);
if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
(scheme == XML_BUFFER_ALLOC_EXACT) ||
(scheme == XML_BUFFER_ALLOC_HYBRID) ||
(scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
(scheme == XML_BUFFER_ALLOC_BOUNDED)) {
buf->alloc = scheme;
if (buf->buffer)
@ -331,8 +295,7 @@ xmlBufFree(xmlBufPtr buf) {
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
(buf->contentIO != NULL)) {
xmlFree(buf->contentIO);
} else if ((buf->content != NULL) &&
(buf->alloc != XML_BUFFER_ALLOC_IMMUTABLE)) {
} else if (buf->content != NULL) {
xmlFree(buf->content);
}
xmlFree(buf);
@ -350,9 +313,7 @@ xmlBufEmpty(xmlBufPtr buf) {
if (buf->content == NULL) return;
CHECK_COMPAT(buf)
buf->use = 0;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
buf->content = BAD_CAST "";
} else if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
(buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
@ -385,8 +346,7 @@ xmlBufShrink(xmlBufPtr buf, size_t len) {
if (len > buf->use) return(0);
buf->use -= len;
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
/*
* we just move the content pointer, but also make sure
* the perceived buffer size has shrunk accordingly
@ -434,7 +394,6 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
if ((buf == NULL) || (buf->error != 0)) return(0);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
if (len < buf->size - buf->use)
return(buf->size - buf->use - 1);
if (len >= SIZE_MAX - buf->use) {
@ -504,7 +463,7 @@ xmlBufGrow(xmlBufPtr buf, int len) {
ret = xmlBufGrowInternal(buf, len);
if (buf->error != 0)
return(-1);
return((int) ret);
return(ret > INT_MAX ? INT_MAX : ret);
}
/**
@ -536,7 +495,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) {
CHECK_COMPAT(buf)
if (file == NULL)
file = stdout;
ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
ret = fwrite(buf->content, 1, buf->use, file);
return(ret);
}
@ -699,7 +658,6 @@ xmlBufResize(xmlBufPtr buf, size_t size)
return(0);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
/*
* Used to provide parsing limits
@ -777,7 +735,8 @@ xmlBufResize(xmlBufPtr buf, size_t size)
if (buf->content == NULL) {
rebuf = (xmlChar *) xmlMallocAtomic(newSize);
buf->use = 0;
rebuf[buf->use] = 0;
if (rebuf != NULL)
rebuf[buf->use] = 0;
} else if (buf->size - buf->use < 100) {
rebuf = (xmlChar *) xmlRealloc(buf->content, newSize);
} else {
@ -825,7 +784,6 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
return -1;
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (len < -1) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
@ -863,7 +821,7 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
}
}
memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
memmove(&buf->content[buf->use], str, len);
buf->use += len;
buf->content[buf->use] = 0;
UPDATE_COMPAT(buf)
@ -885,7 +843,6 @@ xmlBufCat(xmlBufPtr buf, const xmlChar *str) {
if ((buf == NULL) || (buf->error))
return(-1);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (str == NULL) return -1;
return xmlBufAdd(buf, str, -1);
}
@ -923,8 +880,6 @@ xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string) {
if ((buf == NULL) || (buf->error))
return(-1);
CHECK_COMPAT(buf)
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
return(-1);
if (xmlStrchr(string, '\"')) {
if (xmlStrchr(string, '\'')) {
#ifdef DEBUG_BUFFER
@ -1042,11 +997,11 @@ xmlBufBackToBuffer(xmlBufPtr buf) {
* Keep the buffer but provide a truncated size value.
*/
xmlBufOverflowError(buf, "Allocated size too big for xmlBuffer");
ret->use = (int) buf->use;
ret->use = buf->use;
ret->size = INT_MAX;
} else {
ret->use = (int) buf->use;
ret->size = (int) buf->size;
ret->use = buf->use;
ret->size = buf->size;
}
ret->alloc = buf->alloc;
ret->content = buf->content;
@ -1114,7 +1069,7 @@ xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input) {
size_t base;
if ((input == NULL) || (buf == NULL) || (buf->error))
return(-1);
return(0);
CHECK_COMPAT(buf)
base = input->base - buf->content;
/*

View file

@ -1,67 +0,0 @@
/*
* Summary: Internal Interfaces for memory buffers in libxml2
* Description: this module describes most of the new xmlBuf buffer
* entry points, those are private routines, with a
* few exceptions exported in tree.h. This was added
* in 2.9.0.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_BUF_H__
#define __XML_BUF_H__
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
xmlBufPtr xmlBufCreate(void);
xmlBufPtr xmlBufCreateSize(size_t size);
xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
int xmlBufSetAllocationScheme(xmlBufPtr buf,
xmlBufferAllocationScheme scheme);
int xmlBufGetAllocationScheme(xmlBufPtr buf);
void xmlBufFree(xmlBufPtr buf);
void xmlBufEmpty(xmlBufPtr buf);
/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
int xmlBufGrow(xmlBufPtr buf, int len);
int xmlBufResize(xmlBufPtr buf, size_t len);
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
int xmlBufCCat(xmlBufPtr buf, const char *str);
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
size_t xmlBufAvail(const xmlBufPtr buf);
size_t xmlBufLength(const xmlBufPtr buf);
/* size_t xmlBufUse(const xmlBufPtr buf); */
int xmlBufIsEmpty(const xmlBufPtr buf);
int xmlBufAddLen(xmlBufPtr buf, size_t len);
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
xmlChar * xmlBufDetach(xmlBufPtr buf);
size_t xmlBufDump(FILE *file, xmlBufPtr buf);
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
size_t base, size_t cur);
#ifdef __cplusplus
}
#endif
#endif /* __XML_BUF_H__ */

View file

@ -18,14 +18,13 @@
#ifdef LIBXML_CATALOG_ENABLED
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#elif defined (_WIN32)
#include <io.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@ -39,7 +38,8 @@
#include <libxml/threads.h>
#include <libxml/globals.h>
#include "buf.h"
#include "private/buf.h"
#include "private/error.h"
#define MAX_DELEGATE 50
#define MAX_CATAL_DEPTH 50
@ -891,11 +891,7 @@ xmlParseCatalogFile(const char *filename) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
#ifdef LIBXML_SAX1_ENABLED
if (xmlDefaultSAXHandler.error != NULL) {
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
}
#endif
xmlCatalogErrMemory("allocating parser context");
return(NULL);
}
@ -2177,7 +2173,6 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
int len = 0;
int size = 50;
xmlChar stop;
int count = 0;
*id = NULL;
@ -2190,7 +2185,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
} else {
stop = ' ';
}
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
buf = (xmlChar *) xmlMallocAtomic(size);
if (buf == NULL) {
xmlCatalogErrMemory("allocating public ID");
return(NULL);
@ -2202,7 +2197,7 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
break;
if (len + 1 >= size) {
size *= 2;
tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar));
tmp = (xmlChar *) xmlRealloc(buf, size);
if (tmp == NULL) {
xmlCatalogErrMemory("allocating public ID");
xmlFree(buf);
@ -2211,7 +2206,6 @@ xmlParseSGMLCatalogPubid(const xmlChar *cur, xmlChar **id) {
buf = tmp;
}
buf[len++] = *cur;
count++;
NEXT;
}
buf[len] = 0;
@ -2975,6 +2969,8 @@ xmlACatalogAdd(xmlCatalogPtr catal, const xmlChar * type,
if (catal->sgml == NULL)
catal->sgml = xmlHashCreate(10);
res = xmlHashAddEntry(catal->sgml, orig, entry);
if (res < 0)
xmlFreeCatalogEntry(entry, NULL);
}
}
return (res);
@ -3135,7 +3131,7 @@ xmlInitializeCatalog(void) {
strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf));
uri = xmlCanonicPath((const xmlChar*)buf);
if (uri != NULL) {
strncpy(XML_XML_DEFAULT_CATALOG, uri, 255);
strncpy(XML_XML_DEFAULT_CATALOG, (char* )uri, 255);
xmlFree(uri);
}
}

View file

@ -14,6 +14,8 @@
#include "libxml.h"
#include <libxml/chvalid.h>
#include <stddef.h>
/*
* The initial tables ({func_name}_tab) are used to validate whether a
* single-byte character is within the specified group. Each table

View file

@ -30,6 +30,8 @@
#include <libxml/relaxng.h>
#endif
#include "private/error.h"
#define DUMP_TEXT_TYPE 1
typedef struct _xmlDebugCtxt xmlDebugCtxt;
@ -2633,7 +2635,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
int res = -1;
if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1);
vctxt.userData = NULL;
memset(&vctxt, 0, sizeof(vctxt));
vctxt.error = xmlGenericError;
vctxt.warning = xmlGenericError;

View file

@ -23,6 +23,9 @@
#include <stdlib.h>
#include <time.h>
#include "private/dict.h"
#include "private/threads.h"
/*
* Following http://www.ocert.org/advisories/ocert-2011-003.html
* it seems that having hash randomization might be a good idea
@ -127,12 +130,7 @@ struct _xmlDict {
* A mutex for modifying the reference counter for shared
* dictionaries.
*/
static xmlMutexPtr xmlDictMutex = NULL;
/*
* Whether the dictionary mutex was initialized.
*/
static int xmlDictInitialized = 0;
static xmlMutex xmlDictMutex;
#ifdef DICT_RANDOMIZATION
#ifdef HAVE_RAND_R
@ -146,15 +144,10 @@ static unsigned int rand_seed = 0;
/**
* xmlInitializeDict:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* initialize the library.
*
* Do the dictionary mutex initialization.
*
* Returns 0 if initialization was already done, and 1 if that
* call led to the initialization
* DEPRECATED: Alias for xmlInitParser.
*/
int xmlInitializeDict(void) {
xmlInitParser();
return(0);
}
@ -163,20 +156,9 @@ int xmlInitializeDict(void) {
*
* This function is not public
* Do the dictionary mutex initialization.
* this function is not thread safe, initialization should
* normally be done once at setup when called from xmlOnceInit()
* we may also land in this code if thread support is not compiled in
*
* Returns 0 if initialization was already done, and 1 if that
* call led to the initialization
*/
int __xmlInitializeDict(void) {
if (xmlDictInitialized)
return(1);
if ((xmlDictMutex = xmlNewMutex()) == NULL)
return(0);
xmlMutexLock(xmlDictMutex);
xmlInitMutex(&xmlDictMutex);
#ifdef DICT_RANDOMIZATION
#ifdef HAVE_RAND_R
@ -186,8 +168,6 @@ int __xmlInitializeDict(void) {
srand(time(NULL));
#endif
#endif
xmlDictInitialized = 1;
xmlMutexUnlock(xmlDictMutex);
return(1);
}
@ -195,16 +175,13 @@ int __xmlInitializeDict(void) {
int __xmlRandom(void) {
int ret;
if (xmlDictInitialized == 0)
__xmlInitializeDict();
xmlMutexLock(xmlDictMutex);
xmlMutexLock(&xmlDictMutex);
#ifdef HAVE_RAND_R
ret = rand_r(& rand_seed);
#else
ret = rand();
#endif
xmlMutexUnlock(xmlDictMutex);
xmlMutexUnlock(&xmlDictMutex);
return(ret);
}
#endif
@ -212,22 +189,23 @@ int __xmlRandom(void) {
/**
* xmlDictCleanup:
*
* DEPRECATED: This function will be made private. Call xmlCleanupParser
* DEPRECATED: This function is a no-op. Call xmlCleanupParser
* to free global state but see the warnings there. xmlCleanupParser
* should be only called once at program exit. In most cases, you don't
* have call cleanup functions at all.
*
* Free the dictionary mutex. Do not call unless sure the library
* is not in use anymore !
*/
void
xmlDictCleanup(void) {
if (!xmlDictInitialized)
return;
}
xmlFreeMutex(xmlDictMutex);
xmlDictInitialized = 0;
/**
* xmlCleanupDictInternal:
*
* Free the dictionary mutex.
*/
void
xmlCleanupDictInternal(void) {
xmlCleanupMutex(&xmlDictMutex);
}
/*
@ -376,6 +354,7 @@ found_pool:
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
#endif
static uint32_t
xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
@ -411,6 +390,7 @@ xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
*/
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
#endif
static unsigned long
xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
@ -453,7 +433,8 @@ static unsigned long
xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
unsigned long value = seed;
if (name == NULL) return(0);
if ((name == NULL) || (namelen <= 0))
return(value);
value += *name;
value <<= 5;
if (namelen > 10) {
@ -496,10 +477,10 @@ static unsigned long
xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len, int seed)
{
unsigned long value = (unsigned long) seed;
unsigned long value = seed;
if (plen == 0)
value += 30 * (unsigned long) ':';
value += 30 * ':';
else
value += 30 * (*prefix);
@ -537,7 +518,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
}
len -= plen;
if (len > 0) {
value += (unsigned long) ':';
value += ':';
len--;
}
switch (len) {
@ -577,9 +558,7 @@ xmlDictPtr
xmlDictCreate(void) {
xmlDictPtr dict;
if (!xmlDictInitialized)
if (!__xmlInitializeDict())
return(NULL);
xmlInitParser();
#ifdef DICT_DEBUG_PATTERNS
fprintf(stderr, "C");
@ -645,14 +624,10 @@ xmlDictCreateSub(xmlDictPtr sub) {
*/
int
xmlDictReference(xmlDictPtr dict) {
if (!xmlDictInitialized)
if (!__xmlInitializeDict())
return(-1);
if (dict == NULL) return -1;
xmlMutexLock(xmlDictMutex);
xmlMutexLock(&xmlDictMutex);
dict->ref_counter++;
xmlMutexUnlock(xmlDictMutex);
xmlMutexUnlock(&xmlDictMutex);
return(0);
}
@ -809,19 +784,15 @@ xmlDictFree(xmlDictPtr dict) {
if (dict == NULL)
return;
if (!xmlDictInitialized)
if (!__xmlInitializeDict())
return;
/* decrement the counter, it may be shared by a parser and docs */
xmlMutexLock(xmlDictMutex);
xmlMutexLock(&xmlDictMutex);
dict->ref_counter--;
if (dict->ref_counter > 0) {
xmlMutexUnlock(xmlDictMutex);
xmlMutexUnlock(&xmlDictMutex);
return;
}
xmlMutexUnlock(xmlDictMutex);
xmlMutexUnlock(&xmlDictMutex);
if (dict->subdict != NULL) {
xmlDictFree(dict->subdict);
@ -1005,7 +976,7 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
*/
const xmlChar *
xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
unsigned long key, okey, nbi = 0;
unsigned long key, okey;
xmlDictEntryPtr insert;
unsigned int l;
@ -1040,7 +1011,6 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
(!xmlStrncmp(insert->name, name, l)))
return(insert->name);
#endif
nbi++;
}
#ifdef __GNUC__
if ((insert->okey == okey) && (insert->len == l)) {
@ -1082,7 +1052,6 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
(!xmlStrncmp(tmp->name, name, l)))
return(tmp->name);
#endif
nbi++;
}
#ifdef __GNUC__
if ((tmp->okey == skey) && (tmp->len == l)) {

View file

@ -1,32 +0,0 @@
/*
* Summary: Internal Interfaces for encoding in libxml2
* Description: this module describes a few interfaces which were
* added along with the API changes in 2.9.0
* those are private routines at this point
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_ENC_H__
#define __XML_ENC_H__
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len);
int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
#ifdef __cplusplus
}
#endif
#endif /* __XML_ENC_H__ */

View file

@ -40,8 +40,9 @@
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include "buf.h"
#include "enc.h"
#include "private/buf.h"
#include "private/enc.h"
#include "private/error.h"
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
@ -57,9 +58,6 @@ struct _uconv_t {
};
#endif
static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL;
static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL;
typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias;
typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr;
struct _xmlCharEncodingAlias {
@ -76,9 +74,6 @@ static int xmlCharEncodingAliasesMax = 0;
#define DEBUG_ENCODING /* Define this to get encoding traces */
#endif
#else
#ifdef LIBXML_ISO8859X_ENABLED
static void xmlRegisterCharEncodingHandlersISO8859x (void);
#endif
#endif
static int xmlLittleEndian = 1;
@ -202,7 +197,7 @@ asciiToUTF8(unsigned char* out, int *outlen,
} else {
*outlen = out - outstart;
*inlen = processed - base;
return(-1);
return(-2);
}
processed = (const unsigned char*) in;
@ -532,7 +527,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
} else {
tmp = (unsigned char *) in;
c = *tmp++;
c = c | (((unsigned int)*tmp) << 8);
c = c | (*tmp << 8);
in++;
}
if ((c & 0xFC00) == 0xD800) { /* surrogates */
@ -544,7 +539,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
} else {
tmp = (unsigned char *) in;
d = *tmp++;
d = d | (((unsigned int)*tmp) << 8);
d = d | (*tmp << 8);
in++;
}
if ((d & 0xFC00) == 0xDC00) {
@ -655,7 +650,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
*out++ = c;
} else {
tmp = (unsigned char *) out;
*tmp = c ;
*tmp = (unsigned char) c; /* Explicit truncation */
*(tmp + 1) = c >> 8 ;
out++;
}
@ -670,13 +665,13 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen,
} else {
tmp1 = 0xD800 | (c >> 10);
tmp = (unsigned char *) out;
*tmp = (unsigned char) tmp1;
*tmp = (unsigned char) tmp1; /* Explicit truncation */
*(tmp + 1) = tmp1 >> 8;
out++;
tmp2 = 0xDC00 | (c & 0x03FF);
tmp = (unsigned char *) out;
*tmp = (unsigned char) tmp2;
*tmp = (unsigned char) tmp2; /* Explicit truncation */
*(tmp + 1) = tmp2 >> 8;
out++;
}
@ -773,7 +768,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
c = *tmp++;
c = (c << 8) | (unsigned int) *tmp;
c = (c << 8) | *tmp;
in++;
} else {
c= *in++;
@ -785,7 +780,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
d = *tmp++;
d = (d << 8) | (unsigned int) *tmp;
d = (d << 8) | *tmp;
in++;
} else {
d= *in++;
@ -895,7 +890,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
if (xmlLittleEndian) {
tmp = (unsigned char *) out;
*tmp = c >> 8;
*(tmp + 1) = c;
*(tmp + 1) = (unsigned char) c; /* Explicit truncation */
out++;
} else {
*out++ = c;
@ -908,13 +903,13 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen,
tmp1 = 0xD800 | (c >> 10);
tmp = (unsigned char *) out;
*tmp = tmp1 >> 8;
*(tmp + 1) = (unsigned char) tmp1;
*(tmp + 1) = (unsigned char) tmp1; /* Explicit truncation */
out++;
tmp2 = 0xDC00 | (c & 0x03FF);
tmp = (unsigned char *) out;
*tmp = tmp2 >> 8;
*(tmp + 1) = (unsigned char) tmp2;
*(tmp + 1) = (unsigned char) tmp2; /* Explicit truncation */
out++;
} else {
*out++ = 0xD800 | (c >> 10);
@ -1047,7 +1042,7 @@ xmlGetEncodingAlias(const char *alias) {
return(NULL);
for (i = 0;i < 99;i++) {
upper[i] = toupper(alias[i]);
upper[i] = (char) toupper((unsigned char) alias[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
@ -1082,7 +1077,7 @@ xmlAddEncodingAlias(const char *name, const char *alias) {
return(-1);
for (i = 0;i < 99;i++) {
upper[i] = toupper(alias[i]);
upper[i] = (char) toupper((unsigned char) alias[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
@ -1184,7 +1179,7 @@ xmlParseCharEncoding(const char* name)
name = alias;
for (i = 0;i < 499;i++) {
upper[i] = toupper(name[i]);
upper[i] = (char) toupper((unsigned char) name[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
@ -1311,19 +1306,100 @@ xmlGetCharEncodingName(xmlCharEncoding enc) {
* *
************************************************************************/
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) && \
defined(LIBXML_ISO8859X_ENABLED)
#define DECLARE_ISO_FUNCS(n) \
static int ISO8859_##n##ToUTF8(unsigned char* out, int *outlen, \
const unsigned char* in, int *inlen); \
static int UTF8ToISO8859_##n(unsigned char* out, int *outlen, \
const unsigned char* in, int *inlen);
/** DOC_DISABLE */
DECLARE_ISO_FUNCS(2)
DECLARE_ISO_FUNCS(3)
DECLARE_ISO_FUNCS(4)
DECLARE_ISO_FUNCS(5)
DECLARE_ISO_FUNCS(6)
DECLARE_ISO_FUNCS(7)
DECLARE_ISO_FUNCS(8)
DECLARE_ISO_FUNCS(9)
DECLARE_ISO_FUNCS(10)
DECLARE_ISO_FUNCS(11)
DECLARE_ISO_FUNCS(13)
DECLARE_ISO_FUNCS(14)
DECLARE_ISO_FUNCS(15)
DECLARE_ISO_FUNCS(16)
/** DOC_ENABLE */
#endif /* LIBXML_ISO8859X_ENABLED */
#ifdef LIBXML_ICONV_ENABLED
#define EMPTY_ICONV , (iconv_t) 0, (iconv_t) 0
#else
#define EMPTY_ICONV
#endif
#ifdef LIBXML_ICU_ENABLED
#define EMPTY_UCONV , NULL, NULL
#else
#define EMPTY_UCONV
#endif
#define MAKE_HANDLER(name, in, out) \
{ (char *) name, in, out EMPTY_ICONV EMPTY_UCONV }
static const xmlCharEncodingHandler defaultHandlers[] = {
MAKE_HANDLER("UTF-8", UTF8ToUTF8, UTF8ToUTF8)
#ifdef LIBXML_OUTPUT_ENABLED
,MAKE_HANDLER("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE)
,MAKE_HANDLER("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE)
,MAKE_HANDLER("UTF-16", UTF16LEToUTF8, UTF8ToUTF16)
,MAKE_HANDLER("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1)
,MAKE_HANDLER("ASCII", asciiToUTF8, UTF8Toascii)
,MAKE_HANDLER("US-ASCII", asciiToUTF8, UTF8Toascii)
#ifdef LIBXML_HTML_ENABLED
,MAKE_HANDLER("HTML", NULL, UTF8ToHtml)
#endif
#else
,MAKE_HANDLER("UTF-16LE", UTF16LEToUTF8, NULL)
,MAKE_HANDLER("UTF-16BE", UTF16BEToUTF8, NULL)
,MAKE_HANDLER("UTF-16", UTF16LEToUTF8, NULL)
,MAKE_HANDLER("ISO-8859-1", isolat1ToUTF8, NULL)
,MAKE_HANDLER("ASCII", asciiToUTF8, NULL)
,MAKE_HANDLER("US-ASCII", asciiToUTF8, NULL)
#endif /* LIBXML_OUTPUT_ENABLED */
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) && \
defined(LIBXML_ISO8859X_ENABLED)
,MAKE_HANDLER("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2)
,MAKE_HANDLER("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3)
,MAKE_HANDLER("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4)
,MAKE_HANDLER("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5)
,MAKE_HANDLER("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6)
,MAKE_HANDLER("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7)
,MAKE_HANDLER("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8)
,MAKE_HANDLER("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9)
,MAKE_HANDLER("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10)
,MAKE_HANDLER("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11)
,MAKE_HANDLER("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13)
,MAKE_HANDLER("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14)
,MAKE_HANDLER("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15)
,MAKE_HANDLER("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16)
#endif
};
#define NUM_DEFAULT_HANDLERS \
(sizeof(defaultHandlers) / sizeof(defaultHandlers[0]))
static const xmlCharEncodingHandler *xmlUTF16LEHandler = &defaultHandlers[1];
static const xmlCharEncodingHandler *xmlUTF16BEHandler = &defaultHandlers[2];
/* the size should be growable, but it's not a big deal ... */
#define MAX_ENCODING_HANDLERS 50
static xmlCharEncodingHandlerPtr *handlers = NULL;
static int nbCharEncodingHandler = 0;
/*
* The default is UTF-8 for XML, that's also the default used for the
* parser internals, so the default encoding handler is NULL
*/
static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL;
/**
* xmlNewCharEncodingHandler:
* @name: the encoding name, in UTF-8 format (ASCII actually)
@ -1360,7 +1436,7 @@ xmlNewCharEncodingHandler(const char *name,
return(NULL);
}
for (i = 0;i < 499;i++) {
upper[i] = toupper(name[i]);
upper[i] = (char) toupper((unsigned char) name[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
@ -1408,64 +1484,29 @@ xmlNewCharEncodingHandler(const char *name,
/**
* xmlInitCharEncodingHandlers:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* initialize the library.
*
* Initialize the char encoding support, it registers the default
* encoding supported.
* NOTE: while public, this function usually doesn't need to be called
* in normal processing.
* DEPRECATED: Alias for xmlInitParser.
*/
void
xmlInitCharEncodingHandlers(void) {
xmlInitParser();
}
/**
* xmlInitEncodingInternal:
*
* Initialize the char encoding support.
*/
void
xmlInitEncodingInternal(void) {
unsigned short int tst = 0x1234;
unsigned char *ptr = (unsigned char *) &tst;
if (handlers != NULL) return;
handlers = (xmlCharEncodingHandlerPtr *)
xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr));
if (*ptr == 0x12) xmlLittleEndian = 0;
else if (*ptr == 0x34) xmlLittleEndian = 1;
else {
xmlEncodingErr(XML_ERR_INTERNAL_ERROR,
"Odd problem at endianness detection\n", NULL);
}
if (handlers == NULL) {
xmlEncodingErrMemory("xmlInitCharEncodingHandlers : out of memory !\n");
return;
}
xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8);
#ifdef LIBXML_OUTPUT_ENABLED
xmlUTF16LEHandler =
xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE);
xmlUTF16BEHandler =
xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE);
xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, UTF8ToUTF16);
xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1);
xmlNewCharEncodingHandler("ASCII", asciiToUTF8, UTF8Toascii);
xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, UTF8Toascii);
#ifdef LIBXML_HTML_ENABLED
xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml);
#endif
#else
xmlUTF16LEHandler =
xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL);
xmlUTF16BEHandler =
xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL);
xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL);
xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL);
xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL);
xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL);
#endif /* LIBXML_OUTPUT_ENABLED */
#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED)
#ifdef LIBXML_ISO8859X_ENABLED
xmlRegisterCharEncodingHandlersISO8859x ();
#endif
#endif
}
/**
@ -1496,7 +1537,6 @@ xmlCleanupCharEncodingHandlers(void) {
xmlFree(handlers);
handlers = NULL;
nbCharEncodingHandler = 0;
xmlDefaultCharEncodingHandler = NULL;
}
/**
@ -1507,11 +1547,17 @@ xmlCleanupCharEncodingHandlers(void) {
*/
void
xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) {
if (handlers == NULL) xmlInitCharEncodingHandlers();
if ((handler == NULL) || (handlers == NULL)) {
if (handler == NULL) {
xmlEncodingErr(XML_I18N_NO_HANDLER,
"xmlRegisterCharEncodingHandler: NULL handler !\n", NULL);
goto free_handler;
"xmlRegisterCharEncodingHandler: NULL handler\n", NULL);
return;
}
if (handlers == NULL) {
handlers = xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(handlers[0]));
if (handlers == NULL) {
xmlEncodingErrMemory("allocating handler table");
goto free_handler;
}
}
if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) {
@ -1544,7 +1590,6 @@ xmlCharEncodingHandlerPtr
xmlGetCharEncodingHandler(xmlCharEncoding enc) {
xmlCharEncodingHandlerPtr handler;
if (handlers == NULL) xmlInitCharEncodingHandlers();
switch (enc) {
case XML_CHAR_ENCODING_ERROR:
return(NULL);
@ -1553,9 +1598,9 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
case XML_CHAR_ENCODING_UTF8:
return(NULL);
case XML_CHAR_ENCODING_UTF16LE:
return(xmlUTF16LEHandler);
return((xmlCharEncodingHandlerPtr) xmlUTF16LEHandler);
case XML_CHAR_ENCODING_UTF16BE:
return(xmlUTF16BEHandler);
return((xmlCharEncodingHandlerPtr) xmlUTF16BEHandler);
case XML_CHAR_ENCODING_EBCDIC:
handler = xmlFindCharEncodingHandler("EBCDIC");
if (handler != NULL) return(handler);
@ -1670,7 +1715,8 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) {
* xmlFindCharEncodingHandler:
* @name: a string describing the char encoding.
*
* Search in the registered set the handler able to read/write that encoding.
* Search in the registered set the handler able to read/write that encoding
* or create a new one.
*
* Returns the handler or NULL if not found
*/
@ -1690,9 +1736,8 @@ xmlFindCharEncodingHandler(const char *name) {
char upper[100];
int i;
if (handlers == NULL) xmlInitCharEncodingHandlers();
if (name == NULL) return(xmlDefaultCharEncodingHandler);
if (name[0] == 0) return(xmlDefaultCharEncodingHandler);
if (name == NULL) return(NULL);
if (name[0] == 0) return(NULL);
/*
* Do the alias resolution
@ -1706,11 +1751,16 @@ xmlFindCharEncodingHandler(const char *name) {
* Check first for directly registered encoding names
*/
for (i = 0;i < 99;i++) {
upper[i] = toupper(name[i]);
upper[i] = (char) toupper((unsigned char) name[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
for (i = 0; i < (int) NUM_DEFAULT_HANDLERS; i++) {
if (strcmp(upper, defaultHandlers[i].name) == 0)
return((xmlCharEncodingHandlerPtr) &defaultHandlers[i]);
}
if (handlers != NULL) {
for (i = 0;i < nbCharEncodingHandler; i++) {
if (!strcmp(upper, handlers[i]->name)) {
@ -1743,6 +1793,12 @@ xmlFindCharEncodingHandler(const char *name) {
}
memset(enc, 0, sizeof(xmlCharEncodingHandler));
enc->name = xmlMemStrdup(name);
if (enc->name == NULL) {
xmlFree(enc);
iconv_close(icv_in);
iconv_close(icv_out);
return(NULL);
}
enc->input = NULL;
enc->output = NULL;
enc->iconv_in = icv_in;
@ -1775,6 +1831,12 @@ xmlFindCharEncodingHandler(const char *name) {
}
memset(encu, 0, sizeof(xmlCharEncodingHandler));
encu->name = xmlMemStrdup(name);
if (encu->name == NULL) {
xmlFree(encu);
closeIcuConverter(ucv_in);
closeIcuConverter(ucv_out);
return(NULL);
}
encu->input = NULL;
encu->output = NULL;
encu->uconv_in = ucv_in;
@ -1975,7 +2037,7 @@ xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen,
* as the return value is 0, else unpredictable.
* The value of @outlen after return is the number of octets produced.
*/
static int
int
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen, int flush) {
int ret;
@ -2055,221 +2117,18 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
return(ret);
}
/**
* xmlCharEncFirstLineInt:
* @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input
* @len: number of bytes to convert for the first line, or -1
*
* Front-end for the encoding handler input function, but handle only
* the very first line, i.e. limit itself to 45 chars.
*
* Returns the number of byte written if success, or
* -1 general error
* -2 if the transcoding fails (for *in is not valid utf8 string or
* the result of transformation can't fit into the encoding we want), or
*/
int
xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in, int len) {
int ret;
int written;
int toconv;
if (handler == NULL) return(-1);
if (out == NULL) return(-1);
if (in == NULL) return(-1);
/* calculate space available */
written = out->size - out->use - 1; /* count '\0' */
toconv = in->use;
/*
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
* 45 chars should be sufficient to reach the end of the encoding
* declaration without going too far inside the document content.
* on UTF-16 this means 90bytes, on UCS4 this means 180
* The actual value depending on guessed encoding is passed as @len
* if provided
*/
if (len >= 0) {
if (toconv > len)
toconv = len;
} else {
if (toconv > 180)
toconv = 180;
}
if (toconv * 2 >= written) {
xmlBufferGrow(out, toconv * 2);
written = out->size - out->use - 1;
}
ret = xmlEncInputChunk(handler, &out->content[out->use], &written,
in->content, &toconv, 0);
xmlBufferShrink(in, toconv);
out->use += written;
out->content[out->use] = 0;
if (ret == -1) ret = -3;
#ifdef DEBUG_ENCODING
switch (ret) {
case 0:
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input\n",
toconv, written);
break;
case -1:
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
toconv, written, in->use);
break;
case -2:
xmlGenericError(xmlGenericErrorContext,
"input conversion failed due to input error\n");
break;
case -3:
xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of input, %d left\n",
toconv, written, in->use);
break;
default:
xmlGenericError(xmlGenericErrorContext,"Unknown input conversion failed %d\n", ret);
}
#endif /* DEBUG_ENCODING */
/*
* Ignore when input buffer is not on a boundary
*/
if (ret == -3) ret = 0;
if (ret == -1) ret = 0;
return(written ? written : ret);
}
/**
* xmlCharEncFirstLine:
* @handler: char encoding transformation data structure
* @out: an xmlBuffer for the output.
* @in: an xmlBuffer for the input
*
* Front-end for the encoding handler input function, but handle only
* the very first line, i.e. limit itself to 45 chars.
*
* Returns the number of byte written if success, or
* -1 general error
* -2 if the transcoding fails (for *in is not valid utf8 string or
* the result of transformation can't fit into the encoding we want), or
* DEPERECATED: Don't use.
*/
int
xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out,
xmlBufferPtr in) {
return(xmlCharEncFirstLineInt(handler, out, in, -1));
}
/**
* xmlCharEncFirstLineInput:
* @input: a parser input buffer
* @len: number of bytes to convert for the first line, or -1
*
* Front-end for the encoding handler input function, but handle only
* the very first line. Point is that this is based on autodetection
* of the encoding and once that first line is converted we may find
* out that a different decoder is needed to process the input.
*
* Returns the number of byte written if success, or
* -1 general error
* -2 if the transcoding fails (for *in is not valid utf8 string or
* the result of transformation can't fit into the encoding we want), or
*/
int
xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len)
{
int ret;
size_t written;
size_t toconv;
int c_in;
int c_out;
xmlBufPtr in;
xmlBufPtr out;
if ((input == NULL) || (input->encoder == NULL) ||
(input->buffer == NULL) || (input->raw == NULL))
return (-1);
out = input->buffer;
in = input->raw;
toconv = xmlBufUse(in);
if (toconv == 0)
return (0);
written = xmlBufAvail(out);
/*
* echo '<?xml version="1.0" encoding="UCS4"?>' | wc -c => 38
* 45 chars should be sufficient to reach the end of the encoding
* declaration without going too far inside the document content.
* on UTF-16 this means 90bytes, on UCS4 this means 180
* The actual value depending on guessed encoding is passed as @len
* if provided
*/
if (len >= 0) {
if (toconv > (unsigned int) len)
toconv = len;
} else {
if (toconv > 180)
toconv = 180;
}
if (toconv * 2 >= written) {
xmlBufGrow(out, toconv * 2);
written = xmlBufAvail(out);
}
if (written > 360)
written = 360;
c_in = toconv;
c_out = written;
ret = xmlEncInputChunk(input->encoder, xmlBufEnd(out), &c_out,
xmlBufContent(in), &c_in, 0);
xmlBufShrink(in, c_in);
xmlBufAddLen(out, c_out);
if (ret == -1)
ret = -3;
switch (ret) {
case 0:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input\n",
c_in, c_out);
#endif
break;
case -1:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input, %d left\n",
c_in, c_out, (int)xmlBufUse(in));
#endif
break;
case -3:
#ifdef DEBUG_ENCODING
xmlGenericError(xmlGenericErrorContext,
"converted %d bytes to %d bytes of input, %d left\n",
c_in, c_out, (int)xmlBufUse(in));
#endif
break;
case -2: {
char buf[50];
const xmlChar *content = xmlBufContent(in);
snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X",
content[0], content[1],
content[2], content[3]);
buf[49] = 0;
xmlEncodingErr(XML_I18N_CONV_FAILED,
"input conversion failed due to input error, bytes %s\n",
buf);
}
}
/*
* Ignore when input buffer is not on a boundary
*/
if (ret == -3) ret = 0;
if (ret == -1) ret = 0;
return(c_out ? c_out : ret);
xmlBufferPtr in) {
return(xmlCharEncInFunc(handler, out, in));
}
/**
@ -2308,7 +2167,8 @@ xmlCharEncInput(xmlParserInputBufferPtr input, int flush)
toconv = 64 * 1024;
written = xmlBufAvail(out);
if (toconv * 2 >= written) {
xmlBufGrow(out, toconv * 2);
if (xmlBufGrow(out, toconv * 2) < 0)
return (-1);
written = xmlBufAvail(out);
}
if ((written > 128 * 1024) && (flush == 0))
@ -2569,7 +2429,7 @@ retry:
break;
case -2: {
xmlChar charref[20];
int len = (int) xmlBufUse(in);
int len = xmlBufUse(in);
xmlChar *content = xmlBufContent(in);
int cur, charrefLen;
@ -2609,8 +2469,7 @@ retry:
xmlEncodingErr(XML_I18N_CONV_FAILED,
"output conversion failed due to conv error, bytes %s\n",
buf);
if (xmlBufGetAllocationScheme(in) != XML_BUFFER_ALLOC_IMMUTABLE)
content[0] = ' ';
content[0] = ' ';
break;
}
@ -2770,8 +2629,7 @@ retry:
xmlEncodingErr(XML_I18N_CONV_FAILED,
"output conversion failed due to conv error, bytes %s\n",
buf);
if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE)
in->content[0] = ' ';
in->content[0] = ' ';
break;
}
@ -2796,19 +2654,19 @@ int
xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
int ret = 0;
int tofree = 0;
int i, handler_in_list = 0;
/* Avoid unused variable warning if features are disabled. */
(void) handler_in_list;
int i = 0;
if (handler == NULL) return(-1);
if (handler->name == NULL) return(-1);
for (i = 0; i < (int) NUM_DEFAULT_HANDLERS; i++) {
if (handler == &defaultHandlers[i])
return(0);
}
if (handlers != NULL) {
for (i = 0;i < nbCharEncodingHandler; i++) {
if (handler == handlers[i]) {
handler_in_list = 1;
break;
}
if (handler == handlers[i])
return(0);
}
}
#ifdef LIBXML_ICONV_ENABLED
@ -2816,8 +2674,7 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
* Iconv handlers can be used only once, free the whole block.
* and the associated icon resources.
*/
if ((handler_in_list == 0) &&
((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) {
if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) {
tofree = 1;
if (handler->iconv_out != NULL) {
if (iconv_close(handler->iconv_out))
@ -2832,8 +2689,7 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) {
}
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
if ((handler_in_list == 0) &&
((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) {
if ((handler->uconv_out != NULL) || (handler->uconv_in != NULL)) {
tofree = 1;
if (handler->uconv_out != NULL) {
closeIcuConverter(handler->uconv_out);
@ -3972,24 +3828,6 @@ static int UTF8ToISO8859_16 (unsigned char* out, int *outlen,
return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_16);
}
static void
xmlRegisterCharEncodingHandlersISO8859x (void) {
xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2);
xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3);
xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4);
xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5);
xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6);
xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7);
xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8);
xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9);
xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10);
xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11);
xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13);
xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14);
xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15);
xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16);
}
#endif
#endif

View file

@ -26,7 +26,8 @@
#include <libxml/globals.h>
#include <libxml/dict.h>
#include "save.h"
#include "private/entities.h"
#include "private/error.h"
/*
* The XML predefined entities.
@ -37,35 +38,35 @@ static xmlEntity xmlEntityLt = {
NULL, NULL, NULL, NULL, NULL, NULL,
BAD_CAST "<", BAD_CAST "<", 1,
XML_INTERNAL_PREDEFINED_ENTITY,
NULL, NULL, NULL, NULL, 0, 1
NULL, NULL, NULL, NULL, 0, 0, 0
};
static xmlEntity xmlEntityGt = {
NULL, XML_ENTITY_DECL, BAD_CAST "gt",
NULL, NULL, NULL, NULL, NULL, NULL,
BAD_CAST ">", BAD_CAST ">", 1,
XML_INTERNAL_PREDEFINED_ENTITY,
NULL, NULL, NULL, NULL, 0, 1
NULL, NULL, NULL, NULL, 0, 0, 0
};
static xmlEntity xmlEntityAmp = {
NULL, XML_ENTITY_DECL, BAD_CAST "amp",
NULL, NULL, NULL, NULL, NULL, NULL,
BAD_CAST "&", BAD_CAST "&", 1,
XML_INTERNAL_PREDEFINED_ENTITY,
NULL, NULL, NULL, NULL, 0, 1
NULL, NULL, NULL, NULL, 0, 0, 0
};
static xmlEntity xmlEntityQuot = {
NULL, XML_ENTITY_DECL, BAD_CAST "quot",
NULL, NULL, NULL, NULL, NULL, NULL,
BAD_CAST "\"", BAD_CAST "\"", 1,
XML_INTERNAL_PREDEFINED_ENTITY,
NULL, NULL, NULL, NULL, 0, 1
NULL, NULL, NULL, NULL, 0, 0, 0
};
static xmlEntity xmlEntityApos = {
NULL, XML_ENTITY_DECL, BAD_CAST "apos",
NULL, NULL, NULL, NULL, NULL, NULL,
BAD_CAST "'", BAD_CAST "'", 1,
XML_INTERNAL_PREDEFINED_ENTITY,
NULL, NULL, NULL, NULL, 0, 1
NULL, NULL, NULL, NULL, 0, 0, 0
};
/**
@ -162,7 +163,6 @@ xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type,
}
memset(ret, 0, sizeof(xmlEntity));
ret->type = XML_ENTITY_DECL;
ret->checked = 0;
/*
* fill the structure.
@ -604,7 +604,7 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
* allocate an translation buffer.
*/
buffer_size = 1000;
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
buffer = (xmlChar *) xmlMalloc(buffer_size);
if (buffer == NULL) {
xmlEntitiesErrMemory("xmlEncodeEntities: malloc failed");
return(NULL);
@ -844,7 +844,7 @@ xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input)
* allocate an translation buffer.
*/
buffer_size = 1000;
buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar));
buffer = (xmlChar *) xmlMalloc(buffer_size);
if (buffer == NULL) {
xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed");
return(NULL);
@ -1010,7 +1010,6 @@ xmlCopyEntitiesTable(xmlEntitiesTablePtr table) {
*/
static void
xmlDumpEntityContent(xmlBufferPtr buf, const xmlChar *content) {
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
if (xmlStrchr(content, '%')) {
const xmlChar * base, *cur;

View file

@ -16,9 +16,9 @@
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#include "private/error.h"
#define XML_MAX_ERRORS 100
#define XML_GET_VAR_STR(msg, str) { \
int size, prev_size = -1; \
@ -83,6 +83,8 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
* initGenericErrorDefaultFunc:
* @handler: the handler
*
* DEPRECATED: Use xmlSetGenericErrorFunc.
*
* Set or reset (if NULL) the default handler for generic errors
* to the builtin error function.
*/
@ -163,7 +165,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
}
/**
* xmlParserPrintFileContext:
* xmlParserPrintFileContextInternal:
* @input: an xmlParserInputPtr input
*
* Displays current context within the input content for error tracking
@ -172,7 +174,7 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) {
static void
xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
xmlGenericErrorFunc channel, void *data ) {
const xmlChar *cur, *base;
const xmlChar *cur, *base, *start;
unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
xmlChar content[81]; /* space for 80 chars + line terminator */
xmlChar *ctnt;
@ -188,22 +190,35 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
}
n = 0;
/* search backwards for beginning-of-line (to max buff size) */
while ((n++ < (sizeof(content)-1)) && (cur > base) &&
(*(cur) != '\n') && (*(cur) != '\r'))
while ((n < sizeof(content) - 1) && (cur > base) &&
(*cur != '\n') && (*cur != '\r')) {
cur--;
if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
n++;
}
if ((n > 0) && ((*cur == '\n') || (*cur == '\r'))) {
cur++;
} else {
/* skip over continuation bytes */
while ((cur < input->cur) && ((*cur & 0xC0) == 0x80))
cur++;
}
/* calculate the error position in terms of the current position */
col = input->cur - cur;
/* search forward for end-of-line (to max buff size) */
n = 0;
ctnt = content;
start = cur;
/* copy selected text to our buffer */
while ((*cur != 0) && (*(cur) != '\n') &&
(*(cur) != '\r') && (n < sizeof(content)-1)) {
*ctnt++ = *cur++;
n++;
while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) {
int len = input->end - cur;
int c = xmlGetUTF8Char(cur, &len);
if ((c < 0) || (n + len > sizeof(content)-1))
break;
cur += len;
n += len;
}
*ctnt = 0;
memcpy(content, start, n);
content[n] = 0;
/* print out the selected text */
channel(data ,"%s\n", content);
/* create blank line with problem pointer */
@ -474,12 +489,25 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel,
(domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
(domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
ctxt = (xmlParserCtxtPtr) ctx;
if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->initialized == XML_SAX2_MAGIC) &&
(ctxt->sax->serror != NULL)) {
schannel = ctxt->sax->serror;
data = ctxt->userData;
}
if (ctxt != NULL) {
if (level == XML_ERR_WARNING) {
if (ctxt->nbWarnings >= XML_MAX_ERRORS)
return;
ctxt->nbWarnings += 1;
} else {
if (ctxt->nbErrors >= XML_MAX_ERRORS)
return;
ctxt->nbErrors += 1;
}
if ((schannel == NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->initialized == XML_SAX2_MAGIC) &&
(ctxt->sax->serror != NULL)) {
schannel = ctxt->sax->serror;
data = ctxt->userData;
}
}
}
/*
* Check if structured error handler set

View file

@ -21,6 +21,11 @@
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include "private/error.h"
#include "private/globals.h"
#include "private/threads.h"
#include "private/tree.h"
/* #define DEBUG_GLOBALS */
/*
@ -35,20 +40,24 @@
/*
* Mutex to protect "ForNewThreads" variables
*/
static xmlMutexPtr xmlThrDefMutex = NULL;
static xmlMutex xmlThrDefMutex;
/**
* xmlInitGlobals:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* initialize the library.
* DEPRECATED: Alias for xmlInitParser.
*/
void xmlInitGlobals(void) {
xmlInitParser();
}
/**
* xmlInitGlobalsInternal:
*
* Additional initialisation for multi-threading
*/
void xmlInitGlobals(void)
{
if (xmlThrDefMutex == NULL)
xmlThrDefMutex = xmlNewMutex();
void xmlInitGlobalsInternal(void) {
xmlInitMutex(&xmlThrDefMutex);
}
/************************************************************************
@ -175,6 +184,8 @@ const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
/**
* xmlBufferAllocScheme:
*
* DEPRECATED: Don't use.
*
* Global setting, default allocation policy for buffers, default is
* XML_BUFFER_ALLOC_EXACT
*/
@ -183,6 +194,8 @@ static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_E
/**
* xmlDefaultBufferSize:
*
* DEPRECATED: Don't use.
*
* Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
*/
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@ -201,6 +214,8 @@ int oldXMLWDcompatibility = 0; /* DEPRECATED */
/**
* xmlParserDebugEntities:
*
* DEPRECATED: Don't use
*
* Global setting, asking the parser to print out debugging information.
* while handling entities.
* Disabled by default
@ -210,6 +225,8 @@ static int xmlParserDebugEntitiesThrDef = 0;
/**
* xmlDoValidityCheckingDefaultValue:
*
* DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.
*
* Global setting, indicate that the parser should work in validating mode.
* Disabled by default.
*/
@ -218,7 +235,9 @@ static int xmlDoValidityCheckingDefaultValueThrDef = 0;
/**
* xmlGetWarningsDefaultValue:
*
* Global setting, indicate that the parser should provide warnings.
* DEPRECATED: Don't use
*
* Global setting, indicate that the DTD validation should provide warnings.
* Activated by default.
*/
int xmlGetWarningsDefaultValue = 1;
@ -226,6 +245,8 @@ static int xmlGetWarningsDefaultValueThrDef = 1;
/**
* xmlLoadExtDtdDefaultValue:
*
* DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.
*
* Global setting, indicate that the parser should load DTD while not
* validating.
* Disabled by default.
@ -235,6 +256,8 @@ static int xmlLoadExtDtdDefaultValueThrDef = 0;
/**
* xmlPedanticParserDefaultValue:
*
* DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
*
* Global setting, indicate that the parser be pedantic
* Disabled by default.
*/
@ -243,6 +266,8 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
/**
* xmlLineNumbersDefaultValue:
*
* DEPRECATED: The modern options API always enables line numbers.
*
* Global setting, indicate that the parser should store the line number
* in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
@ -253,6 +278,8 @@ static int xmlLineNumbersDefaultValueThrDef = 0;
/**
* xmlKeepBlanksDefaultValue:
*
* DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
*
* Global setting, indicate that the parser should keep all blanks
* nodes found in the content
* Activated by default, this is actually needed to have the parser
@ -264,6 +291,8 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
/**
* xmlSubstituteEntitiesDefaultValue:
*
* DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
*
* Global setting, indicate that the parser should not generate entity
* references but replace them with the actual content of the entity
* Disabled by default, this should be activated when using XPath since
@ -273,26 +302,38 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
int xmlSubstituteEntitiesDefaultValue = 0;
static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
/**
* xmlRegisterNodeDefaultValue:
*
* DEPRECATED: Don't use
*/
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
/**
* xmlDeregisterNodeDefaultValue:
*
* DEPRECATED: Don't use
*/
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
/**
* xmlParserInputBufferCreateFilenameValue:
*
* DEPRECATED: Don't use
*/
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
/**
* xmlOutputBufferCreateFilenameValue:
*
* DEPRECATED: Don't use
*/
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
/*
* Error handling
*/
/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
/* Must initialize xmlGenericError in xmlInitParser */
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
const char *msg,
...);
/**
* xmlGenericError:
*
@ -358,6 +399,9 @@ static int xmlSaveNoEmptyTagsThrDef = 0;
/**
* xmlDefaultSAXHandler:
*
* DEPRECATED: This handler is unused and will be removed from future
* versions.
*
* Default SAX version1 handler for XML, builds the DOM tree
*/
xmlSAXHandlerV1 xmlDefaultSAXHandler = {
@ -388,13 +432,15 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
xmlSAX2GetParameterEntity,
xmlSAX2CDataBlock,
xmlSAX2ExternalSubset,
0,
1,
};
#endif /* LIBXML_SAX1_ENABLED */
/**
* xmlDefaultSAXLocator:
*
* DEPRECATED: Don't use
*
* The default SAX Locator
* { getPublicId, getSystemId, getLineNumber, getColumnNumber}
*/
@ -405,10 +451,13 @@ xmlSAXLocator xmlDefaultSAXLocator = {
xmlSAX2GetColumnNumber
};
#ifdef LIBXML_HTML_ENABLED
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
/**
* htmlDefaultSAXHandler:
*
* DEPRECATED: This handler is unused and will be removed from future
* versions.
*
* Default old SAX v1 handler for HTML, builds the DOM tree
*/
xmlSAXHandlerV1 htmlDefaultSAXHandler = {
@ -436,10 +485,10 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
xmlParserWarning,
xmlParserError,
xmlParserError,
xmlSAX2GetParameterEntity,
NULL,
xmlSAX2CDataBlock,
NULL,
0,
1,
};
#endif /* LIBXML_HTML_ENABLED */
@ -454,17 +503,11 @@ void
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{
#ifdef DEBUG_GLOBALS
fprintf(stderr, "Initializing globals at %lu for thread %d\n",
(unsigned long) gs, xmlGetThreadId());
fprintf(stderr, "Initializing globals at %p for thread %d\n",
(void *) gs, xmlGetThreadId());
#endif
/*
* Perform initialization as required by libxml
*/
if (xmlThrDefMutex == NULL)
xmlInitGlobals();
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
@ -519,51 +562,49 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef;
memset(&gs->xmlLastError, 0, sizeof(xmlError));
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
}
/**
* xmlCleanupGlobals:
*
* DEPRECATED: This function will be made private. Call xmlCleanupParser
* DEPRECATED: This function is a no-op. Call xmlCleanupParser
* to free global state but see the warnings there. xmlCleanupParser
* should be only called once at program exit. In most cases, you don't
* have call cleanup functions at all.
*
* Additional cleanup for multi-threading
*/
void xmlCleanupGlobals(void)
{
xmlResetError(&xmlLastError);
if (xmlThrDefMutex != NULL) {
xmlFreeMutex(xmlThrDefMutex);
xmlThrDefMutex = NULL;
}
__xmlGlobalInitMutexDestroy();
void xmlCleanupGlobals(void) {
}
/**
* DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
* those are really internal work
* xmlCleanupGlobalsInternal:
*
* Additional cleanup for multi-threading
*/
void xmlCleanupGlobalsInternal(void) {
xmlResetError(&xmlLastError);
xmlCleanupMutex(&xmlThrDefMutex);
__xmlGlobalInitMutexDestroy();
}
void
xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
xmlGenericErrorContextThrDef = ctx;
if (handler != NULL)
xmlGenericErrorThrDef = handler;
else
xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
}
void
xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
xmlStructuredErrorContextThrDef = ctx;
xmlStructuredErrorThrDef = handler;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
}
/**
@ -589,12 +630,12 @@ xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
{
xmlRegisterNodeFunc old;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
old = xmlRegisterNodeDefaultValueThrDef;
__xmlRegisterCallbacks = 1;
xmlRegisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return(old);
}
@ -622,12 +663,12 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
{
xmlDeregisterNodeFunc old;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
old = xmlDeregisterNodeDefaultValueThrDef;
__xmlRegisterCallbacks = 1;
xmlDeregisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return(old);
}
@ -637,14 +678,14 @@ xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilena
{
xmlParserInputBufferCreateFilenameFunc old;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
if (old == NULL) {
old = __xmlParserInputBufferCreateFilename;
}
xmlParserInputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return(old);
}
@ -654,7 +695,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
{
xmlOutputBufferCreateFilenameFunc old;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED
if (old == NULL) {
@ -662,12 +703,12 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
}
#endif
xmlOutputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return(old);
}
#ifdef LIBXML_HTML_ENABLED
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
#undef htmlDefaultSAXHandler
xmlSAXHandlerV1 *
__htmlDefaultSAXHandler(void) {
@ -765,10 +806,10 @@ __xmlBufferAllocScheme(void) {
}
xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) {
xmlBufferAllocationScheme ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlBufferAllocSchemeThrDef;
xmlBufferAllocSchemeThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -782,10 +823,10 @@ __xmlDefaultBufferSize(void) {
}
int xmlThrDefDefaultBufferSize(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDefaultBufferSizeThrDef;
xmlDefaultBufferSizeThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -819,15 +860,15 @@ __xmlDoValidityCheckingDefaultValue(void) {
}
int xmlThrDefDoValidityCheckingDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlDoValidityCheckingDefaultValueThrDef;
xmlDoValidityCheckingDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
#undef xmlGenericError
xmlGenericErrorFunc * XMLCALL
xmlGenericErrorFunc *
__xmlGenericError(void) {
if (IS_MAIN_THREAD)
return (&xmlGenericError);
@ -872,10 +913,10 @@ __xmlGetWarningsDefaultValue(void) {
}
int xmlThrDefGetWarningsDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlGetWarningsDefaultValueThrDef;
xmlGetWarningsDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -889,10 +930,10 @@ __xmlIndentTreeOutput(void) {
}
int xmlThrDefIndentTreeOutput(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlIndentTreeOutputThrDef;
xmlIndentTreeOutputThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -906,10 +947,10 @@ __xmlTreeIndentString(void) {
}
const char * xmlThrDefTreeIndentString(const char * v) {
const char * ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlTreeIndentStringThrDef;
xmlTreeIndentStringThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -923,10 +964,10 @@ __xmlKeepBlanksDefaultValue(void) {
}
int xmlThrDefKeepBlanksDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlKeepBlanksDefaultValueThrDef;
xmlKeepBlanksDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -940,10 +981,10 @@ __xmlLineNumbersDefaultValue(void) {
}
int xmlThrDefLineNumbersDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLineNumbersDefaultValueThrDef;
xmlLineNumbersDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -957,10 +998,10 @@ __xmlLoadExtDtdDefaultValue(void) {
}
int xmlThrDefLoadExtDtdDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlLoadExtDtdDefaultValueThrDef;
xmlLoadExtDtdDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -974,10 +1015,10 @@ __xmlParserDebugEntities(void) {
}
int xmlThrDefParserDebugEntities(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlParserDebugEntitiesThrDef;
xmlParserDebugEntitiesThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -1000,10 +1041,10 @@ __xmlPedanticParserDefaultValue(void) {
}
int xmlThrDefPedanticParserDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlPedanticParserDefaultValueThrDef;
xmlPedanticParserDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -1017,10 +1058,10 @@ __xmlSaveNoEmptyTags(void) {
}
int xmlThrDefSaveNoEmptyTags(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSaveNoEmptyTagsThrDef;
xmlSaveNoEmptyTagsThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}
@ -1034,10 +1075,10 @@ __xmlSubstituteEntitiesDefaultValue(void) {
}
int xmlThrDefSubstituteEntitiesDefaultValue(int v) {
int ret;
xmlMutexLock(xmlThrDefMutex);
xmlMutexLock(&xmlThrDefMutex);
ret = xmlSubstituteEntitiesDefaultValueThrDef;
xmlSubstituteEntitiesDefaultValueThrDef = v;
xmlMutexUnlock(xmlThrDefMutex);
xmlMutexUnlock(&xmlThrDefMutex);
return ret;
}

View file

@ -39,6 +39,8 @@
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
#include "private/dict.h"
#define MAX_HASH_LEN 8
/* #define DEBUG_GROW */
@ -76,6 +78,7 @@ struct _xmlHashTable {
*/
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
#endif
static unsigned long
xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
@ -109,6 +112,7 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
#ifdef __clang__
ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
ATTRIBUTE_NO_SANITIZE("unsigned-shift-base")
#endif
static unsigned long
xmlHashComputeQKey(xmlHashTablePtr table,
@ -130,7 +134,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name != NULL) {
while ((ch = *name++) != 0) {
@ -142,7 +146,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name2 != NULL) {
while ((ch = *name2++) != 0) {
@ -154,7 +158,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
while ((ch = *prefix3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
value = value ^ ((value << 5) + (value >> 3) + ':');
}
if (name3 != NULL) {
while ((ch = *name3++) != 0) {
@ -176,6 +180,8 @@ xmlHashTablePtr
xmlHashCreate(int size) {
xmlHashTablePtr table;
xmlInitParser();
if (size <= 0)
size = 256;
@ -609,8 +615,24 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
entry->name3 = (xmlChar *) name3;
} else {
entry->name = xmlStrdup(name);
entry->name2 = xmlStrdup(name2);
entry->name3 = xmlStrdup(name3);
if (entry->name == NULL) {
entry->name2 = NULL;
goto error;
}
if (name2 == NULL) {
entry->name2 = NULL;
} else {
entry->name2 = xmlStrdup(name2);
if (entry->name2 == NULL)
goto error;
}
if (name3 == NULL) {
entry->name3 = NULL;
} else {
entry->name3 = xmlStrdup(name3);
if (entry->name3 == NULL)
goto error;
}
}
entry->payload = userdata;
entry->next = NULL;
@ -626,6 +648,13 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name,
xmlHashGrow(table, MAX_HASH_LEN * table->size);
return(0);
error:
xmlFree(entry->name2);
xmlFree(entry->name);
if (insert != NULL)
xmlFree(entry);
return(-1);
}
/**
@ -739,8 +768,24 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
entry->name3 = (xmlChar *) name3;
} else {
entry->name = xmlStrdup(name);
entry->name2 = xmlStrdup(name2);
entry->name3 = xmlStrdup(name3);
if (entry->name == NULL) {
entry->name2 = NULL;
goto error;
}
if (name2 == NULL) {
entry->name2 = NULL;
} else {
entry->name2 = xmlStrdup(name2);
if (entry->name2 == NULL)
goto error;
}
if (name3 == NULL) {
entry->name3 = NULL;
} else {
entry->name3 = xmlStrdup(name3);
if (entry->name3 == NULL)
goto error;
}
}
entry->payload = userdata;
entry->next = NULL;
@ -752,6 +797,13 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name,
insert->next = entry;
}
return(0);
error:
xmlFree(entry->name2);
xmlFree(entry->name);
if (insert != NULL)
xmlFree(entry);
return(-1);
}
/**

View file

@ -83,87 +83,101 @@ struct _htmlEntityDesc {
/*
* There is only few public functions.
*/
XMLPUBFUN const htmlElemDesc * XMLCALL
XML_DEPRECATED
XMLPUBFUN void
htmlInitAutoClose (void);
XMLPUBFUN const htmlElemDesc *
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
XMLPUBFUN const htmlEntityDesc *
htmlEntityLookup(const xmlChar *name);
XMLPUBFUN const htmlEntityDesc * XMLCALL
XMLPUBFUN const htmlEntityDesc *
htmlEntityValueLookup(unsigned int value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlAutoCloseTag(htmlDocPtr doc,
const xmlChar *name,
htmlNodePtr elem);
XMLPUBFUN const htmlEntityDesc * XMLCALL
XML_DEPRECATED
XMLPUBFUN const htmlEntityDesc *
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
const xmlChar **str);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
htmlParseCharRef(htmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
htmlParseElement(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
XMLPUBFUN htmlParserCtxtPtr
htmlNewParserCtxt(void);
XMLPUBFUN htmlParserCtxtPtr
htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
void *userData);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
XMLPUBFUN htmlParserCtxtPtr
htmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlParseDocument(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN htmlDocPtr
htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlParserCtxtPtr
htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
XML_DEPRECATED
XMLPUBFUN htmlDocPtr
htmlSAXParseFile(const char *filename,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlParseFile (const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
UTF8ToHtml (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlIsScriptAttribute(const xmlChar *name);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlHandleOmittedElem(int val);
#ifdef LIBXML_PUSH_ENABLED
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN htmlParserCtxtPtr XMLCALL
XMLPUBFUN htmlParserCtxtPtr
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlParseChunk (htmlParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
/*
@ -188,63 +202,63 @@ typedef enum {
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
} htmlParserOption;
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlCtxtReset (htmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
@ -266,10 +280,10 @@ typedef enum {
/* Using htmlElemDesc rather than name here, to emphasise the fact
that otherwise there's a lookup overhead
*/
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XMLPUBFUN htmlStatus htmlNodeStatus(const htmlNodePtr, int) ;
/**
* htmlDefaultSubelement:
* @elt: HTML element

View file

@ -59,73 +59,73 @@ extern "C" {
*/
#define HTML_PI_NODE XML_PI_NODE
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlNewDoc (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN htmlDocPtr XMLCALL
XMLPUBFUN htmlDocPtr
htmlNewDocNoDtD (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
htmlGetMetaEncoding (htmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar *encoding);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlNodeDumpFile (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlNodeDumpFileFormat (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlSaveFileFormat (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
@ -133,7 +133,7 @@ XMLPUBFUN void XMLCALL
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
htmlIsBooleanAttr (const xmlChar *name);

View file

@ -23,61 +23,61 @@
extern "C" {
#endif
XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
getPublicId (void *ctx);
XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
getSystemId (void *ctx);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
setDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
getLineNumber (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
getColumnNumber (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
isStandalone (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
hasInternalSubset (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
hasExternalSubset (void *ctx);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
internalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
externalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XML_DEPRECATED
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
getEntity (void *ctx,
const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
getParameterEntity (void *ctx,
const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
resolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
entityDecl (void *ctx,
const xmlChar *name,
int type,
@ -85,7 +85,7 @@ XMLPUBFUN void XMLCALL
const xmlChar *systemId,
xmlChar *content);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
attributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
@ -94,19 +94,19 @@ XMLPUBFUN void XMLCALL
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
elementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
notationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
unparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
@ -114,83 +114,83 @@ XMLPUBFUN void XMLCALL
const xmlChar *notationName);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
startDocument (void *ctx);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
endDocument (void *ctx);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
attribute (void *ctx,
const xmlChar *fullname,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
startElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
endElement (void *ctx,
const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
reference (void *ctx,
const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
characters (void *ctx,
const xmlChar *ch,
int len);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
ignorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
processingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
globalNamespace (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
setNamespace (void *ctx,
const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
getNamespace (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
checkNamespace (void *ctx,
xmlChar *nameSpace);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
namespaceDecl (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
comment (void *ctx,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
cdataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#endif /* LIBXML_SAX1_ENABLED */

View file

@ -20,55 +20,55 @@
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlSAX2GetPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlSAX2GetSystemId (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2SetDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAX2GetLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAX2GetColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAX2IsStandalone (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAX2HasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAX2HasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2InternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2ExternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlSAX2GetEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlSAX2GetParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlSAX2ResolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2EntityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2AttributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
@ -76,38 +76,38 @@ XMLPUBFUN void XMLCALL
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2ElementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2NotationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2UnparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
@ -117,54 +117,55 @@ XMLPUBFUN void XMLCALL
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2EndElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2Reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2Characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2IgnorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2ProcessingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2Comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2CDataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSAXVersion (xmlSAXHandler *hdlr,
int version);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
htmlDefaultSAXHandlerInit (void);
#endif
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}

View file

@ -66,113 +66,113 @@ typedef xmlCatalog *xmlCatalogPtr;
/*
* Operations on a given catalog.
*/
XMLPUBFUN xmlCatalogPtr XMLCALL
XMLPUBFUN xmlCatalogPtr
xmlNewCatalog (int sgml);
XMLPUBFUN xmlCatalogPtr XMLCALL
XMLPUBFUN xmlCatalogPtr
xmlLoadACatalog (const char *filename);
XMLPUBFUN xmlCatalogPtr XMLCALL
XMLPUBFUN xmlCatalogPtr
xmlLoadSGMLSuperCatalog (const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlACatalogResolveSystem(xmlCatalogPtr catal,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlACatalogResolvePublic(xmlCatalogPtr catal,
const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlACatalogDump (xmlCatalogPtr catal,
FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCatalogIsEmpty (xmlCatalogPtr catal);
/*
* Global operations.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitializeCatalog (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlLoadCatalog (const char *filename);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCatalogDump (FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCatalogRemove (const xmlChar *value);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlParseCatalogFile (const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCatalogConvert (void);
/*
* Strictly minimal interfaces for per-document catalogs used
* by the parser.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI);
/*
* Preference settings.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCatalogSetDebug (int level);
XMLPUBFUN xmlCatalogPrefer XMLCALL
XMLPUBFUN xmlCatalogPrefer
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow XMLCALL
XMLPUBFUN xmlCatalogAllow
xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlCatalogGetSystem (const xmlChar *sysID);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus

View file

@ -51,7 +51,7 @@ struct _xmlChRangeGroup {
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
@ -207,21 +207,21 @@ XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsBaseChar(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsBlank(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsChar(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsCombining(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsDigit(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsExtender(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsIdeographic(unsigned int ch);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus

View file

@ -25,39 +25,39 @@ extern "C" {
/*
* The standard Dump routines.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpString (FILE *output,
const xmlChar *str);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpAttr (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpAttrList (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpOneNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpNodeList (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpDocumentHead(FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpDocument (FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpDTD (FILE *output,
xmlDtdPtr dtd);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDebugDumpEntities (FILE *output,
xmlDocPtr doc);
@ -67,7 +67,7 @@ XMLPUBFUN void XMLCALL
* *
****************************************************************/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc);
@ -77,12 +77,12 @@ XMLPUBFUN int XMLCALL
* *
****************************************************************/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlLsOneNode (FILE *output, xmlNodePtr node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlLsCountNode (xmlNodePtr node);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlBoolToText (int boolval);
/****************************************************************
@ -136,63 +136,63 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlShellPrintXPathError (int errorType,
const char *arg);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellList (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellBase (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellDir (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellLoad (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlShellPrintNode (xmlNodePtr node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellCat (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellWrite (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellSave (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellValidate (xmlShellCtxtPtr ctxt,
char *dtd,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_VALID_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellDu (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr tree,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlShellPwd (xmlShellCtxtPtr ctxt,
char *buffer,
xmlNodePtr node,
@ -201,7 +201,7 @@ XMLPUBFUN int XMLCALL
/*
* The Shell interface.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlShell (xmlDocPtr doc,
char *filename,
xmlShellReadlineFunc input,

View file

@ -28,51 +28,51 @@ typedef xmlDict *xmlDictPtr;
* Initializer
*/
XML_DEPRECATED
XMLPUBFUN int XMLCALL xmlInitializeDict(void);
XMLPUBFUN int xmlInitializeDict(void);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlDictPtr XMLCALL
XMLPUBFUN xmlDictPtr
xmlDictCreate (void);
XMLPUBFUN size_t XMLCALL
XMLPUBFUN size_t
xmlDictSetLimit (xmlDictPtr dict,
size_t limit);
XMLPUBFUN size_t XMLCALL
XMLPUBFUN size_t
xmlDictGetUsage (xmlDictPtr dict);
XMLPUBFUN xmlDictPtr XMLCALL
XMLPUBFUN xmlDictPtr
xmlDictCreateSub(xmlDictPtr sub);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDictReference(xmlDictPtr dict);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDictFree (xmlDictPtr dict);
/*
* Lookup of entry in the dictionary.
*/
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlDictLookup (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlDictExists (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlDictQLookup (xmlDictPtr dict,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDictOwns (xmlDictPtr dict,
const xmlChar *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDictSize (xmlDictPtr dict);
/*
* Cleanup function
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDictCleanup (void);
#ifdef __cplusplus

View file

@ -154,18 +154,18 @@ extern "C" {
* Interfaces for encoding handlers.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitCharEncodingHandlers (void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
XMLPUBFUN xmlCharEncodingHandlerPtr
xmlGetCharEncodingHandler (xmlCharEncoding enc);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
XMLPUBFUN xmlCharEncodingHandlerPtr
xmlFindCharEncodingHandler (const char *name);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
XMLPUBFUN xmlCharEncodingHandlerPtr
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
@ -173,54 +173,55 @@ XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
/*
* Interfaces for encoding names and aliases.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlAddEncodingAlias (const char *name,
const char *alias);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDelEncodingAlias (const char *alias);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlGetEncodingAlias (const char *alias);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupEncodingAliases (void);
XMLPUBFUN xmlCharEncoding XMLCALL
XMLPUBFUN xmlCharEncoding
xmlParseCharEncoding (const char *name);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlGetCharEncodingName (xmlCharEncoding enc);
/*
* Interfaces directly used by the parsers.
*/
XMLPUBFUN xmlCharEncoding XMLCALL
XMLPUBFUN xmlCharEncoding
xmlDetectCharEncoding (const unsigned char *in,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
/*
* Export a few useful functions
*/
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
UTF8Toisolat1 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
isolat1ToUTF8 (unsigned char *out,
int *outlen,
const unsigned char *in,

View file

@ -56,10 +56,8 @@ struct _xmlEntity {
struct _xmlEntity *nexte; /* unused */
const xmlChar *URI; /* the full URI as computed */
int owner; /* does the entity own the childrens */
int checked; /* was the entity content checked */
/* this is also used to count entities
* references done from that entity
* and if it contains '<' */
int flags; /* various flags */
unsigned long expandedSize; /* expanded size */
};
/*
@ -76,72 +74,72 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr;
#ifdef LIBXML_LEGACY_ENABLED
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitializePredefinedEntities (void);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlNewEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlAddDtdEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlGetDocEntity (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlGetDtdEntity (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr
xmlGetParameterEntity (xmlDocPtr doc,
const xmlChar *name);
#ifdef LIBXML_LEGACY_ENABLED
XML_DEPRECATED
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlEncodeEntities (xmlDocPtr doc,
const xmlChar *input);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlEncodeSpecialChars (const xmlDoc *doc,
const xmlChar *input);
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
XMLPUBFUN xmlEntitiesTablePtr
xmlCreateEntitiesTable (void);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
XMLPUBFUN xmlEntitiesTablePtr
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpEntitiesTable (xmlBufferPtr buf,
xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpEntityDecl (xmlBufferPtr buf,
xmlEntityPtr ent);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupPredefinedEntities(void);
#endif /* LIBXML_LEGACY_ENABLED */

View file

@ -25,9 +25,9 @@ extern "C" {
#endif
XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlInitGlobals(void);
XMLPUBFUN void xmlInitGlobals(void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
XMLPUBFUN void xmlCleanupGlobals(void);
/**
* xmlParserInputBufferCreateFilenameFunc:
@ -60,9 +60,9 @@ typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI
int compression);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
/*
* Externally global symbols which need to be protected for backwards
@ -175,24 +175,23 @@ struct _xmlGlobalState
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XMLPUBFUN void xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
XMLPUBFUN void xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XMLPUBFUN void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
@ -204,8 +203,10 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
/** DOC_DISABLE */
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
XMLPUBFUN xmlMallocFunc * __xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
@ -213,7 +214,7 @@ XMLPUBVAR xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
XMLPUBFUN xmlMallocFunc * __xmlMallocAtomic(void);
#define xmlMallocAtomic \
(*(__xmlMallocAtomic()))
#else
@ -221,7 +222,7 @@ XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void);
XMLPUBFUN xmlReallocFunc * __xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
@ -229,7 +230,7 @@ XMLPUBVAR xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void);
XMLPUBFUN xmlFreeFunc * __xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
@ -237,13 +238,14 @@ XMLPUBVAR xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
XMLPUBFUN xmlStrdupFunc * __xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
/** DOC_ENABLE */
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
@ -253,16 +255,18 @@ XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
XMLPUBFUN xmlError * __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
@ -277,59 +281,71 @@ XMLPUBVAR xmlError xmlLastError;
*/
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
XML_DEPRECATED
XMLPUBFUN int * __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
XML_DEPRECATED
XMLPUBVAR int oldXMLWDcompatibility;
#endif
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme * __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
XML_DEPRECATED
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlBufferAllocationScheme
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
XML_DEPRECATED
XMLPUBFUN int * __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlDefaultBufferSize;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefDefaultBufferSize(int v);
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
XML_DEPRECATED
XMLPUBFUN xmlSAXHandlerV1 * __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
XML_DEPRECATED
XMLPUBFUN xmlSAXLocator * __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
XML_DEPRECATED
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
XMLPUBFUN int * __xmlDoValidityCheckingDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN int xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
XMLPUBFUN xmlGenericErrorFunc * __xmlGenericError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericError \
(*(__xmlGenericError()))
@ -337,7 +353,7 @@ XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
#endif
XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
XMLPUBFUN xmlStructuredErrorFunc * __xmlStructuredError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredError \
(*(__xmlStructuredError()))
@ -345,7 +361,7 @@ XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
#endif
XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
XMLPUBFUN void * * __xmlGenericErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
@ -353,7 +369,7 @@ XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
XMLPUBFUN void * * __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
@ -361,70 +377,73 @@ XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
XMLPUBFUN int * __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
XMLPUBVAR int xmlGetWarningsDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
XMLPUBFUN int * __xmlIndentTreeOutput(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
XMLPUBVAR int xmlIndentTreeOutput;
#endif
XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN int xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
XMLPUBFUN const char * * __xmlTreeIndentString(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlTreeIndentString \
(*(__xmlTreeIndentString()))
#else
XMLPUBVAR const char * xmlTreeIndentString;
#endif
XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN const char * xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
XMLPUBFUN int * __xmlKeepBlanksDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int * __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
XMLPUBFUN int * __xmlLoadExtDtdDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
XMLPUBVAR int xmlLoadExtDtdDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
XMLPUBFUN int * __xmlParserDebugEntities(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
XMLPUBVAR int xmlParserDebugEntities;
#endif
XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
XMLPUBFUN int xmlThrDefParserDebugEntities(int v);
XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
XMLPUBFUN const char * * __xmlParserVersion(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserVersion \
(*(__xmlParserVersion()))
@ -432,63 +451,74 @@ XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
XMLPUBVAR const char * xmlParserVersion;
#endif
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN int * __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
XML_DEPRECATED
XMLPUBFUN int xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
XMLPUBFUN int * __xmlSaveNoEmptyTags(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
XMLPUBVAR int xmlSaveNoEmptyTags;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
XMLPUBFUN int * __xmlSubstituteEntitiesDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN int xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN xmlRegisterNodeFunc * __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
XML_DEPRECATED
XMLPUBFUN xmlDeregisterNodeFunc * __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * \
__xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
XML_DEPRECATED
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
XML_DEPRECATED
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif

View file

@ -103,48 +103,48 @@ typedef void (*xmlHashScannerFull)(void *payload, void *data,
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN xmlHashTablePtr
xmlHashCreate (int size);
XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN xmlHashTablePtr
xmlHashCreateDict(int size,
xmlDictPtr dict);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashDefaultDeallocator(void *entry,
const xmlChar *name);
/*
* Add a new entry to the hash table.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar *name,
void *userdata);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashUpdateEntry(xmlHashTablePtr table,
const xmlChar *name,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashAddEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashUpdateEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashAddEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashUpdateEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
@ -155,13 +155,13 @@ XMLPUBFUN int XMLCALL
/*
* Remove an entry from the hash table.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashDeallocator f);
@ -169,29 +169,29 @@ XMLPUBFUN int XMLCALL
/*
* Retrieve the userdata.
*/
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashLookup (xmlHashTablePtr table,
const xmlChar *name);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashQLookup (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
@ -203,27 +203,27 @@ XMLPUBFUN void * XMLCALL
/*
* Helpers.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
XMLPUBFUN xmlHashTablePtr
xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHashSize (xmlHashTablePtr table);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashScan3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHashScanFull3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,

View file

@ -52,79 +52,79 @@ typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
typedef int (*xmlListWalker) (const void *data, void *user);
/* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL
XMLPUBFUN xmlListPtr
xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListDelete (xmlListPtr l);
/* Basic Operators */
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlListSearch (xmlListPtr l,
void *data);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlListReverseSearch (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListInsert (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListAppend (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListRemoveFirst (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListRemoveLast (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListRemoveAll (xmlListPtr l,
void *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListClear (xmlListPtr l);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListEmpty (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
XMLPUBFUN xmlLinkPtr
xmlListFront (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
XMLPUBFUN xmlLinkPtr
xmlListEnd (xmlListPtr l);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListSize (xmlListPtr l);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListPopFront (xmlListPtr l);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListPopBack (xmlListPtr l);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListPushFront (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListPushBack (xmlListPtr l,
void *data);
/* Advanced Operators */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListReverse (xmlListPtr l);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListSort (xmlListPtr l);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListWalk (xmlListPtr l,
xmlListWalker walker,
void *user);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
void *user);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlListMerge (xmlListPtr l1,
xmlListPtr l2);
XMLPUBFUN xmlListPtr XMLCALL
XMLPUBFUN xmlListPtr
xmlListDup (const xmlListPtr old);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlListCopy (xmlListPtr cur,
const xmlListPtr old);
/* Link operators */
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */

View file

@ -80,52 +80,52 @@ typedef void (*ftpDataCallback) (void *userData,
* Init
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoFTPInit (void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
XML_DEPRECATED
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoFTPNewCtxt (const char *URL);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoFTPFreeCtxt (void * ctx);
XML_DEPRECATED
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
XML_DEPRECATED
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoFTPOpen (const char *URL);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPConnect (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPClose (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPQuit (void *ctx);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoFTPScanProxy (const char *URL);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
@ -133,48 +133,48 @@ XMLPUBFUN int XMLCALL
* Rather internal commands.
*/
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPGetResponse (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPCwd (void *ctx,
const char *directory);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPDele (void *ctx,
const char *file);
XML_DEPRECATED
XMLPUBFUN SOCKET XMLCALL
XMLPUBFUN SOCKET
xmlNanoFTPGetConnection (void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPCloseConnection(void *ctx);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
XML_DEPRECATED
XMLPUBFUN SOCKET XMLCALL
XMLPUBFUN SOCKET
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoFTPRead (void *ctx,
void *dest,
int len);

View file

@ -18,24 +18,24 @@
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoHTTPInit (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoHTTPCleanup (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoHTTPScanProxy (const char *URL);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoHTTPFetch (const char *URL,
const char *filename,
char **contentType);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoHTTPMethod (const char *URL,
const char *method,
const char *input,
char **contentType,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoHTTPMethodRedir (const char *URL,
const char *method,
const char *input,
@ -43,35 +43,35 @@ XMLPUBFUN void * XMLCALL
char **redir,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoHTTPOpen (const char *URL,
char **contentType);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlNanoHTTPOpenRedir (const char *URL,
char **contentType,
char **redir);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoHTTPReturnCode (void *ctx);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL
XMLPUBFUN const char *
xmlNanoHTTPMimeType (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNanoHTTPSave (void *ctxt,
const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
}

View file

@ -61,17 +61,14 @@ struct _xmlParserInput {
int length; /* length if known */
int line; /* Current line */
int col; /* Current column */
/*
* NOTE: consumed is only tested for equality in the parser code,
* so even if there is an overflow this should not give troubles
* for parsing very large instances.
*/
unsigned long consumed; /* How many xmlChars already consumed */
xmlParserInputDeallocate free; /* function to deallocate the base */
const xmlChar *encoding; /* the encoding string for entity */
const xmlChar *version; /* the version string for entity */
int standalone; /* Was that entity marked standalone */
int id; /* an unique identifier for the entity */
unsigned long parentConsumed; /* consumed bytes from parents */
xmlEntityPtr entity; /* entity, if any */
};
/**
@ -300,7 +297,7 @@ struct _xmlParserCtxt {
*/
xmlError lastError;
xmlParserMode parseMode; /* the parser mode */
unsigned long nbentities; /* number of entities references */
unsigned long nbentities; /* unused */
unsigned long sizeentities; /* size of parsed entities */
/* for use by HTML non-recursive parser */
@ -311,6 +308,10 @@ struct _xmlParserCtxt {
int input_id; /* we need to label inputs */
unsigned long sizeentcopy; /* volume of entity copy */
int endCheckState; /* quote state for push parser */
unsigned short nbErrors; /* number of errors */
unsigned short nbWarnings; /* number of warnings */
};
/**
@ -819,18 +820,20 @@ extern "C" {
/*
* Init/Cleanup
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitParser (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupParser (void);
/*
* Input functions
*/
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParserInputRead (xmlParserInputPtr in,
int len);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParserInputGrow (xmlParserInputPtr in,
int len);
@ -838,101 +841,114 @@ XMLPUBFUN int XMLCALL
* Basic parsing Interfaces
*/
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlParseDoc (const xmlChar *cur);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlParseFile (const char *filename);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlParseMemory (const char *buffer,
int size);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSubstituteEntitiesDefault(int val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlKeepBlanksDefault (int val);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlStopParser (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPedanticParserDefault(int val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlLineNumbersDefault (int val);
#ifdef LIBXML_SAX1_ENABLED
/*
* Recovery mode
*/
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlRecoverDoc (const xmlChar *cur);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlRecoverMemory (const char *buffer,
int size);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlRecoverFile (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
/*
* Less common routines and SAX interfaces
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseDocument (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
void *user_data,
const char *filename);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
void *user_data,
const char *buffer,
int size);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseDoc (xmlSAXHandlerPtr sax,
const xmlChar *cur,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseMemory (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
const char *buffer,
int size,
int recovery,
void *data);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseFile (xmlSAXHandlerPtr sax,
const char *filename,
int recovery);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
const char *filename,
int recovery,
void *data);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlSAXParseEntity (xmlSAXHandlerPtr sax,
const char *filename);
XMLPUBFUN xmlDocPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDocPtr
xmlParseEntity (const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN xmlDtdPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlDtdPtr
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlParseDTD (const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlIOParseDTD (xmlSAXHandlerPtr sax,
xmlParserInputBufferPtr input,
xmlCharEncoding enc);
#endif /* LIBXML_VALID_ENABLE */
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseBalancedChunkMemory(xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
@ -940,14 +956,14 @@ XMLPUBFUN int XMLCALL
const xmlChar *string,
xmlNodePtr *lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserErrors XMLCALL
XMLPUBFUN xmlParserErrors
xmlParseInNodeContext (xmlNodePtr node,
const char *data,
int datalen,
int options,
xmlNodePtr *lst);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
@ -955,7 +971,8 @@ XMLPUBFUN int XMLCALL
const xmlChar *string,
xmlNodePtr *lst,
int recover);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseExternalEntity (xmlDocPtr doc,
xmlSAXHandlerPtr sax,
void *user_data,
@ -964,7 +981,7 @@ XMLPUBFUN int XMLCALL
const xmlChar *ID,
xmlNodePtr *lst);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
const xmlChar *URL,
const xmlChar *ID,
@ -973,21 +990,25 @@ XMLPUBFUN int XMLCALL
/*
* Parser contexts handling.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlNewParserCtxt (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlNewSAXParserCtxt (const xmlSAXHandler *sax,
void *userData);
XMLPUBFUN int
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
const xmlChar* buffer,
const char *filename);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateDocParserCtxt (const xmlChar *cur);
#ifdef LIBXML_LEGACY_ENABLED
@ -995,16 +1016,16 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
* Reading/setting optional parsing features.
*/
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGetFeaturesList (int *len,
const char **result);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGetFeature (xmlParserCtxtPtr ctxt,
const char *name,
void *result);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSetFeature (xmlParserCtxtPtr ctxt,
const char *name,
void *value);
@ -1014,13 +1035,13 @@ XMLPUBFUN int XMLCALL
/*
* Interfaces for the Push mode.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseChunk (xmlParserCtxtPtr ctxt,
const char *chunk,
int size,
@ -1031,7 +1052,7 @@ XMLPUBFUN int XMLCALL
* Special I/O mode.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
void *user_data,
xmlInputReadCallback ioread,
@ -1039,7 +1060,7 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc);
@ -1047,17 +1068,17 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
/*
* Node infos.
*/
XMLPUBFUN const xmlParserNodeInfo* XMLCALL
XMLPUBFUN const xmlParserNodeInfo*
xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt,
const xmlNodePtr node);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
XMLPUBFUN unsigned long XMLCALL
XMLPUBFUN unsigned long
xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq,
const xmlNodePtr node);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
const xmlParserNodeInfoPtr info);
@ -1065,11 +1086,11 @@ XMLPUBFUN void XMLCALL
* External entities handling actually implemented in xmlIO.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
XMLPUBFUN xmlExternalEntityLoader XMLCALL
XMLPUBFUN xmlExternalEntityLoader
xmlGetExternalEntityLoader(void);
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlLoadExternalEntity (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
@ -1077,7 +1098,7 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
/*
* Index lookup, actually implemented in the encoding module
*/
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlByteConsumed (xmlParserCtxtPtr ctxt);
/*
@ -1117,69 +1138,69 @@ typedef enum {
XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */
} xmlParserOption;
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCtxtReset (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
const char *chunk,
int size,
const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
@ -1235,7 +1256,7 @@ typedef enum {
XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature;
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlHasFeature (xmlFeature feature);
#ifdef __cplusplus

View file

@ -40,6 +40,13 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/
#define XML_MAX_TEXT_LENGTH 10000000
/**
* XML_MAX_HUGE_LENGTH:
*
* Maximum size allowed when XML_PARSE_HUGE is set.
*/
#define XML_MAX_HUGE_LENGTH 1000000000
/**
* XML_MAX_NAME_LENGTH:
*
@ -278,34 +285,6 @@ XMLPUBVAR unsigned int xmlParserMaxDepth;
*/
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/**
* SKIP_EOL:
* @p: and UTF8 string pointer
*
* Skips the end of line chars.
*/
#define SKIP_EOL(p) \
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
/**
* MOVETO_ENDTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '>' char.
*/
#define MOVETO_ENDTAG(p) \
while ((*p) && (*(p) != '>')) (p)++
/**
* MOVETO_STARTTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '<' char.
*/
#define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++
/**
* Global variables used for predefined strings.
*/
@ -316,71 +295,62 @@ XMLPUBVAR const xmlChar xmlStringComment[];
/*
* Function to finish the work of the macros where needed.
*/
XMLPUBFUN int XMLCALL xmlIsLetter (int c);
XMLPUBFUN int xmlIsLetter (int c);
/**
* Parser context.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateURLParserCtxt (const char *filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);
#ifdef IN_LIBXML
/* internal error reporting */
XMLPUBFUN void XMLCALL
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
xmlParserErrors xmlerr,
const char *msg,
const xmlChar * str1,
const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
#endif
/**
* Input Streams.
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar *buffer);
XMLPUBFUN xmlParserInputPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlParserInputPtr
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input);
XMLPUBFUN xmlChar XMLCALL
XMLPUBFUN xmlChar
xmlPopInput (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeInputStream (xmlParserInputPtr input);
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
*/
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlChar **prefix);
@ -388,109 +358,151 @@ XMLPUBFUN xmlChar * XMLCALL
/**
* Generic production rules.
*/
XMLPUBFUN const xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseAttValue (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID,
int strict);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseComment (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParsePITarget (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParsePI (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN xmlEnumerationPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlEnumerationPtr
xmlParseNotationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEnumerationPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlEnumerationPtr
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlElementContentPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlElementContentPtr
xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN xmlElementContentPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlElementContentPtr
xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlElementContentPtr *result);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseCharRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEntityPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlEntityPtr
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParsePEReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN const xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseStartTag (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParseContent (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseElement (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseEncName (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar *ExternalID,
const xmlChar *SystemID);
@ -519,14 +531,16 @@ XMLPUBFUN void XMLCALL
*/
#define XML_SUBSTITUTE_BOTH 3
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN xmlChar * XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int len,
@ -538,48 +552,49 @@ XMLPUBFUN xmlChar * XMLCALL
/*
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
*/
XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
XML_DEPRECATED
XMLPUBFUN int nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value);
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
XML_DEPRECATED
XMLPUBFUN xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
XMLPUBFUN xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN const xmlChar * namePop (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN int namePush (xmlParserCtxtPtr ctxt,
const xmlChar *value);
/*
* other commodities shared between parser.c and parserInternals.
*/
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
XML_DEPRECATED
XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
int *len);
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
XML_DEPRECATED
XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang);
/*
* Really core function shared with HTML parser.
*/
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
XML_DEPRECATED
XMLPUBFUN int xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out,
int val);
XMLPUBFUN int XMLCALL xmlCopyChar (int len,
XMLPUBFUN int xmlCopyChar (int len,
xmlChar *out,
int val);
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
#endif
XMLPUBFUN void xmlNextChar (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN void xmlParserInputShrink (xmlParserInputPtr in);
/*
* Specific function to keep track of entities references
@ -600,34 +615,34 @@ typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr lastNode);
XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
XMLPUBFUN void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlParseQuotedString (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParseNamespace (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlScanName (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar **prefix);
/**
* Entities
*/
XML_DEPRECATED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
@ -635,21 +650,12 @@ XMLPUBFUN xmlChar * XMLCALL
xmlChar end2,
xmlChar end3);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef IN_LIBXML
/*
* internal only
*/
XMLPUBFUN void XMLCALL
xmlErrMemory (xmlParserCtxtPtr ctxt,
const char *extra);
#endif
#ifdef __cplusplus
}
#endif

View file

@ -43,18 +43,18 @@ typedef enum {
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
} xmlPatternFlags;
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreePattern (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreePatternList (xmlPatternPtr comp);
XMLPUBFUN xmlPatternPtr XMLCALL
XMLPUBFUN xmlPatternPtr
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node);
@ -62,34 +62,34 @@ XMLPUBFUN int XMLCALL
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPatternStreamable (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPatternMaxDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPatternMinDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPatternFromRoot (xmlPatternPtr comp);
XMLPUBFUN xmlStreamCtxtPtr XMLCALL
XMLPUBFUN xmlStreamCtxtPtr
xmlPatternGetStreamCtxt (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns,
int nodeType);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStreamPop (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
#ifdef __cplusplus
}

View file

@ -116,95 +116,95 @@ typedef enum {
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGInitTypes (void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
XMLPUBFUN xmlRelaxNGParserCtxtPtr
xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
XMLPUBFUN xmlRelaxNGParserCtxtPtr
xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
XMLPUBFUN xmlRelaxNGParserCtxtPtr
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
int flag);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN xmlRelaxNGPtr XMLCALL
XMLPUBFUN xmlRelaxNGPtr
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGFree (xmlRelaxNGPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, void *ctx);
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
XMLPUBFUN xmlRelaxNGValidCtxtPtr
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc);
/*
* Interfaces for progressive validation when possible
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);

View file

@ -947,8 +947,8 @@ struct _xmlSchema {
void *volatiles; /* Obsolete */
};
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
XMLPUBFUN void xmlSchemaFreeType (xmlSchemaTypePtr type);
XMLPUBFUN void xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
#ifdef __cplusplus
}

View file

@ -36,52 +36,55 @@ typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlMutexPtr XMLCALL
XMLPUBFUN xmlMutexPtr
xmlNewMutex (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMutexLock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMutexUnlock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeMutex (xmlMutexPtr tok);
XMLPUBFUN xmlRMutexPtr XMLCALL
XMLPUBFUN xmlRMutexPtr
xmlNewRMutex (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRMutexLock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRMutexUnlock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeRMutex (xmlRMutexPtr tok);
/*
* Library wide APIs.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlLockLibrary (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlUnlockLibrary(void);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlGetThreadId (void);
XMLPUBFUN int XMLCALL
XML_DEPRECATED
XMLPUBFUN int
xmlIsMainThread (void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlGlobalStatePtr
xmlGetGlobalState(void);
#ifdef HAVE_PTHREAD_H
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL
/** DOC_DISABLE */
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
!defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
int
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#endif
#endif
/** DOC_ENABLE */
#ifdef __cplusplus
}

View file

@ -74,7 +74,7 @@ typedef xmlEntity *xmlEntityPtr;
typedef enum {
XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer, deprecated */
XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
@ -117,10 +117,10 @@ typedef xmlBuf *xmlBufPtr;
* A few public routines for xmlBuf. As those are expected to be used
* mostly internally the bulk of the routines are internal in buf.h
*/
XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf);
XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len);
XMLPUBFUN xmlChar* xmlBufContent (const xmlBuf* buf);
XMLPUBFUN xmlChar* xmlBufEnd (xmlBufPtr buf);
XMLPUBFUN size_t xmlBufUse (const xmlBufPtr buf);
XMLPUBFUN size_t xmlBufShrink (xmlBufPtr buf, size_t len);
/*
* LIBXML2_NEW_BUFFER:
@ -180,8 +180,10 @@ typedef enum {
/* XML_DOCB_DOCUMENT_NODE= 21 */ /* removed */
} xmlElementType;
/** DOC_DISABLE */
/* For backward compatibility */
#define XML_DOCB_DOCUMENT_NODE 21
/** DOC_ENABLE */
/**
* xmlNotation:
@ -660,32 +662,32 @@ struct _xmlDOMWrapCtxt {
defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \
defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \
defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNCName (const xmlChar *value,
int space);
#endif
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateQName (const xmlChar *value,
int space);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateName (const xmlChar *value,
int space);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNMToken (const xmlChar *value,
int space);
#endif
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlBuildQName (const xmlChar *ncname,
const xmlChar *prefix,
xmlChar *memory,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlSplitQName2 (const xmlChar *name,
xmlChar **prefix);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlSplitQName3 (const xmlChar *name,
int *len);
@ -693,318 +695,318 @@ XMLPUBFUN const xmlChar * XMLCALL
* Handling Buffers, the old ones see @xmlBuf for the new ones.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
XMLPUBFUN xmlBufferAllocationScheme
xmlGetBufferAllocationScheme(void);
XMLPUBFUN xmlBufferPtr XMLCALL
XMLPUBFUN xmlBufferPtr
xmlBufferCreate (void);
XMLPUBFUN xmlBufferPtr XMLCALL
XMLPUBFUN xmlBufferPtr
xmlBufferCreateSize (size_t size);
XMLPUBFUN xmlBufferPtr XMLCALL
XMLPUBFUN xmlBufferPtr
xmlBufferCreateStatic (void *mem,
size_t size);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferResize (xmlBufferPtr buf,
unsigned int size);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferFree (xmlBufferPtr buf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferDump (FILE *file,
xmlBufferPtr buf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferAdd (xmlBufferPtr buf,
const xmlChar *str,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferAddHead (xmlBufferPtr buf,
const xmlChar *str,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferCat (xmlBufferPtr buf,
const xmlChar *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferCCat (xmlBufferPtr buf,
const char *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferShrink (xmlBufferPtr buf,
unsigned int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferGrow (xmlBufferPtr buf,
unsigned int len);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferEmpty (xmlBufferPtr buf);
XMLPUBFUN const xmlChar* XMLCALL
XMLPUBFUN const xmlChar*
xmlBufferContent (const xmlBuffer *buf);
XMLPUBFUN xmlChar* XMLCALL
XMLPUBFUN xmlChar*
xmlBufferDetach (xmlBufferPtr buf);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferSetAllocationScheme(xmlBufferPtr buf,
xmlBufferAllocationScheme scheme);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufferLength (const xmlBuffer *buf);
/*
* Creating/freeing new structures.
*/
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlCreateIntSubset (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlNewDtd (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlGetIntSubset (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeDtd (xmlDtdPtr cur);
#ifdef LIBXML_LEGACY_ENABLED
XML_DEPRECATED
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlNewGlobalNs (xmlDocPtr doc,
const xmlChar *href,
const xmlChar *prefix);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlNewNs (xmlNodePtr node,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeNs (xmlNsPtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeNsList (xmlNsPtr cur);
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlNewDoc (const xmlChar *version);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeDoc (xmlDocPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlNewDocProp (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *value);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlNewProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *value);
#endif
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlNewNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlNewNsPropEatName (xmlNodePtr node,
xmlNsPtr ns,
xmlChar *name,
const xmlChar *value);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreePropList (xmlAttrPtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeProp (xmlAttrPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlCopyProp (xmlNodePtr target,
xmlAttrPtr cur);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlCopyPropList (xmlNodePtr target,
xmlAttrPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlDtdPtr XMLCALL
XMLPUBFUN xmlDtdPtr
xmlCopyDtd (xmlDtdPtr dtd);
#endif /* LIBXML_TREE_ENABLED */
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlCopyDoc (xmlDocPtr doc,
int recursive);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
/*
* Creating new nodes.
*/
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocNodeEatName (xmlDocPtr doc,
xmlNsPtr ns,
xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewNode (xmlNsPtr ns,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewNodeEatName (xmlNsPtr ns,
xmlChar *name);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
#endif
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocText (const xmlDoc *doc,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewText (const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocPI (xmlDocPtr doc,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewPI (const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocTextLen (xmlDocPtr doc,
const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewTextLen (const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocComment (xmlDocPtr doc,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewComment (const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewCDataBlock (xmlDocPtr doc,
const xmlChar *content,
int len);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewCharRef (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewReference (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlCopyNode (xmlNodePtr node,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlDocCopyNode (xmlNodePtr node,
xmlDocPtr doc,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlDocCopyNodeList (xmlDocPtr doc,
xmlNodePtr node);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlCopyNodeList (xmlNodePtr node);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewTextChild (xmlNodePtr parent,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocRawNode (xmlDocPtr doc,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNewDocFragment (xmlDocPtr doc);
#endif /* LIBXML_TREE_ENABLED */
/*
* Navigating.
*/
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlGetLineNo (const xmlNode *node);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlGetNodePath (const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlDocGetRootElement (const xmlDoc *doc);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlGetLastChild (const xmlNode *parent);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNodeIsText (const xmlNode *node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsBlankNode (const xmlNode *node);
/*
* Changing the structure.
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlDocSetRootElement (xmlDocPtr doc,
xmlNodePtr root);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetName (xmlNodePtr cur,
const xmlChar *name);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlAddChild (xmlNodePtr parent,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlAddChildList (xmlNodePtr parent,
xmlNodePtr cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlReplaceNode (xmlNodePtr old,
xmlNodePtr cur);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlAddPrevSibling (xmlNodePtr cur,
xmlNodePtr elem);
#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlAddSibling (xmlNodePtr cur,
xmlNodePtr elem);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlAddNextSibling (xmlNodePtr cur,
xmlNodePtr elem);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlUnlinkNode (xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlTextMerge (xmlNodePtr first,
xmlNodePtr second);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextConcat (xmlNodePtr node,
const xmlChar *content,
int len);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeNodeList (xmlNodePtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeNode (xmlNodePtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetTreeDoc (xmlNodePtr tree,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetListDoc (xmlNodePtr list,
xmlDocPtr doc);
/*
* Namespaces.
*/
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlSearchNs (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar *nameSpace);
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlSearchNsByHref (xmlDocPtr doc,
xmlNodePtr node,
const xmlChar *href);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlNsPtr * XMLCALL
XMLPUBFUN xmlNsPtr *
xmlGetNsList (const xmlDoc *doc,
const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetNs (xmlNodePtr node,
xmlNsPtr ns);
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlCopyNamespace (xmlNsPtr cur);
XMLPUBFUN xmlNsPtr XMLCALL
XMLPUBFUN xmlNsPtr
xmlCopyNamespaceList (xmlNsPtr cur);
/*
@ -1012,94 +1014,94 @@ XMLPUBFUN xmlNsPtr XMLCALL
*/
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlSetProp (xmlNodePtr node,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlSetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name,
const xmlChar *value);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlGetNoNsProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlGetProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlHasProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlHasNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlGetNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlStringGetNodeList (const xmlDoc *doc,
const xmlChar *value);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlStringLenGetNodeList (const xmlDoc *doc,
const xmlChar *value,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNodeListGetString (xmlDocPtr doc,
const xmlNode *list,
int inLine);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNodeListGetRawString (const xmlDoc *doc,
const xmlNode *list,
int inLine);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetContent (xmlNodePtr cur,
const xmlChar *content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetContentLen (xmlNodePtr cur,
const xmlChar *content,
int len);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeAddContent (xmlNodePtr cur,
const xmlChar *content);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeAddContentLen (xmlNodePtr cur,
const xmlChar *content,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNodeGetContent (const xmlNode *cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNodeBufGetContent (xmlBufferPtr buffer,
const xmlNode *cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlBufGetNodeContent (xmlBufPtr buf,
const xmlNode *cur);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNodeGetLang (const xmlNode *cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNodeGetSpacePreserve (const xmlNode *cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetLang (xmlNodePtr cur,
const xmlChar *lang);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetSpacePreserve (xmlNodePtr cur,
int val);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNodeGetBase (const xmlDoc *doc,
const xmlNode *cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeSetBase (xmlNodePtr cur,
const xmlChar *uri);
#endif
@ -1107,14 +1109,14 @@ XMLPUBFUN void XMLCALL
/*
* Removing content.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRemoveProp (xmlAttrPtr cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUnsetNsProp (xmlNodePtr node,
xmlNsPtr ns,
const xmlChar *name);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUnsetProp (xmlNodePtr node,
const xmlChar *name);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
@ -1122,13 +1124,13 @@ XMLPUBFUN int XMLCALL
/*
* Internal, don't use.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferWriteCHAR (xmlBufferPtr buf,
const xmlChar *string);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferWriteChar (xmlBufferPtr buf,
const char *string);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlBufferWriteQuotedString(xmlBufferPtr buf,
const xmlChar *string);
@ -1143,7 +1145,7 @@ XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
/*
* Namespace handling.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReconciliateNs (xmlDocPtr doc,
xmlNodePtr tree);
#endif
@ -1152,67 +1154,67 @@ XMLPUBFUN int XMLCALL
/*
* Saving.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDocDumpFormatMemory (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
xmlChar **doc_txt_ptr,
int * doc_txt_len,
const char *txt_encoding);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
xmlChar **doc_txt_ptr,
int * doc_txt_len,
const char *txt_encoding,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDocFormatDump (FILE *f,
xmlDocPtr cur,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlElemDump (FILE *f,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFormatFile (const char *filename,
xmlDocPtr cur,
int format);
XMLPUBFUN size_t XMLCALL
XMLPUBFUN size_t
xmlBufNodeDump (xmlBufPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
int level,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
@ -1220,13 +1222,13 @@ XMLPUBFUN void XMLCALL
int format,
const char *encoding);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFormatFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
@ -1235,47 +1237,47 @@ XMLPUBFUN int XMLCALL
/*
* XHTML
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsXHTML (const xmlChar *systemID,
const xmlChar *publicID);
/*
* Compression.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGetDocCompressMode (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetDocCompressMode (xmlDocPtr doc,
int mode);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGetCompressMode (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetCompressMode (int mode);
/*
* DOM-wrapper helper functions.
*/
XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
XMLPUBFUN xmlDOMWrapCtxtPtr
xmlDOMWrapNewCtxt (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
xmlNodePtr elem,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
xmlDocPtr destDoc,
xmlNodePtr destParent,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr node,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
xmlDocPtr sourceDoc,
xmlNodePtr node,
@ -1290,15 +1292,15 @@ XMLPUBFUN int XMLCALL
* 5 interfaces from DOM ElementTraversal, but different in entities
* traversal.
*/
XMLPUBFUN unsigned long XMLCALL
XMLPUBFUN unsigned long
xmlChildElementCount (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlNextElementSibling (xmlNodePtr node);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlFirstElementChild (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlLastElementChild (xmlNodePtr parent);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlPreviousElementSibling (xmlNodePtr node);
#endif
#ifdef __cplusplus

View file

@ -49,43 +49,43 @@ struct _xmlURI {
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
* xmlNodePtr cur);
*/
XMLPUBFUN xmlURIPtr XMLCALL
XMLPUBFUN xmlURIPtr
xmlCreateURI (void);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlBuildURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlURIPtr XMLCALL
XMLPUBFUN xmlURIPtr
xmlParseURI (const char *str);
XMLPUBFUN xmlURIPtr XMLCALL
XMLPUBFUN xmlURIPtr
xmlParseURIRaw (const char *str,
int raw);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParseURIReference (xmlURIPtr uri,
const char *str);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlSaveUri (xmlURIPtr uri);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlPrintURI (FILE *stream,
xmlURIPtr uri);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list);
XMLPUBFUN char * XMLCALL
XMLPUBFUN char *
xmlURIUnescapeString (const char *str,
int len,
char *target);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlURIEscape (const xmlChar *str);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeURI (xmlURIPtr uri);
XMLPUBFUN xmlChar* XMLCALL
XMLPUBFUN xmlChar*
xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar* XMLCALL
XMLPUBFUN xmlChar*
xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus

View file

@ -58,21 +58,6 @@ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#ifdef IN_LIBXML
/**
* XML_VCTXT_DTD_VALIDATED:
*
* Set after xmlValidateDtdFinal was called.
*/
#define XML_VCTXT_DTD_VALIDATED (1u << 0)
/**
* XML_VCTXT_USE_PCTXT:
*
* Set if the validation context is part of a parser context.
*/
#define XML_VCTXT_USE_PCTXT (1u << 1)
#endif
/*
* xmlValidCtxt:
* An xmlValidCtxt is used for error reporting when validating.
@ -150,55 +135,55 @@ typedef struct _xmlHashTable xmlRefTable;
typedef xmlRefTable *xmlRefTablePtr;
/* Notation */
XMLPUBFUN xmlNotationPtr XMLCALL
XMLPUBFUN xmlNotationPtr
xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *PublicID,
const xmlChar *SystemID);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNotationTablePtr XMLCALL
XMLPUBFUN xmlNotationTablePtr
xmlCopyNotationTable (xmlNotationTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeNotationTable (xmlNotationTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
/* the non Doc version are being deprecated */
XMLPUBFUN xmlElementContentPtr XMLCALL
XMLPUBFUN xmlElementContentPtr
xmlNewElementContent (const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
XMLPUBFUN xmlElementContentPtr
xmlCopyElementContent (xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeElementContent (xmlElementContentPtr cur);
/* the new versions with doc argument */
XMLPUBFUN xmlElementContentPtr XMLCALL
XMLPUBFUN xmlElementContentPtr
xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
XMLPUBFUN xmlElementContentPtr
xmlCopyDocElementContent(xmlDocPtr doc,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeDocElementContent(xmlDocPtr doc,
xmlElementContentPtr cur);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSnprintfElementContent(char *buf,
int size,
xmlElementContentPtr content,
int englob);
#ifdef LIBXML_OUTPUT_ENABLED
/* DEPRECATED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSprintfElementContent(char *buf,
xmlElementContentPtr content,
int englob);
@ -206,39 +191,39 @@ XMLPUBFUN void XMLCALL
/* DEPRECATED */
/* Element */
XMLPUBFUN xmlElementPtr XMLCALL
XMLPUBFUN xmlElementPtr
xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
xmlElementTypeVal type,
xmlElementContentPtr content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlElementTablePtr XMLCALL
XMLPUBFUN xmlElementTablePtr
xmlCopyElementTable (xmlElementTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeElementTable (xmlElementTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XMLPUBFUN xmlEnumerationPtr XMLCALL
XMLPUBFUN xmlEnumerationPtr
xmlCreateEnumeration (const xmlChar *name);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeEnumeration (xmlEnumerationPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEnumerationPtr XMLCALL
XMLPUBFUN xmlEnumerationPtr
xmlCopyEnumeration (xmlEnumerationPtr cur);
#endif /* LIBXML_TREE_ENABLED */
/* Attribute */
XMLPUBFUN xmlAttributePtr XMLCALL
XMLPUBFUN xmlAttributePtr
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *elem,
@ -249,60 +234,60 @@ XMLPUBFUN xmlAttributePtr XMLCALL
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlAttributeTablePtr XMLCALL
XMLPUBFUN xmlAttributeTablePtr
xmlCopyAttributeTable (xmlAttributeTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeAttributeTable (xmlAttributeTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr);
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN xmlIDPtr XMLCALL
XMLPUBFUN xmlIDPtr
xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeIDTable (xmlIDTablePtr table);
XMLPUBFUN xmlAttrPtr XMLCALL
XMLPUBFUN xmlAttrPtr
xmlGetID (xmlDocPtr doc,
const xmlChar *ID);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr);
/* IDREFs */
XML_DEPRECATED
XMLPUBFUN xmlRefPtr XMLCALL
XMLPUBFUN xmlRefPtr
xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeRefTable (xmlRefTablePtr table);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN xmlListPtr XMLCALL
XMLPUBFUN xmlListPtr
xmlGetRefs (xmlDocPtr doc,
const xmlChar *ID);
@ -311,146 +296,146 @@ XMLPUBFUN xmlListPtr XMLCALL
*/
#ifdef LIBXML_VALID_ENABLED
/* Allocate/Release Validation Contexts */
XMLPUBFUN xmlValidCtxtPtr XMLCALL
XMLPUBFUN xmlValidCtxtPtr
xmlNewValidCtxt(void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeValidCtxt(xmlValidCtxtPtr);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateAttributeValue(xmlAttributeType type,
const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *prefix,
xmlNsPtr ns,
const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
#endif /* LIBXML_VALID_ENABLED */
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIsMixedElement (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
XMLPUBFUN xmlAttributePtr
xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
XMLPUBFUN xmlAttributePtr
xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlNotationPtr XMLCALL
XMLPUBFUN xmlNotationPtr
xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar *name);
XMLPUBFUN xmlElementPtr XMLCALL
XMLPUBFUN xmlElementPtr
xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlElementPtr XMLCALL
XMLPUBFUN xmlElementPtr
xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar *name);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidGetPotentialChildren(xmlElementContent *ctree,
const xmlChar **names,
int *len,
int max);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidGetValidElements(xmlNode *prev,
xmlNode *next,
const xmlChar **names,
int max);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNameValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNamesValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNmtokenValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
xmlElementPtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,

View file

@ -89,35 +89,35 @@ typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
/*
* standalone processing
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcess (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
int flags,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
int flags,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessTree (xmlNodePtr tree);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
int flags);
/*
* contextual processing
*/
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
XMLPUBFUN xmlXIncludeCtxtPtr
xmlXIncludeNewContext (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr tree);
#ifdef __cplusplus

View file

@ -31,7 +31,7 @@ extern "C" {
*
* Returns 1 if yes and 0 if another Input module should be used
*/
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
typedef int (*xmlInputMatchCallback) (char const *filename);
/**
* xmlInputOpenCallback:
* @filename: the filename or URI
@ -40,7 +40,7 @@ typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
*
* Returns an Input context or NULL in case or error
*/
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
typedef void * (*xmlInputOpenCallback) (char const *filename);
/**
* xmlInputReadCallback:
* @context: an Input context
@ -51,7 +51,7 @@ typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
*
* Returns the number of bytes read or -1 in case of error
*/
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* xmlInputCloseCallback:
* @context: an Input context
@ -60,7 +60,7 @@ typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
typedef int (*xmlInputCloseCallback) (void * context);
#ifdef LIBXML_OUTPUT_ENABLED
/*
@ -77,7 +77,7 @@ typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
*
* Returns 1 if yes and 0 if another Output module should be used
*/
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
typedef int (*xmlOutputMatchCallback) (char const *filename);
/**
* xmlOutputOpenCallback:
* @filename: the filename or URI
@ -86,7 +86,7 @@ typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
*
* Returns an Output context or NULL in case or error
*/
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
typedef void * (*xmlOutputOpenCallback) (char const *filename);
/**
* xmlOutputWriteCallback:
* @context: an Output context
@ -97,7 +97,7 @@ typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
*
* Returns the number of bytes written or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* xmlOutputCloseCallback:
@ -107,7 +107,7 @@ typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buff
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
typedef int (*xmlOutputCloseCallback) (void * context);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
@ -155,53 +155,54 @@ struct _xmlOutputBuffer {
/*
* Interfaces for input
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupInputCallbacks (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPopInputCallbacks (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegisterDefaultInputCallbacks (void);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlAllocParserInputBuffer (xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateFilename (const char *URI,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateFile (FILE *file,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateMem (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateStatic (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char *buf);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
XMLPUBFUN char * XMLCALL
XMLPUBFUN char *
xmlParserGetDirectory (const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
@ -215,62 +216,62 @@ xmlParserInputBufferPtr
/*
* Interfaces for output
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupOutputCallbacks (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlPopOutputCallbacks (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlOutputBufferCreateFilename (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlOutputBufferCreateFile (FILE *file,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
XMLPUBFUN xmlOutputBufferPtr
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
xmlCharEncodingHandlerPtr encoder);
/* Couple of APIs to get the output without digging into the buffers */
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlOutputBufferGetContent (xmlOutputBufferPtr out);
XMLPUBFUN size_t XMLCALL
XMLPUBFUN size_t
xmlOutputBufferGetSize (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char *buf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar *str,
xmlCharEncodingOutputFunc escaping);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlOutputBufferFlush (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlOutputBufferClose (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
@ -283,20 +284,20 @@ xmlOutputBufferPtr
#ifdef LIBXML_HTTP_ENABLED
/* This function only exists if HTTP support built into the library */
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegisterHTTPPostCallbacks (void );
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret);
/*
* A predefined entity loader disabling network accesses
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
XMLPUBFUN xmlParserInputPtr
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
@ -305,43 +306,43 @@ XMLPUBFUN xmlParserInputPtr XMLCALL
* xmlNormalizeWindowsPath is obsolete, don't use it.
* Check xmlCanonicPath in uri.h for a better alternative.
*/
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlNormalizeWindowsPath (const xmlChar *path);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCheckFilename (const char *path);
/**
* Default 'file://' protocol callbacks
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlFileMatch (const char *filename);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlFileOpen (const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlFileRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlFileClose (void * context);
/**
* Default 'http://' protocol callbacks
*/
#ifdef LIBXML_HTTP_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOHTTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlIOHTTPOpen (const char *filename);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlIOHTTPOpenW (const char * post_uri,
int compression );
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOHTTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOHTTPClose (void * context);
#endif /* LIBXML_HTTP_ENABLED */
@ -349,15 +350,15 @@ XMLPUBFUN int XMLCALL
* Default 'ftp://' protocol callbacks
*/
#ifdef LIBXML_FTP_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOFTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlIOFTPOpen (const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOFTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlIOFTPClose (void * context);
#endif /* LIBXML_FTP_ENABLED */

View file

@ -11,11 +11,11 @@
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef LIBXML_AUTOMATA_ENABLED
#include <libxml/xmlregexp.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
@ -40,32 +40,32 @@ typedef xmlAutomataState *xmlAutomataStatePtr;
/*
* Building API
*/
XMLPUBFUN xmlAutomataPtr XMLCALL
XMLPUBFUN xmlAutomataPtr
xmlNewAutomata (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeAutomata (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataGetInitState (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewState (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
@ -73,7 +73,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
@ -81,7 +81,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
@ -90,7 +90,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
@ -98,7 +98,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
@ -107,33 +107,33 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
XMLPUBFUN xmlAutomataStatePtr
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max);
XMLPUBFUN xmlRegexpPtr XMLCALL
XMLPUBFUN struct _xmlRegexp *
xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlAutomataIsDeterminist (xmlAutomataPtr am);
#ifdef __cplusplus

View file

@ -855,19 +855,20 @@ typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
* Signature of the function to use when there is an error and
* the module handles the new error reporting mechanism.
*/
typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
/*
* Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL
XML_DEPRECATED
XMLPUBFUN void
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSetStructuredErrorFunc (void *ctx,
xmlStructuredErrorFunc handler);
/*
@ -890,57 +891,28 @@ XMLPUBFUN void XMLCDECL
xmlParserValidityWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParserPrintFileInfo (xmlParserInputPtr input);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlParserPrintFileContext (xmlParserInputPtr input);
/*
* Extended error information routines
*/
XMLPUBFUN xmlErrorPtr XMLCALL
XMLPUBFUN xmlErrorPtr
xmlGetLastError (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlResetLastError (void);
XMLPUBFUN xmlErrorPtr XMLCALL
XMLPUBFUN xmlErrorPtr
xmlCtxtGetLastError (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCtxtResetLastError (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlResetError (xmlErrorPtr err);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
#ifdef IN_LIBXML
/*
* Internal callback reporting routine
*/
XMLPUBFUN void XMLCDECL
__xmlRaiseError (xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel,
void *data,
void *ctx,
void *node,
int domain,
int code,
xmlErrorLevel level,
const char *file,
int line,
const char *str1,
const char *str2,
const char *str3,
int int1,
int col,
const char *msg,
...) LIBXML_ATTR_FORMAT(16,17);
XMLPUBFUN void XMLCALL
__xmlSimpleError (int domain,
int code,
xmlNodePtr node,
const char *msg,
const char *extra) LIBXML_ATTR_FORMAT(4,0);
#endif
#ifdef __cplusplus
}
#endif

View file

@ -8,52 +8,19 @@
#ifndef __XML_EXPORTS_H__
#define __XML_EXPORTS_H__
#if defined(_WIN32) || defined(__CYGWIN__)
/** DOC_DISABLE */
#include <windef.h>
#ifdef LIBXML_STATIC
#define XMLPUBLIC
#elif defined(IN_LIBXML)
#define XMLPUBLIC __declspec(dllexport)
#else
#define XMLPUBLIC __declspec(dllimport)
#endif
#if defined(LIBXML_FASTCALL)
#define XMLCALL __fastcall
#else
#define XMLCALL __cdecl
#endif
#define XMLCDECL WINAPIV
/** DOC_ENABLE */
#if defined(_WIN32) || defined(__CYGWIN__)
#ifdef LIBXML_STATIC
#define XMLPUBLIC
#elif defined(IN_LIBXML)
#define XMLPUBLIC __declspec(dllexport)
#else
#define XMLPUBLIC __declspec(dllimport)
#endif
#else /* not Windows */
/**
* XMLPUBLIC:
*
* Macro which declares a public symbol
*/
#define XMLPUBLIC
/**
* XMLCALL:
*
* Macro which declares the calling convention for exported functions
*/
#define XMLCALL
/**
* XMLCDECL:
*
* Macro which declares the calling convention for exported functions that
* use '...'.
*/
#define XMLCDECL
#define XMLPUBLIC
#endif /* platform switch */
/** DOC_ENABLE */
/*
* XMLPUBFUN:
@ -69,10 +36,14 @@
*/
#define XMLPUBVAR XMLPUBLIC extern
/** DOC_DISABLE */
/* Compatibility */
#define XMLCALL
#define XMLCDECL WINAPIV
#if !defined(LIBXML_DLL_IMPORT)
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
/** DOC_ENABLE */
#endif /* __XML_EXPORTS_H__ */

View file

@ -54,7 +54,7 @@ extern "C" {
*
* Signature for a free() implementation.
*/
typedef void (XMLCALL *xmlFreeFunc)(void *mem);
typedef void (*xmlFreeFunc)(void *mem);
/**
* xmlMallocFunc:
* @size: the size requested in bytes
@ -63,7 +63,7 @@ typedef void (XMLCALL *xmlFreeFunc)(void *mem);
*
* Returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) *xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
@ -74,7 +74,7 @@ typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
*
* Returns a pointer to the newly reallocated block or NULL in case of error.
*/
typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
typedef void *(*xmlReallocFunc)(void *mem, size_t size);
/**
* xmlStrdupFunc:
@ -84,7 +84,7 @@ typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
*
* Returns the copy of the string or NULL in case of error.
*/
typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
typedef char *(*xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml.
@ -100,23 +100,23 @@ LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
* The xmlGc function have an extra entry for atomic block
* allocations useful for garbage collected memory allocators
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGcMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
@ -127,45 +127,47 @@ XMLPUBFUN int XMLCALL
* Initialization of the memory layer.
*/
XML_DEPRECATED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlCleanupMemory (void);
/*
* These are specific to the XML debug memory wrapper.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN size_t
xmlMemSize (void *ptr);
XMLPUBFUN int
xmlMemUsed (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlMemBlocks (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMemDisplay (FILE *fp);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMemDisplayLast(FILE *fp, long nbBytes);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMemShow (FILE *fp, int nr);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMemoryDump (void);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlMemFree (void *ptr);
XMLPUBFUN char * XMLCALL
XMLPUBFUN char *
xmlMemoryStrdup (const char *str);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN char * XMLCALL
XMLPUBFUN char *
xmlMemStrdupLoc (const char *str, const char *file, int line);

View file

@ -108,16 +108,16 @@ typedef xmlTextReader *xmlTextReaderPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlNewTextReader (xmlParserInputBufferPtr input,
const char *URI);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlNewTextReaderFilename(const char *URI);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlFreeTextReader (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderSetup(xmlTextReaderPtr reader,
xmlParserInputBufferPtr input, const char *URL,
const char *encoding, int options);
@ -125,222 +125,222 @@ XMLPUBFUN int XMLCALL
/*
* Iterators
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderRead (xmlTextReaderPtr reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);
#endif
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderReadString (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);
/*
* Attributes of the node
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderDepth (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderHasValue(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderNodeType (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderReadState (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar *str);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstValue (xmlTextReaderPtr reader);
/*
* use the Const version of the routine for
* better performance and simpler code
*/
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderLocalName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderPrefix (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderValue (xmlTextReaderPtr reader);
/*
* Methods of the XmlTextReader
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderClose (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
XMLPUBFUN xmlParserInputBufferPtr
xmlTextReaderGetRemainder (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
const xmlChar *prefix);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
int no);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderNormalization (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstEncoding (xmlTextReaderPtr reader);
/*
* Extensions
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlTextReaderPreserve (xmlTextReaderPtr reader);
#ifdef LIBXML_PATTERN_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
const xmlChar *pattern,
const xmlChar **namespaces);
#endif /* LIBXML_PATTERN_ENABLED */
XMLPUBFUN xmlDocPtr XMLCALL
XMLPUBFUN xmlDocPtr
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlTextReaderExpand (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderNext (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderIsValid (xmlTextReaderPtr reader);
#ifdef LIBXML_SCHEMAS_ENABLED
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
const char *rng);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,
xmlRelaxNGValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
xmlRelaxNGPtr schema);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char *xsd);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema);
#endif
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderStandalone (xmlTextReaderPtr reader);
/*
* Index lookup
*/
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlTextReaderByteConsumed (xmlTextReaderPtr reader);
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderWalker (xmlDocPtr doc);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
XMLPUBFUN xmlTextReaderPtr
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
@ -348,34 +348,34 @@ XMLPUBFUN xmlTextReaderPtr XMLCALL
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewFile (xmlTextReaderPtr reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewMemory (xmlTextReaderPtr reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
@ -397,23 +397,23 @@ typedef void * xmlTextReaderLocatorPtr;
*
* Signature of an error callback from a reader parser
*/
typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
typedef void (*xmlTextReaderErrorFunc)(void *arg,
const char *msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc *f,
void **arg);

View file

@ -48,16 +48,16 @@ extern "C" {
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexpPtr XMLCALL
XMLPUBFUN xmlRegexpPtr
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
XMLPUBFUN void xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/**
@ -77,29 +77,29 @@ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
/*
* The progressive API
*/
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
XMLPUBFUN xmlRegExecCtxtPtr
xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback,
void *data);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string,
int *nbval,
@ -116,15 +116,15 @@ XMLPUBFUN int XMLCALL
typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL
XMLPUBFUN xmlExpCtxtPtr
xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */
@ -150,31 +150,31 @@ XMLPUBVAR xmlExpNodePtr emptyExp;
/*
* Expressions are reference counted internally
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlExpRef (xmlExpNodePtr expr);
/*
* constructors can be either manual or from a string
*/
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset,
int min,
@ -182,34 +182,34 @@ XMLPUBFUN xmlExpNodePtr XMLCALL
/*
* The really interesting APIs
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**langList,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**tokList,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar *str,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
XMLPUBFUN xmlExpNodePtr
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */

View file

@ -41,42 +41,42 @@ typedef enum {
typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
XMLPUBFUN xmlSaveCtxtPtr
xmlSaveToFd (int fd,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
XMLPUBFUN xmlSaveCtxtPtr
xmlSaveToFilename (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
XMLPUBFUN xmlSaveCtxtPtr
xmlSaveToBuffer (xmlBufferPtr buffer,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
XMLPUBFUN xmlSaveCtxtPtr
xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
const char *encoding,
int options);
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
#ifdef __cplusplus

View file

@ -134,89 +134,89 @@ typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx,
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
XMLPUBFUN xmlSchemaParserCtxtPtr
xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
XMLPUBFUN xmlSchemaParserCtxtPtr
xmlSchemaNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
XMLPUBFUN xmlSchemaParserCtxtPtr
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaPtr XMLCALL
XMLPUBFUN xmlSchemaPtr
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaFree (xmlSchemaPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaDump (FILE *output,
xmlSchemaPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
XMLPUBFUN xmlSchemaValidCtxtPtr
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr instance);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void *user_data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
XMLPUBFUN xmlParserCtxtPtr
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
/*
@ -225,15 +225,15 @@ XMLPUBFUN xmlParserCtxtPtr XMLCALL
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
XMLPUBFUN xmlSchemaSAXPlugPtr
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr *sax,
void **user_data);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
xmlSchemaValidityLocatorFunc f,
void *ctxt);

View file

@ -30,118 +30,118 @@ typedef enum {
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType;
XMLPUBFUN void XMLCALL
XMLPUBFUN int
xmlSchemaInitTypes (void);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
XMLPUBFUN xmlSchemaTypePtr
xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaFreeValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaFacetPtr XMLCALL
XMLPUBFUN xmlSchemaFacetPtr
xmlSchemaNewFacet (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr ctxt,
const xmlChar *name);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
XMLPUBFUN xmlSchemaTypePtr
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar *value,
unsigned long actualLen,
unsigned long *expectedLen);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
XMLPUBFUN xmlSchemaTypePtr
xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long XMLCALL
XMLPUBFUN unsigned long
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar **retValue);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar **retValue,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur);
XMLPUBFUN xmlSchemaValPtr XMLCALL
XMLPUBFUN xmlSchemaValPtr
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValPtr XMLCALL
XMLPUBFUN xmlSchemaValPtr
xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value);
XMLPUBFUN xmlSchemaValPtr XMLCALL
XMLPUBFUN xmlSchemaValPtr
xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN xmlSchemaValPtr XMLCALL
XMLPUBFUN xmlSchemaValPtr
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
const xmlChar *localName);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws);
XMLPUBFUN xmlSchemaValPtr XMLCALL
XMLPUBFUN xmlSchemaValPtr
xmlSchemaCopyValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValType XMLCALL
XMLPUBFUN xmlSchemaValType
xmlSchemaGetValType (xmlSchemaValPtr val);
#ifdef __cplusplus

View file

@ -37,60 +37,60 @@ typedef unsigned char xmlChar;
/*
* xmlChar handling
*/
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrdup (const xmlChar *cur);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrndup (const xmlChar *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCharStrndup (const char *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlCharStrdup (const char *cur);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrsub (const xmlChar *str,
int start,
int len);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlStrchr (const xmlChar *str,
xmlChar val);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlStrstr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlStrcasestr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrcmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrncmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrcasecmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrQEqual (const xmlChar *pref,
const xmlChar *name,
const xmlChar *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrlen (const xmlChar *str);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrcat (xmlChar *cur,
const xmlChar *add);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrncat (xmlChar *cur,
const xmlChar *add,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlStrncatNew (const xmlChar *str1,
const xmlChar *str2,
int len);
@ -99,38 +99,38 @@ XMLPUBFUN int XMLCDECL
int len,
const char *msg,
...) LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlStrVPrintf (xmlChar *buf,
int len,
const char *msg,
va_list ap) LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlGetUTF8Char (const unsigned char *utf,
int *len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlCheckUTF8 (const unsigned char *utf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUTF8Strsize (const xmlChar *utf,
int len);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlUTF8Strndup (const xmlChar *utf,
int len);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlUTF8Strpos (const xmlChar *utf,
int pos);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUTF8Strloc (const xmlChar *utf,
const xmlChar *utfchar);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlUTF8Strsub (const xmlChar *utf,
int start,
int len);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUTF8Strlen (const xmlChar *utf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUTF8Size (const xmlChar *utf);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlUTF8Charcmp (const xmlChar *utf1,
const xmlChar *utf2);

View file

@ -23,175 +23,175 @@
extern "C" {
#endif
XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code);
XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code);
XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLao (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code);
XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code);
XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTags (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThai (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int xmlUCSIsAegeanNumbers (int code);
XMLPUBFUN int xmlUCSIsAlphabeticPresentationForms (int code);
XMLPUBFUN int xmlUCSIsArabic (int code);
XMLPUBFUN int xmlUCSIsArabicPresentationFormsA (int code);
XMLPUBFUN int xmlUCSIsArabicPresentationFormsB (int code);
XMLPUBFUN int xmlUCSIsArmenian (int code);
XMLPUBFUN int xmlUCSIsArrows (int code);
XMLPUBFUN int xmlUCSIsBasicLatin (int code);
XMLPUBFUN int xmlUCSIsBengali (int code);
XMLPUBFUN int xmlUCSIsBlockElements (int code);
XMLPUBFUN int xmlUCSIsBopomofo (int code);
XMLPUBFUN int xmlUCSIsBopomofoExtended (int code);
XMLPUBFUN int xmlUCSIsBoxDrawing (int code);
XMLPUBFUN int xmlUCSIsBraillePatterns (int code);
XMLPUBFUN int xmlUCSIsBuhid (int code);
XMLPUBFUN int xmlUCSIsByzantineMusicalSymbols (int code);
XMLPUBFUN int xmlUCSIsCJKCompatibility (int code);
XMLPUBFUN int xmlUCSIsCJKCompatibilityForms (int code);
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographs (int code);
XMLPUBFUN int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
XMLPUBFUN int xmlUCSIsCJKRadicalsSupplement (int code);
XMLPUBFUN int xmlUCSIsCJKSymbolsandPunctuation (int code);
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographs (int code);
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XMLPUBFUN int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XMLPUBFUN int xmlUCSIsCherokee (int code);
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarks (int code);
XMLPUBFUN int xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
XMLPUBFUN int xmlUCSIsCombiningHalfMarks (int code);
XMLPUBFUN int xmlUCSIsCombiningMarksforSymbols (int code);
XMLPUBFUN int xmlUCSIsControlPictures (int code);
XMLPUBFUN int xmlUCSIsCurrencySymbols (int code);
XMLPUBFUN int xmlUCSIsCypriotSyllabary (int code);
XMLPUBFUN int xmlUCSIsCyrillic (int code);
XMLPUBFUN int xmlUCSIsCyrillicSupplement (int code);
XMLPUBFUN int xmlUCSIsDeseret (int code);
XMLPUBFUN int xmlUCSIsDevanagari (int code);
XMLPUBFUN int xmlUCSIsDingbats (int code);
XMLPUBFUN int xmlUCSIsEnclosedAlphanumerics (int code);
XMLPUBFUN int xmlUCSIsEnclosedCJKLettersandMonths (int code);
XMLPUBFUN int xmlUCSIsEthiopic (int code);
XMLPUBFUN int xmlUCSIsGeneralPunctuation (int code);
XMLPUBFUN int xmlUCSIsGeometricShapes (int code);
XMLPUBFUN int xmlUCSIsGeorgian (int code);
XMLPUBFUN int xmlUCSIsGothic (int code);
XMLPUBFUN int xmlUCSIsGreek (int code);
XMLPUBFUN int xmlUCSIsGreekExtended (int code);
XMLPUBFUN int xmlUCSIsGreekandCoptic (int code);
XMLPUBFUN int xmlUCSIsGujarati (int code);
XMLPUBFUN int xmlUCSIsGurmukhi (int code);
XMLPUBFUN int xmlUCSIsHalfwidthandFullwidthForms (int code);
XMLPUBFUN int xmlUCSIsHangulCompatibilityJamo (int code);
XMLPUBFUN int xmlUCSIsHangulJamo (int code);
XMLPUBFUN int xmlUCSIsHangulSyllables (int code);
XMLPUBFUN int xmlUCSIsHanunoo (int code);
XMLPUBFUN int xmlUCSIsHebrew (int code);
XMLPUBFUN int xmlUCSIsHighPrivateUseSurrogates (int code);
XMLPUBFUN int xmlUCSIsHighSurrogates (int code);
XMLPUBFUN int xmlUCSIsHiragana (int code);
XMLPUBFUN int xmlUCSIsIPAExtensions (int code);
XMLPUBFUN int xmlUCSIsIdeographicDescriptionCharacters (int code);
XMLPUBFUN int xmlUCSIsKanbun (int code);
XMLPUBFUN int xmlUCSIsKangxiRadicals (int code);
XMLPUBFUN int xmlUCSIsKannada (int code);
XMLPUBFUN int xmlUCSIsKatakana (int code);
XMLPUBFUN int xmlUCSIsKatakanaPhoneticExtensions (int code);
XMLPUBFUN int xmlUCSIsKhmer (int code);
XMLPUBFUN int xmlUCSIsKhmerSymbols (int code);
XMLPUBFUN int xmlUCSIsLao (int code);
XMLPUBFUN int xmlUCSIsLatin1Supplement (int code);
XMLPUBFUN int xmlUCSIsLatinExtendedA (int code);
XMLPUBFUN int xmlUCSIsLatinExtendedB (int code);
XMLPUBFUN int xmlUCSIsLatinExtendedAdditional (int code);
XMLPUBFUN int xmlUCSIsLetterlikeSymbols (int code);
XMLPUBFUN int xmlUCSIsLimbu (int code);
XMLPUBFUN int xmlUCSIsLinearBIdeograms (int code);
XMLPUBFUN int xmlUCSIsLinearBSyllabary (int code);
XMLPUBFUN int xmlUCSIsLowSurrogates (int code);
XMLPUBFUN int xmlUCSIsMalayalam (int code);
XMLPUBFUN int xmlUCSIsMathematicalAlphanumericSymbols (int code);
XMLPUBFUN int xmlUCSIsMathematicalOperators (int code);
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
XMLPUBFUN int xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
XMLPUBFUN int xmlUCSIsMiscellaneousSymbols (int code);
XMLPUBFUN int xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XMLPUBFUN int xmlUCSIsMiscellaneousTechnical (int code);
XMLPUBFUN int xmlUCSIsMongolian (int code);
XMLPUBFUN int xmlUCSIsMusicalSymbols (int code);
XMLPUBFUN int xmlUCSIsMyanmar (int code);
XMLPUBFUN int xmlUCSIsNumberForms (int code);
XMLPUBFUN int xmlUCSIsOgham (int code);
XMLPUBFUN int xmlUCSIsOldItalic (int code);
XMLPUBFUN int xmlUCSIsOpticalCharacterRecognition (int code);
XMLPUBFUN int xmlUCSIsOriya (int code);
XMLPUBFUN int xmlUCSIsOsmanya (int code);
XMLPUBFUN int xmlUCSIsPhoneticExtensions (int code);
XMLPUBFUN int xmlUCSIsPrivateUse (int code);
XMLPUBFUN int xmlUCSIsPrivateUseArea (int code);
XMLPUBFUN int xmlUCSIsRunic (int code);
XMLPUBFUN int xmlUCSIsShavian (int code);
XMLPUBFUN int xmlUCSIsSinhala (int code);
XMLPUBFUN int xmlUCSIsSmallFormVariants (int code);
XMLPUBFUN int xmlUCSIsSpacingModifierLetters (int code);
XMLPUBFUN int xmlUCSIsSpecials (int code);
XMLPUBFUN int xmlUCSIsSuperscriptsandSubscripts (int code);
XMLPUBFUN int xmlUCSIsSupplementalArrowsA (int code);
XMLPUBFUN int xmlUCSIsSupplementalArrowsB (int code);
XMLPUBFUN int xmlUCSIsSupplementalMathematicalOperators (int code);
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaA (int code);
XMLPUBFUN int xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XMLPUBFUN int xmlUCSIsSyriac (int code);
XMLPUBFUN int xmlUCSIsTagalog (int code);
XMLPUBFUN int xmlUCSIsTagbanwa (int code);
XMLPUBFUN int xmlUCSIsTags (int code);
XMLPUBFUN int xmlUCSIsTaiLe (int code);
XMLPUBFUN int xmlUCSIsTaiXuanJingSymbols (int code);
XMLPUBFUN int xmlUCSIsTamil (int code);
XMLPUBFUN int xmlUCSIsTelugu (int code);
XMLPUBFUN int xmlUCSIsThaana (int code);
XMLPUBFUN int xmlUCSIsThai (int code);
XMLPUBFUN int xmlUCSIsTibetan (int code);
XMLPUBFUN int xmlUCSIsUgaritic (int code);
XMLPUBFUN int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
XMLPUBFUN int xmlUCSIsVariationSelectors (int code);
XMLPUBFUN int xmlUCSIsVariationSelectorsSupplement (int code);
XMLPUBFUN int xmlUCSIsYiRadicals (int code);
XMLPUBFUN int xmlUCSIsYiSyllables (int code);
XMLPUBFUN int xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block);
XMLPUBFUN int xmlUCSIsBlock (int code, const char *block);
XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code);
XMLPUBFUN int xmlUCSIsCatC (int code);
XMLPUBFUN int xmlUCSIsCatCc (int code);
XMLPUBFUN int xmlUCSIsCatCf (int code);
XMLPUBFUN int xmlUCSIsCatCo (int code);
XMLPUBFUN int xmlUCSIsCatCs (int code);
XMLPUBFUN int xmlUCSIsCatL (int code);
XMLPUBFUN int xmlUCSIsCatLl (int code);
XMLPUBFUN int xmlUCSIsCatLm (int code);
XMLPUBFUN int xmlUCSIsCatLo (int code);
XMLPUBFUN int xmlUCSIsCatLt (int code);
XMLPUBFUN int xmlUCSIsCatLu (int code);
XMLPUBFUN int xmlUCSIsCatM (int code);
XMLPUBFUN int xmlUCSIsCatMc (int code);
XMLPUBFUN int xmlUCSIsCatMe (int code);
XMLPUBFUN int xmlUCSIsCatMn (int code);
XMLPUBFUN int xmlUCSIsCatN (int code);
XMLPUBFUN int xmlUCSIsCatNd (int code);
XMLPUBFUN int xmlUCSIsCatNl (int code);
XMLPUBFUN int xmlUCSIsCatNo (int code);
XMLPUBFUN int xmlUCSIsCatP (int code);
XMLPUBFUN int xmlUCSIsCatPc (int code);
XMLPUBFUN int xmlUCSIsCatPd (int code);
XMLPUBFUN int xmlUCSIsCatPe (int code);
XMLPUBFUN int xmlUCSIsCatPf (int code);
XMLPUBFUN int xmlUCSIsCatPi (int code);
XMLPUBFUN int xmlUCSIsCatPo (int code);
XMLPUBFUN int xmlUCSIsCatPs (int code);
XMLPUBFUN int xmlUCSIsCatS (int code);
XMLPUBFUN int xmlUCSIsCatSc (int code);
XMLPUBFUN int xmlUCSIsCatSk (int code);
XMLPUBFUN int xmlUCSIsCatSm (int code);
XMLPUBFUN int xmlUCSIsCatSo (int code);
XMLPUBFUN int xmlUCSIsCatZ (int code);
XMLPUBFUN int xmlUCSIsCatZl (int code);
XMLPUBFUN int xmlUCSIsCatZp (int code);
XMLPUBFUN int xmlUCSIsCatZs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat);
XMLPUBFUN int xmlUCSIsCat (int code, const char *cat);
#ifdef __cplusplus
}

View file

@ -21,7 +21,7 @@ extern "C" {
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
XMLPUBFUN void xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.10.0"
#define LIBXML_DOTTED_VERSION "2.11.4"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 21000
#define LIBXML_VERSION 21104
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "21000"
#define LIBXML_VERSION_STRING "21104"
/**
* LIBXML_VERSION_EXTRA:
@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(21000);
#define LIBXML_TEST_VERSION xmlCheckVersion(21104);
#ifndef VMS
#if 0
@ -313,7 +313,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_DEBUG_RUNTIME:
*
* Whether the runtime debugging is configured in
* Removed
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
@ -409,12 +409,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifdef __GNUC__
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
/** DOC_DISABLE */
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
@ -424,12 +419,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# endif
#endif
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
@ -440,12 +429,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
@ -457,14 +440,27 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
#ifndef XML_DEPRECATED
# ifdef IN_LIBXML
# if defined (IN_LIBXML) || (__GNUC__ * 100 + __GNUC_MINOR__ < 301)
# define XML_DEPRECATED
# else
/* Available since at least GCC 3.1 */
# else
# define XML_DEPRECATED __attribute__((deprecated))
# endif
#endif
#if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
#define XML_IGNORE_FPTR_CAST_WARNINGS \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#define XML_POP_WARNINGS \
_Pragma("GCC diagnostic pop")
#else
#define XML_IGNORE_FPTR_CAST_WARNINGS
#define XML_POP_WARNINGS
#endif
/** DOC_ENABLE */
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@ -491,7 +487,34 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* is deprecated.
*/
#ifndef XML_DEPRECATED
#define XML_DEPRECATED
# if defined (IN_LIBXML) || !defined (_MSC_VER)
# define XML_DEPRECATED
/* Available since Visual Studio 2005 */
# elif defined (_MSC_VER) && (_MSC_VER >= 1400)
# define XML_DEPRECATED __declspec(deprecated)
# endif
#endif
/**
* LIBXML_IGNORE_FPTR_CAST_WARNINGS:
*
* Macro used to ignore pointer cast warnings that can't be worked around.
*/
#if defined (_MSC_VER) && (_MSC_VER >= 1400)
# define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
#else
# define XML_IGNORE_FPTR_CAST_WARNINGS
#endif
/**
* XML_POP_WARNINGS:
*
* Macro used to restore warnings state.
*/
#ifndef XML_POP_WARNINGS
# if defined (_MSC_VER) && (_MSC_VER >= 1400)
# define XML_POP_WARNINGS __pragma(warning(pop))
# else
# define XML_POP_WARNINGS
# endif
#endif
#endif /* __GNUC__ */

View file

@ -400,7 +400,7 @@ struct _xmlXPathParserContext {
int xptr; /* it this an XPointer expression */
xmlNodePtr ancestor; /* used for walking preceding axis */
int valueFrame; /* used to limit Pop on the stack */
int valueFrame; /* unused */
};
/************************************************************************
@ -454,68 +454,68 @@ XMLPUBVAR double xmlXPathNINF;
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeObject (xmlXPathObjectPtr obj);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeSetCreate (xmlNodePtr val);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathObjectCopy (xmlXPathObjectPtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCmpNodes (xmlNodePtr node1,
xmlNodePtr node2);
/**
* Conversion functions to basic types.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCastNumberToBoolean (double val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCastStringToBoolean (const xmlChar * val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCastToBoolean (xmlXPathObjectPtr val);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathCastBooleanToNumber (int val);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathCastStringToNumber (const xmlChar * val);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathCastNodeToNumber (xmlNodePtr node);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathCastToNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathCastBooleanToString (int val);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathCastNumberToString (double val);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathCastNodeToString (xmlNodePtr node);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathCastToString (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathConvertBoolean (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathConvertNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathConvertString (xmlXPathObjectPtr val);
/**
* Context handling.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
XMLPUBFUN xmlXPathContextPtr
xmlXPathNewContext (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
int active,
int value,
@ -523,48 +523,48 @@ XMLPUBFUN int XMLCALL
/**
* Evaluation functions.
*/
XMLPUBFUN long XMLCALL
XMLPUBFUN long
xmlXPathOrderDocElems (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathSetContextNode (xmlNodePtr node,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNodeEval (xmlNodePtr node,
const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathEval (const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathEvalExpression (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
xmlXPathObjectPtr res);
/**
* Separate compilation/evaluation entry points.
*/
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
XMLPUBFUN xmlXPathCompExprPtr
xmlXPathCompile (const xmlChar *str);
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
XMLPUBFUN xmlXPathCompExprPtr
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
const xmlChar *str);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathInit (void);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathIsNaN (double val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathIsInf (double val);
#ifdef __cplusplus

View file

@ -100,15 +100,15 @@ extern "C" {
*/
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathPopString (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void *
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
/**
@ -331,7 +331,7 @@ XMLPUBFUN void * XMLCALL
* Variable Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
xmlXPathVariableLookupFunc f,
void *data);
@ -340,7 +340,7 @@ XMLPUBFUN void XMLCALL
* Function Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
xmlXPathFuncLookupFunc f,
void *funcCtxt);
@ -348,22 +348,22 @@ XMLPUBFUN void XMLCALL
/*
* Error reporting.
*/
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPatherror (xmlXPathParserContextPtr ctxt,
const char *file,
int line,
int no);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathErr (xmlXPathParserContextPtr ctxt,
int error);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
int depth);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathDebugDumpCompExpr(FILE *output,
xmlXPathCompExprPtr comp,
int depth);
@ -371,48 +371,48 @@ XMLPUBFUN void XMLCALL
/**
* NodeSet handling.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathNodeSetContains (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathDifference (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathIntersection (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathDistinct (xmlNodeSetPtr nodes);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeLeading (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathLeading (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathTrailing (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
@ -421,208 +421,208 @@ XMLPUBFUN xmlNodeSetPtr XMLCALL
* Extending a context.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
const xmlChar *prefix,
const xmlChar *ns_uri);
XMLPUBFUN const xmlChar * XMLCALL
XMLPUBFUN const xmlChar *
xmlXPathNsLookup (xmlXPathContextPtr ctxt,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathObjectPtr value);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathFunction XMLCALL
XMLPUBFUN xmlXPathFunction
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathFunction XMLCALL
XMLPUBFUN xmlXPathFunction
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
/**
* Utilities to extend XPath.
*/
XMLPUBFUN xmlXPathParserContextPtr XMLCALL
XMLPUBFUN xmlXPathParserContextPtr
xmlXPathNewParserContext (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
/* TODO: remap to xmlXPathValuePop and Push. */
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
valuePop (xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
valuePush (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewString (const xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewCString (const char *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathWrapString (xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathWrapCString (char * val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewFloat (double val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewBoolean (int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewNodeSet (xmlNodePtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewValueTree (xmlNodePtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
xmlNodePtr node,
xmlNsPtr ns);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathNodeSetSort (xmlNodeSetPtr set);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRoot (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathParseName (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
XMLPUBFUN xmlChar *
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
/*
* Existing functions.
*/
XMLPUBFUN double XMLCALL
XMLPUBFUN double
xmlXPathStringEvalNumber (const xmlChar *str);
XMLPUBFUN int XMLCALL
XMLPUBFUN int
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
XMLPUBFUN xmlNodeSetPtr
xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
xmlNodeSetPtr val2);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathNodeSetDel (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathNewNodeSetList (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathWrapNodeSet (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPathWrapExternal (void *val);
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines.
*/
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
XMLPUBFUN xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
/*
* The official core of XPath functions.
*/
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
/**
* Really internal functions
*/
XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNsPtr ns);
#ifdef __cplusplus
}

View file

@ -45,64 +45,64 @@ struct _xmlLocationSet {
*/
XML_DEPRECATED
XMLPUBFUN xmlLocationSetPtr XMLCALL
XMLPUBFUN xmlLocationSetPtr
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
XML_DEPRECATED
XMLPUBFUN xmlLocationSetPtr XMLCALL
XMLPUBFUN xmlLocationSetPtr
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrNewCollapsedRange (xmlNodePtr start);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XML_DEPRECATED
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val);
#endif /* LIBXML_XPTR_LOCS_ENABLED */
@ -110,23 +110,23 @@ XMLPUBFUN void XMLCALL
/*
* Functions.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
XMLPUBFUN xmlXPathContextPtr
xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here,
xmlNodePtr origin);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
XMLPUBFUN xmlXPathObjectPtr
xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx);
#ifdef LIBXML_XPTR_LOCS_ENABLED
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs);
XML_DEPRECATED
XMLPUBFUN xmlNodePtr XMLCALL
XMLPUBFUN xmlNodePtr
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
XMLPUBFUN void
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
#endif /* LIBXML_XPTR_LOCS_ENABLED */
#ifdef __cplusplus

View file

@ -0,0 +1,70 @@
#ifndef XML_BUF_H_PRIVATE__
#define XML_BUF_H_PRIVATE__
#include <libxml/tree.h>
XML_HIDDEN xmlBufPtr
xmlBufCreate(void);
XML_HIDDEN xmlBufPtr
xmlBufCreateSize(size_t size);
XML_HIDDEN int
xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme);
XML_HIDDEN int
xmlBufGetAllocationScheme(xmlBufPtr buf);
XML_HIDDEN void
xmlBufFree(xmlBufPtr buf);
XML_HIDDEN void
xmlBufEmpty(xmlBufPtr buf);
/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
XML_HIDDEN int
xmlBufGrow(xmlBufPtr buf, int len);
XML_HIDDEN int
xmlBufResize(xmlBufPtr buf, size_t len);
XML_HIDDEN int
xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
XML_HIDDEN int
xmlBufCat(xmlBufPtr buf, const xmlChar *str);
XML_HIDDEN int
xmlBufCCat(xmlBufPtr buf, const char *str);
XML_HIDDEN int
xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
XML_HIDDEN size_t
xmlBufAvail(const xmlBufPtr buf);
XML_HIDDEN size_t
xmlBufLength(const xmlBufPtr buf);
/* size_t xmlBufUse(const xmlBufPtr buf); */
XML_HIDDEN int
xmlBufIsEmpty(const xmlBufPtr buf);
XML_HIDDEN int
xmlBufAddLen(xmlBufPtr buf, size_t len);
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
XML_HIDDEN xmlChar *
xmlBufDetach(xmlBufPtr buf);
XML_HIDDEN size_t
xmlBufDump(FILE *file, xmlBufPtr buf);
XML_HIDDEN xmlBufPtr
xmlBufFromBuffer(xmlBufferPtr buffer);
XML_HIDDEN xmlBufferPtr
xmlBufBackToBuffer(xmlBufPtr buf);
XML_HIDDEN int
xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
XML_HIDDEN int
xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
XML_HIDDEN size_t
xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
XML_HIDDEN int
xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
size_t base, size_t cur);
#endif /* XML_BUF_H_PRIVATE__ */

View file

@ -0,0 +1,11 @@
#ifndef XML_DICT_H_PRIVATE__
#define XML_DICT_H_PRIVATE__
XML_HIDDEN int
__xmlInitializeDict(void);
XML_HIDDEN void
xmlCleanupDictInternal(void);
XML_HIDDEN int
__xmlRandom(void);
#endif /* XML_DICT_H_PRIVATE__ */

View file

@ -0,0 +1,18 @@
#ifndef XML_ENC_H_PRIVATE__
#define XML_ENC_H_PRIVATE__
#include <libxml/encoding.h>
#include <libxml/tree.h>
XML_HIDDEN void
xmlInitEncodingInternal(void);
XML_HIDDEN int
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
int *outlen, const unsigned char *in, int *inlen, int flush);
XML_HIDDEN int
xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
XML_HIDDEN int
xmlCharEncOutput(xmlOutputBufferPtr output, int init);
#endif /* XML_ENC_H_PRIVATE__ */

View file

@ -0,0 +1,23 @@
#ifndef XML_ENTITIES_H_PRIVATE__
#define XML_ENTITIES_H_PRIVATE__
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
/*
* Entity flags
*
* XML_ENT_PARSED: The entity was parsed and `children` points to the
* content.
* XML_ENT_CHECKED: The entity was checked for loops.
*/
#define XML_ENT_PARSED (1<<0)
#define XML_ENT_CHECKED (1<<1)
#define XML_ENT_EXPANDING (1<<2)
#define XML_ENT_CHECKED_LT (1<<3)
#define XML_ENT_CONTAINS_LT (1<<4)
XML_HIDDEN xmlChar *
xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
#endif /* XML_ENTITIES_H_PRIVATE__ */

View file

@ -0,0 +1,21 @@
#ifndef XML_ERROR_H_PRIVATE__
#define XML_ERROR_H_PRIVATE__
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
XML_HIDDEN void XMLCDECL
__xmlRaiseError(xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel, void *data, void *ctx,
void *nod, int domain, int code, xmlErrorLevel level,
const char *file, int line, const char *str1,
const char *str2, const char *str3, int int1, int col,
const char *msg, ...) LIBXML_ATTR_FORMAT(16,17);
XML_HIDDEN void
__xmlSimpleError(int domain, int code, xmlNodePtr node,
const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0);
XML_HIDDEN void XMLCDECL
xmlGenericErrorDefaultFunc(void *ctx, const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#endif /* XML_ERROR_H_PRIVATE__ */

View file

@ -0,0 +1,9 @@
#ifndef XML_GLOBALS_H_PRIVATE__
#define XML_GLOBALS_H_PRIVATE__
XML_HIDDEN void
xmlInitGlobalsInternal(void);
XML_HIDDEN void
xmlCleanupGlobalsInternal(void);
#endif /* XML_GLOBALS_H_PRIVATE__ */

View file

@ -0,0 +1,13 @@
#ifndef XML_HTML_H_PRIVATE__
#define XML_HTML_H_PRIVATE__
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTML_ENABLED
XML_HIDDEN void
__htmlParseContent(void *ctx);
#endif /* LIBXML_HTML_ENABLED */
#endif /* XML_HTML_H_PRIVATE__ */

View file

@ -0,0 +1,19 @@
#ifndef XML_IO_H_PRIVATE__
#define XML_IO_H_PRIVATE__
#include <libxml/encoding.h>
#include <libxml/tree.h>
#include <libxml/xmlversion.h>
XML_HIDDEN void
__xmlIOErr(int domain, int code, const char *extra);
XML_HIDDEN void
__xmlLoaderErr(void *ctx, const char *msg,
const char *filename) LIBXML_ATTR_FORMAT(2,0);
#ifdef LIBXML_OUTPUT_ENABLED
XML_HIDDEN xmlOutputBufferPtr
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
#endif
#endif /* XML_IO_H_PRIVATE__ */

View file

@ -0,0 +1,9 @@
#ifndef XML_MEMORY_H_PRIVATE__
#define XML_MEMORY_H_PRIVATE__
XML_HIDDEN void
xmlInitMemoryInternal(void);
XML_HIDDEN void
xmlCleanupMemoryInternal(void);
#endif /* XML_MEMORY_H_PRIVATE__ */

View file

@ -0,0 +1,33 @@
#ifndef XML_PARSER_H_PRIVATE__
#define XML_PARSER_H_PRIVATE__
#include <libxml/parser.h>
#include <libxml/xmlversion.h>
/**
* XML_VCTXT_DTD_VALIDATED:
*
* Set after xmlValidateDtdFinal was called.
*/
#define XML_VCTXT_DTD_VALIDATED (1u << 0)
/**
* XML_VCTXT_USE_PCTXT:
*
* Set if the validation context is part of a parser context.
*/
#define XML_VCTXT_USE_PCTXT (1u << 1)
XML_HIDDEN void
xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
XML_HIDDEN void
__xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
const char *msg, const xmlChar *str1,
const xmlChar *str2) LIBXML_ATTR_FORMAT(3,0);
XML_HIDDEN void
xmlHaltParser(xmlParserCtxtPtr ctxt);
XML_HIDDEN int
xmlParserGrow(xmlParserCtxtPtr ctxt);
XML_HIDDEN void
xmlParserShrink(xmlParserCtxtPtr ctxt);
#endif /* XML_PARSER_H_PRIVATE__ */

View file

@ -0,0 +1,9 @@
#ifndef XML_REGEXP_H_PRIVATE__
#define XML_REGEXP_H_PRIVATE__
#include <libxml/xmlautomata.h>
XML_HIDDEN void
xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
#endif /* XML_REGEXP_H_PRIVATE__ */

View file

@ -0,0 +1,17 @@
#ifndef XML_SAVE_H_PRIVATE__
#define XML_SAVE_H_PRIVATE__
#include <libxml/tree.h>
#include <libxml/xmlversion.h>
#ifdef LIBXML_OUTPUT_ENABLED
XML_HIDDEN void
xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlAttrPtr attr, const xmlChar * string);
XML_HIDDEN void
xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* XML_SAVE_H_PRIVATE__ */

View file

@ -0,0 +1,9 @@
#ifndef XML_STRING_H_PRIVATE__
#define XML_STRING_H_PRIVATE__
#include <libxml/xmlstring.h>
XML_HIDDEN xmlChar *
xmlEscapeFormatString(xmlChar **msg);
#endif /* XML_STRING_H_PRIVATE__ */

View file

@ -0,0 +1,50 @@
#ifndef XML_THREADS_H_PRIVATE__
#define XML_THREADS_H_PRIVATE__
#include <libxml/threads.h>
#ifdef LIBXML_THREAD_ENABLED
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#define HAVE_POSIX_THREADS
#elif defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifndef HAVE_COMPILER_TLS
#include <process.h>
#endif
#define HAVE_WIN32_THREADS
#endif
#endif
/*
* xmlMutex are a simple mutual exception locks
*/
struct _xmlMutex {
#ifdef HAVE_POSIX_THREADS
pthread_mutex_t lock;
#elif defined HAVE_WIN32_THREADS
CRITICAL_SECTION cs;
#else
int empty;
#endif
};
XML_HIDDEN void
__xmlGlobalInitMutexLock(void);
XML_HIDDEN void
__xmlGlobalInitMutexUnlock(void);
XML_HIDDEN void
__xmlGlobalInitMutexDestroy(void);
XML_HIDDEN void
xmlInitThreadsInternal(void);
XML_HIDDEN void
xmlCleanupThreadsInternal(void);
XML_HIDDEN void
xmlInitMutex(xmlMutexPtr mutex);
XML_HIDDEN void
xmlCleanupMutex(xmlMutexPtr mutex);
#endif /* XML_THREADS_H_PRIVATE__ */

View file

@ -0,0 +1,18 @@
#ifndef XML_TREE_H_PRIVATE__
#define XML_TREE_H_PRIVATE__
/*
* Internal variable indicating if a callback has been registered for
* node creation/destruction. It avoids spending a lot of time in locking
* function while checking if the callback exists.
*/
XML_HIDDEN extern int
__xmlRegisterCallbacks;
XML_HIDDEN xmlNodePtr
xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
int extended);
XML_HIDDEN xmlNodePtr
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
#endif /* XML_TREE_H_PRIVATE__ */

View file

@ -0,0 +1,9 @@
#ifndef XML_INCLUDE_H_PRIVATE__
#define XML_INCLUDE_H_PRIVATE__
#include <libxml/xinclude.h>
XML_HIDDEN int
xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode);
#endif /* XML_INCLUDE_H_PRIVATE__ */

View file

@ -0,0 +1,7 @@
#ifndef XML_XPATH_H_PRIVATE__
#define XML_XPATH_H_PRIVATE__
XML_HIDDEN void
xmlInitXPathInternal(void);
#endif /* XML_XPATH_H_PRIVATE__ */

View file

@ -1,9 +1,6 @@
#ifndef __LIBXML_WIN32_CONFIG__
#define __LIBXML_WIN32_CONFIG__
#define SEND_ARG2_CAST
#define GETHOSTBYNAME_ARG_CAST
#define HAVE_SYS_STAT_H
#define HAVE_STAT
#define HAVE_FCNTL_H
@ -12,16 +9,16 @@
#include <direct.h>
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_STDINT_H
#define HAVE_STDINT_H
#endif
#if defined(_MSC_VER)
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if _MSC_VER < 1500
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
#endif
#endif
#endif /* __LIBXML_WIN32_CONFIG__ */

View file

@ -14,103 +14,49 @@
* Do not add any #include directives above this block.
*/
#ifndef NO_LARGEFILE_SOURCE
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#endif
/*
* Currently supported platforms use either autoconf or
* copy to config.h own "preset" configuration file.
* As result ifdef HAVE_CONFIG_H is omitted here.
* These files are generated by the build system and contain private
* and public build configuration.
*/
#include "win32config.h"
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
/*
* Due to some Autotools limitations, this variable must be passed as
* compiler flag. Define a default value if the macro wasn't set by the
* build system.
*/
#ifndef SYSCONFDIR
#define SYSCONFDIR "/etc"
#endif
#if defined(__Lynx__)
#include <stdio.h> /* pull definition of size_t */
#include <varargs.h>
int snprintf(char *, size_t, const char *, ...);
int vfprintf(FILE *, const char *, va_list);
#ifdef WITH_TRIO
#define TRIO_REPLACE_STDIO
#include "trio.h"
#endif
#ifndef WITH_TRIO
#include <stdio.h>
#if !defined(_WIN32) && \
!defined(__CYGWIN__) && \
(defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 4)))
#define XML_HIDDEN __attribute__((visibility("hidden")))
#else
/**
* TRIO_REPLACE_STDIO:
*
* This macro is defined if the trio string formatting functions are to
* be used instead of the default stdio ones.
*/
#define TRIO_REPLACE_STDIO
#include "trio.h"
#endif
#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
#define XML_IGNORE_PEDANTIC_WARNINGS \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")
#define XML_POP_WARNINGS \
_Pragma("GCC diagnostic pop")
#else
#define XML_IGNORE_PEDANTIC_WARNINGS
#define XML_POP_WARNINGS
#define XML_HIDDEN
#endif
#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 8))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#else
#define ATTRIBUTE_NO_SANITIZE(arg)
#define ATTRIBUTE_NO_SANITIZE(arg)
#endif
/*
* Internal variable indicating if a callback has been registered for
* node creation/destruction. It avoids spending a lot of time in locking
* function while checking if the callback exists.
*/
extern int __xmlRegisterCallbacks;
/*
* internal error reporting routines, shared but not part of the API.
*/
void __xmlIOErr(int domain, int code, const char *extra);
void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0);
#ifdef LIBXML_HTML_ENABLED
/*
* internal function of HTML parser needed for xmlParseInNodeContext
* but not part of the API
*/
void __htmlParseContent(void *ctx);
#endif
/*
* internal global initialization critical section routines.
*/
void __xmlGlobalInitMutexLock(void);
void __xmlGlobalInitMutexUnlock(void);
void __xmlGlobalInitMutexDestroy(void);
int __xmlInitializeDict(void);
/*
* internal thread safe random function
*/
int __xmlRandom(void);
XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
int xmlInputReadCallbackNop(void *context, char *buffer, int len);
#if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC)
# define LIBXML_STATIC
#endif
#endif /* ! __XML_LIBXML_H__ */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2039,22 +2039,12 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
#endif /* if 0 ------------------------------------------------------- */
if (match) {
final = step.flags & XML_STREAM_STEP_FINAL;
if (desc) {
if (final) {
ret = 1;
} else {
/* descending match create a new state */
xmlStreamCtxtAddState(stream, stepNr + 1,
stream->level + 1);
}
} else {
if (final) {
ret = 1;
} else {
xmlStreamCtxtAddState(stream, stepNr + 1,
stream->level + 1);
}
}
if (final) {
ret = 1;
} else {
xmlStreamCtxtAddState(stream, stepNr + 1,
stream->level + 1);
}
if ((ret != 1) && (step.flags & XML_STREAM_STEP_IN_SET)) {
/*
* Check if we have a special case like "foo/bar//.", where
@ -2207,7 +2197,7 @@ stream_next:
int
xmlStreamPush(xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *ns) {
return (xmlStreamPushInternal(stream, name, ns, (int) XML_ELEMENT_NODE));
return (xmlStreamPushInternal(stream, name, ns, XML_ELEMENT_NODE));
}
/**
@ -2257,7 +2247,7 @@ xmlStreamPushNode(xmlStreamCtxtPtr stream,
int
xmlStreamPushAttr(xmlStreamCtxtPtr stream,
const xmlChar *name, const xmlChar *ns) {
return (xmlStreamPushInternal(stream, name, ns, (int) XML_ATTRIBUTE_NODE));
return (xmlStreamPushInternal(stream, name, ns, XML_ATTRIBUTE_NODE));
}
/**

View file

@ -34,6 +34,10 @@
#include <libxml/xmlregexp.h>
#include <libxml/xmlschemastypes.h>
#include "private/error.h"
#include "private/regexp.h"
#include "private/string.h"
/*
* The Relax-NG namespace
*/
@ -2875,10 +2879,6 @@ xmlRelaxNGCleanupTypes(void)
* *
************************************************************************/
/* from automata.c but not exported */
void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGDefinePtr def);
@ -7987,12 +7987,7 @@ xmlRelaxNGValidateCompiledCallback(xmlRegExecCtxtPtr exec ATTRIBUTE_UNUSED,
ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
return;
}
if ((ctxt == NULL) || (define == NULL)) {
fprintf(stderr, "callback on %s missing info\n", token);
if ((ctxt != NULL) && (ctxt->errNo == XML_RELAXNG_OK))
ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
return;
} else if (define->type != XML_RELAXNG_ELEMENT) {
if (define->type != XML_RELAXNG_ELEMENT) {
fprintf(stderr, "callback on %s define is not element\n", token);
if (ctxt->errNo == XML_RELAXNG_OK)
ctxt->errNo = XML_RELAXNG_ERR_INTERNAL;
@ -8588,7 +8583,7 @@ xmlRelaxNGNormalize(xmlRelaxNGValidCtxtPtr ctxt, const xmlChar * str)
tmp++;
len = tmp - str;
ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic(len + 1);
if (ret == NULL) {
xmlRngVErrMemory(ctxt, "validating\n");
return (NULL);

View file

@ -16,37 +16,50 @@
#include <libxml/threads.h>
#include <libxml/globals.h>
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#elif defined HAVE_WIN32_THREADS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifndef HAVE_COMPILER_TLS
#include <process.h>
#endif
#endif
#ifdef HAVE_BEOS_THREADS
#include <OS.h>
#include <TLS.h>
#endif
#if defined(SOLARIS)
#include <note.h>
#endif
#include "private/dict.h"
#include "private/threads.h"
/* #define DEBUG_THREADS */
#ifdef HAVE_PTHREAD_H
#if defined(HAVE_POSIX_THREADS) && \
defined(__GLIBC__) && \
__GLIBC__ * 100 + __GLIBC_MINOR__ >= 234
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \
defined(__GLIBC__) && defined(__linux__)
/*
* The modern way available since glibc 2.32.
*
* The check above is for glibc 2.34 which merged the pthread symbols into
* libc. Since we still allow linking without pthread symbols (see below),
* this only works if pthread symbols are guaranteed to be available.
*/
static int libxml_is_threaded = -1;
#include <sys/single_threaded.h>
#define XML_PTHREAD_WEAK
#define XML_IS_THREADED() (!__libc_single_threaded)
#define XML_IS_NEVER_THREADED() 0
#elif defined(HAVE_POSIX_THREADS) && \
defined(__GLIBC__) && \
defined(__GNUC__)
/*
* The traditional way to check for single-threaded applications with
* glibc was to check whether the separate libpthread library is
* linked in. This works by not linking libxml2 with libpthread (see
* BASE_THREAD_LIBS in configure.ac and Makefile.am) and declaring
* pthread functions as weak symbols.
*
* In glibc 2.34, the pthread symbols were moved from libpthread to libc,
* so this doesn't work anymore.
*
* At some point, this legacy code and the BASE_THREAD_LIBS hack in
* configure.ac can probably be removed.
*/
#pragma weak pthread_once
#pragma weak pthread_getspecific
#pragma weak pthread_setspecific
#pragma weak pthread_key_create
@ -64,13 +77,18 @@ static int libxml_is_threaded = -1;
#pragma weak pthread_key_delete
#pragma weak pthread_cond_signal
#else /* __GNUC__, __GLIBC__, __linux__ */
#define XML_PTHREAD_WEAK
#define XML_IS_THREADED() libxml_is_threaded
#define XML_IS_NEVER_THREADED() (!libxml_is_threaded)
static int libxml_is_threaded = 1;
static int libxml_is_threaded = -1;
#endif /* __GNUC__, __GLIBC__, __linux__ */
#else /* other POSIX platforms */
#endif /* HAVE_PTHREAD_H */
#define XML_IS_THREADED() 1
#define XML_IS_NEVER_THREADED() 0
#endif
/*
* TODO: this module still uses malloc/free and not xmlMalloc/xmlFree
@ -78,27 +96,11 @@ static int libxml_is_threaded = 1;
* be hosted on allocated blocks needing them for the allocation ...
*/
/*
* xmlMutex are a simple mutual exception locks
*/
struct _xmlMutex {
#ifdef HAVE_PTHREAD_H
pthread_mutex_t lock;
#elif defined HAVE_WIN32_THREADS
CRITICAL_SECTION cs;
#elif defined HAVE_BEOS_THREADS
sem_id sem;
thread_id tid;
#else
int empty;
#endif
};
/*
* xmlRMutex are reentrant mutual exception locks
*/
struct _xmlRMutex {
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
pthread_mutex_t lock;
unsigned int held;
unsigned int waiters;
@ -106,10 +108,6 @@ struct _xmlRMutex {
pthread_cond_t cv;
#elif defined HAVE_WIN32_THREADS
CRITICAL_SECTION cs;
#elif defined HAVE_BEOS_THREADS
xmlMutexPtr lock;
thread_id tid;
int32 count;
#else
int empty;
#endif
@ -121,11 +119,9 @@ struct _xmlRMutex {
* - globalkey used for per-thread data
*/
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
static pthread_key_t globalkey;
static pthread_t mainthread;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
#elif defined HAVE_WIN32_THREADS
#if defined(HAVE_COMPILER_TLS)
@ -135,26 +131,29 @@ static __declspec(thread) int tlstate_inited = 0;
static DWORD globalkey = TLS_OUT_OF_INDEXES;
#endif /* HAVE_COMPILER_TLS */
static DWORD mainthread;
static struct {
DWORD done;
LONG control;
} run_once = { 0, 0};
static volatile LPCRITICAL_SECTION global_init_lock = NULL;
/* endif HAVE_WIN32_THREADS */
#elif defined HAVE_BEOS_THREADS
int32 globalkey = 0;
thread_id mainthread = 0;
int32 run_once_init = 0;
static int32 global_init_lock = -1;
static vint32 global_init_count = 0;
#endif
static xmlRMutexPtr xmlLibraryLock = NULL;
#ifdef LIBXML_THREAD_ENABLED
static void xmlOnceInit(void);
/**
* xmlInitMutex:
* @mutex: the mutex
*
* Initialize a mutex.
*/
void
xmlInitMutex(xmlMutexPtr mutex)
{
#ifdef HAVE_POSIX_THREADS
if (XML_IS_NEVER_THREADED() == 0)
pthread_mutex_init(&mutex->lock, NULL);
#elif defined HAVE_WIN32_THREADS
InitializeCriticalSection(&mutex->cs);
#else
(void) mutex;
#endif
}
/**
* xmlNewMutex:
@ -171,27 +170,34 @@ xmlNewMutex(void)
if ((tok = malloc(sizeof(xmlMutex))) == NULL)
return (NULL);
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0)
pthread_mutex_init(&tok->lock, NULL);
#elif defined HAVE_WIN32_THREADS
InitializeCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) {
free(tok);
return NULL;
}
tok->tid = -1;
#endif
xmlInitMutex(tok);
return (tok);
}
/**
* xmlCleanupMutex:
* @mutex: the simple mutex
*
* Reclaim resources associated with a mutex.
*/
void
xmlCleanupMutex(xmlMutexPtr mutex)
{
#ifdef HAVE_POSIX_THREADS
if (XML_IS_NEVER_THREADED() == 0)
pthread_mutex_destroy(&mutex->lock);
#elif defined HAVE_WIN32_THREADS
DeleteCriticalSection(&mutex->cs);
#else
(void) mutex;
#endif
}
/**
* xmlFreeMutex:
* @tok: the simple mutex
*
* xmlFreeMutex() is used to reclaim resources associated with a libxml2 token
* struct.
* Free a mutex.
*/
void
xmlFreeMutex(xmlMutexPtr tok)
@ -199,14 +205,7 @@ xmlFreeMutex(xmlMutexPtr tok)
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0)
pthread_mutex_destroy(&tok->lock);
#elif defined HAVE_WIN32_THREADS
DeleteCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
delete_sem(tok->sem);
#endif
xmlCleanupMutex(tok);
free(tok);
}
@ -221,19 +220,15 @@ xmlMutexLock(xmlMutexPtr tok)
{
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0)
#ifdef HAVE_POSIX_THREADS
/*
* This assumes that __libc_single_threaded won't change while the
* lock is held.
*/
if (XML_IS_THREADED() != 0)
pthread_mutex_lock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
EnterCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if (acquire_sem(tok->sem) != B_NO_ERROR) {
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlMutexLock():BeOS:Couldn't acquire semaphore\n");
#endif
}
tok->tid = find_thread(NULL);
#endif
}
@ -249,16 +244,11 @@ xmlMutexUnlock(xmlMutexPtr tok)
{
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0)
#ifdef HAVE_POSIX_THREADS
if (XML_IS_THREADED() != 0)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
LeaveCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if (tok->tid == find_thread(NULL)) {
tok->tid = -1;
release_sem(tok->sem);
}
#endif
}
@ -279,8 +269,8 @@ xmlNewRMutex(void)
if ((tok = malloc(sizeof(xmlRMutex))) == NULL)
return (NULL);
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0) {
#ifdef HAVE_POSIX_THREADS
if (XML_IS_NEVER_THREADED() == 0) {
pthread_mutex_init(&tok->lock, NULL);
tok->held = 0;
tok->waiters = 0;
@ -288,12 +278,6 @@ xmlNewRMutex(void)
}
#elif defined HAVE_WIN32_THREADS
InitializeCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if ((tok->lock = xmlNewMutex()) == NULL) {
free(tok);
return NULL;
}
tok->count = 0;
#endif
return (tok);
}
@ -310,15 +294,13 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
{
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0) {
#ifdef HAVE_POSIX_THREADS
if (XML_IS_NEVER_THREADED() == 0) {
pthread_mutex_destroy(&tok->lock);
pthread_cond_destroy(&tok->cv);
}
#elif defined HAVE_WIN32_THREADS
DeleteCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
xmlFreeMutex(tok->lock);
#endif
free(tok);
}
@ -334,8 +316,8 @@ xmlRMutexLock(xmlRMutexPtr tok)
{
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded == 0)
#ifdef HAVE_POSIX_THREADS
if (XML_IS_THREADED() == 0)
return;
pthread_mutex_lock(&tok->lock);
@ -356,14 +338,6 @@ xmlRMutexLock(xmlRMutexPtr tok)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
EnterCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if (tok->lock->tid == find_thread(NULL)) {
tok->count++;
return;
} else {
xmlMutexLock(tok->lock);
tok->count = 1;
}
#endif
}
@ -378,8 +352,8 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
{
if (tok == NULL)
return;
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded == 0)
#ifdef HAVE_POSIX_THREADS
if (XML_IS_THREADED() == 0)
return;
pthread_mutex_lock(&tok->lock);
@ -392,14 +366,6 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
pthread_mutex_unlock(&tok->lock);
#elif defined HAVE_WIN32_THREADS
LeaveCriticalSection(&tok->cs);
#elif defined HAVE_BEOS_THREADS
if (tok->lock->tid == find_thread(NULL)) {
tok->count--;
if (tok->count == 0) {
xmlMutexUnlock(tok->lock);
}
return;
}
#endif
}
@ -413,12 +379,15 @@ void
__xmlGlobalInitMutexLock(void)
{
/* Make sure the global init lock is initialized and then lock it. */
#ifdef HAVE_PTHREAD_H
/* The mutex is statically initialized, so we just lock it. */
#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (pthread_mutex_lock == NULL)
return;
#endif /* XML_PTHREAD_WEAK */
#else
if (XML_IS_THREADED() == 0)
return;
#endif
/* The mutex is statically initialized, so we just lock it. */
pthread_mutex_lock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS
LPCRITICAL_SECTION cs;
@ -453,52 +422,25 @@ __xmlGlobalInitMutexLock(void)
/* Lock the chosen critical section */
EnterCriticalSection(global_init_lock);
#elif defined HAVE_BEOS_THREADS
int32 sem;
/* Allocate a new semaphore */
sem = create_sem(1, "xmlGlobalinitMutex");
while (global_init_lock == -1) {
if (atomic_add(&global_init_count, 1) == 0) {
global_init_lock = sem;
} else {
snooze(1);
atomic_add(&global_init_count, -1);
}
}
/* If another thread successfully recorded its critical
* section in the global_init_lock then discard the one
* allocated by this thread. */
if (global_init_lock != sem)
delete_sem(sem);
/* Acquire the chosen semaphore */
if (acquire_sem(global_init_lock) != B_NO_ERROR) {
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
#endif
}
#endif
}
void
__xmlGlobalInitMutexUnlock(void)
{
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (pthread_mutex_unlock == NULL)
if (pthread_mutex_lock == NULL)
return;
#endif /* XML_PTHREAD_WEAK */
#else
if (XML_IS_THREADED() == 0)
return;
#endif
pthread_mutex_unlock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) {
LeaveCriticalSection(global_init_lock);
}
#elif defined HAVE_BEOS_THREADS
release_sem(global_init_lock);
#endif
}
@ -511,7 +453,7 @@ __xmlGlobalInitMutexUnlock(void)
void
__xmlGlobalInitMutexDestroy(void)
{
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
#elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) {
DeleteCriticalSection(global_init_lock);
@ -576,7 +518,7 @@ xmlNewGlobalState(void)
}
#endif /* LIBXML_THREAD_ENABLED */
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
#elif defined HAVE_WIN32_THREADS
#if !defined(HAVE_COMPILER_TLS)
#if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
@ -585,7 +527,7 @@ typedef struct _xmlGlobalStateCleanupHelperParams {
void *memory;
} xmlGlobalStateCleanupHelperParams;
static void XMLCDECL
static void
xmlGlobalStateCleanupHelper(void *p)
{
xmlGlobalStateCleanupHelperParams *params =
@ -611,27 +553,11 @@ static CRITICAL_SECTION cleanup_helpers_cs;
#endif /* HAVE_COMPILER_TLS */
#endif /* HAVE_WIN32_THREADS */
#if defined HAVE_BEOS_THREADS
/**
* xmlGlobalStateCleanup:
* @data: unused parameter
*
* Used for Beos only
*/
void
xmlGlobalStateCleanup(void *data)
{
void *globalval = tls_get(globalkey);
if (globalval != NULL)
xmlFreeGlobalState(globalval);
}
#endif
/**
* xmlGetGlobalState:
*
* DEPRECATED: Internal function, do not use.
*
* xmlGetGlobalState() is called to retrieve the global state for a thread.
*
* Returns the thread global state or NULL in case of error
@ -639,14 +565,12 @@ xmlGlobalStateCleanup(void *data)
xmlGlobalStatePtr
xmlGetGlobalState(void)
{
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
xmlGlobalState *globalval;
if (libxml_is_threaded == 0)
if (XML_IS_THREADED() == 0)
return (NULL);
pthread_once(&once_control, xmlOnceInit);
if ((globalval = (xmlGlobalState *)
pthread_getspecific(globalkey)) == NULL) {
xmlGlobalState *tsd = xmlNewGlobalState();
@ -667,8 +591,6 @@ xmlGetGlobalState(void)
#else /* HAVE_COMPILER_TLS */
xmlGlobalState *globalval;
xmlGlobalStateCleanupHelperParams *p;
xmlOnceInit();
#if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
globalval = (xmlGlobalState *) TlsGetValue(globalkey);
#else
@ -711,21 +633,6 @@ xmlGetGlobalState(void)
}
return (globalval);
#endif /* HAVE_COMPILER_TLS */
#elif defined HAVE_BEOS_THREADS
xmlGlobalState *globalval;
xmlOnceInit();
if ((globalval = (xmlGlobalState *) tls_get(globalkey)) == NULL) {
xmlGlobalState *tsd = xmlNewGlobalState();
if (tsd == NULL)
return (NULL);
tls_set(globalkey, tsd);
on_exit_thread(xmlGlobalStateCleanup, NULL);
return (tsd);
}
return (globalval);
#else
return (NULL);
#endif
@ -740,6 +647,8 @@ xmlGetGlobalState(void)
/**
* xmlGetThreadId:
*
* DEPRECATED: Internal function, do not use.
*
* xmlGetThreadId() find the current thread ID number
* Note that this is likely to be broken on some platforms using pthreads
* as the specification doesn't mandate pthread_t to be an integer type
@ -749,11 +658,11 @@ xmlGetGlobalState(void)
int
xmlGetThreadId(void)
{
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
pthread_t id;
int ret;
if (libxml_is_threaded == 0)
if (XML_IS_THREADED() == 0)
return (0);
id = pthread_self();
/* horrible but preserves compat, see warning above */
@ -761,8 +670,6 @@ xmlGetThreadId(void)
return (ret);
#elif defined HAVE_WIN32_THREADS
return GetCurrentThreadId();
#elif defined HAVE_BEOS_THREADS
return find_thread(NULL);
#else
return ((int) 0);
#endif
@ -771,6 +678,8 @@ xmlGetThreadId(void)
/**
* xmlIsMainThread:
*
* DEPRECATED: Internal function, do not use.
*
* xmlIsMainThread() check whether the current thread is the main thread.
*
* Returns 1 if the current thread is the main thread, 0 otherwise
@ -778,27 +687,17 @@ xmlGetThreadId(void)
int
xmlIsMainThread(void)
{
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded == -1)
xmlInitThreads();
if (libxml_is_threaded == 0)
return (1);
pthread_once(&once_control, xmlOnceInit);
#elif defined HAVE_WIN32_THREADS
xmlOnceInit();
#elif defined HAVE_BEOS_THREADS
xmlOnceInit();
#endif
xmlInitParser();
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlIsMainThread()\n");
#endif
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
if (XML_IS_THREADED() == 0)
return (1);
return (pthread_equal(mainthread,pthread_self()));
#elif defined HAVE_WIN32_THREADS
return (mainthread == GetCurrentThreadId());
#elif defined HAVE_BEOS_THREADS
return (mainthread == find_thread(NULL));
#else
return (1);
#endif
@ -837,19 +736,31 @@ xmlUnlockLibrary(void)
/**
* xmlInitThreads:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* initialize the library.
*
* xmlInitThreads() is used to to initialize all the thread related
* data of the libxml2 library.
* DEPRECATED: Alias for xmlInitParser.
*/
void
xmlInitThreads(void)
{
#ifdef HAVE_PTHREAD_H
xmlInitParser();
}
/**
* xmlInitThreadsInternal:
*
* Used to to initialize all the thread related data.
*/
void
xmlInitThreadsInternal(void)
{
#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (libxml_is_threaded == -1) {
if ((pthread_once != NULL) &&
/*
* This is somewhat unreliable since libpthread could be loaded
* later with dlopen() and threads could be created. But it's
* long-standing behavior and hard to work around.
*/
if (libxml_is_threaded == -1)
libxml_is_threaded =
(pthread_getspecific != NULL) &&
(pthread_setspecific != NULL) &&
(pthread_key_create != NULL) &&
@ -861,51 +772,56 @@ xmlInitThreads(void)
(pthread_cond_init != NULL) &&
(pthread_cond_destroy != NULL) &&
(pthread_cond_wait != NULL) &&
(pthread_equal != NULL) &&
/*
* pthread_equal can be inline, resuting in -Waddress warnings.
* Let's assume it's available if all the other functions are.
*/
/* (pthread_equal != NULL) && */
(pthread_self != NULL) &&
(pthread_cond_signal != NULL)) {
libxml_is_threaded = 1;
/* fprintf(stderr, "Running multithreaded\n"); */
} else {
/* fprintf(stderr, "Running without multithread\n"); */
libxml_is_threaded = 0;
}
}
(pthread_cond_signal != NULL);
if (libxml_is_threaded == 0)
return;
#endif /* XML_PTHREAD_WEAK */
pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
#elif defined(HAVE_WIN32_THREADS)
#if !defined(HAVE_COMPILER_TLS)
#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
InitializeCriticalSection(&cleanup_helpers_cs);
#endif
globalkey = TlsAlloc();
#endif
mainthread = GetCurrentThreadId();
#endif
}
/**
* xmlCleanupThreads:
*
* DEPRECATED: This function will be made private. Call xmlCleanupParser
* DEPRECATED: This function is a no-op. Call xmlCleanupParser
* to free global state but see the warnings there. xmlCleanupParser
* should be only called once at program exit. In most cases, you don't
* have call cleanup functions at all.
*
* xmlCleanupThreads() is used to to cleanup all the thread related
* data of the libxml2 library once processing has ended.
*
* WARNING: if your application is multithreaded or has plugin support
* calling this may crash the application if another thread or
* a plugin is still using libxml2. It's sometimes very hard to
* guess if libxml2 is in use in the application, some libraries
* or plugins may use it without notice. In case of doubt abstain
* from calling this function or do it just before calling exit()
* to avoid leak reports from valgrind !
*/
void
xmlCleanupThreads(void)
{
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n");
#endif
#ifdef HAVE_PTHREAD_H
if (libxml_is_threaded != 0)
pthread_key_delete(globalkey);
once_control = once_control_init;
}
/**
* xmlCleanupThreadsInternal:
*
* Used to to cleanup all the thread related data.
*/
void
xmlCleanupThreadsInternal(void)
{
#ifdef HAVE_POSIX_THREADS
#ifdef XML_PTHREAD_WEAK
if (libxml_is_threaded == 0)
return;
#endif /* XML_PTHREAD_WEAK */
pthread_key_delete(globalkey);
#elif defined(HAVE_WIN32_THREADS)
#if !defined(HAVE_COMPILER_TLS)
if (globalkey != TLS_OUT_OF_INDEXES) {
@ -931,60 +847,9 @@ xmlCleanupThreads(void)
DeleteCriticalSection(&cleanup_helpers_cs);
#endif
#endif
run_once.done = 0;
run_once.control = 0;
#endif
}
#ifdef LIBXML_THREAD_ENABLED
/**
* xmlOnceInit
*
* xmlOnceInit() is used to initialize the value of mainthread for use
* in other routines. This function should only be called using
* pthread_once() in association with the once_control variable to ensure
* that the function is only called once. See man pthread_once for more
* details.
*/
static void
xmlOnceInit(void)
{
#ifdef HAVE_PTHREAD_H
(void) pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
__xmlInitializeDict();
#elif defined(HAVE_WIN32_THREADS)
if (!run_once.done) {
if (InterlockedIncrement(&run_once.control) == 1) {
#if !defined(HAVE_COMPILER_TLS)
#if !defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)
InitializeCriticalSection(&cleanup_helpers_cs);
#endif
globalkey = TlsAlloc();
#endif
mainthread = GetCurrentThreadId();
__xmlInitializeDict();
run_once.done = 1;
} else {
/* Another thread is working; give up our slice and
* wait until they're done. */
while (!run_once.done)
Sleep(0);
}
}
#elif defined HAVE_BEOS_THREADS
if (atomic_add(&run_once_init, 1) == 0) {
globalkey = tls_allocate();
tls_set(globalkey, NULL);
mainthread = find_thread(NULL);
__xmlInitializeDict();
} else
atomic_add(&run_once_init, -1);
#endif
}
#endif
/**
* DllMain:
* @hinstDLL: handle to DLL instance
@ -996,10 +861,10 @@ xmlOnceInit(void)
*
* Returns TRUE always
*/
#ifdef HAVE_PTHREAD_H
#ifdef HAVE_POSIX_THREADS
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL
int
xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason,
ATTRIBUTE_UNUSED void *lpvReserved)
#else

View file

@ -44,8 +44,10 @@
#include <libxml/debugXML.h>
#endif
#include "buf.h"
#include "save.h"
#include "private/buf.h"
#include "private/entities.h"
#include "private/error.h"
#include "private/tree.h"
int __xmlRegisterCallbacks = 0;
@ -1214,11 +1216,6 @@ xmlFreeDoc(xmlDocPtr cur) {
#endif
return;
}
#ifdef LIBXML_DEBUG_RUNTIME
#ifdef LIBXML_DEBUG_ENABLED
xmlDebugCheckDocument(stderr, cur);
#endif
#endif
if (cur != NULL) dict = cur->dict;
@ -1414,14 +1411,21 @@ xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
if (val != NULL) xmlFree(val);
goto out;
}
else if ((ent != NULL) && (ent->children == NULL)) {
else if ((ent != NULL) &&
((ent->flags & XML_ENT_PARSED) == 0) &&
((ent->flags & XML_ENT_EXPANDING) == 0)) {
xmlNodePtr temp;
/* Set to non-NULL value to avoid recursion. */
ent->children = (xmlNodePtr) -1;
/*
* The entity should have been checked already,
* but set the flag anyway to avoid recursion.
*/
ent->flags |= XML_ENT_EXPANDING;
ent->children = xmlStringGetNodeList(doc,
(const xmlChar*)node->content);
ent->owner = 1;
ent->flags &= ~XML_ENT_EXPANDING;
ent->flags |= XML_ENT_PARSED;
temp = ent->children;
while (temp) {
temp->parent = (xmlNodePtr)ent;
@ -1493,9 +1497,9 @@ out:
*/
xmlNodePtr
xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
xmlNodePtr ret = NULL, last = NULL;
xmlNodePtr ret = NULL, head = NULL, last = NULL;
xmlNodePtr node;
xmlChar *val;
xmlChar *val = NULL;
const xmlChar *cur = value;
const xmlChar *q;
xmlEntityPtr ent;
@ -1593,14 +1597,12 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
*/
if (!xmlBufIsEmpty(buf)) {
node = xmlNewDocText(doc, NULL);
if (node == NULL) {
if (val != NULL) xmlFree(val);
goto out;
}
if (node == NULL)
goto out;
node->content = xmlBufDetach(buf);
if (last == NULL) {
last = ret = node;
last = head = node;
} else {
last = xmlAddNextSibling(last, node);
}
@ -1610,18 +1612,23 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
* Create a new REFERENCE_REF node
*/
node = xmlNewReference(doc, val);
if (node == NULL) {
if (val != NULL) xmlFree(val);
if (node == NULL)
goto out;
}
else if ((ent != NULL) && (ent->children == NULL)) {
if ((ent != NULL) &&
((ent->flags & XML_ENT_PARSED) == 0) &&
((ent->flags & XML_ENT_EXPANDING) == 0)) {
xmlNodePtr temp;
/* Set to non-NULL value to avoid recursion. */
ent->children = (xmlNodePtr) -1;
/*
* The entity should have been checked already,
* but set the flag anyway to avoid recursion.
*/
ent->flags |= XML_ENT_EXPANDING;
ent->children = xmlStringGetNodeList(doc,
(const xmlChar*)node->content);
ent->owner = 1;
ent->flags &= ~XML_ENT_EXPANDING;
ent->flags |= XML_ENT_PARSED;
temp = ent->children;
while (temp) {
temp->parent = (xmlNodePtr)ent;
@ -1630,12 +1637,13 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
}
}
if (last == NULL) {
last = ret = node;
last = head = node;
} else {
last = xmlAddNextSibling(last, node);
}
}
xmlFree(val);
val = NULL;
}
cur++;
q = cur;
@ -1654,7 +1662,7 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
} else
cur++;
}
if ((cur != q) || (ret == NULL)) {
if ((cur != q) || (head == NULL)) {
/*
* Handle the last piece of text.
*/
@ -1663,21 +1671,24 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
if (!xmlBufIsEmpty(buf)) {
node = xmlNewDocText(doc, NULL);
if (node == NULL) {
xmlBufFree(buf);
return(NULL);
}
if (node == NULL)
goto out;
node->content = xmlBufDetach(buf);
if (last == NULL) {
ret = node;
head = node;
} else {
xmlAddNextSibling(last, node);
}
}
ret = head;
head = NULL;
out:
xmlBufFree(buf);
if (val != NULL) xmlFree(val);
if (head != NULL) xmlFreeNodeList(head);
return(ret);
}
@ -1863,7 +1874,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) {
if ((eatname == 1) &&
((node->doc == NULL) ||
((node->doc == NULL) || (node->doc->dict == NULL) ||
(!(xmlDictOwns(node->doc->dict, name)))))
xmlFree((xmlChar *) name);
return (NULL);
@ -1876,6 +1887,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
if (cur == NULL) {
if ((eatname == 1) &&
((node == NULL) || (node->doc == NULL) ||
(node->doc->dict == NULL) ||
(!(xmlDictOwns(node->doc->dict, name)))))
xmlFree((xmlChar *) name);
xmlTreeErrMemory("building attribute");
@ -2386,8 +2398,9 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns,
}
} else {
/* if name don't come from the doc dictionary free it here */
if ((name != NULL) && (doc != NULL) &&
(!(xmlDictOwns(doc->dict, name))))
if ((name != NULL) &&
((doc == NULL) || (doc->dict == NULL) ||
(!(xmlDictOwns(doc->dict, name)))))
xmlFree(name);
}
return(cur);
@ -4077,6 +4090,10 @@ xmlCopyNamespaceList(xmlNsPtr cur) {
while (cur != NULL) {
q = xmlCopyNamespace(cur);
if (q == NULL) {
xmlFreeNsList(ret);
return(NULL);
}
if (p == NULL) {
ret = p = q;
} else {
@ -4088,9 +4105,6 @@ xmlCopyNamespaceList(xmlNsPtr cur) {
return(ret);
}
static xmlNodePtr
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
static xmlAttrPtr
xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
xmlAttrPtr ret;
@ -4221,8 +4235,10 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
return(NULL);
while (cur != NULL) {
q = xmlCopyProp(target, cur);
if (q == NULL)
if (q == NULL) {
xmlFreePropList(ret);
return(NULL);
}
if (p == NULL) {
ret = p = q;
} else {
@ -4254,7 +4270,7 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
* namespace info, but don't recurse on children.
*/
static xmlNodePtr
xmlNodePtr
xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
int extended) {
xmlNodePtr ret;
@ -4453,7 +4469,7 @@ out:
return(ret);
}
static xmlNodePtr
xmlNodePtr
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
xmlNodePtr ret = NULL;
xmlNodePtr p = NULL,q;
@ -4467,7 +4483,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
}
if (doc->intSubset == NULL) {
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
if (q == NULL) return(NULL);
if (q == NULL) goto error;
q->doc = doc;
q->parent = parent;
doc->intSubset = (xmlDtdPtr) q;
@ -4479,7 +4495,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
} else
#endif /* LIBXML_TREE_ENABLED */
q = xmlStaticCopyNode(node, doc, parent, 1);
if (q == NULL) return(NULL);
if (q == NULL) goto error;
if (ret == NULL) {
q->prev = NULL;
ret = p = q;
@ -4492,6 +4508,9 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
node = node->next;
}
return(ret);
error:
xmlFreeNodeList(ret);
return(NULL);
}
/**
@ -4808,12 +4827,12 @@ xmlGetNodePath(const xmlNode *node)
return (NULL);
buf_len = 500;
buffer = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
buffer = (xmlChar *) xmlMallocAtomic(buf_len);
if (buffer == NULL) {
xmlTreeErrMemory("getting node path");
return (NULL);
}
buf = (xmlChar *) xmlMallocAtomic(buf_len * sizeof(xmlChar));
buf = (xmlChar *) xmlMallocAtomic(buf_len);
if (buf == NULL) {
xmlTreeErrMemory("getting node path");
xmlFree(buffer);
@ -6019,7 +6038,7 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
int nbns = 0;
int maxns = 10;
int maxns = 0;
int i;
if ((node == NULL) || (node->type == XML_NAMESPACE_DECL))
@ -6029,16 +6048,6 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
if (node->type == XML_ELEMENT_NODE) {
cur = node->nsDef;
while (cur != NULL) {
if (ret == NULL) {
ret =
(xmlNsPtr *) xmlMalloc((maxns + 1) *
sizeof(xmlNsPtr));
if (ret == NULL) {
xmlTreeErrMemory("getting namespace list");
return (NULL);
}
ret[nbns] = NULL;
}
for (i = 0; i < nbns; i++) {
if ((cur->prefix == ret[i]->prefix) ||
(xmlStrEqual(cur->prefix, ret[i]->prefix)))
@ -6046,15 +6055,18 @@ xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
}
if (i >= nbns) {
if (nbns >= maxns) {
maxns *= 2;
ret = (xmlNsPtr *) xmlRealloc(ret,
(maxns +
1) *
xmlNsPtr *tmp;
maxns = maxns ? maxns * 2 : 10;
tmp = (xmlNsPtr *) xmlRealloc(ret,
(maxns + 1) *
sizeof(xmlNsPtr));
if (ret == NULL) {
if (tmp == NULL) {
xmlTreeErrMemory("getting namespace list");
xmlFree(ret);
return (NULL);
}
ret = tmp;
}
ret[nbns++] = cur;
ret[nbns] = NULL;
@ -7146,7 +7158,7 @@ xmlBufferCreate(void) {
ret->use = 0;
ret->size = xmlDefaultBufferSize;
ret->alloc = xmlBufferAllocScheme;
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlTreeErrMemory("creating buffer");
xmlFree(ret);
@ -7179,7 +7191,7 @@ xmlBufferCreateSize(size_t size) {
ret->alloc = xmlBufferAllocScheme;
ret->size = (size ? size + 1 : 0); /* +1 for ending null */
if (ret->size){
ret->content = (xmlChar *) xmlMallocAtomic(ret->size * sizeof(xmlChar));
ret->content = (xmlChar *) xmlMallocAtomic(ret->size);
if (ret->content == NULL) {
xmlTreeErrMemory("creating buffer");
xmlFree(ret);
@ -7208,8 +7220,6 @@ xmlBufferDetach(xmlBufferPtr buf) {
if (buf == NULL)
return(NULL);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)
return(NULL);
ret = buf->content;
buf->content = NULL;
@ -7225,31 +7235,14 @@ xmlBufferDetach(xmlBufferPtr buf) {
* @mem: the memory area
* @size: the size in byte
*
* routine to create an XML buffer from an immutable memory area.
* The area won't be modified nor copied, and is expected to be
* present until the end of the buffer lifetime.
*
* returns the new structure.
* Create an XML buffer initialized with bytes.
*/
xmlBufferPtr
xmlBufferCreateStatic(void *mem, size_t size) {
xmlBufferPtr ret;
xmlBufferPtr buf = xmlBufferCreateSize(size);
if ((mem == NULL) || (size == 0))
return(NULL);
if (size > UINT_MAX)
return(NULL);
ret = (xmlBufferPtr) xmlMalloc(sizeof(xmlBuffer));
if (ret == NULL) {
xmlTreeErrMemory("creating buffer");
return(NULL);
}
ret->use = size;
ret->size = size;
ret->alloc = XML_BUFFER_ALLOC_IMMUTABLE;
ret->content = (xmlChar *) mem;
return(ret);
xmlBufferAdd(buf, mem, size);
return(buf);
}
/**
@ -7269,12 +7262,10 @@ xmlBufferSetAllocationScheme(xmlBufferPtr buf,
#endif
return;
}
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
(buf->alloc == XML_BUFFER_ALLOC_IO)) return;
if (buf->alloc == XML_BUFFER_ALLOC_IO) return;
if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
(scheme == XML_BUFFER_ALLOC_EXACT) ||
(scheme == XML_BUFFER_ALLOC_HYBRID) ||
(scheme == XML_BUFFER_ALLOC_IMMUTABLE))
(scheme == XML_BUFFER_ALLOC_HYBRID))
buf->alloc = scheme;
}
@ -7298,8 +7289,7 @@ xmlBufferFree(xmlBufferPtr buf) {
if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
(buf->contentIO != NULL)) {
xmlFree(buf->contentIO);
} else if ((buf->content != NULL) &&
(buf->alloc != XML_BUFFER_ALLOC_IMMUTABLE)) {
} else if (buf->content != NULL) {
xmlFree(buf->content);
}
xmlFree(buf);
@ -7316,10 +7306,7 @@ xmlBufferEmpty(xmlBufferPtr buf) {
if (buf == NULL) return;
if (buf->content == NULL) return;
buf->use = 0;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) {
buf->content = BAD_CAST "";
} else if ((buf->alloc == XML_BUFFER_ALLOC_IO) &&
(buf->contentIO != NULL)) {
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
size_t start_buf = buf->content - buf->contentIO;
buf->size += start_buf;
@ -7346,8 +7333,7 @@ xmlBufferShrink(xmlBufferPtr buf, unsigned int len) {
if (len > buf->use) return(-1);
buf->use -= len;
if ((buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) ||
((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL))) {
if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
/*
* we just move the content pointer, but also make sure
* the perceived buffer size has shrunk accordingly
@ -7391,7 +7377,6 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) {
if (buf == NULL) return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
if (len < buf->size - buf->use)
return(0);
if (len >= UINT_MAX - buf->use) {
@ -7456,8 +7441,8 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
}
if (file == NULL)
file = stdout;
ret = fwrite(buf->content, sizeof(xmlChar), buf->use, file);
return(ret > INT_MAX ? INT_MAX : (int)ret);
ret = fwrite(buf->content, 1, buf->use, file);
return(ret > INT_MAX ? INT_MAX : ret);
}
/**
@ -7515,8 +7500,6 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
if (buf == NULL)
return(0);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
/* Don't resize if we don't have to */
if (size < buf->size)
return 1;
@ -7634,7 +7617,6 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
if ((str == NULL) || (buf == NULL)) {
return -1;
}
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (len < -1) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
@ -7663,7 +7645,7 @@ xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) {
}
}
memmove(&buf->content[buf->use], str, len*sizeof(xmlChar));
memmove(&buf->content[buf->use], str, len);
buf->use += len;
buf->content[buf->use] = 0;
return 0;
@ -7687,7 +7669,6 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) {
if (buf == NULL)
return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (str == NULL) {
#ifdef DEBUG_BUFFER
xmlGenericError(xmlGenericErrorContext,
@ -7758,7 +7739,6 @@ int
xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) {
if (buf == NULL)
return(-1);
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1;
if (str == NULL) return -1;
return xmlBufferAdd(buf, str, -1);
}
@ -7790,7 +7770,6 @@ void
xmlBufferWriteCHAR(xmlBufferPtr buf, const xmlChar *string) {
if (buf == NULL)
return;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
xmlBufferCat(buf, string);
}
@ -7806,7 +7785,6 @@ void
xmlBufferWriteChar(xmlBufferPtr buf, const char *string) {
if (buf == NULL)
return;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
xmlBufferCCat(buf, string);
}
@ -7825,7 +7803,6 @@ xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
const xmlChar *cur, *base;
if (buf == NULL)
return;
if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return;
if (xmlStrchr(string, '\"')) {
if (xmlStrchr(string, '\'')) {
#ifdef DEBUG_BUFFER
@ -10248,3 +10225,48 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
return (0);
}
/************************************************************************
* *
* XHTML detection *
* *
************************************************************************/
#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Strict//EN"
#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Frameset//EN"
#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Transitional//EN"
#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
/**
* xmlIsXHTML:
* @systemID: the system identifier
* @publicID: the public identifier
*
* Try to find if the document correspond to an XHTML DTD
*
* Returns 1 if true, 0 if not and -1 in case of error
*/
int
xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
if ((systemID == NULL) && (publicID == NULL))
return(-1);
if (publicID != NULL) {
if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
}
if (systemID != NULL) {
if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
}
return(0);
}

View file

@ -19,6 +19,8 @@
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include "private/error.h"
/**
* MAX_URI_LENGTH:
*
@ -33,6 +35,9 @@
*/
#define MAX_URI_LENGTH 1024 * 1024
#define PORT_EMPTY 0
#define PORT_EMPTY_SERVER -1
static void
xmlURIErrMemory(const char *extra)
{
@ -768,8 +773,11 @@ xmlParse3986HierPart(xmlURIPtr uri, const char **str)
cur += 2;
ret = xmlParse3986Authority(uri, &cur);
if (ret != 0) return(ret);
if (uri->server == NULL)
uri->port = -1;
/*
* An empty server is marked with a special URI value.
*/
if ((uri->server == NULL) && (uri->port == PORT_EMPTY))
uri->port = PORT_EMPTY_SERVER;
ret = xmlParse3986PathAbEmpty(uri, &cur);
if (ret != 0) return(ret);
*str = cur;
@ -1026,6 +1034,7 @@ xmlCreateURI(void) {
return(NULL);
}
memset(ret, 0, sizeof(xmlURI));
ret->port = PORT_EMPTY;
return(ret);
}
@ -1074,7 +1083,7 @@ xmlSaveUri(xmlURIPtr uri) {
max = 80;
ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic(max + 1);
if (ret == NULL) {
xmlURIErrMemory("saving URI\n");
return(NULL);
@ -1117,7 +1126,7 @@ xmlSaveUri(xmlURIPtr uri) {
}
}
} else {
if ((uri->server != NULL) || (uri->port == -1)) {
if ((uri->server != NULL) || (uri->port != PORT_EMPTY)) {
if (len + 3 >= max) {
temp = xmlSaveUriRealloc(ret, &max);
if (temp == NULL) goto mem_error;
@ -1162,17 +1171,18 @@ xmlSaveUri(xmlURIPtr uri) {
if (temp == NULL) goto mem_error;
ret = temp;
}
ret[len++] = *p++;
}
if (uri->port > 0) {
if (len + 10 >= max) {
temp = xmlSaveUriRealloc(ret, &max);
if (temp == NULL) goto mem_error;
ret = temp;
}
len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
/* TODO: escaping? */
ret[len++] = (xmlChar) *p++;
}
}
if (uri->port > 0) {
if (len + 10 >= max) {
temp = xmlSaveUriRealloc(ret, &max);
if (temp == NULL) goto mem_error;
ret = temp;
}
len += snprintf((char *) &ret[len], max - len, ":%d", uri->port);
}
} else if (uri->authority != NULL) {
if (len + 3 >= max) {
temp = xmlSaveUriRealloc(ret, &max);
@ -1655,6 +1665,7 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
c = c * 16 + (*in - 'A') + 10;
in++;
len -= 3;
/* Explicit sign change */
*out++ = (char) c;
} else {
*out++ = *in++;
@ -1670,8 +1681,8 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
* @str: string to escape
* @list: exception list string of chars not to escape
*
* This routine escapes a string to hex, ignoring reserved characters (a-z)
* and the characters in the exception list.
* This routine escapes a string to hex, ignoring reserved characters
* (a-z, A-Z, 0-9, "@-_.!~*'()") and the characters in the exception list.
*
* Returns a new escaped string or NULL in case of error.
*/
@ -1817,10 +1828,10 @@ xmlURIEscape(const xmlChar * str)
xmlFree(segment);
}
if (uri->port) {
xmlChar port[10];
if (uri->port > 0) {
xmlChar port[11];
snprintf((char *) port, 10, "%d", uri->port);
snprintf((char *) port, 11, "%d", uri->port);
ret = xmlStrcat(ret, BAD_CAST ":");
ret = xmlStrcat(ret, port);
}
@ -1966,12 +1977,13 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
if (res == NULL)
goto done;
if ((ref->scheme == NULL) && (ref->path == NULL) &&
((ref->authority == NULL) && (ref->server == NULL))) {
((ref->authority == NULL) && (ref->server == NULL) &&
(ref->port == PORT_EMPTY))) {
if (bas->scheme != NULL)
res->scheme = xmlMemStrdup(bas->scheme);
if (bas->authority != NULL)
res->authority = xmlMemStrdup(bas->authority);
else if ((bas->server != NULL) || (bas->port == -1)) {
else {
if (bas->server != NULL)
res->server = xmlMemStrdup(bas->server);
if (bas->user != NULL)
@ -2020,11 +2032,13 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
* component, which will also be undefined if the URI scheme does not
* use an authority component.
*/
if ((ref->authority != NULL) || (ref->server != NULL)) {
if ((ref->authority != NULL) || (ref->server != NULL) ||
(ref->port != PORT_EMPTY)) {
if (ref->authority != NULL)
res->authority = xmlMemStrdup(ref->authority);
else {
res->server = xmlMemStrdup(ref->server);
if (ref->server != NULL)
res->server = xmlMemStrdup(ref->server);
if (ref->user != NULL)
res->user = xmlMemStrdup(ref->user);
res->port = ref->port;
@ -2035,7 +2049,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
}
if (bas->authority != NULL)
res->authority = xmlMemStrdup(bas->authority);
else if ((bas->server != NULL) || (bas->port == -1)) {
else if ((bas->server != NULL) || (bas->port != PORT_EMPTY)) {
if (bas->server != NULL)
res->server = xmlMemStrdup(bas->server);
if (bas->user != NULL)
@ -2105,7 +2119,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) {
/*
* Ensure the path includes a '/'
*/
if ((out == 0) && (bas->server != NULL))
if ((out == 0) && ((bas->server != NULL) || bas->port != PORT_EMPTY))
res->path[out++] = '/';
while (ref->path[indx] != 0) {
res->path[out++] = ref->path[indx++];
@ -2223,7 +2237,8 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
if ((ref->scheme != NULL) &&
((bas->scheme == NULL) ||
(xmlStrcmp ((xmlChar *)bas->scheme, (xmlChar *)ref->scheme)) ||
(xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server)))) {
(xmlStrcmp ((xmlChar *)bas->server, (xmlChar *)ref->server)) ||
(bas->port != ref->port))) {
val = xmlStrdup (URI);
goto done;
}

View file

@ -23,8 +23,12 @@
#include <libxml/list.h>
#include <libxml/globals.h>
static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
int create);
#include "private/error.h"
#include "private/parser.h"
static xmlElementPtr
xmlGetDtdElementDesc2(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
int create);
/* #define DEBUG_VALID_ALGO */
/* #define DEBUG_REGEXP_ALGO */
@ -64,9 +68,7 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra)
/* Look up flag to detect if it is part of a parsing
context */
if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
long delta = (char *) ctxt - (char *) ctxt->userData;
if ((delta > 0) && (delta < 250))
pctxt = ctxt->userData;
pctxt = ctxt->userData;
}
}
if (extra)
@ -103,9 +105,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
/* Look up flag to detect if it is part of a parsing
context */
if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
long delta = (char *) ctxt - (char *) ctxt->userData;
if ((delta > 0) && (delta < 250))
pctxt = ctxt->userData;
pctxt = ctxt->userData;
}
}
if (extra)
@ -149,9 +149,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
/* Look up flag to detect if it is part of a parsing
context */
if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
long delta = (char *) ctxt - (char *) ctxt->userData;
if ((delta > 0) && (delta < 250))
pctxt = ctxt->userData;
pctxt = ctxt->userData;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@ -191,9 +189,7 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
/* Look up flag to detect if it is part of a parsing
context */
if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
long delta = (char *) ctxt - (char *) ctxt->userData;
if ((delta > 0) && (delta < 250))
pctxt = ctxt->userData;
pctxt = ctxt->userData;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@ -231,9 +227,7 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
/* Look up flag to detect if it is part of a parsing
context */
if (ctxt->flags & XML_VCTXT_USE_PCTXT) {
long delta = (char *) ctxt - (char *) ctxt->userData;
if ((delta > 0) && (delta < 250))
pctxt = ctxt->userData;
pctxt = ctxt->userData;
}
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
@ -832,7 +826,7 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
xmlSnprintfElementContent(expr, 5000, elem->content, 1);
xmlErrValidNode(ctxt, (xmlNodePtr) elem,
XML_DTD_CONTENT_NOT_DETERMINIST,
"Content model of %s is not determinist: %s\n",
"Content model of %s is not deterministic: %s\n",
elem->name, BAD_CAST expr, NULL);
#ifdef DEBUG_REGEXP_ALGO
xmlRegexpPrint(stderr, elem->contModel);
@ -885,6 +879,8 @@ xmlValidCtxtPtr xmlNewValidCtxt(void) {
*/
void
xmlFreeValidCtxt(xmlValidCtxtPtr cur) {
if (cur == NULL)
return;
if (cur->vstateTab != NULL)
xmlFree(cur->vstateTab);
if (cur->nodeTab != NULL)
@ -2120,7 +2116,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt,
* Validity Check:
* Multiple ID per element
*/
elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
elemDef = xmlGetDtdElementDesc2(ctxt, dtd, elem, 1);
if (elemDef != NULL) {
#ifdef LIBXML_VALID_ENABLED
@ -3284,7 +3280,8 @@ xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) {
*/
static xmlElementPtr
xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
xmlGetDtdElementDesc2(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
int create) {
xmlElementTablePtr table;
xmlElementPtr cur;
xmlChar *uqname = NULL, *prefix = NULL;
@ -3307,7 +3304,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
dtd->elements = (void *) table;
}
if (table == NULL) {
xmlVErrMemory(NULL, "element table allocation failed");
xmlVErrMemory(ctxt, "element table allocation failed");
return(NULL);
}
}
@ -3320,8 +3317,8 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
if ((cur == NULL) && (create)) {
cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement));
if (cur == NULL) {
xmlVErrMemory(NULL, "malloc failed");
return(NULL);
xmlVErrMemory(ctxt, "malloc failed");
goto error;
}
memset(cur, 0, sizeof(xmlElement));
cur->type = XML_ELEMENT_DECL;
@ -3333,8 +3330,13 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) {
cur->prefix = xmlStrdup(prefix);
cur->etype = XML_ELEMENT_TYPE_UNDEFINED;
xmlHashAddEntry2(table, name, prefix, cur);
if (xmlHashAddEntry2(table, name, prefix, cur) < 0) {
xmlVErrMemory(ctxt, "adding entry failed");
xmlFreeElement(cur);
cur = NULL;
}
}
error:
if (prefix != NULL) xmlFree(prefix);
if (uqname != NULL) xmlFree(uqname);
return(cur);
@ -4903,6 +4905,7 @@ cont:
*/
if ((CONT != NULL) &&
((CONT->parent == NULL) ||
(CONT->parent == (xmlElementContentPtr) 1) ||
(CONT->parent->type != XML_ELEMENT_CONTENT_OR)) &&
((CONT->ocur == XML_ELEMENT_CONTENT_MULT) ||
(CONT->ocur == XML_ELEMENT_CONTENT_OPT) ||
@ -5015,7 +5018,7 @@ cont:
* save the second branch 'or' branch
*/
DEBUG_VALID_MSG("saving 'or' branch");
if (vstateVPush(ctxt, CONT->c2, NODE, (unsigned char)(DEPTH + 1),
if (vstateVPush(ctxt, CONT->c2, NODE, DEPTH + 1,
OCCURS, ROLLBACK_OR) < 0)
return(-1);
DEPTH++;
@ -5155,7 +5158,8 @@ analyze:
* Then act accordingly at the parent level
*/
RESET_OCCURRENCE;
if (CONT->parent == NULL)
if ((CONT->parent == NULL) ||
(CONT->parent == (xmlElementContentPtr) 1))
break;
switch (CONT->parent->type) {
@ -5437,9 +5441,13 @@ fail:
STATE = 0;
ret = xmlValidateElementType(ctxt);
if ((ret == -3) && (warn)) {
xmlErrValidWarning(ctxt, child, XML_DTD_CONTENT_NOT_DETERMINIST,
"Content model for Element %s is ambiguous\n",
name, NULL, NULL);
char expr[5000];
expr[0] = 0;
xmlSnprintfElementContent(expr, 5000, elemDecl->content, 1);
xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl,
XML_DTD_CONTENT_NOT_DETERMINIST,
"Content model of %s is not deterministic: %s\n",
name, BAD_CAST expr, NULL);
} else if (ret == -2) {
/*
* An entities reference appeared at this level.
@ -5660,6 +5668,7 @@ done:
return(ret);
}
#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlValidateCheckMixed:
* @ctxt: the validation context
@ -5725,6 +5734,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt,
}
return(0);
}
#endif /* LIBXML_REGEXP_ENABLED */
/**
* xmlValidGetElemDecl:
@ -5989,11 +5999,12 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
if (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT) {
if (state->exec != NULL) {
ret = xmlRegExecPushString(state->exec, NULL, NULL);
if (ret == 0) {
if (ret <= 0) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_CONTENT_MODEL,
"Element %s content does not follow the DTD, Expecting more child\n",
"Element %s content does not follow the DTD, Expecting more children\n",
state->node->name, NULL,NULL);
ret = 0;
} else {
/*
* previous validation errors should not generate
@ -6457,60 +6468,60 @@ name_ok:
*/
int
xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
xmlNodePtr child;
xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr root) {
xmlNodePtr elem;
xmlAttrPtr attr;
xmlNsPtr ns;
const xmlChar *value;
int ret = 1;
if (elem == NULL) return(0);
/*
* XInclude elements were added after parsing in the infoset,
* they don't really mean anything validation wise.
*/
if ((elem->type == XML_XINCLUDE_START) ||
(elem->type == XML_XINCLUDE_END) ||
(elem->type == XML_NAMESPACE_DECL))
return(1);
if (root == NULL) return(0);
CHECK_DTD;
/*
* Entities references have to be handled separately
*/
if (elem->type == XML_ENTITY_REF_NODE) {
return(1);
}
ret &= xmlValidateOneElement(ctxt, doc, elem);
if (elem->type == XML_ELEMENT_NODE) {
attr = elem->properties;
while (attr != NULL) {
value = xmlNodeListGetString(doc, attr->children, 0);
ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
if (value != NULL)
xmlFree((char *)value);
attr= attr->next;
}
ns = elem->nsDef;
while (ns != NULL) {
if (elem->ns == NULL)
ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
ns, ns->href);
else
ret &= xmlValidateOneNamespace(ctxt, doc, elem,
elem->ns->prefix, ns, ns->href);
ns = ns->next;
}
}
child = elem->children;
while (child != NULL) {
ret &= xmlValidateElement(ctxt, doc, child);
child = child->next;
elem = root;
while (1) {
ret &= xmlValidateOneElement(ctxt, doc, elem);
if (elem->type == XML_ELEMENT_NODE) {
attr = elem->properties;
while (attr != NULL) {
value = xmlNodeListGetString(doc, attr->children, 0);
ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
if (value != NULL)
xmlFree((char *)value);
attr= attr->next;
}
ns = elem->nsDef;
while (ns != NULL) {
if (elem->ns == NULL)
ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
ns, ns->href);
else
ret &= xmlValidateOneNamespace(ctxt, doc, elem,
elem->ns->prefix, ns,
ns->href);
ns = ns->next;
}
if (elem->children != NULL) {
elem = elem->children;
continue;
}
}
while (1) {
if (elem == root)
goto done;
if (elem->next != NULL)
break;
elem = elem->parent;
}
elem = elem->next;
}
done:
return(ret);
}

File diff suppressed because it is too large Load diff

View file

@ -15,9 +15,6 @@
#include <stdlib.h>
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@ -66,8 +63,11 @@
#endif
#include <libxml/globals.h>
#include "buf.h"
#include "enc.h"
#include "private/buf.h"
#include "private/enc.h"
#include "private/error.h"
#include "private/io.h"
#include "private/parser.h"
/* #define VERBOSE_FAILURE */
/* #define DEBUG_EXTERNAL_ENTITIES */
@ -111,9 +111,6 @@ typedef struct _xmlOutputCallback {
static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK];
static int xmlOutputCallbackNr = 0;
static int xmlOutputCallbackInitialized = 0;
xmlOutputBufferPtr
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
#endif /* LIBXML_OUTPUT_ENABLED */
/************************************************************************
@ -719,20 +716,6 @@ xmlCheckFilename (const char *path)
return 1;
}
/**
* xmlInputReadCallbackNop:
*
* No Operation xmlInputReadCallback function, does nothing.
*
* Returns zero
*/
int
xmlInputReadCallbackNop(void *context ATTRIBUTE_UNUSED,
char *buffer ATTRIBUTE_UNUSED,
int len ATTRIBUTE_UNUSED) {
return(0);
}
/**
* xmlFdRead:
* @context: the I/O context
@ -1266,7 +1249,7 @@ xmlGzfileClose (void * context) {
* I/O for compressed file accesses *
* *
************************************************************************/
#include "xzlib.h"
#include "private/xzlib.h"
/**
* xmlXzfileMatch:
* @filename: the URI for matching
@ -2035,8 +2018,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
xmlGenericError( xmlGenericErrorContext,
"Transmitted content saved in file: %s\n", buffer );
fwrite( http_content, sizeof( char ),
content_lgth, tst_file );
fwrite( http_content, 1, content_lgth, tst_file );
fclose( tst_file );
}
@ -2050,7 +2032,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
while ( (avail = xmlNanoHTTPRead( http_ctxt,
buffer, sizeof( buffer ) )) > 0 ) {
fwrite( buffer, sizeof( char ), avail, tst_file );
fwrite( buffer, 1, avail, tst_file );
}
fclose( tst_file );
@ -2346,7 +2328,7 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) {
xmlIOErrMemory("creating input buffer");
return(NULL);
}
memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
memset(ret, 0, sizeof(xmlParserInputBuffer));
ret->buffer = xmlBufCreateSize(2 * xmlDefaultBufferSize);
if (ret->buffer == NULL) {
xmlFree(ret);
@ -2385,7 +2367,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
@ -2433,7 +2415,7 @@ xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) {
xmlIOErrMemory("creating output buffer");
return(NULL);
}
memset(ret, 0, (size_t) sizeof(xmlOutputBuffer));
memset(ret, 0, sizeof(xmlOutputBuffer));
ret->buffer = xmlBufCreate();
if (ret->buffer == NULL) {
xmlFree(ret);
@ -2950,11 +2932,11 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
ret->context = (void *) mem;
ret->readcallback = xmlInputReadCallbackNop;
ret->readcallback = NULL;
ret->closecallback = NULL;
errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size);
if (errcode != 0) {
xmlFree(ret);
xmlFreeParserInputBuffer(ret);
return(NULL);
}
}
@ -2968,43 +2950,14 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
* @size: the length of the memory block
* @enc: the charset encoding if known
*
* Create a buffered parser input for the progressive parsing for the input
* from an immutable memory area. This will not copy the memory area to
* the buffer, but the memory is expected to be available until the end of
* the parsing, this is useful for example when using mmap'ed file.
* DEPRECATED: Use xmlParserInputBufferCreateMem.
*
* Returns the new parser input or NULL
*/
xmlParserInputBufferPtr
xmlParserInputBufferCreateStatic(const char *mem, int size,
xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
if (size < 0) return(NULL);
if (mem == NULL) return(NULL);
ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer));
if (ret == NULL) {
xmlIOErrMemory("creating input buffer");
return(NULL);
}
memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer));
ret->buffer = xmlBufCreateStatic((void *)mem, (size_t) size);
if (ret->buffer == NULL) {
xmlFree(ret);
return(NULL);
}
ret->encoder = xmlGetCharEncodingHandler(enc);
if (ret->encoder != NULL)
ret->raw = xmlBufCreateSize(2 * xmlDefaultBufferSize);
else
ret->raw = NULL;
ret->compressed = -1;
ret->context = (void *) mem;
ret->readcallback = NULL;
ret->closecallback = NULL;
return(ret);
return(xmlParserInputBufferCreateMem(mem, size, enc));
}
#ifdef LIBXML_OUTPUT_ENABLED
@ -3159,7 +3112,7 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
if (len < 0) return(0);
if ((in == NULL) || (in->error)) return(-1);
if (in->encoder != NULL) {
unsigned int use;
size_t use, consumed;
/*
* Store the data in the incoming raw buffer
@ -3181,7 +3134,12 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in,
in->error = XML_IO_ENCODER;
return(-1);
}
in->rawconsumed += (use - xmlBufUse(in->raw));
consumed = use - xmlBufUse(in->raw);
if ((consumed > ULONG_MAX) ||
(in->rawconsumed > ULONG_MAX - (unsigned long)consumed))
in->rawconsumed = ULONG_MAX;
else
in->rawconsumed += consumed;
} else {
nbchars = len;
ret = xmlBufAdd(in->buffer, (xmlChar *) buf, nbchars);
@ -3226,41 +3184,42 @@ endOfInput (void * context ATTRIBUTE_UNUSED,
*/
int
xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
char *buffer = NULL;
xmlBufPtr buf;
int res = 0;
int nbchars = 0;
if ((in == NULL) || (in->error)) return(-1);
if ((len <= MINLEN) && (len != 4))
len = MINLEN;
if (xmlBufAvail(in->buffer) <= 0) {
xmlIOErr(XML_IO_BUFFER_FULL, NULL);
in->error = XML_IO_BUFFER_FULL;
return(-1);
if (in->encoder == NULL) {
if (in->readcallback == NULL)
return(0);
buf = in->buffer;
} else {
if (in->raw == NULL) {
in->raw = xmlBufCreate();
}
buf = in->raw;
}
if (xmlBufGrow(in->buffer, len + 1) < 0) {
xmlIOErrMemory("growing input buffer");
in->error = XML_ERR_NO_MEMORY;
return(-1);
}
buffer = (char *)xmlBufEnd(in->buffer);
/*
* Call the read method for this I/O type.
*/
if (in->readcallback != NULL) {
res = in->readcallback(in->context, &buffer[0], len);
if (xmlBufGrow(buf, len + 1) < 0) {
xmlIOErrMemory("growing input buffer");
in->error = XML_ERR_NO_MEMORY;
return(-1);
}
res = in->readcallback(in->context, (char *)xmlBufEnd(buf), len);
if (res <= 0)
in->readcallback = endOfInput;
} else {
xmlIOErr(XML_IO_NO_INPUT, NULL);
in->error = XML_IO_NO_INPUT;
return(-1);
}
if (res < 0) {
return(-1);
if (res < 0)
return(-1);
if (xmlBufAddLen(buf, res) < 0)
return(-1);
}
/*
@ -3273,41 +3232,32 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
#endif
}
len = res;
if (in->encoder != NULL) {
unsigned int use;
/*
* Store the data in the incoming raw buffer
*/
if (in->raw == NULL) {
in->raw = xmlBufCreate();
}
res = xmlBufAdd(in->raw, (const xmlChar *) buffer, len);
if (res != 0)
return(-1);
size_t use, consumed;
/*
* convert as much as possible to the parser reading buffer.
*/
use = xmlBufUse(in->raw);
nbchars = xmlCharEncInput(in, 1);
if (nbchars < 0) {
use = xmlBufUse(buf);
res = xmlCharEncInput(in, 1);
if (res < 0) {
xmlIOErr(XML_IO_ENCODER, NULL);
in->error = XML_IO_ENCODER;
return(-1);
}
in->rawconsumed += (use - xmlBufUse(in->raw));
} else {
nbchars = len;
xmlBufAddLen(in->buffer, nbchars);
consumed = use - xmlBufUse(buf);
if ((consumed > ULONG_MAX) ||
(in->rawconsumed > ULONG_MAX - (unsigned long)consumed))
in->rawconsumed = ULONG_MAX;
else
in->rawconsumed += consumed;
}
#ifdef DEBUG_INPUT
xmlGenericError(xmlGenericErrorContext,
"I/O: read %d chars, buffer %d\n",
nbchars, xmlBufUse(in->buffer));
#endif
return(nbchars);
return(res);
}
/**
@ -3324,13 +3274,7 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) {
*/
int
xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) {
if ((in == NULL) || (in->error)) return(-1);
if (in->readcallback != NULL)
return(xmlParserInputBufferGrow(in, len));
else if (xmlBufGetAllocationScheme(in->buffer) == XML_BUFFER_ALLOC_IMMUTABLE)
return(0);
else
return(-1);
return(xmlParserInputBufferGrow(in, len));
}
#ifdef LIBXML_OUTPUT_ENABLED
@ -3496,7 +3440,7 @@ xmlEscapeContent(unsigned char* out, int *outlen,
*out++ = '3';
*out++ = ';';
} else {
*out++ = (unsigned char) *in;
*out++ = *in;
}
++in;
}
@ -3532,8 +3476,7 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
int cons; /* byte from str consumed */
if ((out == NULL) || (out->error) || (str == NULL) ||
(out->buffer == NULL) ||
(xmlBufGetAllocationScheme(out->buffer) == XML_BUFFER_ALLOC_IMMUTABLE))
(out->buffer == NULL))
return(-1);
len = strlen((const char *)str);
if (len < 0) return(0);

View file

@ -31,11 +31,13 @@
#include <libxml/xmlerror.h>
#include <libxml/threads.h>
static int xmlMemInitialized = 0;
#include "private/memory.h"
#include "private/threads.h"
static unsigned long debugMemSize = 0;
static unsigned long debugMemBlocks = 0;
static unsigned long debugMaxMemSize = 0;
static xmlMutexPtr xmlMemMutex = NULL;
static xmlMutex xmlMemMutex;
void xmlMallocBreakpoint(void);
@ -147,7 +149,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
MEMHDR *p;
void *ret;
if (!xmlMemInitialized) xmlInitMemory();
xmlInitParser();
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d)\n",size);
@ -175,7 +177,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
p->mh_type = MALLOC_TYPE;
p->mh_file = file;
p->mh_line = line;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
p->mh_number = ++block;
debugMemSize += size;
debugMemBlocks++;
@ -183,7 +185,7 @@ xmlMallocLoc(size_t size, const char * file, int line)
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
@ -223,7 +225,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
MEMHDR *p;
void *ret;
if (!xmlMemInitialized) xmlInitMemory();
xmlInitParser();
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"Malloc(%d)\n",size);
@ -251,7 +253,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
p->mh_type = MALLOC_ATOMIC_TYPE;
p->mh_file = file;
p->mh_line = line;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
p->mh_number = ++block;
debugMemSize += size;
debugMemBlocks++;
@ -259,7 +261,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line)
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
@ -320,7 +322,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
if (ptr == NULL)
return(xmlMallocLoc(size, file, line));
if (!xmlMemInitialized) xmlInitMemory();
xmlInitParser();
TEST_POINT
p = CLIENT_2_HDR(ptr);
@ -331,7 +333,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
goto error;
}
p->mh_tag = ~MEMTAG;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
debugMemSize -= p->mh_size;
debugMemBlocks--;
#ifdef DEBUG_MEMORY
@ -340,7 +342,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
#ifdef MEM_LIST
debugmem_list_delete(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
xmlGenericError(xmlGenericErrorContext,
@ -368,14 +370,14 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line)
p->mh_size = size;
p->mh_file = file;
p->mh_line = line;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
debugMemSize += size;
debugMemBlocks++;
if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize;
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
TEST_POINT
@ -446,7 +448,7 @@ xmlMemFree(void *ptr)
if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint();
p->mh_tag = ~MEMTAG;
memset(target, -1, p->mh_size);
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
debugMemSize -= p->mh_size;
debugMemBlocks--;
#ifdef DEBUG_MEMORY
@ -455,7 +457,7 @@ xmlMemFree(void *ptr)
#ifdef MEM_LIST
debugmem_list_delete(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
free(p);
@ -493,7 +495,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
size_t size = strlen(str) + 1;
MEMHDR *p;
if (!xmlMemInitialized) xmlInitMemory();
xmlInitParser();
TEST_POINT
if (size > (MAX_SIZE_T - RESERVE_SIZE)) {
@ -512,7 +514,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
p->mh_type = STRDUP_TYPE;
p->mh_file = file;
p->mh_line = line;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
p->mh_number = ++block;
debugMemSize += size;
debugMemBlocks++;
@ -520,7 +522,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line)
#ifdef MEM_LIST
debugmem_list_add(p);
#endif
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
s = (char *) HDR_2_CLIENT(p);
@ -556,6 +558,27 @@ xmlMemoryStrdup(const char *str) {
return(xmlMemStrdupLoc(str, "none", 0));
}
/**
* xmlMemSize:
* @ptr: pointer to the memory allocation
*
* Returns the size of a memory allocation.
*/
size_t
xmlMemSize(void *ptr) {
MEMHDR *p;
if (ptr == NULL)
return(0);
p = CLIENT_2_HDR(ptr);
if (p->mh_tag != MEMTAG)
return(0);
return(p->mh_size);
}
/**
* xmlMemUsed:
*
@ -566,12 +589,7 @@ xmlMemoryStrdup(const char *str) {
int
xmlMemUsed(void) {
int res;
xmlMutexLock(xmlMemMutex);
res = debugMemSize;
xmlMutexUnlock(xmlMemMutex);
return(res);
return(debugMemSize);
}
/**
@ -586,74 +604,12 @@ int
xmlMemBlocks(void) {
int res;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
res = debugMemBlocks;
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
return(res);
}
#ifdef MEM_LIST
/**
* xmlMemContentShow:
* @fp: a FILE descriptor used as the output file
* @p: a memory block header
*
* tries to show some content from the memory block
*/
static void
xmlMemContentShow(FILE *fp, MEMHDR *p)
{
int i,j,k,len;
const char *buf;
if (p == NULL) {
fprintf(fp, " NULL");
return;
}
len = p->mh_size;
buf = (const char *) HDR_2_CLIENT(p);
for (i = 0;i < len;i++) {
if (buf[i] == 0) break;
if (!isprint((unsigned char) buf[i])) break;
}
if ((i < 4) && ((buf[i] != 0) || (i == 0))) {
if (len >= 4) {
MEMHDR *q;
void *cur;
for (j = 0;(j < len -3) && (j < 40);j += 4) {
cur = *((void **) &buf[j]);
q = CLIENT_2_HDR(cur);
p = memlist;
k = 0;
while (p != NULL) {
if (p == q) break;
p = p->mh_next;
if (k++ > 100) break;
}
if ((p != NULL) && (p == q)) {
fprintf(fp, " pointer to #%lu at index %d",
p->mh_number, j);
return;
}
}
}
} else if ((i == 0) && (buf[i] == 0)) {
fprintf(fp," null");
} else {
if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf);
else {
fprintf(fp," [");
for (j = 0;j < i;j++)
fprintf(fp,"%c", buf[j]);
fprintf(fp,"]");
}
}
}
#endif
/**
* xmlMemDisplayLast:
* @fp: a FILE descriptor used as the output file, if NULL, the result is
@ -688,7 +644,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
nbBytes, debugMemSize, debugMaxMemSize);
fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
idx = 0;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
p = memlist;
while ((p) && (nbBytes > 0)) {
fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
@ -701,7 +657,7 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
default:
fprintf(fp,"Unknown memory block, may be corrupted");
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
if (old_fp == NULL)
fclose(fp);
return;
@ -710,16 +666,12 @@ xmlMemDisplayLast(FILE *fp, long nbBytes)
if (p->mh_tag != MEMTAG)
fprintf(fp," INVALID");
nb++;
if (nb < 100)
xmlMemContentShow(fp, p);
else
fprintf(fp," skip");
fprintf(fp,"\n");
nbBytes -= (unsigned long)p->mh_size;
p = p->mh_next;
}
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
#else
fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
@ -765,7 +717,7 @@ xmlMemDisplay(FILE *fp)
debugMemSize, debugMaxMemSize);
fprintf(fp,"BLOCK NUMBER SIZE TYPE\n");
idx = 0;
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
p = memlist;
while (p) {
fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number,
@ -778,7 +730,7 @@ xmlMemDisplay(FILE *fp)
case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break;
default:
fprintf(fp,"Unknown memory block, may be corrupted");
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
if (old_fp == NULL)
fclose(fp);
return;
@ -787,15 +739,11 @@ xmlMemDisplay(FILE *fp)
if (p->mh_tag != MEMTAG)
fprintf(fp," INVALID");
nb++;
if (nb < 100)
xmlMemContentShow(fp, p);
else
fprintf(fp," skip");
fprintf(fp,"\n");
p = p->mh_next;
}
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
#else
fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n");
#endif
@ -872,7 +820,7 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n",
debugMemSize, debugMaxMemSize);
#ifdef MEM_LIST
xmlMutexLock(xmlMemMutex);
xmlMutexLock(&xmlMemMutex);
if (nr > 0) {
fprintf(fp,"NUMBER SIZE TYPE WHERE\n");
p = memlist;
@ -890,13 +838,12 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED)
fprintf(fp,"%s(%u)", p->mh_file, p->mh_line);
if (p->mh_tag != MEMTAG)
fprintf(fp," INVALID");
xmlMemContentShow(fp, p);
fprintf(fp,"\n");
nr--;
p = p->mh_next;
}
}
xmlMutexUnlock(xmlMemMutex);
xmlMutexUnlock(&xmlMemMutex);
#endif /* MEM_LIST */
}
@ -935,28 +882,29 @@ xmlMemoryDump(void)
/**
* xmlInitMemory:
*
* DEPRECATED: This function will be made private. Call xmlInitParser to
* initialize the library.
* DEPRECATED: Alias for xmlInitParser.
*/
int
xmlInitMemory(void) {
xmlInitParser();
return(0);
}
/**
* xmlInitMemoryInternal:
*
* Initialize the memory layer.
*
* Returns 0 on success
*/
int
xmlInitMemory(void)
{
void
xmlInitMemoryInternal(void) {
char *breakpoint;
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlInitMemory()\n");
#endif
/*
This is really not good code (see Bug 130419). Suggestions for
improvement will be welcome!
*/
if (xmlMemInitialized) return(-1);
xmlMemInitialized = 1;
xmlMemMutex = xmlNewMutex();
xmlInitMutex(&xmlMemMutex);
breakpoint = getenv("XML_MEM_BREAKPOINT");
if (breakpoint != NULL) {
@ -971,32 +919,34 @@ xmlInitMemory(void)
xmlGenericError(xmlGenericErrorContext,
"xmlInitMemory() Ok\n");
#endif
return(0);
}
/**
* xmlCleanupMemory:
*
* DEPRECATED: This function will be made private. Call xmlCleanupParser
* DEPRECATED: This function is a no-op. Call xmlCleanupParser
* to free global state but see the warnings there. xmlCleanupParser
* should be only called once at program exit. In most cases, you don't
* have call cleanup functions at all.
*/
void
xmlCleanupMemory(void) {
}
/**
* xmlCleanupMemoryInternal:
*
* Free up all the memory allocated by the library for its own
* use. This should not be called by user level code.
*/
void
xmlCleanupMemory(void) {
xmlCleanupMemoryInternal(void) {
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlCleanupMemory()\n");
#endif
if (xmlMemInitialized == 0)
return;
xmlFreeMutex(xmlMemMutex);
xmlMemMutex = NULL;
xmlMemInitialized = 0;
xmlCleanupMutex(&xmlMemMutex);
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
"xmlCleanupMemory() Ok\n");

View file

@ -39,7 +39,11 @@
#include <libxml/pattern.h>
#endif
#include "buf.h"
#include "private/buf.h"
#include "private/tree.h"
#ifdef LIBXML_XINCLUDE_ENABLED
#include "private/xinclude.h"
#endif
#define MAX_ERR_MSG_SIZE 64000
@ -536,30 +540,23 @@ xmlTextReaderDebug(xmlTextReaderPtr reader) {
*
* Pushes a new entity reference node on top of the entities stack
*
* Returns 0 in case of error, the index in the stack otherwise
* Returns -1 in case of error, the index in the stack otherwise
*/
static int
xmlTextReaderEntPush(xmlTextReaderPtr reader, xmlNodePtr value)
{
if (reader->entMax <= 0) {
reader->entMax = 10;
reader->entTab = (xmlNodePtr *) xmlMalloc(reader->entMax *
sizeof(reader->entTab[0]));
if (reader->entTab == NULL) {
xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n");
return (0);
}
}
if (reader->entNr >= reader->entMax) {
reader->entMax *= 2;
reader->entTab =
(xmlNodePtr *) xmlRealloc(reader->entTab,
reader->entMax *
sizeof(reader->entTab[0]));
if (reader->entTab == NULL) {
size_t newSize = reader->entMax == 0 ? 10 : reader->entMax * 2;
xmlNodePtr *tmp;
tmp = (xmlNodePtr *) xmlRealloc(reader->entTab,
newSize * sizeof(*tmp));
if (tmp == NULL) {
xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n");
return (0);
return (-1);
}
reader->entTab = tmp;
reader->entMax = newSize;
}
reader->entTab[reader->entNr] = value;
reader->ent = value;
@ -769,7 +766,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
xmlBufPtr inbuf;
int val, s;
xmlTextReaderState oldstate;
int alloc;
if ((reader->input == NULL) || (reader->input->buffer == NULL))
return(-1);
@ -777,7 +773,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
oldstate = reader->state;
reader->state = XML_TEXTREADER_NONE;
inbuf = reader->input->buffer;
alloc = xmlBufGetAllocationScheme(inbuf);
while (reader->state == XML_TEXTREADER_NONE) {
if (xmlBufUse(inbuf) < reader->cur + CHUNK_SIZE) {
@ -787,7 +782,7 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
if (reader->mode != XML_TEXTREADER_MODE_EOF) {
val = xmlParserInputBufferRead(reader->input, 4096);
if ((val == 0) &&
(alloc == XML_BUFFER_ALLOC_IMMUTABLE)) {
(reader->input->readcallback == NULL)) {
if (xmlBufUse(inbuf) == reader->cur) {
reader->mode = XML_TEXTREADER_MODE_EOF;
reader->state = oldstate;
@ -836,7 +831,7 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
* Discard the consumed input when needed and possible
*/
if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) {
if (alloc != XML_BUFFER_ALLOC_IMMUTABLE) {
if (reader->input->readcallback != NULL) {
if ((reader->cur >= 4096) &&
(xmlBufUse(inbuf) - reader->cur <= CHUNK_SIZE)) {
val = xmlBufShrink(inbuf, reader->cur);
@ -1034,7 +1029,11 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
if ((node->children != NULL) &&
(node->children->type == XML_ENTITY_DECL) &&
(node->children->children != NULL)) {
xmlTextReaderEntPush(reader, node);
if (xmlTextReaderEntPush(reader, node) < 0) {
if (node == oldnode)
break;
goto skip_children;
}
node = node->children->children;
continue;
} else {
@ -1453,6 +1452,7 @@ node_found:
reader->xincctxt = xmlXIncludeNewContext(reader->ctxt->myDoc);
xmlXIncludeSetFlags(reader->xincctxt,
reader->parserFlags & (~XML_PARSE_NOXINCNODE));
xmlXIncludeSetStreamingMode(reader->xincctxt, 1);
}
/*
* expand that node and process it
@ -1479,7 +1479,8 @@ node_found:
if ((reader->node->children != NULL) &&
(reader->node->children->type == XML_ENTITY_DECL) &&
(reader->node->children->children != NULL)) {
xmlTextReaderEntPush(reader, reader->node);
if (xmlTextReaderEntPush(reader, reader->node) < 0)
goto get_next_node;
reader->node = reader->node->children->children;
}
#ifdef LIBXML_REGEXP_ENABLED
@ -3613,7 +3614,7 @@ xmlTextReaderQuoteChar(xmlTextReaderPtr reader) {
if (reader == NULL)
return(-1);
/* TODO maybe lookup the attribute value for " first */
return((int) '"');
return('"');
}
/**
@ -5361,8 +5362,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL,
xmlTextReaderPtr reader;
xmlParserInputBufferPtr buf;
buf = xmlParserInputBufferCreateStatic(buffer, size,
XML_CHAR_ENCODING_NONE);
buf = xmlParserInputBufferCreateMem(buffer, size, XML_CHAR_ENCODING_NONE);
if (buf == NULL) {
return (NULL);
}
@ -5588,7 +5588,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size,
if (buffer == NULL)
return (-1);
input = xmlParserInputBufferCreateStatic(buffer, size,
input = xmlParserInputBufferCreateMem(buffer, size,
XML_CHAR_ENCODING_NONE);
if (input == NULL) {
return (-1);

View file

@ -31,6 +31,9 @@
#include <libxml/xmlautomata.h>
#include <libxml/xmlunicode.h>
#include "private/error.h"
#include "private/regexp.h"
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) -1)
#endif
@ -361,8 +364,6 @@ static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint);
static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint,
int neg, int start, int end, const xmlChar *blockName);
void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
/************************************************************************
* *
* Regexp memory error handler *
@ -435,7 +436,8 @@ xmlRegCalloc2(size_t dim1, size_t dim2, size_t elemSize) {
void *ret;
/* Check for overflow */
if (dim1 > SIZE_MAX / dim2 / elemSize)
if ((dim2 == 0) || (elemSize == 0) ||
(dim1 > SIZE_MAX / dim2 / elemSize))
return (NULL);
totalSize = dim1 * dim2 * elemSize;
ret = xmlMalloc(totalSize);
@ -1237,7 +1239,7 @@ xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) {
* *
************************************************************************/
static void
static xmlRegRangePtr
xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
int neg, xmlRegAtomType type, int start, int end,
xmlChar *blockName) {
@ -1245,11 +1247,11 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
if (atom == NULL) {
ERROR("add range: atom is NULL");
return;
return(NULL);
}
if (atom->type != XML_REGEXP_RANGES) {
ERROR("add range: atom is not ranges");
return;
return(NULL);
}
if (atom->maxRanges == 0) {
atom->maxRanges = 4;
@ -1258,7 +1260,7 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
if (atom->ranges == NULL) {
xmlRegexpErrMemory(ctxt, "adding ranges");
atom->maxRanges = 0;
return;
return(NULL);
}
} else if (atom->nbRanges >= atom->maxRanges) {
xmlRegRangePtr *tmp;
@ -1268,16 +1270,17 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom,
if (tmp == NULL) {
xmlRegexpErrMemory(ctxt, "adding ranges");
atom->maxRanges /= 2;
return;
return(NULL);
}
atom->ranges = tmp;
}
range = xmlRegNewRange(ctxt, neg, type, start, end);
if (range == NULL)
return;
return(NULL);
range->blockName = blockName;
atom->ranges[atom->nbRanges++] = range;
return(range);
}
static int
@ -1314,26 +1317,17 @@ xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) {
ERROR("atom push: atom is NULL");
return(-1);
}
if (ctxt->maxAtoms == 0) {
ctxt->maxAtoms = 4;
ctxt->atoms = (xmlRegAtomPtr *) xmlMalloc(ctxt->maxAtoms *
sizeof(xmlRegAtomPtr));
if (ctxt->atoms == NULL) {
xmlRegexpErrMemory(ctxt, "pushing atom");
ctxt->maxAtoms = 0;
return(-1);
}
} else if (ctxt->nbAtoms >= ctxt->maxAtoms) {
if (ctxt->nbAtoms >= ctxt->maxAtoms) {
size_t newSize = ctxt->maxAtoms ? ctxt->maxAtoms * 2 : 4;
xmlRegAtomPtr *tmp;
ctxt->maxAtoms *= 2;
tmp = (xmlRegAtomPtr *) xmlRealloc(ctxt->atoms, ctxt->maxAtoms *
sizeof(xmlRegAtomPtr));
tmp = xmlRealloc(ctxt->atoms, newSize * sizeof(xmlRegAtomPtr));
if (tmp == NULL) {
xmlRegexpErrMemory(ctxt, "allocating counter");
ctxt->maxAtoms /= 2;
return(-1);
}
ctxt->atoms = tmp;
ctxt->maxAtoms = newSize;
}
atom->no = ctxt->nbAtoms;
ctxt->atoms[ctxt->nbAtoms++] = atom;
@ -1447,33 +1441,31 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state,
xmlRegStateAddTransTo(ctxt, target, state->no);
}
static int
xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) {
if (state == NULL) return(-1);
if (ctxt->maxStates == 0) {
ctxt->maxStates = 4;
ctxt->states = (xmlRegStatePtr *) xmlMalloc(ctxt->maxStates *
sizeof(xmlRegStatePtr));
if (ctxt->states == NULL) {
xmlRegexpErrMemory(ctxt, "adding state");
ctxt->maxStates = 0;
return(-1);
}
} else if (ctxt->nbStates >= ctxt->maxStates) {
static xmlRegStatePtr
xmlRegStatePush(xmlRegParserCtxtPtr ctxt) {
xmlRegStatePtr state;
if (ctxt->nbStates >= ctxt->maxStates) {
size_t newSize = ctxt->maxStates ? ctxt->maxStates * 2 : 4;
xmlRegStatePtr *tmp;
ctxt->maxStates *= 2;
tmp = (xmlRegStatePtr *) xmlRealloc(ctxt->states, ctxt->maxStates *
sizeof(xmlRegStatePtr));
tmp = xmlRealloc(ctxt->states, newSize * sizeof(tmp[0]));
if (tmp == NULL) {
xmlRegexpErrMemory(ctxt, "adding state");
ctxt->maxStates /= 2;
return(-1);
return(NULL);
}
ctxt->states = tmp;
ctxt->maxStates = newSize;
}
state = xmlRegNewState(ctxt);
if (state == NULL)
return(NULL);
state->no = ctxt->nbStates;
ctxt->states[ctxt->nbStates++] = state;
return(0);
return(state);
}
/**
@ -1484,19 +1476,21 @@ xmlRegStatePush(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state) {
* @lax:
*
*/
static void
static int
xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt,
xmlRegStatePtr from, xmlRegStatePtr to,
int lax) {
if (to == NULL) {
to = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, to);
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
ctxt->state = to;
}
if (lax)
xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_LAX_COUNTER);
else
xmlRegStateAddTrans(ctxt, from, NULL, to, -1, REGEXP_ALL_COUNTER);
return(0);
}
/**
@ -1506,15 +1500,17 @@ xmlFAGenerateAllTransition(xmlRegParserCtxtPtr ctxt,
* @to: the target state or NULL for building a new one
*
*/
static void
static int
xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt,
xmlRegStatePtr from, xmlRegStatePtr to) {
if (to == NULL) {
to = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, to);
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
ctxt->state = to;
}
xmlRegStateAddTrans(ctxt, from, NULL, to, -1, -1);
return(0);
}
/**
@ -1525,15 +1521,17 @@ xmlFAGenerateEpsilonTransition(xmlRegParserCtxtPtr ctxt,
* counter: the counter for that transition
*
*/
static void
static int
xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt,
xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
if (to == NULL) {
to = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, to);
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
ctxt->state = to;
}
xmlRegStateAddTrans(ctxt, from, NULL, to, counter, -1);
return(0);
}
/**
@ -1544,15 +1542,17 @@ xmlFAGenerateCountedEpsilonTransition(xmlRegParserCtxtPtr ctxt,
* counter: the counter for that transition
*
*/
static void
static int
xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt,
xmlRegStatePtr from, xmlRegStatePtr to, int counter) {
if (to == NULL) {
to = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, to);
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
ctxt->state = to;
}
xmlRegStateAddTrans(ctxt, from, NULL, to, -1, counter);
return(0);
}
/**
@ -1579,9 +1579,6 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
* this is a subexpression handling one should not need to
* create a new node except for XML_REGEXP_QUANT_RANGE.
*/
if (xmlRegAtomPush(ctxt, atom) < 0) {
return(-1);
}
if ((to != NULL) && (atom->stop != to) &&
(atom->quant != XML_REGEXP_QUANT_RANGE)) {
/*
@ -1591,8 +1588,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
#ifdef DV
} else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) &&
(atom->quant != XML_REGEXP_QUANT_ONCE)) {
to = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, to);
to = xmlRegStatePush(ctxt, to);
if (to == NULL)
return(-1);
ctxt->state = to;
xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to);
#endif
@ -1632,8 +1630,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
if (to != NULL) {
newstate = to;
} else {
newstate = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, newstate);
newstate = xmlRegStatePush(ctxt);
if (newstate == NULL)
return(-1);
}
/*
@ -1661,10 +1660,14 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
copy->max = 0;
if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy)
< 0)
< 0) {
xmlRegFreeAtom(copy);
return(-1);
}
inter = ctxt->state;
counter = xmlRegGetCounter(ctxt);
if (counter < 0)
return(-1);
ctxt->counters[counter].min = atom->min - 1;
ctxt->counters[counter].max = atom->max - 1;
/* count the number of times we see it again */
@ -1683,6 +1686,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
* epsilon transition.
*/
counter = xmlRegGetCounter(ctxt);
if (counter < 0)
return(-1);
ctxt->counters[counter].min = atom->min - 1;
ctxt->counters[counter].max = atom->max - 1;
/* allow a way out based on the count */
@ -1705,6 +1710,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
default:
break;
}
if (xmlRegAtomPush(ctxt, atom) < 0)
return(-1);
return(0);
}
if ((atom->min == 0) && (atom->max == 0) &&
@ -1713,12 +1720,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
* we can discard the atom and generate an epsilon transition instead
*/
if (to == NULL) {
to = xmlRegNewState(ctxt);
if (to != NULL)
xmlRegStatePush(ctxt, to);
else {
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
}
}
xmlFAGenerateEpsilonTransition(ctxt, from, to);
ctxt->state = to;
@ -1726,12 +1730,9 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
return(0);
}
if (to == NULL) {
to = xmlRegNewState(ctxt);
if (to != NULL)
xmlRegStatePush(ctxt, to);
else {
to = xmlRegStatePush(ctxt);
if (to == NULL)
return(-1);
}
}
end = to;
if ((atom->quant == XML_REGEXP_QUANT_MULT) ||
@ -1743,18 +1744,12 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
*/
xmlRegStatePtr tmp;
tmp = xmlRegNewState(ctxt);
if (tmp != NULL)
xmlRegStatePush(ctxt, tmp);
else {
tmp = xmlRegStatePush(ctxt);
if (tmp == NULL)
return(-1);
}
xmlFAGenerateEpsilonTransition(ctxt, tmp, to);
to = tmp;
}
if (xmlRegAtomPush(ctxt, atom) < 0) {
return(-1);
}
if ((atom->quant == XML_REGEXP_QUANT_RANGE) &&
(atom->min == 0) && (atom->max > 0)) {
nullable = 1;
@ -1785,6 +1780,8 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from,
default:
break;
}
if (xmlRegAtomPush(ctxt, atom) < 0)
return(-1);
return(0);
}
@ -4892,11 +4889,16 @@ xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) {
}
if (ctxt->atom == NULL) {
ctxt->atom = xmlRegNewAtom(ctxt, type);
if (ctxt->atom != NULL)
ctxt->atom->valuep = blockName;
if (ctxt->atom == NULL) {
xmlFree(blockName);
return;
}
ctxt->atom->valuep = blockName;
} else if (ctxt->atom->type == XML_REGEXP_RANGES) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
type, 0, 0, blockName);
if (xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
type, 0, 0, blockName) == NULL) {
xmlFree(blockName);
}
}
}
@ -5500,8 +5502,12 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
xmlFAGenerateEpsilonTransition(ctxt, previous, to);
} else {
if (xmlFAGenerateTransitions(ctxt, previous,
(CUR=='|' || CUR==')' || CUR==0) ? to : NULL, ctxt->atom) < 0)
(CUR=='|' || CUR==')' || CUR==0) ? to : NULL,
ctxt->atom) < 0) {
xmlRegFreeAtom(ctxt->atom);
ctxt->atom = NULL;
return(-1);
}
previous = ctxt->state;
ctxt->atom = NULL;
}
@ -5510,8 +5516,11 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) {
if (ret != 0) {
if (xmlFAGenerateTransitions(ctxt, previous,
(CUR=='|' || CUR==')' || CUR==0) ? to : NULL,
ctxt->atom) < 0)
return(-1);
ctxt->atom) < 0) {
xmlRegFreeAtom(ctxt->atom);
ctxt->atom = NULL;
return(-1);
}
previous = ctxt->state;
ctxt->atom = NULL;
}
@ -5612,7 +5621,7 @@ xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) {
*/
xmlRegexpPtr
xmlRegexpCompile(const xmlChar *regexp) {
xmlRegexpPtr ret;
xmlRegexpPtr ret = NULL;
xmlRegParserCtxtPtr ctxt;
ctxt = xmlRegNewParserCtxt(regexp);
@ -5620,19 +5629,19 @@ xmlRegexpCompile(const xmlChar *regexp) {
return(NULL);
/* initialize the parser */
ctxt->state = xmlRegStatePush(ctxt);
if (ctxt->state == NULL)
goto error;
ctxt->start = ctxt->state;
ctxt->end = NULL;
ctxt->start = ctxt->state = xmlRegNewState(ctxt);
xmlRegStatePush(ctxt, ctxt->start);
/* parse the expression building an automata */
xmlFAParseRegExp(ctxt, 1);
if (CUR != 0) {
ERROR("xmlFAParseRegExp: extra characters");
}
if (ctxt->error != 0) {
xmlRegFreeParserCtxt(ctxt);
return(NULL);
}
if (ctxt->error != 0)
goto error;
ctxt->end = ctxt->state;
ctxt->start->type = XML_REGEXP_START_STATE;
ctxt->end->type = XML_REGEXP_FINAL_STATE;
@ -5641,11 +5650,11 @@ xmlRegexpCompile(const xmlChar *regexp) {
xmlFAEliminateEpsilonTransitions(ctxt);
if (ctxt->error != 0) {
xmlRegFreeParserCtxt(ctxt);
return(NULL);
}
if (ctxt->error != 0)
goto error;
ret = xmlRegEpxFromParse(ctxt);
error:
xmlRegFreeParserCtxt(ctxt);
return(ret);
}
@ -5770,18 +5779,15 @@ xmlNewAutomata(void) {
return(NULL);
/* initialize the parser */
ctxt->state = xmlRegStatePush(ctxt);
if (ctxt->state == NULL) {
xmlFreeAutomata(ctxt);
return(NULL);
}
ctxt->start = ctxt->state;
ctxt->end = NULL;
ctxt->start = ctxt->state = xmlRegNewState(ctxt);
if (ctxt->start == NULL) {
xmlFreeAutomata(ctxt);
return(NULL);
}
ctxt->start->type = XML_REGEXP_START_STATE;
if (xmlRegStatePush(ctxt, ctxt->start) < 0) {
xmlRegFreeState(ctxt->start);
xmlFreeAutomata(ctxt);
return(NULL);
}
ctxt->flags = 0;
return(ctxt);
@ -6044,6 +6050,8 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
return(NULL);
if ((token2 == NULL) || (*token2 == 0)) {
atom->valuep = xmlStrdup(token);
if (atom->valuep == NULL)
goto error;
} else {
int lenn, lenp;
xmlChar *str;
@ -6052,10 +6060,8 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
lenp = strlen((char *) token);
str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
if (str == NULL) {
xmlRegFreeAtom(atom);
return(NULL);
}
if (str == NULL)
goto error;
memcpy(&str[0], token, lenp);
str[lenp] = '|';
memcpy(&str[lenp + 1], token2, lenn);
@ -6074,16 +6080,20 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
* associate a counter to the transition.
*/
counter = xmlRegGetCounter(am);
if (counter < 0)
goto error;
am->counters[counter].min = min;
am->counters[counter].max = max;
/* xmlFAGenerateTransitions(am, from, to, atom); */
if (to == NULL) {
to = xmlRegNewState(am);
xmlRegStatePush(am, to);
to = xmlRegStatePush(am);
if (to == NULL)
goto error;
}
xmlRegStateAddTrans(am, from, atom, to, counter, -1);
xmlRegAtomPush(am, atom);
if (xmlRegAtomPush(am, atom) < 0)
goto error;
am->state = to;
if (to == NULL)
@ -6093,6 +6103,10 @@ xmlAutomataNewCountTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
if (min == 0)
xmlFAGenerateEpsilonTransition(am, from, to);
return(to);
error:
xmlRegFreeAtom(atom);
return(NULL);
}
/**
@ -6129,6 +6143,8 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
if (atom == NULL)
return(NULL);
atom->valuep = xmlStrdup(token);
if (atom->valuep == NULL)
goto error;
atom->data = data;
if (min == 0)
atom->min = 1;
@ -6140,16 +6156,20 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
* associate a counter to the transition.
*/
counter = xmlRegGetCounter(am);
if (counter < 0)
goto error;
am->counters[counter].min = min;
am->counters[counter].max = max;
/* xmlFAGenerateTransitions(am, from, to, atom); */
if (to == NULL) {
to = xmlRegNewState(am);
xmlRegStatePush(am, to);
to = xmlRegStatePush(am);
if (to == NULL)
goto error;
}
xmlRegStateAddTrans(am, from, atom, to, counter, -1);
xmlRegAtomPush(am, atom);
if (xmlRegAtomPush(am, atom) < 0)
goto error;
am->state = to;
if (to == NULL)
@ -6159,6 +6179,10 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
if (min == 0)
xmlFAGenerateEpsilonTransition(am, from, to);
return(to);
error:
xmlRegFreeAtom(atom);
return(NULL);
}
/**
@ -6199,6 +6223,8 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
return(NULL);
if ((token2 == NULL) || (*token2 == 0)) {
atom->valuep = xmlStrdup(token);
if (atom->valuep == NULL)
goto error;
} else {
int lenn, lenp;
xmlChar *str;
@ -6207,10 +6233,8 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
lenp = strlen((char *) token);
str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
if (str == NULL) {
xmlRegFreeAtom(atom);
return(NULL);
}
if (str == NULL)
goto error;
memcpy(&str[0], token, lenp);
str[lenp] = '|';
memcpy(&str[lenp + 1], token2, lenn);
@ -6226,18 +6250,26 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from,
* associate a counter to the transition.
*/
counter = xmlRegGetCounter(am);
if (counter < 0)
goto error;
am->counters[counter].min = 1;
am->counters[counter].max = 1;
/* xmlFAGenerateTransitions(am, from, to, atom); */
if (to == NULL) {
to = xmlRegNewState(am);
xmlRegStatePush(am, to);
to = xmlRegStatePush(am);
if (to == NULL)
goto error;
}
xmlRegStateAddTrans(am, from, atom, to, counter, -1);
xmlRegAtomPush(am, atom);
if (xmlRegAtomPush(am, atom) < 0)
goto error;
am->state = to;
return(to);
error:
xmlRegFreeAtom(atom);
return(NULL);
}
@ -6285,18 +6317,26 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
* associate a counter to the transition.
*/
counter = xmlRegGetCounter(am);
if (counter < 0)
goto error;
am->counters[counter].min = 1;
am->counters[counter].max = 1;
/* xmlFAGenerateTransitions(am, from, to, atom); */
if (to == NULL) {
to = xmlRegNewState(am);
xmlRegStatePush(am, to);
to = xmlRegStatePush(am);
if (to == NULL)
goto error;
}
xmlRegStateAddTrans(am, from, atom, to, counter, -1);
xmlRegAtomPush(am, atom);
if (xmlRegAtomPush(am, atom) < 0)
goto error;
am->state = to;
return(to);
error:
xmlRegFreeAtom(atom);
return(NULL);
}
/**
@ -6309,13 +6349,9 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
*/
xmlAutomataStatePtr
xmlAutomataNewState(xmlAutomataPtr am) {
xmlAutomataStatePtr to;
if (am == NULL)
return(NULL);
to = xmlRegNewState(am);
xmlRegStatePush(am, to);
return(to);
return(xmlRegStatePush(am));
}
/**

View file

@ -19,57 +19,15 @@
#include <libxml/HTMLtree.h>
#include "buf.h"
#include "enc.h"
#include "save.h"
/************************************************************************
* *
* XHTML detection *
* *
************************************************************************/
#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Strict//EN"
#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Frameset//EN"
#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
"-//W3C//DTD XHTML 1.0 Transitional//EN"
#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
/**
* xmlIsXHTML:
* @systemID: the system identifier
* @publicID: the public identifier
*
* Try to find if the document correspond to an XHTML DTD
*
* Returns 1 if true, 0 if not and -1 in case of error
*/
int
xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
if ((systemID == NULL) && (publicID == NULL))
return(-1);
if (publicID != NULL) {
if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
}
if (systemID != NULL) {
if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
}
return(0);
}
#include "private/buf.h"
#include "private/enc.h"
#include "private/error.h"
#include "private/save.h"
#ifdef LIBXML_OUTPUT_ENABLED
#define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml"
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
@ -463,7 +421,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr)
*
* This will dump the content of the notation table as an XML DTD definition
*/
void
static void
xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
xmlBufferPtr buffer;
@ -487,7 +445,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) {
* This will dump the content of the element declaration as an XML
* DTD definition
*/
void
static void
xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
xmlBufferPtr buffer;
@ -511,7 +469,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) {
* This will dump the content of the attribute declaration as an XML
* DTD definition
*/
void
static void
xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
xmlBufferPtr buffer;
@ -534,7 +492,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) {
*
* This will dump the content of the entity table as an XML DTD definition
*/
void
static void
xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) {
xmlBufferPtr buffer;
@ -595,7 +553,6 @@ static void
xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
#endif
static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
/**
@ -2178,7 +2135,7 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level,
xmlBufBackToBuffer(buffer);
if (ret > INT_MAX)
return(-1);
return((int) ret);
return(ret);
}
/**
@ -2406,6 +2363,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
if ((out_buff = xmlAllocOutputBuffer(conv_hdlr)) == NULL ) {
xmlSaveErrMemory("creating buffer");
xmlCharEncCloseFunc(conv_hdlr);
return;
}

View file

@ -76,6 +76,9 @@
#include <libxml/xmlreader.h>
#endif
#include "private/error.h"
#include "private/string.h"
/* #define DEBUG 1 */
/* #define DEBUG_CONTENT 1 */
@ -305,10 +308,20 @@ static const xmlChar *xmlNamespaceNs = (const xmlChar *)
#define WXS_SCHEMA(ctx) (ctx)->schema
#define WXS_ADD_LOCAL(ctx, item) \
xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item)
do { \
if (xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->locals), 10, item) < 0) { \
xmlFree(item); \
item = NULL; \
} \
} while (0)
#define WXS_ADD_GLOBAL(ctx, item) \
xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item)
do { \
if (xmlSchemaAddItemSize(&(WXS_BUCKET(ctx)->globals), 5, item) < 0) { \
xmlFree(item); \
item = NULL; \
} \
} while (0)
#define WXS_ADD_PENDING(ctx, item) \
xmlSchemaAddItemSize(&((ctx)->constructor->pending), 10, item)
@ -3407,23 +3420,17 @@ xmlSchemaItemListClear(xmlSchemaItemListPtr list)
static int
xmlSchemaItemListAdd(xmlSchemaItemListPtr list, void *item)
{
if (list->items == NULL) {
list->items = (void **) xmlMalloc(
20 * sizeof(void *));
if (list->items == NULL) {
xmlSchemaPErrMemory(NULL, "allocating new item list", NULL);
return(-1);
}
list->sizeItems = 20;
} else if (list->sizeItems <= list->nbItems) {
list->sizeItems *= 2;
list->items = (void **) xmlRealloc(list->items,
list->sizeItems * sizeof(void *));
if (list->items == NULL) {
if (list->sizeItems <= list->nbItems) {
void **tmp;
size_t newSize = list->sizeItems == 0 ? 20 : list->sizeItems * 2;
tmp = (void **) xmlRealloc(list->items, newSize * sizeof(void *));
if (tmp == NULL) {
xmlSchemaPErrMemory(NULL, "growing item list", NULL);
list->sizeItems = 0;
return(-1);
}
list->items = tmp;
list->sizeItems = newSize;
}
list->items[list->nbItems++] = item;
return(0);
@ -3445,14 +3452,17 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list,
}
list->sizeItems = initialSize;
} else if (list->sizeItems <= list->nbItems) {
void **tmp;
list->sizeItems *= 2;
list->items = (void **) xmlRealloc(list->items,
tmp = (void **) xmlRealloc(list->items,
list->sizeItems * sizeof(void *));
if (list->items == NULL) {
if (tmp == NULL) {
xmlSchemaPErrMemory(NULL, "growing item list", NULL);
list->sizeItems = 0;
list->sizeItems /= 2;
return(-1);
}
list->items = tmp;
}
list->items[list->nbItems++] = item;
return(0);
@ -3461,23 +3471,17 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list,
static int
xmlSchemaItemListInsert(xmlSchemaItemListPtr list, void *item, int idx)
{
if (list->items == NULL) {
list->items = (void **) xmlMalloc(
20 * sizeof(void *));
if (list->items == NULL) {
xmlSchemaPErrMemory(NULL, "allocating new item list", NULL);
return(-1);
}
list->sizeItems = 20;
} else if (list->sizeItems <= list->nbItems) {
list->sizeItems *= 2;
list->items = (void **) xmlRealloc(list->items,
list->sizeItems * sizeof(void *));
if (list->items == NULL) {
if (list->sizeItems <= list->nbItems) {
void **tmp;
size_t newSize = list->sizeItems == 0 ? 20 : list->sizeItems * 2;
tmp = (void **) xmlRealloc(list->items, newSize * sizeof(void *));
if (tmp == NULL) {
xmlSchemaPErrMemory(NULL, "growing item list", NULL);
list->sizeItems = 0;
return(-1);
}
list->items = tmp;
list->sizeItems = newSize;
}
/*
* Just append if the index is greater/equal than the item count.
@ -3645,12 +3649,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
ret->type = type;
ret->globals = xmlSchemaItemListCreate();
if (ret->globals == NULL) {
xmlFree(ret);
xmlSchemaBucketFree(ret);
return(NULL);
}
ret->locals = xmlSchemaItemListCreate();
if (ret->locals == NULL) {
xmlFree(ret);
xmlSchemaBucketFree(ret);
return(NULL);
}
/*
@ -3739,7 +3743,10 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
return(NULL);
}
}
xmlSchemaItemListAdd(mainSchema->includes, ret);
if (xmlSchemaItemListAdd(mainSchema->includes, ret) < 0) {
xmlSchemaBucketFree(ret);
return(NULL);
}
}
/*
* Add to list of all buckets; this is used for lookup
@ -3758,8 +3765,7 @@ xmlSchemaAddItemSize(xmlSchemaItemListPtr *list, int initialSize, void *item)
if (*list == NULL)
return(-1);
}
xmlSchemaItemListAddSize(*list, initialSize, item);
return(0);
return(xmlSchemaItemListAddSize(*list, initialSize, item));
}
/**
@ -4757,6 +4763,8 @@ xmlSchemaGetNodeContent(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node)
val = xmlStrdup((xmlChar *)"");
ret = xmlDictLookup(ctxt->dict, val, -1);
xmlFree(val);
if (ret == NULL)
xmlSchemaPErrMemory(ctxt, "getting node content", node);
return(ret);
}
@ -6100,6 +6108,8 @@ xmlGetMaxOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
if (attr == NULL)
return (def);
val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
if (val == NULL)
return (def);
if (xmlStrEqual(val, (const xmlChar *) "unbounded")) {
if (max != UNBOUNDED) {
@ -6174,6 +6184,8 @@ xmlGetMinOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
if (attr == NULL)
return (def);
val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
if (val == NULL)
return (def);
cur = val;
while (IS_BLANK_CH(*cur))
cur++;
@ -6846,6 +6858,8 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt,
*/
attr = xmlSchemaGetPropNode(node, "namespace");
ns = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
if (ns == NULL)
return (-1);
if ((attr == NULL) || (xmlStrEqual(ns, BAD_CAST "##any")))
wildc->any = 1;
else if (xmlStrEqual(ns, BAD_CAST "##other")) {
@ -8994,6 +9008,8 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
xmlSchemaQNameRefPtr ref;
cur = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
if (cur == NULL)
return (-1);
type->base = cur;
do {
while (IS_BLANK_CH(*cur))
@ -9004,6 +9020,11 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
if (end == cur)
break;
tmp = xmlStrndup(cur, end - cur);
if (tmp == NULL) {
xmlSchemaPErrMemory(ctxt, "xmlSchemaParseUnion, "
"duplicating type name", NULL);
return (-1);
}
if (xmlSchemaPValAttrNodeQNameValue(ctxt, schema,
NULL, attr, BAD_CAST tmp, &nsName, &localName) == 0) {
/*
@ -9014,6 +9035,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema,
if (link == NULL) {
xmlSchemaPErrMemory(ctxt, "xmlSchemaParseUnion, "
"allocating a type link", NULL);
FREE_AND_NULL(tmp)
return (-1);
}
link->type = NULL;
@ -11149,17 +11171,6 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt,
* differ from the resulting namespace.
*/
isChameleon = 1;
if (bucket->parsed &&
bucket->origTargetNamespace != NULL) {
xmlSchemaCustomErr(ACTXT_CAST pctxt,
XML_SCHEMAP_SRC_INCLUDE,
node, NULL,
"The target namespace of the included/redefined schema "
"'%s' has to be absent or the same as the "
"including/redefining schema's target namespace",
schemaLocation, NULL);
goto exit_error;
}
bucket->targetNamespace = pctxt->targetNamespace;
}
}
@ -13345,8 +13356,19 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl,
* declaration `resolved` to by the `actual value`
* of the substitutionGroup [attribute], if present"
*/
if (elemDecl->subtypes == NULL)
elemDecl->subtypes = substHead->subtypes;
if (elemDecl->subtypes == NULL) {
if (substHead->subtypes == NULL) {
/*
* This can happen with self-referencing substitution
* groups. The cycle will be detected later, but we have
* to set subtypes to avoid null-pointer dereferences.
*/
elemDecl->subtypes = xmlSchemaGetBuiltInType(
XML_SCHEMAS_ANYTYPE);
} else {
elemDecl->subtypes = substHead->subtypes;
}
}
}
}
/*
@ -14536,6 +14558,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt,
{
PERROR_INT("xmlSchemaFixupTypeAttributeUses",
"failed to expand attributes");
return(-1);
}
if (pctxt->attrProhibs->nbItems != 0)
prohibs = pctxt->attrProhibs;
@ -14546,6 +14569,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt,
{
PERROR_INT("xmlSchemaFixupTypeAttributeUses",
"failed to expand attributes");
return(-1);
}
}
}
@ -18608,7 +18632,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
"allowed to appear inside other model groups",
NULL, NULL);
} else if (! dummySequence) {
} else if ((!dummySequence) && (baseType->subtypes != NULL)) {
xmlSchemaTreeItemPtr effectiveContent =
(xmlSchemaTreeItemPtr) type->subtypes;
/*
@ -19946,7 +19970,8 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt,
/*
* The set of all {derivation method}s involved in the derivation
*/
while ((type != NULL) && (type != headType)) {
while ((type != NULL) && (type != headType) &&
(type != type->baseType)) {
if ((WXS_IS_EXTENSION(type)) &&
((methSet & XML_SCHEMAS_TYPE_BLOCK_RESTRICTION) == 0))
methSet |= XML_SCHEMAS_TYPE_BLOCK_EXTENSION;
@ -21432,7 +21457,8 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
* the API; i.e. not automatically by the validated instance document.
*/
xmlSchemaInitTypes();
if (xmlSchemaInitTypes() < 0)
return (NULL);
if (ctxt == NULL)
return (NULL);
@ -21452,7 +21478,7 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt)
if (ctxt->constructor == NULL) {
ctxt->constructor = xmlSchemaConstructionCtxtCreate(ctxt->dict);
if (ctxt->constructor == NULL)
return(NULL);
goto exit_failure;
/* Take ownership of the constructor to be able to free it. */
ctxt->ownsConstructor = 1;
}
@ -21861,7 +21887,6 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
{
const xmlChar *cur, *end;
const xmlChar *nsname = NULL, *location;
int count = 0;
int ret = 0;
xmlSchemaAttrInfoPtr iattr;
@ -21896,7 +21921,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
end++;
if (end == cur)
break;
count++; /* TODO: Don't use the schema's dict. */
/* TODO: Don't use the schema's dict. */
nsname = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
cur = end;
}
@ -21923,7 +21948,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt)
}
break;
}
count++; /* TODO: Don't use the schema's dict. */
/* TODO: Don't use the schema's dict. */
location = xmlDictLookup(vctxt->schema->dict, cur, end - cur);
cur = end;
ret = xmlSchemaAssembleByLocation(vctxt, vctxt->schema,
@ -29063,7 +29088,6 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr sax, void *user_data)
{
xmlSchemaSAXPlugPtr plug = NULL;
xmlSAXHandlerPtr old_sax = NULL;
xmlParserCtxtPtr pctxt = NULL;
xmlParserInputPtr inputStream = NULL;
int ret;
@ -29074,12 +29098,18 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
/*
* prepare the parser
*/
pctxt = xmlNewParserCtxt();
if (pctxt == NULL)
return (-1);
old_sax = pctxt->sax;
pctxt->sax = sax;
pctxt->userData = user_data;
if (sax != NULL) {
pctxt = xmlNewSAXParserCtxt(sax, user_data);
if (pctxt == NULL)
return (-1);
} else {
pctxt = xmlNewParserCtxt();
if (pctxt == NULL)
return (-1);
/* We really want pctxt->sax to be NULL here. */
xmlFree(pctxt->sax);
pctxt->sax = NULL;
}
#if 0
if (options)
xmlCtxtUseOptions(pctxt, options);
@ -29125,7 +29155,6 @@ done:
}
/* cleanup */
if (pctxt != NULL) {
pctxt->sax = old_sax;
xmlFreeParserCtxt(pctxt);
}
return (ret);

View file

@ -33,6 +33,8 @@
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemastypes.h>
#include "private/error.h"
#define DEBUG
#ifndef LIBXML_XPATH_ENABLED
@ -383,18 +385,61 @@ xmlSchemaAddParticle(void)
return (ret);
}
static void
xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlSchemaFreeType((xmlSchemaTypePtr) type);
}
/**
* xmlSchemaCleanupTypesInternal:
*
* Cleanup the default XML Schemas type library
*/
static void
xmlSchemaCleanupTypesInternal(void) {
xmlSchemaParticlePtr particle;
/*
* Free xs:anyType.
*/
if (xmlSchemaTypeAnyTypeDef != NULL) {
/* Attribute wildcard. */
xmlSchemaFreeWildcard(xmlSchemaTypeAnyTypeDef->attributeWildcard);
/* Content type. */
particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;
/* Wildcard. */
xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
particle->children->children->children);
xmlFree((xmlSchemaParticlePtr) particle->children->children);
/* Sequence model group. */
xmlFree((xmlSchemaModelGroupPtr) particle->children);
xmlFree((xmlSchemaParticlePtr) particle);
xmlSchemaTypeAnyTypeDef->subtypes = NULL;
xmlSchemaTypeAnyTypeDef = NULL;
}
xmlHashFree(xmlSchemaTypesBank, xmlSchemaFreeTypeEntry);
xmlSchemaTypesBank = NULL;
/* Note that the xmlSchemaType*Def pointers aren't set to NULL. */
}
/*
* xmlSchemaInitTypes:
*
* Initialize the default XML Schemas type library
*
* Returns 0 on success, -1 on error.
*/
void
int
xmlSchemaInitTypes(void)
{
if (xmlSchemaTypesInitialized != 0)
return;
return (0);
xmlSchemaTypesBank = xmlHashCreate(40);
if (xmlSchemaTypesBank == NULL) {
xmlSchemaTypeErrMemory(NULL, NULL);
goto error;
}
/*
* 3.4.7 Built-in Complex Type Definition
@ -402,6 +447,8 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",
XML_SCHEMAS_ANYTYPE,
NULL);
if (xmlSchemaTypeAnyTypeDef == NULL)
goto error;
xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;
xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
/*
@ -415,14 +462,14 @@ xmlSchemaInitTypes(void)
/* First particle. */
particle = xmlSchemaAddParticle();
if (particle == NULL)
return;
goto error;
xmlSchemaTypeAnyTypeDef->subtypes = (xmlSchemaTypePtr) particle;
/* Sequence model group. */
sequence = (xmlSchemaModelGroupPtr)
xmlMalloc(sizeof(xmlSchemaModelGroup));
if (sequence == NULL) {
xmlSchemaTypeErrMemory(NULL, "allocating model group component");
return;
goto error;
}
memset(sequence, 0, sizeof(xmlSchemaModelGroup));
sequence->type = XML_SCHEMA_TYPE_SEQUENCE;
@ -430,7 +477,7 @@ xmlSchemaInitTypes(void)
/* Second particle. */
particle = xmlSchemaAddParticle();
if (particle == NULL)
return;
goto error;
particle->minOccurs = 0;
particle->maxOccurs = UNBOUNDED;
sequence->children = (xmlSchemaTreeItemPtr) particle;
@ -438,7 +485,7 @@ xmlSchemaInitTypes(void)
wild = (xmlSchemaWildcardPtr) xmlMalloc(sizeof(xmlSchemaWildcard));
if (wild == NULL) {
xmlSchemaTypeErrMemory(NULL, "allocating wildcard component");
return;
goto error;
}
memset(wild, 0, sizeof(xmlSchemaWildcard));
wild->type = XML_SCHEMA_TYPE_ANY;
@ -452,7 +499,7 @@ xmlSchemaInitTypes(void)
if (wild == NULL) {
xmlSchemaTypeErrMemory(NULL, "could not create an attribute "
"wildcard on anyType");
return;
goto error;
}
memset(wild, 0, sizeof(xmlSchemaWildcard));
wild->any = 1;
@ -462,66 +509,106 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",
XML_SCHEMAS_ANYSIMPLETYPE,
xmlSchemaTypeAnyTypeDef);
if (xmlSchemaTypeAnySimpleTypeDef == NULL)
goto error;
/*
* primitive datatypes
*/
xmlSchemaTypeStringDef = xmlSchemaInitBasicType("string",
XML_SCHEMAS_STRING,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeStringDef == NULL)
goto error;
xmlSchemaTypeDecimalDef = xmlSchemaInitBasicType("decimal",
XML_SCHEMAS_DECIMAL,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeDecimalDef == NULL)
goto error;
xmlSchemaTypeDateDef = xmlSchemaInitBasicType("date",
XML_SCHEMAS_DATE,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeDateDef == NULL)
goto error;
xmlSchemaTypeDatetimeDef = xmlSchemaInitBasicType("dateTime",
XML_SCHEMAS_DATETIME,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeDatetimeDef == NULL)
goto error;
xmlSchemaTypeTimeDef = xmlSchemaInitBasicType("time",
XML_SCHEMAS_TIME,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeTimeDef == NULL)
goto error;
xmlSchemaTypeGYearDef = xmlSchemaInitBasicType("gYear",
XML_SCHEMAS_GYEAR,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeGYearDef == NULL)
goto error;
xmlSchemaTypeGYearMonthDef = xmlSchemaInitBasicType("gYearMonth",
XML_SCHEMAS_GYEARMONTH,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeGYearMonthDef == NULL)
goto error;
xmlSchemaTypeGMonthDef = xmlSchemaInitBasicType("gMonth",
XML_SCHEMAS_GMONTH,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeGMonthDef == NULL)
goto error;
xmlSchemaTypeGMonthDayDef = xmlSchemaInitBasicType("gMonthDay",
XML_SCHEMAS_GMONTHDAY,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeGMonthDayDef == NULL)
goto error;
xmlSchemaTypeGDayDef = xmlSchemaInitBasicType("gDay",
XML_SCHEMAS_GDAY,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeGDayDef == NULL)
goto error;
xmlSchemaTypeDurationDef = xmlSchemaInitBasicType("duration",
XML_SCHEMAS_DURATION,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeDurationDef == NULL)
goto error;
xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float",
XML_SCHEMAS_FLOAT,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeFloatDef == NULL)
goto error;
xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double",
XML_SCHEMAS_DOUBLE,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeDoubleDef == NULL)
goto error;
xmlSchemaTypeBooleanDef = xmlSchemaInitBasicType("boolean",
XML_SCHEMAS_BOOLEAN,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeBooleanDef == NULL)
goto error;
xmlSchemaTypeAnyURIDef = xmlSchemaInitBasicType("anyURI",
XML_SCHEMAS_ANYURI,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeAnyURIDef == NULL)
goto error;
xmlSchemaTypeHexBinaryDef = xmlSchemaInitBasicType("hexBinary",
XML_SCHEMAS_HEXBINARY,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeHexBinaryDef == NULL)
goto error;
xmlSchemaTypeBase64BinaryDef
= xmlSchemaInitBasicType("base64Binary", XML_SCHEMAS_BASE64BINARY,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeBase64BinaryDef == NULL)
goto error;
xmlSchemaTypeNotationDef = xmlSchemaInitBasicType("NOTATION",
XML_SCHEMAS_NOTATION,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeNotationDef == NULL)
goto error;
xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName",
XML_SCHEMAS_QNAME,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeQNameDef == NULL)
goto error;
/*
* derived datatypes
@ -529,69 +616,113 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeIntegerDef = xmlSchemaInitBasicType("integer",
XML_SCHEMAS_INTEGER,
xmlSchemaTypeDecimalDef);
if (xmlSchemaTypeIntegerDef == NULL)
goto error;
xmlSchemaTypeNonPositiveIntegerDef =
xmlSchemaInitBasicType("nonPositiveInteger",
XML_SCHEMAS_NPINTEGER,
xmlSchemaTypeIntegerDef);
if (xmlSchemaTypeNonPositiveIntegerDef == NULL)
goto error;
xmlSchemaTypeNegativeIntegerDef =
xmlSchemaInitBasicType("negativeInteger", XML_SCHEMAS_NINTEGER,
xmlSchemaTypeNonPositiveIntegerDef);
if (xmlSchemaTypeNegativeIntegerDef == NULL)
goto error;
xmlSchemaTypeLongDef =
xmlSchemaInitBasicType("long", XML_SCHEMAS_LONG,
xmlSchemaTypeIntegerDef);
if (xmlSchemaTypeLongDef == NULL)
goto error;
xmlSchemaTypeIntDef = xmlSchemaInitBasicType("int", XML_SCHEMAS_INT,
xmlSchemaTypeLongDef);
if (xmlSchemaTypeIntDef == NULL)
goto error;
xmlSchemaTypeShortDef = xmlSchemaInitBasicType("short",
XML_SCHEMAS_SHORT,
xmlSchemaTypeIntDef);
if (xmlSchemaTypeShortDef == NULL)
goto error;
xmlSchemaTypeByteDef = xmlSchemaInitBasicType("byte",
XML_SCHEMAS_BYTE,
xmlSchemaTypeShortDef);
if (xmlSchemaTypeByteDef == NULL)
goto error;
xmlSchemaTypeNonNegativeIntegerDef =
xmlSchemaInitBasicType("nonNegativeInteger",
XML_SCHEMAS_NNINTEGER,
xmlSchemaTypeIntegerDef);
if (xmlSchemaTypeNonNegativeIntegerDef == NULL)
goto error;
xmlSchemaTypeUnsignedLongDef =
xmlSchemaInitBasicType("unsignedLong", XML_SCHEMAS_ULONG,
xmlSchemaTypeNonNegativeIntegerDef);
if (xmlSchemaTypeUnsignedLongDef == NULL)
goto error;
xmlSchemaTypeUnsignedIntDef =
xmlSchemaInitBasicType("unsignedInt", XML_SCHEMAS_UINT,
xmlSchemaTypeUnsignedLongDef);
if (xmlSchemaTypeUnsignedIntDef == NULL)
goto error;
xmlSchemaTypeUnsignedShortDef =
xmlSchemaInitBasicType("unsignedShort", XML_SCHEMAS_USHORT,
xmlSchemaTypeUnsignedIntDef);
if (xmlSchemaTypeUnsignedShortDef == NULL)
goto error;
xmlSchemaTypeUnsignedByteDef =
xmlSchemaInitBasicType("unsignedByte", XML_SCHEMAS_UBYTE,
xmlSchemaTypeUnsignedShortDef);
if (xmlSchemaTypeUnsignedByteDef == NULL)
goto error;
xmlSchemaTypePositiveIntegerDef =
xmlSchemaInitBasicType("positiveInteger", XML_SCHEMAS_PINTEGER,
xmlSchemaTypeNonNegativeIntegerDef);
if (xmlSchemaTypePositiveIntegerDef == NULL)
goto error;
xmlSchemaTypeNormStringDef = xmlSchemaInitBasicType("normalizedString",
XML_SCHEMAS_NORMSTRING,
xmlSchemaTypeStringDef);
if (xmlSchemaTypeNormStringDef == NULL)
goto error;
xmlSchemaTypeTokenDef = xmlSchemaInitBasicType("token",
XML_SCHEMAS_TOKEN,
xmlSchemaTypeNormStringDef);
if (xmlSchemaTypeTokenDef == NULL)
goto error;
xmlSchemaTypeLanguageDef = xmlSchemaInitBasicType("language",
XML_SCHEMAS_LANGUAGE,
xmlSchemaTypeTokenDef);
if (xmlSchemaTypeLanguageDef == NULL)
goto error;
xmlSchemaTypeNameDef = xmlSchemaInitBasicType("Name",
XML_SCHEMAS_NAME,
xmlSchemaTypeTokenDef);
if (xmlSchemaTypeNameDef == NULL)
goto error;
xmlSchemaTypeNmtokenDef = xmlSchemaInitBasicType("NMTOKEN",
XML_SCHEMAS_NMTOKEN,
xmlSchemaTypeTokenDef);
if (xmlSchemaTypeNmtokenDef == NULL)
goto error;
xmlSchemaTypeNCNameDef = xmlSchemaInitBasicType("NCName",
XML_SCHEMAS_NCNAME,
xmlSchemaTypeNameDef);
if (xmlSchemaTypeNCNameDef == NULL)
goto error;
xmlSchemaTypeIdDef = xmlSchemaInitBasicType("ID", XML_SCHEMAS_ID,
xmlSchemaTypeNCNameDef);
if (xmlSchemaTypeIdDef == NULL)
goto error;
xmlSchemaTypeIdrefDef = xmlSchemaInitBasicType("IDREF",
XML_SCHEMAS_IDREF,
xmlSchemaTypeNCNameDef);
if (xmlSchemaTypeIdrefDef == NULL)
goto error;
xmlSchemaTypeEntityDef = xmlSchemaInitBasicType("ENTITY",
XML_SCHEMAS_ENTITY,
xmlSchemaTypeNCNameDef);
if (xmlSchemaTypeEntityDef == NULL)
goto error;
/*
* Derived list types.
*/
@ -599,25 +730,31 @@ xmlSchemaInitTypes(void)
xmlSchemaTypeEntitiesDef = xmlSchemaInitBasicType("ENTITIES",
XML_SCHEMAS_ENTITIES,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeEntitiesDef == NULL)
goto error;
xmlSchemaTypeEntitiesDef->subtypes = xmlSchemaTypeEntityDef;
/* IDREFS */
xmlSchemaTypeIdrefsDef = xmlSchemaInitBasicType("IDREFS",
XML_SCHEMAS_IDREFS,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeIdrefsDef == NULL)
goto error;
xmlSchemaTypeIdrefsDef->subtypes = xmlSchemaTypeIdrefDef;
/* NMTOKENS */
xmlSchemaTypeNmtokensDef = xmlSchemaInitBasicType("NMTOKENS",
XML_SCHEMAS_NMTOKENS,
xmlSchemaTypeAnySimpleTypeDef);
if (xmlSchemaTypeNmtokensDef == NULL)
goto error;
xmlSchemaTypeNmtokensDef->subtypes = xmlSchemaTypeNmtokenDef;
xmlSchemaTypesInitialized = 1;
}
return (0);
static void
xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
xmlSchemaFreeType((xmlSchemaTypePtr) type);
error:
xmlSchemaCleanupTypesInternal();
return (-1);
}
/**
@ -626,34 +763,16 @@ xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) {
* DEPRECATED: This function will be made private. Call xmlCleanupParser
* to free global state but see the warnings there. xmlCleanupParser
* should be only called once at program exit. In most cases, you don't
* have call cleanup functions at all.
* have to call cleanup functions at all.
*
* Cleanup the default XML Schemas type library
*/
void
xmlSchemaCleanupTypes(void) {
if (xmlSchemaTypesInitialized == 0)
return;
/*
* Free xs:anyType.
*/
{
xmlSchemaParticlePtr particle;
/* Attribute wildcard. */
xmlSchemaFreeWildcard(xmlSchemaTypeAnyTypeDef->attributeWildcard);
/* Content type. */
particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;
/* Wildcard. */
xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
particle->children->children->children);
xmlFree((xmlSchemaParticlePtr) particle->children->children);
/* Sequence model group. */
xmlFree((xmlSchemaModelGroupPtr) particle->children);
xmlFree((xmlSchemaParticlePtr) particle);
xmlSchemaTypeAnyTypeDef->subtypes = NULL;
if (xmlSchemaTypesInitialized != 0) {
xmlSchemaCleanupTypesInternal();
xmlSchemaTypesInitialized = 0;
}
xmlHashFree(xmlSchemaTypesBank, xmlSchemaFreeTypeEntry);
xmlSchemaTypesInitialized = 0;
}
/**
@ -748,8 +867,9 @@ xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType)
xmlSchemaTypePtr
xmlSchemaGetBuiltInType(xmlSchemaValType type)
{
if (xmlSchemaTypesInitialized == 0)
xmlSchemaInitTypes();
if ((xmlSchemaTypesInitialized == 0) &&
(xmlSchemaInitTypes() < 0))
return (NULL);
switch (type) {
case XML_SCHEMAS_ANYSIMPLETYPE:
@ -1081,8 +1201,9 @@ xmlSchemaFreeValue(xmlSchemaValPtr value) {
*/
xmlSchemaTypePtr
xmlSchemaGetPredefinedType(const xmlChar *name, const xmlChar *ns) {
if (xmlSchemaTypesInitialized == 0)
xmlSchemaInitTypes();
if ((xmlSchemaTypesInitialized == 0) &&
(xmlSchemaInitTypes() < 0))
return (NULL);
if (name == NULL)
return(NULL);
return((xmlSchemaTypePtr) xmlHashLookup2(xmlSchemaTypesBank, name, ns));
@ -2251,8 +2372,9 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
xmlChar *norm = NULL;
int ret = 0;
if (xmlSchemaTypesInitialized == 0)
xmlSchemaInitTypes();
if ((xmlSchemaTypesInitialized == 0) &&
(xmlSchemaInitTypes() < 0))
return (-1);
if (type == NULL)
return (-1);
@ -3034,6 +3156,8 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
value = norm;
}
tmpval = xmlStrdup(value);
if (tmpval == NULL)
goto error;
for (cur = tmpval; *cur; ++cur) {
if (*cur < 32 || *cur >= 127 || *cur == ' ' ||
*cur == '<' || *cur == '>' || *cur == '"' ||
@ -3220,8 +3344,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
if (v == NULL)
goto error;
base =
(xmlChar *) xmlMallocAtomic((i + pad + 1) *
sizeof(xmlChar));
(xmlChar *) xmlMallocAtomic(i + pad + 1);
if (base == NULL) {
xmlSchemaTypeErrMemory(node, "allocating base64 data");
xmlFree(v);
@ -4141,9 +4264,15 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
if (!y->value.date.tz_flag) {
p1 = xmlSchemaDateNormalize(x, 0);
if (p1 == NULL)
return -2;
p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
/* normalize y + 14:00 */
q1 = xmlSchemaDateNormalize(y, (14 * SECS_PER_HOUR));
if (q1 == NULL) {
xmlSchemaFreeValue(p1);
return -2;
}
q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
if (p1d < q1d) {
@ -4162,6 +4291,11 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
int ret = 0;
/* normalize y - 14:00 */
q2 = xmlSchemaDateNormalize(y, -(14 * SECS_PER_HOUR));
if (q2 == NULL) {
xmlSchemaFreeValue(p1);
xmlSchemaFreeValue(q1);
return -2;
}
q2d = _xmlSchemaDateCastYMToDays(q2) + q2->value.date.day;
if (p1d > q2d)
ret = 1;
@ -4185,10 +4319,16 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
}
} else if (y->value.date.tz_flag) {
q1 = xmlSchemaDateNormalize(y, 0);
if (q1 == NULL)
return -2;
q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
/* normalize x - 14:00 */
p1 = xmlSchemaDateNormalize(x, -(14 * SECS_PER_HOUR));
if (p1 == NULL) {
xmlSchemaFreeValue(q1);
return -2;
}
p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
if (p1d < q1d) {
@ -4207,6 +4347,11 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
int ret = 0;
/* normalize x + 14:00 */
p2 = xmlSchemaDateNormalize(x, (14 * SECS_PER_HOUR));
if (p2 == NULL) {
xmlSchemaFreeValue(p1);
xmlSchemaFreeValue(q1);
return -2;
}
p2d = _xmlSchemaDateCastYMToDays(p2) + p2->value.date.day;
if (p2d > q1d) {
@ -4236,9 +4381,15 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y)
if (x->type == y->type) {
int ret = 0;
q1 = xmlSchemaDateNormalize(y, 0);
if (q1 == NULL)
return -2;
q1d = _xmlSchemaDateCastYMToDays(q1) + q1->value.date.day;
p1 = xmlSchemaDateNormalize(x, 0);
if (p1 == NULL) {
xmlSchemaFreeValue(q1);
return -2;
}
p1d = _xmlSchemaDateCastYMToDays(p1) + p1->value.date.day;
if (p1d < q1d) {

View file

@ -23,6 +23,9 @@
#include <libxml/parserInternals.h>
#include <libxml/xmlstring.h>
#include "private/parser.h"
#include "private/string.h"
/************************************************************************
* *
* Commodity functions to handle xmlChars *
@ -43,12 +46,11 @@ xmlStrndup(const xmlChar *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
}
memcpy(ret, cur, len * sizeof(xmlChar));
memcpy(ret, cur, len);
ret[len] = 0;
return(ret);
}
@ -88,12 +90,12 @@ xmlCharStrndup(const char *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic((size_t) len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
}
for (i = 0;i < len;i++) {
/* Explicit sign change */
ret[i] = (xmlChar) cur[i];
if (ret[i] == 0) return(ret);
}
@ -457,12 +459,11 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
size = xmlStrlen(cur);
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
ret = (xmlChar *) xmlRealloc(cur, ((size_t) size + len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlRealloc(cur, (size_t) size + len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(cur);
}
memcpy(&ret[size], add, len * sizeof(xmlChar));
memcpy(&ret[size], add, len);
ret[size + len] = 0;
return(ret);
}
@ -497,13 +498,12 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
size = xmlStrlen(str1);
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
ret = (xmlChar *) xmlMalloc(((size_t) size + len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMalloc((size_t) size + len + 1);
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(xmlStrndup(str1, size));
}
memcpy(ret, str1, size * sizeof(xmlChar));
memcpy(&ret[size], str2, len * sizeof(xmlChar));
memcpy(ret, str1, size);
memcpy(&ret[size], str2, len);
ret[size + len] = 0;
return(ret);
}
@ -871,11 +871,11 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
if ((utf == NULL) || (len < 0)) return(NULL);
i = xmlUTF8Strsize(utf, len);
ret = (xmlChar *) xmlMallocAtomic(((size_t) i + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic((size_t) i + 1);
if (ret == NULL) {
return(NULL);
}
memcpy(ret, utf, i * sizeof(xmlChar));
memcpy(ret, utf, i);
ret[i] = 0;
return(ret);
}
@ -1022,13 +1022,12 @@ xmlEscapeFormatString(xmlChar **msg)
if ((count > INT_MAX) || (msgLen > INT_MAX - count))
return(NULL);
resultLen = msgLen + count + 1;
result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
result = (xmlChar *) xmlMallocAtomic(resultLen);
if (result == NULL) {
/* Clear *msg to prevent format string vulnerabilities in
out-of-memory situations. */
xmlFree(*msg);
*msg = NULL;
xmlErrMemory(NULL, NULL);
return(NULL);
}

File diff suppressed because it is too large Load diff

View file

@ -52,6 +52,8 @@
#endif
#endif
#include "private/error.h"
#define TODO \
xmlGenericError(xmlGenericErrorContext, \
"Unimplemented block at %s:%d\n", \
@ -266,7 +268,7 @@ xmlXPtrNewPoint(xmlNodePtr node, int indx) {
xmlXPtrErrMemory("allocating point");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_POINT;
ret->user = (void *) node;
ret->index = indx;
@ -586,7 +588,7 @@ xmlXPtrLocationSetCreate(xmlXPathObjectPtr val) {
xmlXPtrErrMemory("allocating locationset");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlLocationSet));
memset(ret, 0 , sizeof(xmlLocationSet));
if (val != NULL) {
ret->locTab = (xmlXPathObjectPtr *) xmlMalloc(XML_RANGESET_DEFAULT *
sizeof(xmlXPathObjectPtr));
@ -596,7 +598,7 @@ xmlXPtrLocationSetCreate(xmlXPathObjectPtr val) {
return(NULL);
}
memset(ret->locTab, 0 ,
XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
XML_RANGESET_DEFAULT * sizeof(xmlXPathObjectPtr));
ret->locMax = XML_RANGESET_DEFAULT;
ret->locTab[ret->locNr++] = val;
}
@ -638,7 +640,7 @@ xmlXPtrLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) {
return;
}
memset(cur->locTab, 0 ,
XML_RANGESET_DEFAULT * (size_t) sizeof(xmlXPathObjectPtr));
XML_RANGESET_DEFAULT * sizeof(xmlXPathObjectPtr));
cur->locMax = XML_RANGESET_DEFAULT;
} else if (cur->locNr == cur->locMax) {
xmlXPathObjectPtr *temp;
@ -771,7 +773,7 @@ xmlXPtrNewLocationSetNodes(xmlNodePtr start, xmlNodePtr end) {
xmlXPtrErrMemory("allocating locationset");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
memset(ret, 0 , sizeof(xmlXPathObject));
ret->type = XPATH_LOCATIONSET;
if (end == NULL)
ret->user = xmlXPtrLocationSetCreate(xmlXPtrNewCollapsedRange(start));
@ -798,7 +800,7 @@ xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set) {
xmlXPtrErrMemory("allocating locationset");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
memset(ret, 0, sizeof(xmlXPathObject));
ret->type = XPATH_LOCATIONSET;
if (set != NULL) {
int i;
@ -834,7 +836,7 @@ xmlXPtrWrapLocationSet(xmlLocationSetPtr val) {
xmlXPtrErrMemory("allocating locationset");
return(NULL);
}
memset(ret, 0 , (size_t) sizeof(xmlXPathObject));
memset(ret, 0, sizeof(xmlXPathObject));
ret->type = XPATH_LOCATIONSET;
ret->user = (void *) val;
return(ret);
@ -967,7 +969,7 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
len = xmlStrlen(ctxt->cur);
len++;
buffer = (xmlChar *) xmlMallocAtomic(len * sizeof (xmlChar));
buffer = (xmlChar *) xmlMallocAtomic(len);
if (buffer == NULL) {
xmlXPtrErrMemory("allocating buffer");
xmlFree(name);