[Expat-checkins] expat/lib xmlparse.c,1.126,1.127

Karl Waclawek kwaclaw at users.sourceforge.net
Mon Mar 15 23:41:57 EST 2004


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

Modified Files:
	xmlparse.c 
Log Message:
When the parser was suspended while processing an internal entity,
an XML_ERROR_NO_ELEMENTS condition could happen.
The reason was that the internal entity's start tag level was not preserved
when parsing was suspended. This has been corrected.

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- xmlparse.c	16 Mar 2004 04:27:18 -0000	1.126
+++ xmlparse.c	16 Mar 2004 04:41:54 -0000	1.127
@@ -284,6 +284,7 @@
   const char *internalEventEndPtr;
   struct open_internal_entity *next;
   ENTITY *entity;
+  int startTagLevel;
   XML_Bool betweenDecl; /* WFC: PE Between Declarations */
 } OPEN_INTERNAL_ENTITY;
 
@@ -4568,6 +4569,7 @@
   openEntity->next = openInternalEntities;
   openInternalEntities = openEntity;
   openEntity->entity = entity;
+  openEntity->startTagLevel = tagLevel;
   openEntity->betweenDecl = betweenDecl;
   openEntity->internalEventPtr = NULL;
   openEntity->internalEventEndPtr = NULL;
@@ -4610,7 +4612,6 @@
   ENTITY *entity;
   const char *textStart, *textEnd;
   const char *next;
-  int processorTagLevel;
   enum XML_Error result;
   OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities;
   if (!openEntity)
@@ -4619,11 +4620,6 @@
   entity = openEntity->entity;
   textStart = ((char *)entity->textPtr) + entity->processed;
   textEnd = (char *)(entity->textPtr + entity->textLen);
-  /* compare with cdataSectionProcessor */
-  if (parentParser)
-    processorTagLevel = 1;
-  else
-    processorTagLevel = 0;
 
 #ifdef XML_DTD
   if (entity->is_param) {
@@ -4633,7 +4629,7 @@
   }
   else
 #endif /* XML_DTD */
-    result = doContent(parser, processorTagLevel, internalEncoding, 
+    result = doContent(parser, openEntity->startTagLevel, internalEncoding, 
                        textStart, textEnd, &next, XML_FALSE);  
 
   if (result != XML_ERROR_NONE)
@@ -4662,8 +4658,9 @@
 #endif /* XML_DTD */
   {
     processor = contentProcessor;
-    return doContent(parser, processorTagLevel, encoding, s, end, nextPtr,
-                     (XML_Bool)!finalBuffer); 
+    /* see externalEntityContentProcessor vs contentProcessor */
+    return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
+                     nextPtr, (XML_Bool)!finalBuffer); 
   }  
 }
 




More information about the Expat-checkins mailing list