libxml2 r3695 - trunk



Author: veillard
Date: Sat Feb 16 10:08:14 2008
New Revision: 3695
URL: http://svn.gnome.org/viewvc/libxml2?rev=3695&view=rev

Log:
* xmlIO.c: fix output bug reported by Petr Pajas and analyzed by Bill
Daniel


Modified:
   trunk/ChangeLog
   trunk/xmlIO.c

Modified: trunk/xmlIO.c
==============================================================================
--- trunk/xmlIO.c	(original)
+++ trunk/xmlIO.c	Sat Feb 16 10:08:14 2008
@@ -3315,6 +3315,16 @@
 	cons = len;
 	chunk = (out->buffer->size - out->buffer->use) - 1;
 
+        /*
+	 * make sure we have enough room to save first, if this is
+	 * not the case force a flush, but make sure we stay in the loop
+	 */
+	if (chunk < 40) {
+	    nbchars = 0;
+	    oldwritten = -1;
+	    goto flush;
+	}
+
 	/*
 	 * first handle encoding stuff.
 	 */
@@ -3360,6 +3370,7 @@
 	if ((nbchars < MINLEN) && (len <= 0))
 	    goto done;
 
+flush:
 	if (out->writecallback) {
 	    /*
 	     * second write the stuff to the I/O channel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]