[Expat-checkins] expat/lib xmlparse.c,1.157,1.158
Karl Waclawek
kwaclaw at users.sourceforge.net
Mon Jul 10 20:59:55 CEST 2006
Update of /cvsroot/expat/expat/lib
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv28082/lib
Modified Files:
xmlparse.c
Log Message:
Improved fix for issues # 1515266 and # 1515600. Will now preserve the
"failover to default handler" logic. Note: clearing the character data handler
does not take effect immediately anymore.
Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- xmlparse.c 6 Jul 2006 02:50:27 -0000 1.157
+++ xmlparse.c 10 Jul 2006 18:59:52 -0000 1.158
@@ -2544,29 +2544,30 @@
}
*nextPtr = end;
return XML_ERROR_NONE;
- case XML_TOK_DATA_CHARS:
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- if (characterDataHandler) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- characterDataHandler(handlerArg, dataBuf,
- (int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
- break;
- *eventPP = s;
+ case XML_TOK_DATA_CHARS:
+ {
+ XML_CharacterDataHandler charDataHandler = characterDataHandler;
+ if (charDataHandler) {
+ if (MUST_CONVERT(enc, s)) {
+ for (;;) {
+ ICHAR *dataPtr = (ICHAR *)dataBuf;
+ XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ *eventEndPP = s;
+ charDataHandler(handlerArg, dataBuf,
+ (int)(dataPtr - (ICHAR *)dataBuf));
+ if (s == next)
+ break;
+ *eventPP = s;
+ }
}
else
- break;
+ charDataHandler(handlerArg,
+ (XML_Char *)s,
+ (int)((XML_Char *)next - (XML_Char *)s));
}
+ else if (defaultHandler)
+ reportDefault(parser, enc, s, next);
}
- else if (characterDataHandler)
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (int)((XML_Char *)next - (XML_Char *)s));
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
break;
case XML_TOK_PI:
if (!reportProcessingInstruction(parser, enc, s, next))
@@ -3127,28 +3128,29 @@
reportDefault(parser, enc, s, next);
break;
case XML_TOK_DATA_CHARS:
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- if (characterDataHandler) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = next;
- characterDataHandler(handlerArg, dataBuf,
- (int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
- break;
- *eventPP = s;
+ {
+ XML_CharacterDataHandler charDataHandler = characterDataHandler;
+ if (charDataHandler) {
+ if (MUST_CONVERT(enc, s)) {
+ for (;;) {
+ ICHAR *dataPtr = (ICHAR *)dataBuf;
+ XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ *eventEndPP = next;
+ charDataHandler(handlerArg, dataBuf,
+ (int)(dataPtr - (ICHAR *)dataBuf));
+ if (s == next)
+ break;
+ *eventPP = s;
+ }
}
else
- break;
+ charDataHandler(handlerArg,
+ (XML_Char *)s,
+ (int)((XML_Char *)next - (XML_Char *)s));
}
+ else if (defaultHandler)
+ reportDefault(parser, enc, s, next);
}
- else if (characterDataHandler)
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (int)((XML_Char *)next - (XML_Char *)s));
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
break;
case XML_TOK_INVALID:
*eventPP = next;
More information about the Expat-checkins
mailing list