cpython: e4dc8be9a72f (original) (raw)
--- a/Modules/expat/COPYING +++ b/Modules/expat/COPYING @@ -1,5 +1,6 @@ Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
--- a/Modules/expat/amigaconfig.h
+++ b/Modules/expat/amigaconfig.h
@@ -10,66 +10,12 @@
/* Define to 1 if you have the <check.h> header file. /
#undef HAVE_CHECK_H
-/ Define to 1 if you have the <dlfcn.h> header file. /
-#undef HAVE_DLFCN_H
-
-/ Define to 1 if you have the <fcntl.h> header file. /
-#define HAVE_FCNTL_H 1
-
-/ Define to 1 if you have the getpagesize' function. */[](#l2.13) -#undef HAVE_GETPAGESIZE[](#l2.14) -[](#l2.15) -/* Define to 1 if you have the <inttypes.h> header file. */[](#l2.16) -#define HAVE_INTTYPES_H 1[](#l2.17) -[](#l2.18) /* Define to 1 if you have the
memmove' function. /
#define HAVE_MEMMOVE 1
-/ Define to 1 if you have the <memory.h> header file. /
-#undef HAVE_MEMORY_H
-
-/ Define to 1 if you have a working mmap' system call. */[](#l2.25) -#undef HAVE_MMAP[](#l2.26) -[](#l2.27) -/* Define to 1 if you have the <stdint.h> header file. */[](#l2.28) -#define HAVE_STDINT_H 1[](#l2.29) -[](#l2.30) -/* Define to 1 if you have the <stdlib.h> header file. */[](#l2.31) -#define HAVE_STDLIB_H 1[](#l2.32) -[](#l2.33) -/* Define to 1 if you have the <strings.h> header file. */[](#l2.34) -#define HAVE_STRINGS_H 1[](#l2.35) -[](#l2.36) -/* Define to 1 if you have the <string.h> header file. */[](#l2.37) -#define HAVE_STRING_H 1[](#l2.38) -[](#l2.39) -/* Define to 1 if you have the <sys/stat.h> header file. */[](#l2.40) -#define HAVE_SYS_STAT_H 1[](#l2.41) -[](#l2.42) -/* Define to 1 if you have the <sys/types.h> header file. */[](#l2.43) -#define HAVE_SYS_TYPES_H 1[](#l2.44) -[](#l2.45) /* Define to 1 if you have the <unistd.h> header file. */[](#l2.46) #define HAVE_UNISTD_H 1[](#l2.47) [](#l2.48) -/* Define to the address where bug reports for this package should be sent. */[](#l2.49) -#define PACKAGE_BUGREPORT "expat-bugs@mail.libexpat.org"[](#l2.50) -[](#l2.51) -/* Define to the full name of this package. */[](#l2.52) -#define PACKAGE_NAME "expat"[](#l2.53) -[](#l2.54) -/* Define to the full name and version of this package. */[](#l2.55) -#define PACKAGE_STRING "expat 1.95.8"[](#l2.56) -[](#l2.57) -/* Define to the one symbol short name of this package. */[](#l2.58) -#undef PACKAGE_TARNAME[](#l2.59) -[](#l2.60) -/* Define to the version of this package. */[](#l2.61) -#define PACKAGE_VERSION "1.95.8"[](#l2.62) -[](#l2.63) -/* Define to 1 if you have the ANSI C header files. */[](#l2.64) -#define STDC_HEADERS 1[](#l2.65) -[](#l2.66) /* whether byteorder is bigendian */[](#l2.67) #define WORDS_BIGENDIAN[](#l2.68) [](#l2.69) @@ -83,14 +29,4 @@[](#l2.70) /* Define to make XML Namespaces functionality available. */[](#l2.71) #define XML_NS[](#l2.72) [](#l2.73) -/* Define to empty if
const' does not conform to ANSI C. /
-#undef const
-
-/ Define to long' if <sys/types.h> does not define. */[](#l2.77) -#undef off_t[](#l2.78) -[](#l2.79) -/* Define to
unsigned' if <sys/types.h> does not define. /
-#undef size_t
-
-
#endif / AMIGACONFIG_H */
--- a/Modules/expat/ascii.h +++ b/Modules/expat/ascii.h @@ -83,3 +83,10 @@ #define ASCII_LSQB 0x5B #define ASCII_RSQB 0x5D #define ASCII_UNDERSCORE 0x5F +#define ASCII_LPAREN 0x28 +#define ASCII_RPAREN 0x29 +#define ASCII_FF 0x0C +#define ASCII_SLASH 0x2F +#define ASCII_HASH 0x23 +#define ASCII_PIPE 0x7C +#define ASCII_COMMA 0x2C
--- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -742,6 +742,29 @@ XML_GetSpecifiedAttributeCount(XML_Parse XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); +#ifdef XML_ATTR_INFO +/* Source file byte offsets for the start and end of attribute names and values.
- The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
- file an attribute value of "blah" will yield:
- info->valueEnd - info->valueStart = 4 bytes. +*/ +typedef struct {
- XML_Index nameStart; /* Offset to beginning of the attribute name. */
- XML_Index nameEnd; /* Offset after the attribute name's last byte. */
- XML_Index valueStart; /* Offset to beginning of the attribute value. */
- XML_Index valueEnd; /* Offset after the attribute value's last byte. / +} XML_AttrInfo; + +/ Returns an array of XML_AttrInfo structures for the attribute/value pairs
- passed in last call to the XML_StartElementHandler that were specified
- in the start-tag rather than defaulted. Each attribute/value pair counts
- as 1; thus the number of entries in the array is
- XML_GetSpecifiedAttributeCount(parser) / 2. +*/ +XMLPARSEAPI(const XML_AttrInfo *) +XML_GetAttributeInfo(XML_Parser parser); +#endif +
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is detected. The last call to XML_Parse must have isFinal true; len may be zero for this call (or any other). @@ -994,7 +1017,9 @@ enum XML_FeatureEnum { XML_FEATURE_MIN_SIZE, XML_FEATURE_SIZEOF_XML_CHAR, XML_FEATURE_SIZEOF_XML_LCHAR,
- XML_FEATURE_NS,
- XML_FEATURE_LARGE_SIZE,
- XML_FEATURE_ATTR_INFO /* Additional features must be added to the end of this enum. */ }; @@ -1014,7 +1039,7 @@ XML_GetFeatureList(void); change to major or minor version. */
#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 0 +#define XML_MINOR_VERSION 1 #define XML_MICRO_VERSION 0 #ifdef __cplusplus
--- a/Modules/expat/expat_external.h +++ b/Modules/expat/expat_external.h @@ -7,11 +7,7 @@ /* External API definitions / -/ Namespace external symbols to allow multiple libexpat version to
-#if defined(_MSC_EXTENSIONS) && !defined(CYGWIN) +#if defined(_MSC_EXTENSIONS) && !defined(BEOS) && !defined(CYGWIN) #define XML_USE_MSC_EXTENSIONS 1 #endif @@ -38,9 +34,9 @@ system headers may assume the cdecl convention. / #ifndef XMLCALL -#if defined(XML_USE_MSC_EXTENSIONS) +#if defined(_MSC_VER) #define XMLCALL __cdecl -#elif defined(GNUC) && defined(__i386) +#elif defined(GNUC) && defined(__i386) && !defined(__INTEL_COMPILER) #define XMLCALL attribute((cdecl)) #else / For any platform which uses this definition and supports more than
--- a/Modules/expat/internal.h +++ b/Modules/expat/internal.h @@ -20,7 +20,7 @@ and therefore subject to change. / -#if defined(GNUC) && defined(i386) +#if defined(GNUC) && defined(i386) && !defined(MINGW32) / We'll use this version by default only where we know it helps. regparm() generates warnings on Solaris boxes. See SF bug #692878.
new file mode 100644 --- /dev/null +++ b/Modules/expat/watcomconfig.h @@ -0,0 +1,47 @@ +/* expat_config.h for use with Open Watcom 1.5 and above. / + +#ifndef WATCOMCONFIG_H +#define WATCOMCONFIG_H + +#ifdef NT +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN +#endif + +/ 1234 = LIL_ENDIAN, 4321 = BIGENDIAN / +#define BYTEORDER 1234 + +/ Define to 1 if you have the `memmove' function. / +#define HAVE_MEMMOVE 1 + +/ Define to 1 if you have the <unistd.h> header file. / +#define HAVE_UNISTD_H 1 + +/ Define to the address where bug reports for this package should be sent. / +#define PACKAGE_BUGREPORT "expat-bugs@mail.libexpat.org" + +/ Define to the full name of this package. / +#define PACKAGE_NAME "expat" + +/ Define to the full name and version of this package. / +#define PACKAGE_STRING "expat 2.0.0" + +/ Define to the one symbol short name of this package. / +#undef PACKAGE_TARNAME + +/ Define to the version of this package. / +#define PACKAGE_VERSION "2.0.0" + +/ Define to specify how much context to retain around the current parse
+/* Define to make parameter entity parsing functionality available. / +#define XML_DTD 1 + +/ Define to make XML Namespaces functionality available. */ +#define XML_NS 1 + +#endif +
--- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -2,24 +2,27 @@ See the file COPYING for copying permission. / +#include <stddef.h> +#include <string.h> / memset(), memcpy() / +#include <assert.h> +#include <limits.h> / UINT_MAX / +#include <time.h> / time() / + #define XML_BUILDING_EXPAT 1 #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" -#elif defined(amigaos4) +#elif defined(amigaos) #include "amigaconfig.h" +#elif defined(WATCOMC) +#include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include <expat_config.h> #endif / ndef COMPILED_FROM_DSP / -#include <stddef.h> -#include <string.h> / memset(), memcpy() / -#include <assert.h> -#include <limits.h> / UINT_MAX / -#include <time.h> / time() / - +#include "ascii.h" #include "expat.h" #ifdef XML_UNICODE @@ -28,7 +31,8 @@ #define XmlGetInternalEncoding XmlGetUtf16InternalEncoding #define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS #define XmlEncode XmlUtf16Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) +/ Using pointer subtraction to convert to integer type. */ +#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1)) typedef unsigned short ICHAR; #else #define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX @@ -325,15 +329,15 @@ processXmlDecl(XML_Parser parser, int is static enum XML_Error initializeEncoding(XML_Parser parser); static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
const char *end, int tok, const char *next, const char **nextPtr, [](#l8.53)
+doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
const char *end, int tok, const char *next, const char **nextPtr,[](#l8.55) XML_Bool haveMore);[](#l8.56)
static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, +processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl); static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
const char *start, const char *end, const char **endPtr, [](#l8.63)
const char *start, const char *end, const char **endPtr,[](#l8.64) XML_Bool haveMore);[](#l8.65)
static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, @@ -351,7 +355,7 @@ static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr); static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, +defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, @@ -436,6 +440,7 @@ parserCreate(const XML_Char *encodingNam const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd); + static void parserInit(XML_Parser parser, const XML_Char *encodingName); @@ -535,6 +540,9 @@ struct XML_ParserStruct { NS_ATT *m_nsAtts; unsigned long m_nsAttsVersion; unsigned char m_nsAttsPower; +#ifdef XML_ATTR_INFO
- XML_AttrInfo *m_attInfo; +#endif POSITION m_position; STRING_POOL m_tempPool; STRING_POOL m_temp2Pool; @@ -643,6 +651,7 @@ struct XML_ParserStruct {
#define nsAtts (parser->m_nsAtts) #define nsAttsVersion (parser->m_nsAttsVersion) #define nsAttsPower (parser->m_nsAttsPower) +#define attInfo (parser->m_attInfo) #define tempPool (parser->m_tempPool) #define temp2Pool (parser->m_temp2Pool) #define groupConnector (parser->m_groupConnector) @@ -673,10 +682,12 @@ XML_ParserCreateNS(const XML_Char *encod } static const XML_Char implicitContext[] = {
- 'x', 'm', 'l', '=', 'h', 't', 't', 'p', ':', '/', '/',
- 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
- 'X', 'M', 'L', '/', '1', '9', '9', '8', '/',
- 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', '\0'
- ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p,
- ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w,
- ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g,
- ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9,
- ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e,
- ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' }; static unsigned long @@ -690,23 +701,22 @@ generate_hash_secret_salt(void) static XML_Bool /* only valid for root parser */ startParsing(XML_Parser parser) {
- /* hash functions must be initialized before setContext() is called */ -
- if (hash_secret_salt == 0)
- hash_secret_salt = generate_hash_secret_salt();
- if (ns) {
- /* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it[](#l8.130)
- */
- return setContext(parser, implicitContext);
- }
- return XML_TRUE;
- /* hash functions must be initialized before setContext() is called */
- if (hash_secret_salt == 0)
hash_secret_salt = generate_hash_secret_salt();[](#l8.137)
- if (ns) {
/* implicit context only set for root parser, since child[](#l8.139)
parsers (i.e. external entity parsers) will inherit it[](#l8.140)
*/[](#l8.141)
return setContext(parser, implicitContext);[](#l8.142)
- }
- return XML_TRUE;
} XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName,
const XML_Memory_Handling_Suite *memsuite,[](#l8.151)
const XML_Char *nameSep)[](#l8.152)
{ return parserCreate(encodingName, memsuite, nameSep, NULL); } @@ -753,9 +763,20 @@ parserCreate(const XML_Char *encodingNam FREE(parser); return NULL; } +#ifdef XML_ATTR_INFO
- attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo));
- if (attInfo == NULL) {
- FREE(atts);
- FREE(parser);
- return NULL;
- } +#endif dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); if (dataBuf == NULL) { FREE(atts); +#ifdef XML_ATTR_INFO
- FREE(attInfo);
+#endif FREE(parser); return NULL; } @@ -768,6 +789,9 @@ parserCreate(const XML_Char *encodingNam if (_dtd == NULL) { FREE(dataBuf); FREE(atts); +#ifdef XML_ATTR_INFO
FREE(attInfo);[](#l8.182)
+#endif FREE(parser); return NULL; } @@ -783,7 +807,7 @@ parserCreate(const XML_Char *encodingNam unknownEncodingHandler = NULL; unknownEncodingHandlerData = NULL;
- namespaceSeparator = ASCII_EXCL; ns = XML_FALSE; ns_triplets = XML_FALSE; @@ -1154,6 +1178,9 @@ XML_ParserFree(XML_Parser parser)
#endif /* XML_DTD */ dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); FREE((void *)atts); +#ifdef XML_ATTR_INFO
- FREE((void *)attInfo); +#endif FREE(groupConnector); FREE(buffer); FREE(dataBuf); @@ -1234,6 +1261,14 @@ XML_GetIdAttributeIndex(XML_Parser parse return idAttIndex; } +#ifdef XML_ATTR_INFO +const XML_AttrInfo * XMLCALL +XML_GetAttributeInfo(XML_Parser parser) +{
- return attInfo; +} +#endif + void XMLCALL XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
@@ -1499,7 +1534,7 @@ XML_Parse(XML_Parser parser, const char XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return XML_STATUS_SUSPENDED;
case XML_INITIALIZED: [](#l8.225)
case XML_INITIALIZED:[](#l8.226) case XML_PARSING:[](#l8.227) ps_parsing = XML_FINISHED;[](#l8.228) /* fall through */[](#l8.229)
@@ -1555,15 +1590,11 @@ XML_Parse(XML_Parser parser, const char : (char *)REALLOC(buffer, len * 2)); if (temp == NULL) { errorCode = XML_ERROR_NO_MEMORY;
return XML_STATUS_ERROR;[](#l8.234)
}[](#l8.235)
buffer = temp;[](#l8.236)
if (!buffer) {[](#l8.237)
errorCode = XML_ERROR_NO_MEMORY;[](#l8.238) eventPtr = eventEndPtr = NULL;[](#l8.239) processor = errorProcessor;[](#l8.240) return XML_STATUS_ERROR;[](#l8.241) }[](#l8.242)
buffer = temp;[](#l8.243) bufferLim = buffer + len * 2;[](#l8.244) }[](#l8.245) memcpy(buffer, end, nLeftOver);[](#l8.246)
@@ -1629,7 +1660,7 @@ XML_ParseBuffer(XML_Parser parser, int l case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break;
@@ -1719,6 +1750,8 @@ XML_GetBuffer(XML_Parser parser, int len bufferPtr = buffer = newBuf; #endif /* not defined XML_CONTEXT_BYTES */ }
} return bufferEnd; } @@ -1776,7 +1809,7 @@ XML_ResumeParser(XML_Parser parser) case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break;
@@ -2001,6 +2034,12 @@ XML_GetFeatureList(void) #ifdef XML_NS {XML_FEATURE_NS, XML_L("XML_NS"), 0}, #endif +#ifdef XML_LARGE_SIZE
+#endif {XML_FEATURE_END, NULL, 0} }; @@ -2063,7 +2102,7 @@ contentProcessor(XML_Parser parser, const char *end, const char **endPtr) {
- enum XML_Error result = doContent(parser, 0, encoding, start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result == XML_ERROR_NONE) { if (!storeRawNames(parser)) @@ -2145,7 +2184,7 @@ externalEntityInitProcessor3(XML_Parser if (result != XML_ERROR_NONE) return result; switch (ps_parsing) {
case XML_SUSPENDED: [](#l8.300)
case XML_SUSPENDED:[](#l8.301) *endPtr = next;[](#l8.302) return XML_ERROR_NONE;[](#l8.303) case XML_FINISHED:[](#l8.304)
@@ -2179,7 +2218,7 @@ externalEntityContentProcessor(XML_Parse const char *end, const char **endPtr) {
- enum XML_Error result = doContent(parser, 1, encoding, start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result == XML_ERROR_NONE) { if (!storeRawNames(parser)) @@ -2198,7 +2237,7 @@ doContent(XML_Parser parser, XML_Bool haveMore)
{ /* save one level of indirection */
- DTD * const dtd = _dtd; const char **eventPP; const char **eventEndPP; @@ -2229,8 +2268,8 @@ doContent(XML_Parser parser, } else if (defaultHandler) reportDefault(parser, enc, s, end);
/* We are at the end of the final buffer, should we check for [](#l8.327)
XML_SUSPENDED, XML_FINISHED? [](#l8.328)
/* We are at the end of the final buffer, should we check for[](#l8.329)
XML_SUSPENDED, XML_FINISHED?[](#l8.330) */[](#l8.331) if (startTagLevel == 0)[](#l8.332) return XML_ERROR_NO_ELEMENTS;[](#l8.333)
@@ -2581,8 +2620,8 @@ doContent(XML_Parser parser, } else if (defaultHandler) reportDefault(parser, enc, s, end);
/* We are at the end of the final buffer, should we check for [](#l8.338)
XML_SUSPENDED, XML_FINISHED? [](#l8.339)
/* We are at the end of the final buffer, should we check for[](#l8.340)
XML_SUSPENDED, XML_FINISHED?[](#l8.341) */[](#l8.342) if (startTagLevel == 0) {[](#l8.343) *eventPP = end;[](#l8.344)
@@ -2595,26 +2634,29 @@ doContent(XML_Parser parser, *nextPtr = end; return XML_ERROR_NONE; case XML_TOK_DATA_CHARS:
if (characterDataHandler) {[](#l8.349)
if (MUST_CONVERT(enc, s)) {[](#l8.350)
for (;;) {[](#l8.351)
ICHAR *dataPtr = (ICHAR *)dataBuf;[](#l8.352)
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);[](#l8.353)
*eventEndPP = s;[](#l8.354)
characterDataHandler(handlerArg, dataBuf,[](#l8.355)
(int)(dataPtr - (ICHAR *)dataBuf));[](#l8.356)
if (s == next)[](#l8.357)
break;[](#l8.358)
*eventPP = s;[](#l8.359)
{[](#l8.360)
XML_CharacterDataHandler charDataHandler = characterDataHandler;[](#l8.361)
if (charDataHandler) {[](#l8.362)
if (MUST_CONVERT(enc, s)) {[](#l8.363)
for (;;) {[](#l8.364)
ICHAR *dataPtr = (ICHAR *)dataBuf;[](#l8.365)
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);[](#l8.366)
*eventEndPP = s;[](#l8.367)
charDataHandler(handlerArg, dataBuf,[](#l8.368)
(int)(dataPtr - (ICHAR *)dataBuf));[](#l8.369)
if (s == next)[](#l8.370)
break;[](#l8.371)
*eventPP = s;[](#l8.372)
}[](#l8.373) }[](#l8.374)
else[](#l8.375)
charDataHandler(handlerArg,[](#l8.376)
(XML_Char *)s,[](#l8.377)
(int)((XML_Char *)next - (XML_Char *)s));[](#l8.378) }[](#l8.379)
else[](#l8.380)
characterDataHandler(handlerArg,[](#l8.381)
(XML_Char *)s,[](#l8.382)
(int)((XML_Char *)next - (XML_Char *)s));[](#l8.383)
else if (defaultHandler)[](#l8.384)
reportDefault(parser, enc, s, next);[](#l8.385) }[](#l8.386)
else if (defaultHandler)[](#l8.387)
case XML_TOK_PI: if (!reportProcessingInstruction(parser, enc, s, next))reportDefault(parser, enc, s, next);[](#l8.388) break;[](#l8.389)
@@ -2631,7 +2673,7 @@ doContent(XML_Parser parser, } *eventPP = s = next; switch (ps_parsing) {
- case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: @@ -2690,23 +2732,44 @@ storeAtts(XML_Parser parser, const ENCOD if (n + nDefaultAtts > attsSize) { int oldAttsSize = attsSize; ATTRIBUTE *temp; +#ifdef XML_ATTR_INFO
- XML_AttrInfo *temp2;
+#endif attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); if (temp == NULL) return XML_ERROR_NO_MEMORY; atts = temp; +#ifdef XML_ATTR_INFO
- temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo));
- if (temp2 == NULL)
return XML_ERROR_NO_MEMORY;[](#l8.416)
- attInfo = temp2;
+#endif if (n > oldAttsSize) XmlGetAttributes(enc, attStr, n, atts); } appAtts = (const XML_Char **)atts; for (i = 0; i < n; i++) {
+#endif /* add the name and value to the attribute list */
- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
atts[i].name[](#l8.431)
+ XmlNameLength(enc, atts[i].name));[](#l8.432)
- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name,
currAtt->name[](#l8.434)
if (!attId) return XML_ERROR_NO_MEMORY;+ XmlNameLength(enc, currAtt->name));[](#l8.435)
- currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name);
- currAttInfo->nameEnd = currAttInfo->nameStart +
XmlNameLength(enc, currAtt->name);[](#l8.441)
- currAttInfo->valueStart = parseEndByteIndex -
(parseEndPtr - currAtt->valuePtr);[](#l8.443)
- currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd);
+#endif /* Detect duplicate attributes by their QNames. This does not work when namespace processing is turned on and different prefixes for the same namespace are used. For this case we have a check further down. @@ -2848,8 +2911,6 @@ storeAtts(XML_Parser parser, const ENCOD unsigned long uriHash = hash_secret_salt; ((XML_Char )s)[-1] = 0; / clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);
if (!id)[](#l8.453)
return XML_ERROR_NO_MEMORY;[](#l8.454) b = id->prefix->binding;[](#l8.455) if (!b)[](#l8.456) return XML_ERROR_UNBOUND_PREFIX;[](#l8.457)
@@ -2861,7 +2922,7 @@ storeAtts(XML_Parser parser, const ENCOD return XML_ERROR_NO_MEMORY; uriHash = CHAR_HASH(uriHash, c); }
while (*s++ != XML_T(':'))[](#l8.462)
while (*s++ != XML_T(ASCII_COLON))[](#l8.463) ;[](#l8.464) do { /* copies null terminator */[](#l8.465) const XML_Char c = *s;[](#l8.466)
@@ -2935,7 +2996,7 @@ storeAtts(XML_Parser parser, const ENCOD if (!binding) return XML_ERROR_UNBOUND_PREFIX; localPart = tagNamePtr->str;
- while (*localPart++ != XML_T(ASCII_COLON)) ; } else if (dtd->defaultPrefix.binding) { @@ -2990,25 +3051,29 @@ addBinding(XML_Parser parser, PREFIX *pr const XML_Char *uri, BINDING **bindingsPtr)
{ static const XML_Char xmlNamespace[] = {
- 'h', 't', 't', 'p', ':', '/', '/',
- 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
- 'X', 'M', 'L', '/', '1', '9', '9', '8', '/',
- 'n', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e', '\0'
- ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
- ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
- ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L,
- ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH,
- ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c,
- ASCII_e, '\0'
- static const int xmlLen = (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; static const XML_Char xmlnsNamespace[] = {
- 'h', 't', 't', 'p', ':', '/', '/',
- 'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
- '2', '0', '0', '0', '/', 'x', 'm', 'l', 'n', 's', '/', '\0'
- ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH,
- ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD,
- ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0,
- ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s,
- ASCII_SLASH, '\0'
- static const int xmlnsLen = (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; XML_Bool mustBeXML = XML_FALSE; XML_Bool isXML = XML_TRUE; XML_Bool isXMLNS = XML_TRUE;
- + BINDING *b; int len; @@ -3017,13 +3082,13 @@ addBinding(XML_Parser parser, PREFIX *pr return XML_ERROR_UNDECLARING_PREFIX; if (prefix->name
&& prefix->name[0] == XML_T('x')[](#l8.520)
&& prefix->name[1] == XML_T('m')[](#l8.521)
&& prefix->name[2] == XML_T('l')) {[](#l8.522)
&& prefix->name[0] == XML_T(ASCII_x)[](#l8.523)
&& prefix->name[1] == XML_T(ASCII_m)[](#l8.524)
&& prefix->name[2] == XML_T(ASCII_l)) {[](#l8.525)
/* Not allowed to bind xmlns */
- if (prefix->name[3] == XML_T(ASCII_n)
&& prefix->name[4] == XML_T(ASCII_s)[](#l8.531) && prefix->name[5] == XML_T('\0'))[](#l8.532) return XML_ERROR_RESERVED_PREFIX_XMLNS;[](#l8.533)
@@ -3035,7 +3100,7 @@ addBinding(XML_Parser parser, PREFIX *pr if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) isXML = XML_FALSE;
- if (!mustBeXML && isXMLNS && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) isXMLNS = XML_FALSE; } @@ -3177,26 +3242,29 @@ doCdataSection(XML_Parser parser, reportDefault(parser, enc, s, next); break; case XML_TOK_DATA_CHARS:
if (characterDataHandler) {[](#l8.548)
if (MUST_CONVERT(enc, s)) {[](#l8.549)
for (;;) {[](#l8.550)
ICHAR *dataPtr = (ICHAR *)dataBuf;[](#l8.551)
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);[](#l8.552)
*eventEndPP = next;[](#l8.553)
characterDataHandler(handlerArg, dataBuf,[](#l8.554)
(int)(dataPtr - (ICHAR *)dataBuf));[](#l8.555)
if (s == next)[](#l8.556)
break;[](#l8.557)
*eventPP = s;[](#l8.558)
{[](#l8.559)
XML_CharacterDataHandler charDataHandler = characterDataHandler;[](#l8.560)
if (charDataHandler) {[](#l8.561)
if (MUST_CONVERT(enc, s)) {[](#l8.562)
for (;;) {[](#l8.563)
ICHAR *dataPtr = (ICHAR *)dataBuf;[](#l8.564)
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);[](#l8.565)
*eventEndPP = next;[](#l8.566)
charDataHandler(handlerArg, dataBuf,[](#l8.567)
(int)(dataPtr - (ICHAR *)dataBuf));[](#l8.568)
if (s == next)[](#l8.569)
break;[](#l8.570)
*eventPP = s;[](#l8.571)
}[](#l8.572) }[](#l8.573)
else[](#l8.574)
charDataHandler(handlerArg,[](#l8.575)
(XML_Char *)s,[](#l8.576)
(int)((XML_Char *)next - (XML_Char *)s));[](#l8.577) }[](#l8.578)
else[](#l8.579)
characterDataHandler(handlerArg,[](#l8.580)
(XML_Char *)s,[](#l8.581)
(int)((XML_Char *)next - (XML_Char *)s));[](#l8.582)
else if (defaultHandler)[](#l8.583)
reportDefault(parser, enc, s, next);[](#l8.584) }[](#l8.585)
else if (defaultHandler)[](#l8.586)
case XML_TOK_INVALID: *eventPP = next;reportDefault(parser, enc, s, next);[](#l8.587) break;[](#l8.588)
@@ -3243,7 +3311,7 @@ ignoreSectionProcessor(XML_Parser parser const char *end, const char **endPtr) {
- enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result != XML_ERROR_NONE) return result; @@ -3525,7 +3593,7 @@ entityValueInitProcessor(XML_Parser pars const char *next = start; eventPtr = start;
- for (;;) { tok = XmlPrologTok(encoding, start, end, &next); eventEndPtr = next; if (tok <= 0) { @@ -3553,7 +3621,7 @@ entityValueInitProcessor(XML_Parser pars if (result != XML_ERROR_NONE) return result; switch (ps_parsing) {
case XML_SUSPENDED: [](#l8.613)
case XML_SUSPENDED:[](#l8.614) *nextPtr = next;[](#l8.615) return XML_ERROR_NONE;[](#l8.616) case XML_FINISHED:[](#l8.617)
@@ -3618,7 +3686,7 @@ externalParEntProcessor(XML_Parser parse } processor = prologProcessor;
} @@ -3668,7 +3736,7 @@ prologProcessor(XML_Parser parser, { const char *next = s; int tok = XmlPrologTok(encoding, s, end, &next);
} @@ -3683,26 +3751,30 @@ doProlog(XML_Parser parser, XML_Bool haveMore) { #ifdef XML_DTD
- static const XML_Char atypeCDATA[] = { 'C', 'D', 'A', 'T', 'A', '\0' };
- static const XML_Char atypeID[] = { 'I', 'D', '\0' };
- static const XML_Char atypeIDREF[] = { 'I', 'D', 'R', 'E', 'F', '\0' };
- static const XML_Char atypeIDREFS[] = { 'I', 'D', 'R', 'E', 'F', 'S', '\0' };
- static const XML_Char atypeENTITY[] = { 'E', 'N', 'T', 'I', 'T', 'Y', '\0' };
- static const XML_Char atypeENTITIES[] =
{ 'E', 'N', 'T', 'I', 'T', 'I', 'E', 'S', '\0' };[](#l8.649)
- static const XML_Char atypeCDATA[] =
{ ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };[](#l8.651)
- static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' };
- static const XML_Char atypeIDREF[] =
{ ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };[](#l8.654)
- static const XML_Char atypeIDREFS[] =
{ ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };[](#l8.656)
- static const XML_Char atypeENTITY[] =
{ ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' };[](#l8.658)
- static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N,
static const XML_Char atypeNMTOKEN[] = {ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' };[](#l8.660)
'N', 'M', 'T', 'O', 'K', 'E', 'N', '\0' };[](#l8.662)
- static const XML_Char atypeNMTOKENS[] = {
'N', 'M', 'T', 'O', 'K', 'E', 'N', 'S', '\0' };[](#l8.664)
- static const XML_Char notationPrefix[] = {
'N', 'O', 'T', 'A', 'T', 'I', 'O', 'N', '(', '\0' };[](#l8.666)
- static const XML_Char enumValueSep[] = { '|', '\0' };
- static const XML_Char enumValueStart[] = { '(', '\0' };
ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };[](#l8.669)
- static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T,
ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };[](#l8.671)
- static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T,
ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' };[](#l8.673)
- static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' };
- static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; /* save one level of indirection */
- DTD * const dtd = _dtd; const char **eventPP; const char **eventEndPP; @@ -3818,15 +3890,17 @@ doProlog(XML_Parser parser,
#endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) {
XML_Char *pubId;[](#l8.687) if (!XmlIsPublicId(enc, s, next, eventPP))[](#l8.688) return XML_ERROR_PUBLICID;[](#l8.689)
doctypePubid = poolStoreString(&tempPool, enc,[](#l8.690)
s + enc->minBytesPerChar,[](#l8.691)
next - enc->minBytesPerChar);[](#l8.692)
if (!doctypePubid)[](#l8.693)
pubId = poolStoreString(&tempPool, enc,[](#l8.694)
s + enc->minBytesPerChar,[](#l8.695)
next - enc->minBytesPerChar);[](#l8.696)
if (!pubId)[](#l8.697) return XML_ERROR_NO_MEMORY;[](#l8.698)
normalizePublicId((XML_Char *)doctypePubid);[](#l8.699)
normalizePublicId(pubId);[](#l8.700) poolFinish(&tempPool);[](#l8.701)
doctypePubid = pubId;[](#l8.702) handleDefault = XML_FALSE;[](#l8.703) goto alreadyChecked;[](#l8.704) }[](#l8.705)
@@ -3881,8 +3955,8 @@ doProlog(XML_Parser parser, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; if (dtd->paramEntityRead) {
if (!dtd->standalone && [](#l8.710)
notStandaloneHandler && [](#l8.711)
if (!dtd->standalone &&[](#l8.712)
notStandaloneHandler &&[](#l8.713) !notStandaloneHandler(handlerArg))[](#l8.714) return XML_ERROR_NOT_STANDALONE;[](#l8.715) }[](#l8.716)
@@ -4010,11 +4084,11 @@ doProlog(XML_Parser parser, 0, parser)) return XML_ERROR_NO_MEMORY; if (attlistDeclHandler && declAttributeType) {
if (*declAttributeType == XML_T('(')[](#l8.721)
|| (*declAttributeType == XML_T('N')[](#l8.722)
&& declAttributeType[1] == XML_T('O'))) {[](#l8.723)
if (*declAttributeType == XML_T(ASCII_LPAREN)[](#l8.724)
|| (*declAttributeType == XML_T(ASCII_N)[](#l8.725)
&& declAttributeType[1] == XML_T(ASCII_O))) {[](#l8.726) /* Enumerated or Notation type */[](#l8.727)
if (!poolAppendChar(&tempPool, XML_T(')'))[](#l8.728)
if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))[](#l8.729) || !poolAppendChar(&tempPool, XML_T('\0')))[](#l8.730) return XML_ERROR_NO_MEMORY;[](#l8.731) declAttributeType = tempPool.start;[](#l8.732)
@@ -4047,11 +4121,11 @@ doProlog(XML_Parser parser, declAttributeIsCdata, XML_FALSE, attVal, parser)) return XML_ERROR_NO_MEMORY; if (attlistDeclHandler && declAttributeType) {
if (*declAttributeType == XML_T('(')[](#l8.737)
|| (*declAttributeType == XML_T('N')[](#l8.738)
&& declAttributeType[1] == XML_T('O'))) {[](#l8.739)
if (*declAttributeType == XML_T(ASCII_LPAREN)[](#l8.740)
|| (*declAttributeType == XML_T(ASCII_N)[](#l8.741)
&& declAttributeType[1] == XML_T(ASCII_O))) {[](#l8.742) /* Enumerated or Notation type */[](#l8.743)
if (!poolAppendChar(&tempPool, XML_T(')'))[](#l8.744)
if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN))[](#l8.745) || !poolAppendChar(&tempPool, XML_T('\0')))[](#l8.746) return XML_ERROR_NO_MEMORY;[](#l8.747) declAttributeType = tempPool.start;[](#l8.748)
@@ -4321,7 +4395,7 @@ doProlog(XML_Parser parser, switch (tok) { case XML_TOK_PARAM_ENTITY_REF: /* PE references in internal subset are
not allowed within declarations. */ [](#l8.753)
not allowed within declarations. */[](#l8.754) return XML_ERROR_PARAM_ENTITY_REF;[](#l8.755) case XML_TOK_XML_DECL:[](#l8.756) return XML_ERROR_MISPLACED_XML_PI;[](#l8.757)
@@ -4379,14 +4453,14 @@ doProlog(XML_Parser parser, } break; case XML_ROLE_GROUP_SEQUENCE:
if (groupConnector[prologState.level] == '|')[](#l8.762)
if (groupConnector[prologState.level] == ASCII_PIPE)[](#l8.763) return XML_ERROR_SYNTAX;[](#l8.764)
groupConnector[prologState.level] = ',';[](#l8.765)
case XML_ROLE_GROUP_CHOICE:groupConnector[prologState.level] = ASCII_COMMA;[](#l8.766) if (dtd->in_eldecl && elementDeclHandler)[](#l8.767) handleDefault = XML_FALSE;[](#l8.768) break;[](#l8.769)
if (groupConnector[prologState.level] == ',')[](#l8.771)
if (groupConnector[prologState.level] == ASCII_COMMA)[](#l8.772) return XML_ERROR_SYNTAX;[](#l8.773) if (dtd->in_eldecl[](#l8.774) && !groupConnector[prologState.level][](#l8.775)
@@ -4398,7 +4472,7 @@ doProlog(XML_Parser parser, if (elementDeclHandler) handleDefault = XML_FALSE; }
groupConnector[prologState.level] = '|';[](#l8.780)
case XML_ROLE_PARAM_ENTITY_REF:groupConnector[prologState.level] = ASCII_PIPE;[](#l8.781) break;[](#l8.782)
#ifdef XML_DTD @@ -4442,7 +4516,7 @@ doProlog(XML_Parser parser, return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->textPtr) { enum XML_Error result;
XML_Bool betweenDecl = [](#l8.789)
XML_Bool betweenDecl =[](#l8.790) (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE);[](#l8.791) result = processInternalEntity(parser, entity, betweenDecl);[](#l8.792) if (result != XML_ERROR_NONE)[](#l8.793)
@@ -4637,7 +4711,7 @@ doProlog(XML_Parser parser, reportDefault(parser, enc, s, next); switch (ps_parsing) {
- case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: @@ -4707,7 +4781,7 @@ epilogProcessor(XML_Parser parser, } eventPtr = s = next; switch (ps_parsing) {
- case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: @@ -4750,12 +4824,12 @@ processInternalEntity(XML_Parser parser,
#ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
if (result == XML_ERROR_NONE) { @@ -4795,13 +4869,13 @@ internalEntityProcessor(XML_Parser parse #ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
- result = doContent(parser, openEntity->startTagLevel, internalEncoding,
textStart, textEnd, &next, XML_FALSE); [](#l8.839)
- result = doContent(parser, openEntity->startTagLevel, internalEncoding,
textStart, textEnd, &next, XML_FALSE);[](#l8.841)
if (result != XML_ERROR_NONE) return result; @@ -4822,7 +4896,7 @@ internalEntityProcessor(XML_Parser parse int tok; processor = prologProcessor; tok = XmlPrologTok(encoding, s, end, &next);
} else @@ -4831,8 +4905,8 @@ internalEntityProcessor(XML_Parser parse processor = contentProcessor; /* see externalEntityContentProcessor vs contentProcessor */ return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
nextPtr, (XML_Bool)!ps_finalBuffer);[](#l8.860)
- } } static enum XML_Error PTRCALL @@ -4985,7 +5059,7 @@ appendAttributeValue(XML_Parser parser, if (!entity->textPtr) { if (enc == encoding) eventPtr = ptr;
return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;[](#l8.869)
return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;[](#l8.870) }[](#l8.871) else {[](#l8.872) enum XML_Error result;[](#l8.873)
@@ -5328,7 +5402,7 @@ setElementTypePrefix(XML_Parser parser, DTD * const dtd = _dtd; /* save one level of indirection */ const XML_Char *name; for (name = elementType->name; *name; name++) {
- if (*name == XML_T(ASCII_COLON)) { PREFIX *prefix; const XML_Char *s; for (s = elementType->name; s != name; s++) { @@ -5375,12 +5449,12 @@ getAttributeId(XML_Parser parser, const poolFinish(&dtd->pool); if (!ns) ;
- else if (name[0] == XML_T('x')
&& name[1] == XML_T('m')[](#l8.888)
&& name[2] == XML_T('l')[](#l8.889)
&& name[3] == XML_T('n')[](#l8.890)
&& name[4] == XML_T('s')[](#l8.891)
&& (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {[](#l8.892)
- else if (name[0] == XML_T(ASCII_x)
&& name[1] == XML_T(ASCII_m)[](#l8.894)
&& name[2] == XML_T(ASCII_l)[](#l8.895)
&& name[3] == XML_T(ASCII_n)[](#l8.896)
&& name[4] == XML_T(ASCII_s)[](#l8.897)
&& (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) {[](#l8.898) if (name[5] == XML_T('\0'))[](#l8.899) id->prefix = &dtd->defaultPrefix;[](#l8.900) else[](#l8.901)
@@ -5391,7 +5465,7 @@ getAttributeId(XML_Parser parser, const int i; for (i = 0; name[i]; i++) { /* attributes without prefix are not in the default namespace */
if (name[i] == XML_T(':')) {[](#l8.906)
if (name[i] == XML_T(ASCII_COLON)) {[](#l8.907) int j;[](#l8.908) for (j = 0; j < i; j++) {[](#l8.909) if (!poolAppendChar(&dtd->pool, name[j]))[](#l8.910)
@@ -5401,8 +5475,6 @@ getAttributeId(XML_Parser parser, const return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX));
if (!id->prefix)[](#l8.915)
return NULL;[](#l8.916) if (id->prefix->name == poolStart(&dtd->pool))[](#l8.917) poolFinish(&dtd->pool);[](#l8.918) else[](#l8.919)
@@ -5415,7 +5487,7 @@ getAttributeId(XML_Parser parser, const return id; } -#define CONTEXT_SEP XML_T('\f') +#define CONTEXT_SEP XML_T(ASCII_FF) static const XML_Char * getContext(XML_Parser parser) @@ -5427,7 +5499,7 @@ getContext(XML_Parser parser) if (dtd->defaultPrefix.binding) { int i; int len;
- if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) return NULL; len = dtd->defaultPrefix.binding->uriLen; if (namespaceSeparator) @@ -5453,7 +5525,7 @@ getContext(XML_Parser parser) for (s = prefix->name; *s; s++) if (!poolAppendChar(&tempPool, *s)) return NULL;
- if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) return NULL; len = prefix->binding->uriLen; if (namespaceSeparator) @@ -5505,7 +5577,7 @@ setContext(XML_Parser parser, const XML_ context = s; poolDiscard(&tempPool); }
- else if (*s == XML_T(ASCII_EQUALS)) { PREFIX *prefix; if (poolLength(&tempPool) == 0) prefix = &dtd->defaultPrefix;
@@ -6162,12 +6234,13 @@ poolGrow(STRING_POOL *pool) } if (pool->blocks && pool->start == pool->blocks->s) { int blockSize = (int)(pool->end - pool->start)*2;
- BLOCK *temp = (BLOCK *) pool->mem->realloc_fcn(pool->blocks, (offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)));
- if (temp == NULL) return XML_FALSE;
- pool->blocks = temp; pool->blocks->size = blockSize; pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s;
--- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,20 +2,22 @@ See the file COPYING for copying permission. / +#include <stddef.h> + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" -#elif defined(amigaos4) +#elif defined(amigaos) #include "amigaconfig.h" +#elif defined(WATCOMC) +#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include <expat_config.h> #endif #endif / ndef COMPILED_FROM_DSP */ -#include <stddef.h> - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" @@ -53,12 +55,16 @@ static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; +#ifdef XML_DTD static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; +#endif static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; +#ifdef XML_DTD static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; +#endif static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; static const char KW_NMTOKEN[] = {
--- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,20 +2,22 @@ See the file COPYING for copying permission. / +#include <stddef.h> + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" -#elif defined(amigaos4) +#elif defined(amigaos) #include "amigaconfig.h" +#elif defined(WATCOMC) +#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include <expat_config.h> #endif #endif / ndef COMPILED_FROM_DSP */ -#include <stddef.h> - #include "expat_external.h" #include "internal.h" #include "xmltok.h" @@ -295,7 +297,9 @@ sb_charMatches(const ENCODING *enc, cons #endif #define PREFIX(ident) normal_ ## ident +#define XML_TOK_IMPL_C #include "xmltok_impl.c" +#undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE @@ -692,7 +696,9 @@ little2_isNmstrtMin(const ENCODING *enc, #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) +#define XML_TOK_IMPL_C #include "xmltok_impl.c" +#undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE @@ -831,7 +837,9 @@ big2_isNmstrtMin(const ENCODING *enc, co #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) +#define XML_TOK_IMPL_C #include "xmltok_impl.c" +#undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE @@ -1337,7 +1345,7 @@ unknown_toUtf16(const ENCODING *enc, ENCODING * XmlInitUnknownEncoding(void *mem, int *table,
CONVERTER convert, [](#l10.63)
CONVERTER convert,[](#l10.64) void *userData)[](#l10.65)
{ int i; @@ -1610,7 +1618,9 @@ initScan(const ENCODING * const *encodin #define NS(x) x #define ns(x) x +#define XML_TOK_NS_C #include "xmltok_ns.c" +#undef XML_TOK_NS_C #undef NS #undef ns @@ -1619,7 +1629,9 @@ initScan(const ENCODING * const *encodin #define NS(x) x ## NS #define ns(x) x ## _ns +#define XML_TOK_NS_C #include "xmltok_ns.c" +#undef XML_TOK_NS_C #undef NS #undef ns @@ -1627,7 +1639,7 @@ initScan(const ENCODING * const *encodin ENCODING * XmlInitUnknownEncodingNS(void *mem, int *table,
CONVERTER convert, [](#l10.92)
CONVERTER convert,[](#l10.93) void *userData)[](#l10.94)
{ ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
--- a/Modules/expat/xmltok_impl.c +++ b/Modules/expat/xmltok_impl.c @@ -2,6 +2,9 @@ See the file COPYING for copying permission. / +/ This file is included! */ +#ifdef XML_TOK_IMPL_C + #ifndef IS_INVALID_CHAR #define IS_INVALID_CHAR(enc, ptr, n) (0) #endif @@ -882,7 +885,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char **nextTokPtr) { if (ptr == end)
switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: @@ -1777,3 +1780,4 @@ PREFIX(updatePosition)(const ENCODING e #undef CHECK_NMSTRT_CASE #undef CHECK_NMSTRT_CASES +#endif / XML_TOK_IMPL_C */
--- a/Modules/expat/xmltok_ns.c +++ b/Modules/expat/xmltok_ns.c @@ -1,3 +1,10 @@ +/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
+/* This file is included! */ +#ifdef XML_TOK_NS_C + const ENCODING NS(XmlGetUtf8InternalEncoding)(void) { @@ -104,3 +111,5 @@ NS(XmlParseXmlDecl)(int isGeneralTextEnt encoding, standalone); } + +#endif / XML_TOK_NS_C */