generated from sethub/template
[libxml2]Add libxml2 library
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
EXTRA_DIST = \
|
||||
buf.h \
|
||||
cata.h \
|
||||
dict.h \
|
||||
enc.h \
|
||||
entities.h \
|
||||
error.h \
|
||||
globals.h \
|
||||
html.h \
|
||||
io.h \
|
||||
lint.h \
|
||||
memory.h \
|
||||
parser.h \
|
||||
regexp.h \
|
||||
save.h \
|
||||
string.h \
|
||||
threads.h \
|
||||
tree.h \
|
||||
xinclude.h \
|
||||
xpath.h
|
||||
@@ -0,0 +1,45 @@
|
||||
#ifndef XML_BUF_H_PRIVATE__
|
||||
#define XML_BUF_H_PRIVATE__
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
XML_HIDDEN xmlBuf *
|
||||
xmlBufCreate(size_t size);
|
||||
XML_HIDDEN xmlBuf *
|
||||
xmlBufCreateMem(const xmlChar *mem, size_t size, int isStatic);
|
||||
XML_HIDDEN void
|
||||
xmlBufFree(xmlBuf *buf);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlBufEmpty(xmlBuf *buf);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlBufGrow(xmlBuf *buf, size_t len);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlBufAdd(xmlBuf *buf, const xmlChar *str, size_t len);
|
||||
XML_HIDDEN int
|
||||
xmlBufCat(xmlBuf *buf, const xmlChar *str);
|
||||
|
||||
XML_HIDDEN size_t
|
||||
xmlBufAvail(xmlBuf *buf);
|
||||
XML_HIDDEN int
|
||||
xmlBufIsEmpty(xmlBuf *buf);
|
||||
XML_HIDDEN int
|
||||
xmlBufAddLen(xmlBuf *buf, size_t len);
|
||||
|
||||
XML_HIDDEN xmlChar *
|
||||
xmlBufDetach(xmlBuf *buf);
|
||||
|
||||
XML_HIDDEN xmlBuf *
|
||||
xmlBufFromBuffer(xmlBuffer *buffer);
|
||||
XML_HIDDEN int
|
||||
xmlBufBackToBuffer(xmlBuf *buf, xmlBuffer *ret);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlBufResetInput(xmlBuf *buf, xmlParserInput *input);
|
||||
XML_HIDDEN int
|
||||
xmlBufUpdateInput(xmlBuf *buf, xmlParserInput *input, size_t pos);
|
||||
|
||||
#endif /* XML_BUF_H_PRIVATE__ */
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef XML_CATA_H_PRIVATE__
|
||||
#define XML_CATA_H_PRIVATE__
|
||||
|
||||
#ifdef LIBXML_CATALOG_ENABLED
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitCatalogInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupCatalogInternal(void);
|
||||
|
||||
#endif /* LIBXML_CATALOG_ENABLED */
|
||||
|
||||
#endif /* XML_CATA_H_PRIVATE__ */
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef XML_DICT_H_PRIVATE__
|
||||
#define XML_DICT_H_PRIVATE__
|
||||
|
||||
#include <libxml/dict.h>
|
||||
|
||||
/*
|
||||
* Values are ANDed with 0xFFFFFFFF to support platforms where
|
||||
* unsigned is larger than 32 bits. With 32-bit unsigned values,
|
||||
* modern compilers should optimize the operation away.
|
||||
*/
|
||||
|
||||
#define HASH_ROL(x,n) ((x) << (n) | ((x) & 0xFFFFFFFF) >> (32 - (n)))
|
||||
#define HASH_ROR(x,n) (((x) & 0xFFFFFFFF) >> (n) | (x) << (32 - (n)))
|
||||
|
||||
/*
|
||||
* GoodOAAT: One of a smallest non-multiplicative One-At-a-Time functions
|
||||
* that passes SMHasher.
|
||||
*
|
||||
* Author: Sokolov Yura aka funny-falcon
|
||||
*/
|
||||
|
||||
#define HASH_INIT(h1, h2, seed) \
|
||||
do { \
|
||||
h1 = seed ^ 0x3b00; \
|
||||
h2 = HASH_ROL(seed, 15); \
|
||||
} while (0)
|
||||
|
||||
#define HASH_UPDATE(h1, h2, ch) \
|
||||
do { \
|
||||
h1 += ch; \
|
||||
h1 += h1 << 3; \
|
||||
h2 += h1; \
|
||||
h2 = HASH_ROL(h2, 7); \
|
||||
h2 += h2 << 2; \
|
||||
} while (0)
|
||||
|
||||
/* Result is in h2 */
|
||||
#define HASH_FINISH(h1, h2) \
|
||||
do { \
|
||||
h1 ^= h2; \
|
||||
h1 += HASH_ROL(h2, 14); \
|
||||
h2 ^= h1; h2 += HASH_ROR(h1, 6); \
|
||||
h1 ^= h2; h1 += HASH_ROL(h2, 5); \
|
||||
h2 ^= h1; h2 += HASH_ROR(h1, 8); \
|
||||
h2 &= 0xFFFFFFFF; \
|
||||
} while (0)
|
||||
|
||||
typedef struct {
|
||||
unsigned hashValue;
|
||||
const xmlChar *name;
|
||||
} xmlHashedString;
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitDictInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupDictInternal(void);
|
||||
|
||||
XML_HIDDEN unsigned
|
||||
xmlDictComputeHash(const xmlDict *dict, const xmlChar *string);
|
||||
XML_HIDDEN unsigned
|
||||
xmlDictCombineHash(unsigned v1, unsigned v2);
|
||||
XML_HIDDEN xmlHashedString
|
||||
xmlDictLookupHashed(xmlDict *dict, const xmlChar *name, int len);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitRandom(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupRandom(void);
|
||||
XML_HIDDEN unsigned
|
||||
xmlGlobalRandom(void);
|
||||
XML_HIDDEN unsigned
|
||||
xmlRandom(void);
|
||||
|
||||
#endif /* XML_DICT_H_PRIVATE__ */
|
||||
@@ -0,0 +1,19 @@
|
||||
#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 xmlCharEncError
|
||||
xmlEncInputChunk(xmlCharEncodingHandler *handler, unsigned char *out,
|
||||
int *outlen, const unsigned char *in, int *inlen,
|
||||
int flush);
|
||||
XML_HIDDEN xmlCharEncError
|
||||
xmlCharEncInput(xmlParserInputBuffer *input, size_t *sizeOut, int flush);
|
||||
XML_HIDDEN int
|
||||
xmlCharEncOutput(xmlOutputBuffer *output, int init);
|
||||
|
||||
#endif /* XML_ENC_H_PRIVATE__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
#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 and amplification.
|
||||
* expandedSize was set.
|
||||
*
|
||||
* XML_ENT_VALIDATED: The entity contains a valid attribute value.
|
||||
* Only used when entities aren't substituted.
|
||||
*/
|
||||
#define XML_ENT_PARSED (1u << 0)
|
||||
#define XML_ENT_CHECKED (1u << 1)
|
||||
#define XML_ENT_VALIDATED (1u << 2)
|
||||
#define XML_ENT_EXPANDING (1u << 3)
|
||||
|
||||
#endif /* XML_ENTITIES_H_PRIVATE__ */
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef XML_ERROR_H_PRIVATE__
|
||||
#define XML_ERROR_H_PRIVATE__
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#define MAX_ERR_MSG_SIZE 64000
|
||||
|
||||
struct _xmlNode;
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlIsCatastrophicError(int level, int code);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlRaiseMemoryError(xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel,
|
||||
void *data, int domain, xmlError *error);
|
||||
XML_HIDDEN int
|
||||
xmlVRaiseError(xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel,
|
||||
void *data, void *ctx, struct _xmlNode *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, va_list ap);
|
||||
XML_HIDDEN int
|
||||
xmlRaiseError(xmlStructuredErrorFunc schannel, xmlGenericErrorFunc channel,
|
||||
void *data, void *ctx, struct _xmlNode *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);
|
||||
XML_HIDDEN void
|
||||
xmlGenericErrorDefaultFunc(void *ctx, const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
XML_HIDDEN const char *
|
||||
xmlErrString(xmlParserErrors code);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlVPrintErrorMessage(const char *fmt, va_list ap);
|
||||
XML_HIDDEN void
|
||||
xmlPrintErrorMessage(const char *fmt, ...);
|
||||
XML_HIDDEN void
|
||||
xmlAbort(const char *fmt, ...);
|
||||
|
||||
#endif /* XML_ERROR_H_PRIVATE__ */
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef XML_GLOBALS_H_PRIVATE__
|
||||
#define XML_GLOBALS_H_PRIVATE__
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitGlobalsInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupGlobalsInternal(void);
|
||||
|
||||
XML_HIDDEN xmlError *
|
||||
xmlGetLastErrorInternal(void);
|
||||
|
||||
XML_HIDDEN unsigned *
|
||||
xmlGetLocalRngState(void);
|
||||
|
||||
#endif /* XML_GLOBALS_H_PRIVATE__ */
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef XML_HTML_H_PRIVATE__
|
||||
#define XML_HTML_H_PRIVATE__
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#define IS_WS_HTML(c) \
|
||||
(((c) == 0x20) || \
|
||||
(((c) >= 0x09) && ((c) <= 0x0D) && ((c) != 0x0B)))
|
||||
|
||||
#define DATA_RCDATA 1
|
||||
#define DATA_RAWTEXT 2
|
||||
#define DATA_PLAINTEXT 3
|
||||
#define DATA_SCRIPT 4
|
||||
#define DATA_SCRIPT_ESC1 5
|
||||
#define DATA_SCRIPT_ESC2 6
|
||||
|
||||
typedef struct {
|
||||
size_t start;
|
||||
size_t end;
|
||||
size_t size;
|
||||
} htmlMetaEncodingOffsets;
|
||||
|
||||
XML_HIDDEN xmlNode *
|
||||
htmlCtxtParseContentInternal(xmlParserCtxt *ctxt, xmlParserInput *input);
|
||||
|
||||
XML_HIDDEN int
|
||||
htmlParseContentType(const xmlChar *val, htmlMetaEncodingOffsets *off);
|
||||
|
||||
XML_HIDDEN void
|
||||
htmlNodeDumpInternal(xmlOutputBuffer *buf, xmlNode *cur,
|
||||
const char *encoding, int format);
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
||||
#endif /* XML_HTML_H_PRIVATE__ */
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef XML_IO_H_PRIVATE__
|
||||
#define XML_IO_H_PRIVATE__
|
||||
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX ((size_t)(-1))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initial buffer size should include
|
||||
*
|
||||
* - MINLEN = 4000 (I/O chunk size)
|
||||
* - INPUT_CHUNK = 250 (parser prefetch)
|
||||
* - LINE_LEN = 80 (shrink limit for error messages)
|
||||
* - some amount for unshrunken content.
|
||||
*/
|
||||
#define XML_IO_BUFFER_SIZE 6000
|
||||
|
||||
#define XML_ESCAPE_ATTR (1u << 0)
|
||||
#define XML_ESCAPE_NON_ASCII (1u << 1)
|
||||
#define XML_ESCAPE_HTML (1u << 2)
|
||||
#define XML_ESCAPE_QUOT (1u << 3)
|
||||
|
||||
XML_HIDDEN xmlChar *
|
||||
xmlEscapeText(const xmlChar *text, int flags);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlSerializeText(xmlOutputBuffer *buf, const xmlChar *string, size_t maxSize,
|
||||
unsigned flags);
|
||||
#endif
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitIOCallbacks(void);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlNoNetExists(const char *filename);
|
||||
|
||||
XML_HIDDEN xmlParserErrors
|
||||
xmlParserInputBufferCreateUrl(const char *URI, xmlCharEncoding enc,
|
||||
xmlParserInputFlags flags,
|
||||
xmlParserInputBuffer **out);
|
||||
|
||||
XML_HIDDEN xmlParserInputBuffer *
|
||||
xmlNewInputBufferString(const char *str, xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInputBuffer *
|
||||
xmlNewInputBufferMemory(const void *mem, size_t size,
|
||||
xmlParserInputFlags flags, xmlCharEncoding enc);
|
||||
|
||||
XML_HIDDEN xmlParserErrors
|
||||
xmlInputFromFd(xmlParserInputBuffer *buf, int fd, xmlParserInputFlags flags);
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlOutputBufferWriteQuotedString(xmlOutputBuffer *buf,
|
||||
const xmlChar *string);
|
||||
#endif
|
||||
|
||||
#endif /* XML_IO_H_PRIVATE__ */
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef XML_LINT_H_PRIVATE__
|
||||
#define XML_LINT_H_PRIVATE__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
int
|
||||
xmllintMain(int argc, const char **argv, FILE *errStream,
|
||||
xmlResourceLoader loader);
|
||||
|
||||
void
|
||||
xmllintShell(xmlDoc *doc, const char *filename, FILE *output);
|
||||
|
||||
#endif /* XML_LINT_H_PRIVATE__ */
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef XML_MEMORY_H_PRIVATE__
|
||||
#define XML_MEMORY_H_PRIVATE__
|
||||
|
||||
#include "../../libxml.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX ((size_t) -1)
|
||||
#endif
|
||||
|
||||
#define XML_MAX_ITEMS 1000000000 /* 1 billion */
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitMemoryInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupMemoryInternal(void);
|
||||
|
||||
/**
|
||||
* @array: pointer to array
|
||||
* @capacity: pointer to capacity (in/out)
|
||||
* @elemSize: size of an element in bytes
|
||||
* @min: elements in initial allocation
|
||||
* @max: maximum elements in the array
|
||||
*
|
||||
* Grow an array by at least one element, checking for overflow.
|
||||
*
|
||||
* Returns the new array size on success, -1 on failure.
|
||||
*/
|
||||
static XML_INLINE int
|
||||
xmlGrowCapacity(int capacity, size_t elemSize, int min, int max) {
|
||||
int extra;
|
||||
|
||||
if (capacity <= 0) {
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
(void) min;
|
||||
return(1);
|
||||
#else
|
||||
return(min);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((capacity >= max) ||
|
||||
((size_t) capacity > SIZE_MAX / 2 / elemSize))
|
||||
return(-1);
|
||||
|
||||
/* Grow by 50% */
|
||||
extra = (capacity + 1) / 2;
|
||||
|
||||
if (capacity > max - extra)
|
||||
return(max);
|
||||
|
||||
return(capacity + extra);
|
||||
}
|
||||
|
||||
XML_HIDDEN void *
|
||||
xmlGrowArray(void *array, size_t elemSize, int *capacity, int min, int max);
|
||||
|
||||
#endif /* XML_MEMORY_H_PRIVATE__ */
|
||||
@@ -0,0 +1,190 @@
|
||||
#ifndef XML_PARSER_H_PRIVATE__
|
||||
#define XML_PARSER_H_PRIVATE__
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#define XML_INVALID_CHAR 0x200000
|
||||
|
||||
#define XML_MAX_URI_LENGTH 2000
|
||||
|
||||
/**
|
||||
* Set after xmlValidateDtdFinal was called.
|
||||
*/
|
||||
#define XML_VCTXT_DTD_VALIDATED (1u << 0)
|
||||
/**
|
||||
* Set if the validation context is part of a parser context.
|
||||
*/
|
||||
#define XML_VCTXT_USE_PCTXT (1u << 1)
|
||||
/**
|
||||
* Set if the validation is enabled.
|
||||
*/
|
||||
#define XML_VCTXT_VALIDATE (1u << 2)
|
||||
/**
|
||||
* Set when parsing entities.
|
||||
*/
|
||||
#define XML_VCTXT_IN_ENTITY (1u << 3)
|
||||
|
||||
/*
|
||||
* TODO: Rename to avoid confusion with xmlParserInputFlags
|
||||
*/
|
||||
#define XML_INPUT_HAS_ENCODING (1u << 0)
|
||||
#define XML_INPUT_AUTO_ENCODING (7u << 1)
|
||||
#define XML_INPUT_AUTO_UTF8 (1u << 1)
|
||||
#define XML_INPUT_AUTO_UTF16LE (2u << 1)
|
||||
#define XML_INPUT_AUTO_UTF16BE (3u << 1)
|
||||
#define XML_INPUT_AUTO_OTHER (4u << 1)
|
||||
#define XML_INPUT_USES_ENC_DECL (1u << 4)
|
||||
#define XML_INPUT_ENCODING_ERROR (1u << 5)
|
||||
#define XML_INPUT_PROGRESSIVE (1u << 6)
|
||||
#define XML_INPUT_MARKUP_DECL (1u << 7)
|
||||
|
||||
#define PARSER_STOPPED(ctxt) ((ctxt)->disableSAX > 1)
|
||||
|
||||
#define PARSER_PROGRESSIVE(ctxt) \
|
||||
((ctxt)->input->flags & XML_INPUT_PROGRESSIVE)
|
||||
|
||||
#define PARSER_IN_PE(ctxt) \
|
||||
(((ctxt)->input->entity != NULL) && \
|
||||
(((ctxt)->input->entity->etype == XML_INTERNAL_PARAMETER_ENTITY) || \
|
||||
((ctxt)->input->entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)))
|
||||
|
||||
#define PARSER_EXTERNAL(ctxt) \
|
||||
(((ctxt)->inSubset == 2) || \
|
||||
(((ctxt)->input->entity != NULL) && \
|
||||
((ctxt)->input->entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)))
|
||||
|
||||
/**
|
||||
* The parser tries to always have that amount of input ready.
|
||||
* One of the point is providing context when reporting errors.
|
||||
*/
|
||||
#define INPUT_CHUNK 250
|
||||
|
||||
struct _xmlAttrHashBucket {
|
||||
int index;
|
||||
};
|
||||
|
||||
#define XML_SCAN_NC 1
|
||||
#define XML_SCAN_NMTOKEN 2
|
||||
#define XML_SCAN_OLD10 4
|
||||
|
||||
XML_HIDDEN const xmlChar *
|
||||
xmlScanName(const xmlChar *buf, size_t maxSize, int flags);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlCtxtVErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain,
|
||||
xmlParserErrors code, xmlErrorLevel level,
|
||||
const xmlChar *str1, const xmlChar *str2, const xmlChar *str3,
|
||||
int int1, const char *msg, va_list ap);
|
||||
XML_HIDDEN void
|
||||
xmlCtxtErr(xmlParserCtxt *ctxt, xmlNode *node, xmlErrorDomain domain,
|
||||
xmlParserErrors code, xmlErrorLevel level,
|
||||
const xmlChar *str1, const xmlChar *str2, const xmlChar *str3,
|
||||
int int1, const char *msg, ...);
|
||||
XML_HIDDEN void
|
||||
xmlFatalErr(xmlParserCtxt *ctxt, xmlParserErrors error, const char *info);
|
||||
XML_HIDDEN void LIBXML_ATTR_FORMAT(3,0)
|
||||
xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
|
||||
const char *msg, const xmlChar *str1, const xmlChar *str2);
|
||||
XML_HIDDEN void
|
||||
xmlCtxtErrIO(xmlParserCtxt *ctxt, int code, const char *uri);
|
||||
XML_HIDDEN int
|
||||
xmlCtxtIsCatastrophicError(xmlParserCtxt *ctxt);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlParserGrow(xmlParserCtxt *ctxt);
|
||||
XML_HIDDEN void
|
||||
xmlParserShrink(xmlParserCtxt *ctxt);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlDetectEncoding(xmlParserCtxt *ctxt);
|
||||
XML_HIDDEN void
|
||||
xmlSetDeclaredEncoding(xmlParserCtxt *ctxt, xmlChar *encoding);
|
||||
XML_HIDDEN const xmlChar *
|
||||
xmlGetActualEncoding(xmlParserCtxt *ctxt);
|
||||
|
||||
XML_HIDDEN int
|
||||
nodePush(xmlParserCtxt *ctxt, xmlNode *value);
|
||||
XML_HIDDEN xmlNode *
|
||||
nodePop(xmlParserCtxt *ctxt);
|
||||
|
||||
XML_HIDDEN xmlParserNsData *
|
||||
xmlParserNsCreate(void);
|
||||
XML_HIDDEN void
|
||||
xmlParserNsFree(xmlParserNsData *nsdb);
|
||||
/*
|
||||
* These functions allow SAX handlers to attach extra data to namespaces
|
||||
* efficiently and should be made public.
|
||||
*/
|
||||
XML_HIDDEN int
|
||||
xmlParserNsUpdateSax(xmlParserCtxt *ctxt, const xmlChar *prefix,
|
||||
void *saxData);
|
||||
XML_HIDDEN void *
|
||||
xmlParserNsLookupSax(xmlParserCtxt *ctxt, const xmlChar *prefix);
|
||||
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlLoadResource(xmlParserCtxt *ctxt, const char *url, const char *publicId,
|
||||
xmlResourceType type);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlCtxtNewInputFromUrl(xmlParserCtxt *ctxt, const char *url,
|
||||
const char *publicId, const char *encoding,
|
||||
xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlCtxtNewInputFromMemory(xmlParserCtxt *ctxt, const char *url,
|
||||
const void *mem, size_t size,
|
||||
const char *encoding,
|
||||
xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlCtxtNewInputFromString(xmlParserCtxt *ctxt, const char *url,
|
||||
const char *str, const char *encoding,
|
||||
xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlCtxtNewInputFromFd(xmlParserCtxt *ctxt, const char *filename, int fd,
|
||||
const char *encoding, xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlCtxtNewInputFromIO(xmlParserCtxt *ctxt, const char *url,
|
||||
xmlInputReadCallback ioRead,
|
||||
xmlInputCloseCallback ioClose,
|
||||
void *ioCtxt,
|
||||
const char *encoding, xmlParserInputFlags flags);
|
||||
XML_HIDDEN xmlParserInput *
|
||||
xmlNewPushInput(const char *url, const char *chunk, int size);
|
||||
|
||||
XML_HIDDEN xmlChar *
|
||||
xmlExpandEntitiesInAttValue(xmlParserCtxt *ctxt, const xmlChar *str,
|
||||
int normalize);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlParserCheckEOF(xmlParserCtxt *ctxt, xmlParserErrors code);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlParserInputGetWindow(xmlParserInput *input, const xmlChar **startOut,
|
||||
int *sizeInOut, int *offsetOut);
|
||||
|
||||
static XML_INLINE void
|
||||
xmlSaturatedAdd(unsigned long *dst, unsigned long val) {
|
||||
if (val > ULONG_MAX - *dst)
|
||||
*dst = ULONG_MAX;
|
||||
else
|
||||
*dst += val;
|
||||
}
|
||||
|
||||
static XML_INLINE void
|
||||
xmlSaturatedAddSizeT(unsigned long *dst, size_t val) {
|
||||
if (val > ULONG_MAX - *dst)
|
||||
*dst = ULONG_MAX;
|
||||
else
|
||||
*dst += val;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlAttrNormalize helper functions
|
||||
* https://www.w3.org/TR/REC-xml/#AVNormalize
|
||||
*/
|
||||
|
||||
XML_HIDDEN xmlChar * xmlAttrNormalize(xmlChar *src);
|
||||
XML_HIDDEN xmlChar * xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst);
|
||||
|
||||
#endif /* XML_PARSER_H_PRIVATE__ */
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef XML_REGEXP_H_PRIVATE__
|
||||
#define XML_REGEXP_H_PRIVATE__
|
||||
|
||||
#include <libxml/xmlautomata.h>
|
||||
|
||||
#ifdef LIBXML_REGEXP_ENABLED
|
||||
|
||||
/*
|
||||
* -2 and -3 are used by xmlValidateElementType for other things.
|
||||
*/
|
||||
#define XML_REGEXP_OK 0
|
||||
#define XML_REGEXP_NOT_FOUND (-1)
|
||||
#define XML_REGEXP_INTERNAL_ERROR (-4)
|
||||
#define XML_REGEXP_OUT_OF_MEMORY (-5)
|
||||
#define XML_REGEXP_INTERNAL_LIMIT (-6)
|
||||
#define XML_REGEXP_INVALID_UTF8 (-7)
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlAutomataSetFlags(xmlAutomata *am, int flags);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlRegExecClearErrors(xmlRegExecCtxt* exec);
|
||||
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
|
||||
#endif /* XML_REGEXP_H_PRIVATE__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef XML_SAVE_H_PRIVATE__
|
||||
#define XML_SAVE_H_PRIVATE__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlsave.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlSaveNotationDecl(xmlSaveCtxt *ctxt, xmlNotation *cur);
|
||||
XML_HIDDEN int
|
||||
xmlSaveNotationTable(xmlSaveCtxt *ctxt, xmlNotationTable *cur);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlBufAttrSerializeTxtContent(xmlOutputBuffer *buf, xmlDoc *doc,
|
||||
const xmlChar *string);
|
||||
XML_HIDDEN void
|
||||
xmlNsListDumpOutput(xmlOutputBuffer *buf, xmlNs *cur);
|
||||
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
#endif /* XML_SAVE_H_PRIVATE__ */
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef XML_STRING_H_PRIVATE__
|
||||
#define XML_STRING_H_PRIVATE__
|
||||
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlStrVASPrintf(xmlChar **out, int maxSize, const char *msg, va_list ap);
|
||||
XML_HIDDEN int
|
||||
xmlStrASPrintf(xmlChar **out, int maxSize, const char *msg, ...);
|
||||
XML_HIDDEN xmlChar *
|
||||
xmlEscapeFormatString(xmlChar **msg);
|
||||
|
||||
#endif /* XML_STRING_H_PRIVATE__ */
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef XML_THREADS_H_PRIVATE__
|
||||
#define XML_THREADS_H_PRIVATE__
|
||||
|
||||
#include <libxml/threads.h>
|
||||
|
||||
#ifdef LIBXML_THREAD_ENABLED
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifdef _WIN32_WINNT
|
||||
#if _WIN32_WINNT < 0x0600
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#else
|
||||
/* get the default version of the SDK */
|
||||
#include <sdkddkver.h>
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#define HAVE_WIN32_THREADS
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#define HAVE_POSIX_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
|
||||
};
|
||||
|
||||
/*
|
||||
* xmlRMutex are reentrant mutual exception locks
|
||||
*/
|
||||
struct _xmlRMutex {
|
||||
#ifdef HAVE_POSIX_THREADS
|
||||
pthread_mutex_t lock;
|
||||
unsigned int held;
|
||||
unsigned int waiters;
|
||||
pthread_t tid;
|
||||
pthread_cond_t cv;
|
||||
#elif defined HAVE_WIN32_THREADS
|
||||
CRITICAL_SECTION cs;
|
||||
#else
|
||||
int empty;
|
||||
#endif
|
||||
};
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitMutex(xmlMutex *mutex);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupMutex(xmlMutex *mutex);
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitRMutex(xmlRMutex *mutex);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupRMutex(xmlRMutex *mutex);
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlInitSchemasTypesInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupSchemasTypesInternal(void);
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_RELAXNG_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlInitRelaxNGInternal(void);
|
||||
XML_HIDDEN void
|
||||
xmlCleanupRelaxNGInternal(void);
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* XML_THREADS_H_PRIVATE__ */
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef XML_TREE_H_PRIVATE__
|
||||
#define XML_TREE_H_PRIVATE__
|
||||
|
||||
XML_HIDDEN extern int
|
||||
xmlRegisterCallbacks;
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlSearchNsSafe(xmlNode *node, const xmlChar *href, xmlNs **out);
|
||||
XML_HIDDEN int
|
||||
xmlSearchNsByHrefSafe(xmlNode *node, const xmlChar *href, xmlNs **out);
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlNodeParseAttValue(const xmlDoc *doc, xmlAttr *parent,
|
||||
const xmlChar *value, size_t len, xmlNode **listPtr);
|
||||
XML_HIDDEN xmlNode *
|
||||
xmlStaticCopyNode(xmlNode *node, xmlDoc *doc, xmlNode *parent,
|
||||
int extended);
|
||||
XML_HIDDEN xmlNode *
|
||||
xmlStaticCopyNodeList(xmlNode *node, xmlDoc *doc, xmlNode *parent);
|
||||
XML_HIDDEN const xmlChar *
|
||||
xmlSplitQName4(const xmlChar *name, xmlChar **prefixPtr);
|
||||
|
||||
XML_HIDDEN xmlChar *
|
||||
xmlNodeListGetStringInternal(const xmlNode *node, int escape, int flags);
|
||||
|
||||
#endif /* XML_TREE_H_PRIVATE__ */
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef XML_INCLUDE_H_PRIVATE__
|
||||
#define XML_INCLUDE_H_PRIVATE__
|
||||
|
||||
#include <libxml/xinclude.h>
|
||||
|
||||
XML_HIDDEN int
|
||||
xmlXIncludeSetStreamingMode(xmlXIncludeCtxt *ctxt, int mode);
|
||||
|
||||
#endif /* XML_INCLUDE_H_PRIVATE__ */
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef XML_XPATH_H_PRIVATE__
|
||||
#define XML_XPATH_H_PRIVATE__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
XML_HIDDEN void
|
||||
xmlInitXPathInternal(void);
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
XML_HIDDEN void
|
||||
xmlXPathErrMemory(xmlXPathContext *ctxt);
|
||||
XML_HIDDEN void
|
||||
xmlXPathPErrMemory(xmlXPathParserContext *ctxt);
|
||||
#endif
|
||||
|
||||
#endif /* XML_XPATH_H_PRIVATE__ */
|
||||
Reference in New Issue
Block a user