Fix for bug/feature request #653180.

This commit is contained in:
Karl Waclawek 2002-12-16 04:02:02 +00:00
parent ed47baa513
commit e6802bb514
2 changed files with 13 additions and 8 deletions

View File

@ -809,13 +809,15 @@ XMLPARSEAPI(enum XML_Error)
XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse
location. They may be called when XML_Parse or XML_ParseBuffer
return 0; in this case the location is the location of the
character at which the error was detected.
They may also be called from any other callback called to report
some parse event; in this the location is the location of the first
of the sequence of characters that generated the event.
location. They may be called from any callback called to report
some parse event; in this case the location is the location of
the first of the sequence of characters that generated the event.
They may also be called after returning from a call to XML_Parse
or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then
the location is the location of the character at which the error
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);

View File

@ -1393,6 +1393,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
return XML_STATUS_ERROR;
}
XmlUpdatePosition(encoding, positionPtr, end, &position);
positionPtr = end;
nLeftOver = s + len - end;
if (nLeftOver) {
if (buffer == NULL || nLeftOver > bufferLim - buffer) {
@ -1442,8 +1443,10 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
errorCode = processor(parser, start, parseEndPtr = bufferEnd,
isFinal ? (const char **)NULL : &bufferPtr);
if (errorCode == XML_ERROR_NONE) {
if (!isFinal)
if (!isFinal) {
XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
positionPtr = bufferPtr;
}
return XML_STATUS_OK;
}
else {