expat/lib expat.h, 1.64, 1.65 xmlparse.c, 1.128, 1.129

"Karl Waclawek" <[email protected]> Tue, 16 Mar 2004 14:14:46 -0800
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23180

Modified Files:
	expat.h xmlparse.c 
Log Message:
Changed to allow aborting a suspended parser instance.

Index: expat.h
===================================================================
RCS file: /cvsroot/expat/expat/lib/expat.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- expat.h	16 Mar 2004 20:29:28 -0000	1.64
+++ expat.h	16 Mar 2004 22:14:30 -0000	1.65
@@ -829,8 +829,9 @@
 XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
 
 /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.
-   Must be called from within a call-back handler. Some call-backs
-   may still follow because they would otherwise get lost. Examples:
+   Must be called from within a call-back handler, except when aborting
+   (resumable = 0) an already suspended parser. Some call-backs may
+   still follow because they would otherwise get lost. Examples:
    - endElementHandler() for empty elements when stopped in
      startElementHandler(), 
    - endNameSpaceDeclHandler() when stopped in endElementHandler(), 
@@ -840,8 +841,8 @@
    except when parsing an external parameter entity and resumable != 0.
    Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
    Possible error codes: 
-   - XML_ERROR_SUSPENDED:  when the parser is already suspended.
-   - XML_ERROR_FINISHED:   when the parser has already finished.
+   - XML_ERROR_SUSPENDED: when suspending an already suspended parser.
+   - XML_ERROR_FINISHED: when the parser has already finished.
    - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.
 
    When resumable != 0 (true) then parsing is suspended, that is, 

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- xmlparse.c	16 Mar 2004 20:29:28 -0000	1.128
+++ xmlparse.c	16 Mar 2004 22:14:31 -0000	1.129
@@ -1668,8 +1668,12 @@
 {
   switch (parsing) {
   case XML_SUSPENDED:
-    errorCode = XML_ERROR_SUSPENDED;
-    return XML_STATUS_ERROR;
+    if (resumable) {
+      errorCode = XML_ERROR_SUSPENDED;
+      return XML_STATUS_ERROR;
+    }
+    parsing = XML_FINISHED;
+    break;
   case XML_FINISHED:
     errorCode = XML_ERROR_FINISHED;
     return XML_STATUS_ERROR;