Fix for bug 334806 (Update to Expat 2.0.0). r=mrbkap, sr=jst.

This commit is contained in:
peterv%propagandism.org 2006-07-13 12:50:58 +00:00
Родитель 16eefba57c
Коммит 06a64bca01
11 изменённых файлов: 222 добавлений и 182 удалений

Просмотреть файл

@ -51,7 +51,7 @@
14 = reference to invalid character number
15 = reference to binary entity
16 = reference to external entity in attribute
17 = xml declaration not at start of external entity
17 = XML or text declaration not at start of entity
18 = unknown encoding
19 = encoding specified in XML declaration is incorrect
20 = unclosed CDATA section
@ -65,15 +65,15 @@
30 = XML declaration not well-formed
31 = text declaration not well-formed
32 = illegal character(s) in public id
38 = reserved prefix (xml) must not be undeclared or bound to another namespace URI
38 = reserved prefix (xml) must not be undeclared or bound to another namespace name
39 = reserved prefix (xmlns) must not be declared or undeclared
40 = prefix must not be bound to one of the reserved namespace URIs
40 = prefix must not be bound to one of the reserved namespace names
# %1$S is replaced by the Expat error string, may be followed by Expected (see below)
# %2$S is replaced by URL
# %3$d is replaced by line number
# %4$d is replaced by column number
XMLParsingError = XML Parsing Error: %1$S\nLocation: %2$S\nLine Number %3$d, Column %4$d:
# %3$u is replaced by line number
# %4$u is replaced by column number
XMLParsingError = XML Parsing Error: %1$S\nLocation: %2$S\nLine Number %3$u, Column %4$u:
# %S is replaced by a tag name.
# This gets appended to the error string if the error is mismatched tag.

Просмотреть файл

@ -1,6 +1,6 @@
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
and Clark Cooper
Copyright (c) 2001, 2002, 2003 Expat maintainers.
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

Просмотреть файл

@ -2,8 +2,8 @@
See the file COPYING for copying permission.
*/
#ifndef XmlParse_INCLUDED
#define XmlParse_INCLUDED 1
#ifndef Expat_INCLUDED
#define Expat_INCLUDED 1
#ifdef __VMS
/* 0 1 2 3 0 1 2 3
@ -17,6 +17,10 @@
#include <stdlib.h>
#include "expat_external.h"
#ifdef __cplusplus
extern "C" {
#endif
struct XML_ParserStruct;
typedef struct XML_ParserStruct *XML_Parser;
@ -88,11 +92,10 @@ enum XML_Error {
XML_ERROR_ABORTED,
XML_ERROR_FINISHED,
XML_ERROR_SUSPEND_PE,
/* BEGIN MOZILLA CHANGE (backport of bug fix from Expat trunk) */
/* Added in 2.0. */
XML_ERROR_RESERVED_PREFIX_XML,
XML_ERROR_RESERVED_PREFIX_XMLNS,
XML_ERROR_RESERVED_NAMESPACE_URI
/* END MOZILLA CHANGE */
};
enum XML_Content_Type {
@ -210,8 +213,8 @@ XML_ParserCreate(const XML_Char *encoding);
URI, the namespace separator character, and the local part of the
name. If the namespace separator is '\0' then the namespace URI
and the local part will be concatenated without any separator.
When a namespace is not declared, the name and prefix will be
passed through without expansion.
It is a programming error to use the separator '\0' with namespace
triplets (see XML_SetReturnNSTriplet).
*/
XMLPARSEAPI(XML_Parser)
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
@ -902,9 +905,9 @@ XML_GetErrorCode(XML_Parser parser);
was detected; otherwise the location is the location of the last
parse event, as described above.
*/
XMLPARSEAPI(int) XML_GetCurrentLineNumber(XML_Parser parser);
XMLPARSEAPI(int) XML_GetCurrentColumnNumber(XML_Parser parser);
XMLPARSEAPI(long) XML_GetCurrentByteIndex(XML_Parser parser);
XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity.
@ -979,7 +982,8 @@ enum XML_FeatureEnum {
XML_FEATURE_CONTEXT_BYTES,
XML_FEATURE_MIN_SIZE,
XML_FEATURE_SIZEOF_XML_CHAR,
XML_FEATURE_SIZEOF_XML_LCHAR
XML_FEATURE_SIZEOF_XML_LCHAR,
XML_FEATURE_NS
/* Additional features must be added to the end of this enum. */
};
@ -998,9 +1002,9 @@ XML_GetFeatureList(void);
releases. Micro is bumped with each release, and set to 0 with each
change to major or minor version.
*/
#define XML_MAJOR_VERSION 1
#define XML_MINOR_VERSION 95
#define XML_MICRO_VERSION 8
#define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 0
#define XML_MICRO_VERSION 0
/* BEGIN MOZILLA CHANGE (Report opening tag of mismatched closing tag) */
XMLPARSEAPI(const XML_Char*)
@ -1011,4 +1015,4 @@ MOZ_XML_GetMismatchedTag(XML_Parser parser);
}
#endif
#endif /* not XmlParse_INCLUDED */
#endif /* not Expat_INCLUDED */

Просмотреть файл

@ -2,6 +2,9 @@
See the file COPYING for copying permission.
*/
#ifndef Expat_External_INCLUDED
#define Expat_External_INCLUDED 1
/* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
@ -62,6 +65,7 @@
#endif
#endif /* not defined XML_STATIC */
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
@ -96,3 +100,22 @@ typedef char XML_LChar;
#endif
/* END MOZILLA CHANGE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
#else
typedef long long XML_Index;
typedef unsigned long long XML_Size;
#endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
#endif /* XML_LARGE_SIZE */
#ifdef __cplusplus
}
#endif
#endif /* not Expat_External_INCLUDED */

Просмотреть файл

@ -12,6 +12,8 @@
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
#elif defined(__amigaos4__)
#include "amigaconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h>
#endif /* ndef COMPILED_FROM_DSP */
@ -462,7 +464,7 @@ struct XML_ParserStruct {
char *m_bufferEnd;
/* allocated end of buffer */
const char *m_bufferLim;
long m_parseEndByteIndex;
XML_Index m_parseEndByteIndex;
const char *m_parseEndPtr;
XML_Char *m_dataBuf;
XML_Char *m_dataBufEnd;
@ -649,8 +651,8 @@ struct XML_ParserStruct {
#define groupSize (parser->m_groupSize)
#define namespaceSeparator (parser->m_namespaceSeparator)
#define parentParser (parser->m_parentParser)
#define parsing (parser->m_parsingStatus.parsing)
#define finalBuffer (parser->m_parsingStatus.finalBuffer)
#define ps_parsing (parser->m_parsingStatus.parsing)
#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer)
#ifdef XML_DTD
#define isParamEntity (parser->m_isParamEntity)
#define useForeignDTD (parser->m_useForeignDTD)
@ -874,7 +876,7 @@ parserInit(XML_Parser parser, const XML_Char *encodingName)
unknownEncodingRelease = NULL;
unknownEncodingData = NULL;
parentParser = NULL;
parsing = XML_INITIALIZED;
ps_parsing = XML_INITIALIZED;
#ifdef XML_DTD
isParamEntity = XML_FALSE;
useForeignDTD = XML_FALSE;
@ -939,7 +941,7 @@ XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
XXX There's no way for the caller to determine which of the
XXX possible error cases caused the XML_STATUS_ERROR return.
*/
if (parsing == XML_PARSING || parsing == XML_SUSPENDED)
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return XML_STATUS_ERROR;
if (encodingName == NULL)
protocolEncodingName = NULL;
@ -1171,7 +1173,7 @@ XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD)
{
#ifdef XML_DTD
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (parsing == XML_PARSING || parsing == XML_SUSPENDED)
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING;
useForeignDTD = useDTD;
return XML_ERROR_NONE;
@ -1186,7 +1188,7 @@ void XMLCALL
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
{
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (parsing == XML_PARSING || parsing == XML_SUSPENDED)
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return;
ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
}
@ -1459,7 +1461,7 @@ XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing peParsing)
{
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (parsing == XML_PARSING || parsing == XML_SUSPENDED)
if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED)
return 0;
#ifdef XML_DTD
paramEntityParsing = peParsing;
@ -1472,7 +1474,7 @@ XML_SetParamEntityParsing(XML_Parser parser,
enum XML_Status XMLCALL
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
{
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
@ -1480,11 +1482,11 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
default:
parsing = XML_PARSING;
ps_parsing = XML_PARSING;
}
if (len == 0) {
finalBuffer = (XML_Bool)isFinal;
ps_finalBuffer = (XML_Bool)isFinal;
if (!isFinal)
return XML_STATUS_OK;
positionPtr = bufferPtr;
@ -1492,19 +1494,19 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
/* If data are left over from last buffer, and we now know that these
data are the final chunk of input, then we have to check them again
to detect errors based on this information.
to detect errors based on that fact.
*/
errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);
if (errorCode == XML_ERROR_NONE) {
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
return XML_STATUS_SUSPENDED;
case XML_INITIALIZED:
case XML_PARSING:
parsing = XML_FINISHED;
ps_parsing = XML_FINISHED;
/* fall through */
default:
return XML_STATUS_OK;
@ -1521,7 +1523,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
enum XML_Error result;
parseEndByteIndex += len;
positionPtr = s;
finalBuffer = (XML_Bool)isFinal;
ps_finalBuffer = (XML_Bool)isFinal;
errorCode = processor(parser, s, parseEndPtr = s + len, &end);
@ -1531,7 +1533,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
return XML_STATUS_ERROR;
}
else {
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
@ -1539,18 +1541,13 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
case XML_PARSING:
result = XML_STATUS_OK;
if (isFinal) {
parsing = XML_FINISHED;
ps_parsing = XML_FINISHED;
return result;
}
}
}
XmlUpdatePosition(encoding, positionPtr, end, &position);
/* BEGIN MOZILLA CHANGE (backport of bug fix from Expat trunk) */
#if 0
positionPtr = end;
#endif
/* END MOZILLA CHANGE */
nLeftOver = s + len - end;
if (nLeftOver) {
if (buffer == NULL || nLeftOver > bufferLim - buffer) {
@ -1573,12 +1570,6 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
bufferLim = buffer + len * 2;
}
memcpy(buffer, end, nLeftOver);
/* BEGIN MOZILLA CHANGE (backport of bug fix from Expat trunk) */
#if 0
bufferPtr = buffer;
bufferEnd = buffer + nLeftOver;
}
#else
}
bufferPtr = buffer;
bufferEnd = buffer + nLeftOver;
@ -1586,8 +1577,6 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
parseEndPtr = bufferEnd;
eventPtr = bufferPtr;
eventEndPtr = bufferPtr;
#endif
/* END MOZILLA CHANGE */
return result;
}
#endif /* not defined XML_CONTEXT_BYTES */
@ -1606,9 +1595,9 @@ enum XML_Status XMLCALL
XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
{
const char *start;
enum XML_Error result = XML_STATUS_OK;
enum XML_Status result = XML_STATUS_OK;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
@ -1616,7 +1605,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
errorCode = XML_ERROR_FINISHED;
return XML_STATUS_ERROR;
default:
parsing = XML_PARSING;
ps_parsing = XML_PARSING;
}
start = bufferPtr;
@ -1624,7 +1613,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
bufferEnd += len;
parseEndPtr = bufferEnd;
parseEndByteIndex += len;
finalBuffer = (XML_Bool)isFinal;
ps_finalBuffer = (XML_Bool)isFinal;
errorCode = processor(parser, start, parseEndPtr, &bufferPtr);
@ -1634,14 +1623,14 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
return XML_STATUS_ERROR;
}
else {
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
case XML_INITIALIZED:
case XML_PARSING:
if (isFinal) {
parsing = XML_FINISHED;
ps_parsing = XML_FINISHED;
return result;
}
default: ; /* should not happen */
@ -1656,7 +1645,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
void * XMLCALL
XML_GetBuffer(XML_Parser parser, int len)
{
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
return NULL;
@ -1668,9 +1657,9 @@ XML_GetBuffer(XML_Parser parser, int len)
if (len > bufferLim - bufferEnd) {
/* FIXME avoid integer overflow */
int neededSize = len + (bufferEnd - bufferPtr);
int neededSize = len + (int)(bufferEnd - bufferPtr);
#ifdef XML_CONTEXT_BYTES
int keep = bufferPtr - buffer;
int keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES;
@ -1679,7 +1668,7 @@ XML_GetBuffer(XML_Parser parser, int len)
if (neededSize <= bufferLim - buffer) {
#ifdef XML_CONTEXT_BYTES
if (keep < bufferPtr - buffer) {
int offset = (bufferPtr - buffer) - keep;
int offset = (int)(bufferPtr - buffer) - keep;
memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep);
bufferEnd -= offset;
bufferPtr -= offset;
@ -1692,7 +1681,7 @@ XML_GetBuffer(XML_Parser parser, int len)
}
else {
char *newBuf;
int bufferSize = bufferLim - bufferPtr;
int bufferSize = (int)(bufferLim - bufferPtr);
if (bufferSize == 0)
bufferSize = INIT_BUFFER_SIZE;
do {
@ -1706,7 +1695,7 @@ XML_GetBuffer(XML_Parser parser, int len)
bufferLim = newBuf + bufferSize;
#ifdef XML_CONTEXT_BYTES
if (bufferPtr) {
int keep = bufferPtr - buffer;
int keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES;
memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep);
@ -1735,13 +1724,13 @@ XML_GetBuffer(XML_Parser parser, int len)
enum XML_Status XMLCALL
XML_StopParser(XML_Parser parser, XML_Bool resumable)
{
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
if (resumable) {
errorCode = XML_ERROR_SUSPENDED;
return XML_STATUS_ERROR;
}
parsing = XML_FINISHED;
ps_parsing = XML_FINISHED;
break;
case XML_FINISHED:
errorCode = XML_ERROR_FINISHED;
@ -1754,10 +1743,10 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable)
return XML_STATUS_ERROR;
}
#endif
parsing = XML_SUSPENDED;
ps_parsing = XML_SUSPENDED;
}
else
parsing = XML_FINISHED;
ps_parsing = XML_FINISHED;
}
return XML_STATUS_OK;
}
@ -1765,13 +1754,13 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable)
enum XML_Status XMLCALL
XML_ResumeParser(XML_Parser parser)
{
enum XML_Error result = XML_STATUS_OK;
enum XML_Status result = XML_STATUS_OK;
if (parsing != XML_SUSPENDED) {
if (ps_parsing != XML_SUSPENDED) {
errorCode = XML_ERROR_NOT_SUSPENDED;
return XML_STATUS_ERROR;
}
parsing = XML_PARSING;
ps_parsing = XML_PARSING;
errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr);
@ -1781,14 +1770,14 @@ XML_ResumeParser(XML_Parser parser)
return XML_STATUS_ERROR;
}
else {
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
result = XML_STATUS_SUSPENDED;
break;
case XML_INITIALIZED:
case XML_PARSING:
if (finalBuffer) {
parsing = XML_FINISHED;
if (ps_finalBuffer) {
ps_parsing = XML_FINISHED;
return result;
}
default: ;
@ -1797,8 +1786,10 @@ XML_ResumeParser(XML_Parser parser)
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
/* BEGIN MOZILLA CHANGE (always set eventPtr/eventEndPtr) */
eventPtr = bufferPtr;
eventEndPtr = bufferPtr;
/* END MOZILLA CHANGE */
return result;
}
@ -1815,7 +1806,7 @@ XML_GetErrorCode(XML_Parser parser)
return errorCode;
}
long XMLCALL
XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser parser)
{
if (eventPtr)
@ -1835,7 +1826,7 @@ int XMLCALL
XML_GetCurrentByteCount(XML_Parser parser)
{
if (eventEndPtr && eventPtr)
return eventEndPtr - eventPtr;
return (int)(eventEndPtr - eventPtr);
return 0;
}
@ -1844,8 +1835,8 @@ XML_GetInputContext(XML_Parser parser, int *offset, int *size)
{
#ifdef XML_CONTEXT_BYTES
if (eventPtr && buffer) {
*offset = eventPtr - buffer;
*size = bufferEnd - buffer;
*offset = (int)(eventPtr - buffer);
*size = (int)(bufferEnd - buffer);
return buffer;
}
#endif /* defined XML_CONTEXT_BYTES */
@ -1854,7 +1845,7 @@ XML_GetInputContext(XML_Parser parser, int *offset, int *size)
#endif
/* END MOZILLA CHANGE */
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {
@ -1864,7 +1855,7 @@ XML_GetCurrentLineNumber(XML_Parser parser)
return position.lineNumber + 1;
}
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentColumnNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {
@ -1919,7 +1910,7 @@ XML_DefaultCurrent(XML_Parser parser)
const XML_LChar * XMLCALL
XML_ErrorString(enum XML_Error code)
{
static const XML_LChar *message[] = {
static const XML_LChar* const message[] = {
0,
XML_L("out of memory"),
XML_L("syntax error"),
@ -1937,7 +1928,7 @@ XML_ErrorString(enum XML_Error code)
XML_L("reference to invalid character number"),
XML_L("reference to binary entity"),
XML_L("reference to external entity in attribute"),
XML_L("xml declaration not at start of external entity"),
XML_L("XML or text declaration not at start of entity"),
XML_L("unknown encoding"),
XML_L("encoding specified in XML declaration is incorrect"),
XML_L("unclosed CDATA section"),
@ -1957,7 +1948,10 @@ XML_ErrorString(enum XML_Error code)
XML_L("parser not suspended"),
XML_L("parsing aborted"),
XML_L("parsing finished"),
XML_L("cannot suspend in external parameter entity")
XML_L("cannot suspend in external parameter entity"),
XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"),
XML_L("reserved prefix (xmlns) must not be declared or undeclared"),
XML_L("prefix must not be bound to one of the reserved namespace names")
};
if (code > 0 && code < sizeof(message)/sizeof(message[0]))
return message[code];
@ -2001,9 +1995,11 @@ XML_ExpatVersionInfo(void)
const XML_Feature * XMLCALL
XML_GetFeatureList(void)
{
static XML_Feature features[] = {
{XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), 0},
{XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), 0},
static const XML_Feature features[] = {
{XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"),
sizeof(XML_Char)},
{XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"),
sizeof(XML_LChar)},
#ifdef XML_UNICODE
{XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0},
#endif
@ -2019,12 +2015,13 @@ XML_GetFeatureList(void)
#endif
#ifdef XML_MIN_SIZE
{XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0},
#endif
#ifdef XML_NS
{XML_FEATURE_NS, XML_L("XML_NS"), 0},
#endif
{XML_FEATURE_END, NULL, 0}
};
features[0].value = sizeof(XML_Char);
features[1].value = sizeof(XML_LChar);
return features;
}
#endif
@ -2095,7 +2092,7 @@ contentProcessor(XML_Parser parser,
const char **endPtr)
{
enum XML_Error result = doContent(parser, 0, encoding, start, end,
endPtr, (XML_Bool)!finalBuffer);
endPtr, (XML_Bool)!ps_finalBuffer);
if (result == XML_ERROR_NONE) {
if (!storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
@ -2131,21 +2128,21 @@ externalEntityInitProcessor2(XML_Parser parser,
doContent (by detecting XML_TOK_NONE) without processing any xml text
declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
*/
if (next == end && !finalBuffer) {
if (next == end && !ps_finalBuffer) {
*endPtr = next;
return XML_ERROR_NONE;
}
start = next;
break;
case XML_TOK_PARTIAL:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
eventPtr = start;
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
@ -2175,7 +2172,7 @@ externalEntityInitProcessor3(XML_Parser parser,
result = processXmlDecl(parser, 1, start, next);
if (result != XML_ERROR_NONE)
return result;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*endPtr = next;
return XML_ERROR_NONE;
@ -2187,13 +2184,13 @@ externalEntityInitProcessor3(XML_Parser parser,
}
break;
case XML_TOK_PARTIAL:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*endPtr = start;
return XML_ERROR_NONE;
}
@ -2211,7 +2208,7 @@ externalEntityContentProcessor(XML_Parser parser,
const char **endPtr)
{
enum XML_Error result = doContent(parser, 1, encoding, start, end,
endPtr, (XML_Bool)!finalBuffer);
endPtr, (XML_Bool)!ps_finalBuffer);
if (result == XML_ERROR_NONE) {
if (!storeRawNames(parser))
return XML_ERROR_NO_MEMORY;
@ -2416,12 +2413,12 @@ doContent(XML_Parser parser,
XmlConvert(enc,
&fromPtr, rawNameEnd,
(ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
convLen = toPtr - (XML_Char *)tag->buf;
convLen = (int)(toPtr - (XML_Char *)tag->buf);
if (fromPtr == rawNameEnd) {
tag->name.strLen = convLen;
break;
}
bufSize = (tag->bufEnd - tag->buf) << 1;
bufSize = (int)(tag->bufEnd - tag->buf) << 1;
{
char *temp = (char *)REALLOC(tag->buf, bufSize);
if (temp == NULL)
@ -2632,12 +2629,12 @@ doContent(XML_Parser parser,
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
characterDataHandler(handlerArg, dataBuf,
dataPtr - (ICHAR *)dataBuf);
(int)(dataPtr - (ICHAR *)dataBuf));
}
else
characterDataHandler(handlerArg,
(XML_Char *)s,
(XML_Char *)end - (XML_Char *)s);
(int)((XML_Char *)end - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, end);
@ -2662,7 +2659,7 @@ doContent(XML_Parser parser,
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
characterDataHandler(handlerArg, dataBuf,
dataPtr - (ICHAR *)dataBuf);
(int)(dataPtr - (ICHAR *)dataBuf));
if (s == next)
break;
*eventPP = s;
@ -2671,7 +2668,7 @@ doContent(XML_Parser parser,
else
characterDataHandler(handlerArg,
(XML_Char *)s,
(XML_Char *)next - (XML_Char *)s);
(int)((XML_Char *)next - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
@ -2690,7 +2687,7 @@ doContent(XML_Parser parser,
break;
}
*eventPP = s = next;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
@ -3001,14 +2998,13 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
#if 0
if (!--nPrefixes)
break;
#else
if (!--nPrefixes && !nXMLNSDeclarations) {
#endif
/* END MOZILLA CHANGE */
i += 2;
break;
}
#endif
/* END MOZILLA CHANGE */
}
/* BEGIN MOZILLA CHANGE (Include xmlns attributes in attributes array) */
else if (s[-1] == 3) { /* xmlns attribute */
@ -3089,14 +3085,14 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
prefixLen = 0;
if (ns_triplets && binding->prefix->name) {
for (; binding->prefix->name[prefixLen++];)
;
; /* prefixLen includes null terminator */
}
tagNamePtr->localPart = localPart;
tagNamePtr->uriLen = binding->uriLen;
tagNamePtr->prefix = binding->prefix->name;
tagNamePtr->prefixLen = prefixLen;
for (i = 0; localPart[i++];)
;
; /* i includes null terminator */
n = i + binding->uriLen + prefixLen;
if (n > binding->uriAlloc) {
TAG *p;
@ -3111,12 +3107,13 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
FREE(binding->uri);
binding->uri = uri;
}
/* if namespaceSeparator != '\0' then uri includes it already */
uri = binding->uri + binding->uriLen;
memcpy(uri, localPart, i * sizeof(XML_Char));
/* we always have a namespace separator between localPart and prefix */
if (prefixLen) {
uri = uri + (i - 1);
if (namespaceSeparator)
*uri = namespaceSeparator;
uri += i - 1;
*uri = namespaceSeparator; /* replace null terminator */
memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));
}
tagNamePtr->str = binding->uri;
@ -3130,7 +3127,6 @@ static enum XML_Error
addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
const XML_Char *uri, BINDING **bindingsPtr)
{
/* BEGIN MOZILLA CHANGE (backport of bug fix from Expat trunk) */
static const XML_Char xmlNamespace[] = {
'h', 't', 't', 'p', ':', '/', '/',
'w', 'w', 'w', '.', 'w', '3', '.', 'o', 'r', 'g', '/',
@ -3150,7 +3146,6 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
XML_Bool mustBeXML = XML_FALSE;
XML_Bool isXML = XML_TRUE;
XML_Bool isXMLNS = XML_TRUE;
/* END MOZILLA CHANGE */
BINDING *b;
int len;
@ -3159,7 +3154,6 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
if (*uri == XML_T('\0') && prefix->name)
return XML_ERROR_UNDECLARING_PREFIX;
/* BEGIN MOZILLA CHANGE (backport of bug fix from Expat trunk) */
if (prefix->name
&& prefix->name[0] == XML_T('x')
&& prefix->name[1] == XML_T('m')
@ -3192,7 +3186,6 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId,
if (isXMLNS)
return XML_ERROR_RESERVED_NAMESPACE_URI;
/* END MOZILLA CHANGE */
if (namespaceSeparator)
len++;
@ -3250,7 +3243,7 @@ cdataSectionProcessor(XML_Parser parser,
const char **endPtr)
{
enum XML_Error result = doCdataSection(parser, encoding, &start, end,
endPtr, (XML_Bool)!finalBuffer);
endPtr, (XML_Bool)!ps_finalBuffer);
if (result != XML_ERROR_NONE)
return result;
if (start) {
@ -3309,7 +3302,7 @@ doCdataSection(XML_Parser parser,
reportDefault(parser, enc, s, next);
*startPtr = next;
*nextPtr = next;
if (parsing == XML_FINISHED)
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
else
return XML_ERROR_NONE;
@ -3329,7 +3322,7 @@ doCdataSection(XML_Parser parser,
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = next;
characterDataHandler(handlerArg, dataBuf,
dataPtr - (ICHAR *)dataBuf);
(int)(dataPtr - (ICHAR *)dataBuf));
if (s == next)
break;
*eventPP = s;
@ -3338,7 +3331,7 @@ doCdataSection(XML_Parser parser,
else
characterDataHandler(handlerArg,
(XML_Char *)s,
(XML_Char *)next - (XML_Char *)s);
(int)((XML_Char *)next - (XML_Char *)s));
}
else if (defaultHandler)
reportDefault(parser, enc, s, next);
@ -3365,7 +3358,7 @@ doCdataSection(XML_Parser parser,
}
*eventPP = s = next;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
@ -3389,7 +3382,7 @@ ignoreSectionProcessor(XML_Parser parser,
const char **endPtr)
{
enum XML_Error result = doIgnoreSection(parser, encoding, &start, end,
endPtr, (XML_Bool)!finalBuffer);
endPtr, (XML_Bool)!ps_finalBuffer);
if (result != XML_ERROR_NONE)
return result;
if (start) {
@ -3434,7 +3427,7 @@ doIgnoreSection(XML_Parser parser,
reportDefault(parser, enc, s, next);
*startPtr = next;
*nextPtr = next;
if (parsing == XML_FINISHED)
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
else
return XML_ERROR_NONE;
@ -3674,7 +3667,7 @@ entityValueInitProcessor(XML_Parser parser,
tok = XmlPrologTok(encoding, start, end, &next);
eventEndPtr = next;
if (tok <= 0) {
if (!finalBuffer && tok != XML_TOK_INVALID) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
@ -3697,7 +3690,7 @@ entityValueInitProcessor(XML_Parser parser,
result = processXmlDecl(parser, 0, start, next);
if (result != XML_ERROR_NONE)
return result;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
@ -3717,7 +3710,7 @@ entityValueInitProcessor(XML_Parser parser,
then, when this routine is entered the next time, XmlPrologTok will
return XML_TOK_INVALID, since the BOM is still in the buffer
*/
else if (tok == XML_TOK_BOM && next == end && !finalBuffer) {
else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) {
*nextPtr = next;
return XML_ERROR_NONE;
}
@ -3737,7 +3730,7 @@ externalParEntProcessor(XML_Parser parser,
tok = XmlPrologTok(encoding, s, end, &next);
if (tok <= 0) {
if (!finalBuffer && tok != XML_TOK_INVALID) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
@ -3764,7 +3757,7 @@ externalParEntProcessor(XML_Parser parser,
processor = prologProcessor;
return doProlog(parser, encoding, s, end, tok, next,
nextPtr, (XML_Bool)!finalBuffer);
nextPtr, (XML_Bool)!ps_finalBuffer);
}
static enum XML_Error PTRCALL
@ -3781,7 +3774,7 @@ entityValueProcessor(XML_Parser parser,
for (;;) {
tok = XmlPrologTok(enc, start, end, &next);
if (tok <= 0) {
if (!finalBuffer && tok != XML_TOK_INVALID) {
if (!ps_finalBuffer && tok != XML_TOK_INVALID) {
*nextPtr = s;
return XML_ERROR_NONE;
}
@ -3814,7 +3807,7 @@ prologProcessor(XML_Parser parser,
const char *next = s;
int tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next,
nextPtr, (XML_Bool)!finalBuffer);
nextPtr, (XML_Bool)!ps_finalBuffer);
}
static enum XML_Error
@ -4003,7 +3996,8 @@ doProlog(XML_Parser parser,
*/
#ifdef XML_DTD
if (doctypeSysid || useForeignDTD) {
dtd->hasParamEntityRefs = XML_TRUE; /* when docTypeSysid == NULL */
XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
dtd->hasParamEntityRefs = XML_TRUE;
if (paramEntityParsing && externalEntityRefHandler) {
ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
externalSubsetName,
@ -4019,11 +4013,17 @@ doProlog(XML_Parser parser,
entity->systemId,
entity->publicId))
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
if (dtd->paramEntityRead &&
!dtd->standalone &&
if (dtd->paramEntityRead) {
if (!dtd->standalone &&
notStandaloneHandler &&
!notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
}
/* if we didn't read the foreign DTD then this means that there
is no external subset and we must reset dtd->hasParamEntityRefs
*/
else if (!doctypeSysid)
dtd->hasParamEntityRefs = hadParamEntityRefs;
/* end of DTD - no need to update dtd->keepProcessing */
}
useForeignDTD = XML_FALSE;
@ -4040,6 +4040,7 @@ doProlog(XML_Parser parser,
last chance to read the foreign DTD
*/
if (useForeignDTD) {
XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs;
dtd->hasParamEntityRefs = XML_TRUE;
if (paramEntityParsing && externalEntityRefHandler) {
ENTITY *entity = (ENTITY *)lookup(&dtd->paramEntities,
@ -4055,11 +4056,17 @@ doProlog(XML_Parser parser,
entity->systemId,
entity->publicId))
return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
if (dtd->paramEntityRead &&
!dtd->standalone &&
if (dtd->paramEntityRead) {
if (!dtd->standalone &&
notStandaloneHandler &&
!notStandaloneHandler(handlerArg))
return XML_ERROR_NOT_STANDALONE;
}
/* if we didn't read the foreign DTD then this means that there
is no external subset and we must reset dtd->hasParamEntityRefs
*/
else
dtd->hasParamEntityRefs = hadParamEntityRefs;
/* end of DTD - no need to update dtd->keepProcessing */
}
}
@ -4200,7 +4207,7 @@ doProlog(XML_Parser parser,
next - enc->minBytesPerChar);
if (declEntity) {
declEntity->textPtr = poolStart(&dtd->entityValuePool);
declEntity->textLen = poolLength(&dtd->entityValuePool);
declEntity->textLen = (int)(poolLength(&dtd->entityValuePool));
poolFinish(&dtd->entityValuePool);
if (entityDeclHandler) {
*eventEndPP = s;
@ -4767,7 +4774,7 @@ doProlog(XML_Parser parser,
if (handleDefault && defaultHandler)
reportDefault(parser, enc, s, next);
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
@ -4798,7 +4805,7 @@ epilogProcessor(XML_Parser parser,
case -XML_TOK_PROLOG_S:
if (defaultHandler) {
reportDefault(parser, encoding, s, next);
if (parsing == XML_FINISHED)
if (ps_parsing == XML_FINISHED)
return XML_ERROR_ABORTED;
}
*nextPtr = next;
@ -4822,13 +4829,13 @@ epilogProcessor(XML_Parser parser,
eventPtr = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (!finalBuffer) {
if (!ps_finalBuffer) {
*nextPtr = s;
return XML_ERROR_NONE;
}
@ -4837,7 +4844,7 @@ epilogProcessor(XML_Parser parser,
return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
}
eventPtr = s = next;
switch (parsing) {
switch (ps_parsing) {
case XML_SUSPENDED:
*nextPtr = next;
return XML_ERROR_NONE;
@ -4890,8 +4897,8 @@ processInternalEntity(XML_Parser parser, ENTITY *entity,
textEnd, &next, XML_FALSE);
if (result == XML_ERROR_NONE) {
if (textEnd != next && parsing == XML_SUSPENDED) {
entity->processed = next - textStart;
if (textEnd != next && ps_parsing == XML_SUSPENDED) {
entity->processed = (int)(next - textStart);
processor = internalEntityProcessor;
}
else {
@ -4936,8 +4943,8 @@ internalEntityProcessor(XML_Parser parser,
if (result != XML_ERROR_NONE)
return result;
else if (textEnd != next && parsing == XML_SUSPENDED) {
entity->processed = next - (char *)entity->textPtr;
else if (textEnd != next && ps_parsing == XML_SUSPENDED) {
entity->processed = (int)(next - (char *)entity->textPtr);
return result;
}
else {
@ -4954,7 +4961,7 @@ internalEntityProcessor(XML_Parser parser,
processor = prologProcessor;
tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next, nextPtr,
(XML_Bool)!finalBuffer);
(XML_Bool)!ps_finalBuffer);
}
else
#endif /* XML_DTD */
@ -4962,7 +4969,7 @@ internalEntityProcessor(XML_Parser parser,
processor = contentProcessor;
/* see externalEntityContentProcessor vs contentProcessor */
return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
nextPtr, (XML_Bool)!finalBuffer);
nextPtr, (XML_Bool)!ps_finalBuffer);
}
}
@ -5071,9 +5078,8 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
return XML_ERROR_NO_MEMORY;
entity = (ENTITY *)lookup(&dtd->generalEntities, name, 0);
poolDiscard(&temp2Pool);
/* first, determine if a check for an existing declaration is needed;
if yes, check that the entity exists, and that it is internal,
otherwise call the default handler (if called from content)
/* First, determine if a check for an existing declaration is needed;
if yes, check that the entity exists, and that it is internal.
*/
if (pool == &dtd->pool) /* are we called from prolog? */
checkEntityDecl =
@ -5092,15 +5098,18 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata,
return XML_ERROR_ENTITY_DECLARED_IN_PE;
}
else if (!entity) {
/* cannot report skipped entity here - see comments on
skippedEntityHandler
/* Cannot report skipped entity here - see comments on
skippedEntityHandler.
if (skippedEntityHandler)
skippedEntityHandler(handlerArg, name, 0);
*/
/* BEGIN MOZILLA CHANGE (http://bugzilla.mozilla.org/show_bug.cgi?id=35984) */
#if 0
/* Cannot call the default handler because this would be
out of sync with the call to the startElementHandler.
if ((pool == &tempPool) && defaultHandler)
reportDefault(parser, enc, ptr, next);
*/
/* BEGIN MOZILLA CHANGE (http://bugzilla.mozilla.org/show_bug.cgi?id=35984) */
#if 0
break;
#else
return XML_ERROR_UNDEFINED_ENTITY;
@ -5404,12 +5413,12 @@ reportDefault(XML_Parser parser, const ENCODING *enc,
ICHAR *dataPtr = (ICHAR *)dataBuf;
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
*eventPP = s;
} while (s != end);
}
else
defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
}
@ -5563,7 +5572,7 @@ getContext(XML_Parser parser)
if (!poolAppendChar(&tempPool, XML_T('=')))
return NULL;
len = dtd->defaultPrefix.binding->uriLen;
if (namespaceSeparator != XML_T('\0'))
if (namespaceSeparator)
len--;
for (i = 0; i < len; i++)
if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i]))
@ -5589,7 +5598,7 @@ getContext(XML_Parser parser)
if (!poolAppendChar(&tempPool, XML_T('=')))
return NULL;
len = prefix->binding->uriLen;
if (namespaceSeparator != XML_T('\0'))
if (namespaceSeparator)
len--;
for (i = 0; i < len; i++)
if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
@ -6291,7 +6300,7 @@ poolGrow(STRING_POOL *pool)
}
}
if (pool->blocks && pool->start == pool->blocks->s) {
int blockSize = (pool->end - pool->start)*2;
int blockSize = (int)(pool->end - pool->start)*2;
pool->blocks = (BLOCK *)
pool->mem->realloc_fcn(pool->blocks,
(offsetof(BLOCK, s)
@ -6305,7 +6314,7 @@ poolGrow(STRING_POOL *pool)
}
else {
BLOCK *tem;
int blockSize = pool->end - pool->start;
int blockSize = (int)(pool->end - pool->start);
if (blockSize < INIT_BLOCK_SIZE)
blockSize = INIT_BLOCK_SIZE;
else

Просмотреть файл

@ -8,6 +8,8 @@
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
#elif defined(__amigaos4__)
#include "amigaconfig.h"
#else
#ifdef HAVE_EXPAT_CONFIG_H
#include <expat_config.h>
@ -793,7 +795,7 @@ attlist2(PROLOG_STATE *state,
return XML_ROLE_ATTLIST_NONE;
case XML_TOK_NAME:
{
static const char *types[] = {
static const char * const types[] = {
KW_CDATA,
KW_ID,
KW_IDREF,

Просмотреть файл

@ -8,6 +8,8 @@
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
#elif defined(__amigaos4__)
#include "amigaconfig.h"
#else
#ifdef HAVE_EXPAT_CONFIG_H
#include <expat_config.h>
@ -1464,7 +1466,7 @@ static const char KW_UTF_16LE[] = {
static int FASTCALL
getEncodingIndex(const char *name)
{
static const char *encodingNames[] = {
static const char * const encodingNames[] = {
KW_ISO_8859_1,
KW_US_ASCII,
KW_UTF_8,
@ -1497,7 +1499,7 @@ getEncodingIndex(const char *name)
static int
initScan(const ENCODING **encodingTable,
initScan(const ENCODING * const *encodingTable,
const INIT_ENCODING *enc,
int state,
const char *ptr,

Просмотреть файл

@ -111,8 +111,8 @@ extern "C" {
typedef struct position {
/* first line and first column are 0 not 1 */
unsigned long lineNumber;
unsigned long columnNumber;
XML_Size lineNumber;
XML_Size columnNumber;
} POSITION;
typedef struct {

Просмотреть файл

@ -1714,7 +1714,7 @@ PREFIX(nameLength)(const ENCODING *enc, const char *ptr)
ptr += MINBPC(enc);
break;
default:
return ptr - start;
return (int)(ptr - start);
}
}
}
@ -1750,7 +1750,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
case BT_LF:
pos->columnNumber = (unsigned)-1;
pos->columnNumber = (XML_Size)-1;
pos->lineNumber++;
ptr += MINBPC(enc);
break;
@ -1759,7 +1759,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
ptr += MINBPC(enc);
if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
pos->columnNumber = (unsigned)-1;
pos->columnNumber = (XML_Size)-1;
break;
default:
ptr += MINBPC(enc);

Просмотреть файл

@ -19,7 +19,7 @@ NS(XmlGetUtf16InternalEncoding)(void)
#endif
}
static const ENCODING *NS(encodings)[] = {
static const ENCODING * const NS(encodings)[] = {
&ns(latin1_encoding).enc,
&ns(ascii_encoding).enc,
&ns(utf8_encoding).enc,

Просмотреть файл

@ -784,8 +784,8 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr,
static nsresult
CreateErrorText(const PRUnichar* aDescription,
const PRUnichar* aSourceURL,
const PRInt32 aLineNumber,
const PRInt32 aColNumber,
const PRUint32 aLineNumber,
const PRUint32 aColNumber,
nsString& aErrorString)
{
aErrorString.Truncate();
@ -796,7 +796,7 @@ CreateErrorText(const PRUnichar* aDescription,
"XMLParsingError", msg);
NS_ENSURE_SUCCESS(rv, rv);
// XML Parsing Error: %1$S\nLocation: %2$S\nLine Number %3$d, Column %4$d:
// XML Parsing Error: %1$S\nLocation: %2$S\nLine Number %3$u, Column %4$u:
PRUnichar *message = nsTextFormatter::smprintf(msg.get(), aDescription,
aSourceURL, aLineNumber,
aColNumber);
@ -900,8 +900,8 @@ nsExpatDriver::HandleError()
}
// Adjust the column number so that it is one based rather than zero based.
PRInt32 colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1;
PRInt32 lineNumber = XML_GetCurrentLineNumber(mExpatParser);
PRUint32 colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1;
PRUint32 lineNumber = XML_GetCurrentLineNumber(mExpatParser);
nsAutoString errorText;
CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber,
@ -1073,14 +1073,14 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, PRBool& aFlushTokens)
// the error occurred).
// The length of the last line that Expat has parsed.
PRInt32 lastLineLength = XML_GetCurrentColumnNumber(mExpatParser);
XML_Size lastLineLength = XML_GetCurrentColumnNumber(mExpatParser);
if (lastLineLength <= consumed) {
// The length of the last line was less than what expat consumed, so
// there was at least one line break in the consumed data. Store the
// last line until the point where we stopped parsing.
nsScannerIterator startLastLine = currentExpatPosition;
startLastLine.advance(-lastLineLength);
startLastLine.advance(-((ptrdiff_t)lastLineLength));
CopyUnicodeTo(startLastLine, currentExpatPosition, mLastLine);
}
else {