diff options
author | kwaclaw <kwaclaw> | 2005-12-23 14:45:27 +0000 |
---|---|---|
committer | kwaclaw <kwaclaw> | 2005-12-23 14:45:27 +0000 |
commit | a100265576b58e6f80070a893f05c810731f69e1 (patch) | |
tree | 7d18e4fbfdc6ec8bc3138bbcd2d9298a440b1b75 /lib | |
parent | 2bcdd8cee1740ae6259ec8c84d67283afb75c9be (diff) | |
download | libexpat-a100265576b58e6f80070a893f05c810731f69e1.tar.gz |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/expat.h | 6 | ||||
-rw-r--r-- | lib/expat_external.h | 8 | ||||
-rw-r--r-- | lib/xmlparse.c | 8 | ||||
-rw-r--r-- | lib/xmltok.h | 4 |
4 files changed, 17 insertions, 9 deletions
diff --git a/lib/expat.h b/lib/expat.h index ac1053f..09c5d14 100644 --- a/lib/expat.h +++ b/lib/expat.h @@ -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. diff --git a/lib/expat_external.h b/lib/expat_external.h index 7202e11..ddb162d 100644 --- a/lib/expat_external.h +++ b/lib/expat_external.h @@ -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 diff --git a/lib/xmlparse.c b/lib/xmlparse.c index 453077f..04f8b91 100644 --- a/lib/xmlparse.c +++ b/lib/xmlparse.c @@ -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) { diff --git a/lib/xmltok.h b/lib/xmltok.h index 1ecd05f..ca867aa 100644 --- a/lib/xmltok.h +++ b/lib/xmltok.h @@ -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 { |