diff options
author | Mike Hommey <glandium@debian.org> | 2009-03-01 10:53:23 +0100 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2009-03-01 10:53:23 +0100 |
commit | d03a853bb0370d89552eceee59df1746da4a37f8 (patch) | |
tree | 441802d52ac5c0a2b6929e6dd5d8a58210b0fe3a /xmlIO.c | |
parent | 88f9c7ca80bfbc9a5429fc632b90d6c4a2a2787d (diff) | |
download | libxml2-d03a853bb0370d89552eceee59df1746da4a37f8.tar.gz |
Import upstream version 2.7.0upstream/2.7.0.dfsg
Diffstat (limited to 'xmlIO.c')
-rw-r--r-- | xmlIO.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -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 |