mirror of
https://github.com/libexpat/libexpat.git
synced 2025-04-05 21:24:59 +00:00
Make locations right for default handler and for character data spread over multiple calls.
This commit is contained in:
parent
508f4e99ee
commit
38dc320552
1 changed files with 20 additions and 7 deletions
|
@ -1106,11 +1106,14 @@ doContent(XML_Parser parser,
|
|||
case XML_TOK_DATA_CHARS:
|
||||
if (characterDataHandler) {
|
||||
if (MUST_CONVERT(enc, s)) {
|
||||
do {
|
||||
for (;;) {
|
||||
ICHAR *dataPtr = (ICHAR *)dataBuf;
|
||||
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
|
||||
characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
|
||||
} while (s != next);
|
||||
if (s == next)
|
||||
break;
|
||||
*eventPP = s;
|
||||
}
|
||||
}
|
||||
else
|
||||
characterDataHandler(handlerArg,
|
||||
|
@ -1279,11 +1282,14 @@ enum XML_Error doCdataSection(XML_Parser parser,
|
|||
case XML_TOK_DATA_CHARS:
|
||||
if (characterDataHandler) {
|
||||
if (MUST_CONVERT(enc, s)) {
|
||||
do {
|
||||
for (;;) {
|
||||
ICHAR *dataPtr = (ICHAR *)dataBuf;
|
||||
XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
|
||||
characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
|
||||
} while (s != next);
|
||||
if (s == next)
|
||||
break;
|
||||
*eventPP = s;
|
||||
}
|
||||
}
|
||||
else
|
||||
characterDataHandler(handlerArg,
|
||||
|
@ -1729,6 +1735,7 @@ prologProcessor(XML_Parser parser,
|
|||
case XML_TOK_XML_DECL:
|
||||
break;
|
||||
default:
|
||||
eventPtr = s;
|
||||
reportDefault(parser, encoding, s, next);
|
||||
}
|
||||
}
|
||||
|
@ -2058,9 +2065,15 @@ static void
|
|||
reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end)
|
||||
{
|
||||
if (MUST_CONVERT(enc, s)) {
|
||||
ICHAR *dataPtr = (ICHAR *)dataBuf;
|
||||
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
|
||||
defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
|
||||
for (;;) {
|
||||
ICHAR *dataPtr = (ICHAR *)dataBuf;
|
||||
XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
|
||||
defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
|
||||
if (s == end)
|
||||
break;
|
||||
if (enc == encoding)
|
||||
eventPtr = s;
|
||||
}
|
||||
}
|
||||
else
|
||||
defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
|
||||
|
|
Loading…
Add table
Reference in a new issue