From: Karl Waclawek Date: Mon, 16 Dec 2002 04:02:02 +0000 (+0000) Subject: Fix for bug/feature request #653180. X-Git-Tag: R_1_95_6~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6802bb5147e01fe818a9578bc1ef586b665c14a;p=libexpat Fix for bug/feature request #653180. --- diff --git a/expat/lib/expat.h b/expat/lib/expat.h index e8403337..6508154b 100644 --- a/expat/lib/expat.h +++ b/expat/lib/expat.h @@ -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); diff --git a/expat/lib/xmlparse.c b/expat/lib/xmlparse.c index 5de06cb7..0ff94bde 100644 --- a/expat/lib/xmlparse.c +++ b/expat/lib/xmlparse.c @@ -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 {