[Expat-checkins] expat/lib xmlparse.c,1.155,1.156

Karl Waclawek kwaclaw at users.sourceforge.net
Wed Jul 5 15:07:02 CEST 2006


Update of /cvsroot/expat/expat/lib
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv8239/lib

Modified Files:
	xmlparse.c 
Log Message:
Fix for issues # 1515266 and # 1515600. The inner for loop under 
XML_TOK_DATA_CHARS in doContent() and doCdataSection() did not
check if the character data handler was set each time a call-back was made.

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- xmlparse.c	1 Jul 2006 15:30:37 -0000	1.155
+++ xmlparse.c	5 Jul 2006 13:06:59 -0000	1.156
@@ -2545,9 +2545,9 @@
       *nextPtr = end;
       return XML_ERROR_NONE;
     case XML_TOK_DATA_CHARS:
-      if (characterDataHandler) {
-        if (MUST_CONVERT(enc, s)) {
-          for (;;) {
+      if (MUST_CONVERT(enc, s)) {
+        for (;;) {
+          if (characterDataHandler) {
             ICHAR *dataPtr = (ICHAR *)dataBuf;
             XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
             *eventEndPP = s;
@@ -2555,16 +2555,14 @@
                                  (int)(dataPtr - (ICHAR *)dataBuf));
             if (s == next)
               break;
-            if (ps_parsing == XML_FINISHED || ps_parsing == XML_SUSPENDED)
-              break;
             *eventPP = s;
           }
         }
-        else
-          characterDataHandler(handlerArg,
-                               (XML_Char *)s,
-                               (int)((XML_Char *)next - (XML_Char *)s));
       }
+      else if (characterDataHandler)
+        characterDataHandler(handlerArg,
+                             (XML_Char *)s,
+                             (int)((XML_Char *)next - (XML_Char *)s));
       else if (defaultHandler)
         reportDefault(parser, enc, s, next);
       break;
@@ -3127,9 +3125,9 @@
         reportDefault(parser, enc, s, next);
       break;
     case XML_TOK_DATA_CHARS:
-      if (characterDataHandler) {
-        if (MUST_CONVERT(enc, s)) {
-          for (;;) {
+      if (MUST_CONVERT(enc, s)) {
+        for (;;) {
+          if (characterDataHandler) {
             ICHAR *dataPtr = (ICHAR *)dataBuf;
             XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
             *eventEndPP = next;
@@ -3140,11 +3138,11 @@
             *eventPP = s;
           }
         }
-        else
-          characterDataHandler(handlerArg,
-                               (XML_Char *)s,
-                               (int)((XML_Char *)next - (XML_Char *)s));
       }
+      else if (characterDataHandler)
+        characterDataHandler(handlerArg,
+                             (XML_Char *)s,
+                             (int)((XML_Char *)next - (XML_Char *)s));
       else if (defaultHandler)
         reportDefault(parser, enc, s, next);
       break;



More information about the Expat-checkins mailing list