From d03a853bb0370d89552eceee59df1746da4a37f8 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 1 Mar 2009 10:53:23 +0100 Subject: Import upstream version 2.7.0 --- xmlIO.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'xmlIO.c') diff --git a/xmlIO.c b/xmlIO.c index dd4f7e7..aa97c44 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -2274,10 +2274,21 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { xmlFree(ret); return(NULL); } - ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT; + + /* + * For conversion buffers we use the special IO handling + */ + ret->buffer->alloc = XML_BUFFER_ALLOC_IO; + ret->buffer->contentIO = ret->buffer->content; + ret->encoder = encoder; if (encoder != NULL) { ret->conv = xmlBufferCreateSize(4000); + if (ret->conv == NULL) { + xmlFree(ret); + return(NULL); + } + /* * This call is designed to initiate the encoder state */ @@ -3320,9 +3331,10 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, * not the case force a flush, but make sure we stay in the loop */ if (chunk < 40) { - nbchars = 0; - oldwritten = -1; - goto flush; + if (xmlBufferGrow(out->buffer, out->buffer->size + 100) < 0) + return(-1); + oldwritten = -1; + continue; } /* @@ -3370,7 +3382,6 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, if ((nbchars < MINLEN) && (len <= 0)) goto done; -flush: if (out->writecallback) { /* * second write the stuff to the I/O channel -- cgit v1.2.3