Added support for 64-bit integers when reporting byte indexes,

line and column numbers. Can be turned on/off using the
XML_LARGE_SIZE switch.
This commit is contained in:
Karl Waclawek 2005-12-23 14:45:27 +00:00
parent b68d8cffaa
commit f8412b2167
6 changed files with 33 additions and 13 deletions

View file

@ -1,8 +1,10 @@
Release 1.95.9 TBD
Release 2.0 TBD
- We no longer use the "check" library for C unit testing; we
always use the (partial) internal implementation of the API.
- Report XML_NS setting via XML_GetFeatureList().
- Fixed headers for use from C++.
- Added XML_LARGE_SIZE switch to enable 64bit values for
byte indexes and line/column numbers.
- Updated to use libtool 1.5.10 (the most recent).
- Added support for AmigaOS.
- Some mostly minor bug fixes. SF issues include: 1006708,

View file

@ -344,6 +344,16 @@ defined using the <code>wchar_t</code> type; otherwise, <code>unsigned
short</code> is used. Defining this implies
<code>XML_UNICODE</code>.</dd>
<dt>XML_LARGE_SIZE</dt>
<dd>If defined, causes the <code>XML_Size</code> and <code>XML_Index</code>
integer types to be at least 64 bits in size. This is intended to support
processing of very large input streams, where the return values of
<code><a href="#XML_GetCurrentByteIndex" >XML_GetCurrentByteIndex</a></code>,
<code><a href="#XML_GetCurrentLineNumber" >XML_GetCurrentLineNumber</a></code> and
<code><a href="#XML_GetCurrentColumnNumber" >XML_GetCurrentColumnNumber</a></code>
could overflow. It may not be supported by all compilers, and is turned
off by default.</dd>
<dt>XML_CONTEXT_BYTES</dt>
<dd>The number of input bytes of markup context which the parser will
ensure are available for reporting via <code><a href=
@ -1905,7 +1915,7 @@ The code should be one of the enums that can be returned from
</div>
<pre class="fcndec" id="XML_GetCurrentByteIndex">
long XMLCALL
XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser p);
</pre>
<div class="fcndef">
@ -1916,7 +1926,7 @@ the values returned by <code><a href= "#XML_GetCurrentLineNumber"
</div>
<pre class="fcndec" id="XML_GetCurrentLineNumber">
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser p);
</pre>
<div class="fcndef">
@ -1925,7 +1935,7 @@ Return the line number of the position. The first line is reported as
</div>
<pre class="fcndec" id="XML_GetCurrentColumnNumber">
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentColumnNumber(XML_Parser p);
</pre>
<div class="fcndef">

View file

@ -905,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.

View file

@ -94,6 +94,14 @@ typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for counts and positions. */
typedef long long XML_Index;
typedef unsigned long long XML_Size;
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
#endif /* XML_LARGE_SIZE */
#ifdef __cplusplus
}
#endif

View file

@ -458,7 +458,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;
@ -1751,7 +1751,7 @@ XML_GetErrorCode(XML_Parser parser)
return errorCode;
}
long XMLCALL
XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser parser)
{
if (eventPtr)
@ -1780,7 +1780,7 @@ XML_GetInputContext(XML_Parser parser, int *offset, int *size)
return (char *) 0;
}
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {
@ -1790,7 +1790,7 @@ XML_GetCurrentLineNumber(XML_Parser parser)
return position.lineNumber + 1;
}
int XMLCALL
XML_Size XMLCALL
XML_GetCurrentColumnNumber(XML_Parser parser)
{
if (eventPtr && eventPtr >= positionPtr) {

View file

@ -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 {