summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2008-04-09 10:33:41 +0200
committerMike Hommey <glandium@debian.org>2008-04-09 10:33:41 +0200
commit88f9c7ca80bfbc9a5429fc632b90d6c4a2a2787d (patch)
treee12ef38cd8eb205c495e5718852d758b95e3a3c6 /encoding.c
parentfc760252aba4054a612dd20b803d0c7c19713064 (diff)
downloadlibxml2-88f9c7ca80bfbc9a5429fc632b90d6c4a2a2787d.tar.gz
Load /tmp/libxml2-2.6.32 intoupstream/2.6.32.dfsg
libxml2/branches/upstream/current.
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c11
1 files changed, 6 insertions, 5 deletions
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 '<?xml version="1.0" encoding="UCS4"?>' | 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) {