From 88f9c7ca80bfbc9a5429fc632b90d6c4a2a2787d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 9 Apr 2008 10:33:41 +0200 Subject: Load /tmp/libxml2-2.6.32 into libxml2/branches/upstream/current. --- encoding.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'encoding.c') diff --git a/encoding.c b/encoding.c index 002eeba..6c49fff 100644 --- a/encoding.c +++ b/encoding.c @@ -1703,7 +1703,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, } icv_inlen = *inlen; icv_outlen = *outlen; - ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); + ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); *inlen -= icv_inlen; *outlen -= icv_outlen; if ((icv_inlen != 0) || (ret == -1)) { @@ -1768,9 +1768,10 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, * echo '' | wc -c => 38 * 45 chars should be sufficient to reach the end of the encoding * declaration without going too far inside the document content. + * on UTF-16 this means 90bytes, on UCS4 this means 180 */ - if (toconv > 45) - toconv = 45; + if (toconv > 180) + toconv = 180; if (toconv * 2 >= written) { xmlBufferGrow(out, toconv); written = out->size - out->use - 1; @@ -1991,8 +1992,8 @@ retry: toconv = in->use; if (toconv == 0) return(0); - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv * 2); + if (toconv * 4 >= written) { + xmlBufferGrow(out, toconv * 4); written = out->size - out->use - 1; } if (handler->output != NULL) { -- cgit v1.2.3