diff options
author | Mike Hommey <glandium@debian.org> | 2007-06-13 20:47:19 +0200 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2007-06-13 20:47:19 +0200 |
commit | 58f9d16e3a77d5207d9ccc413b61e2cb45190018 (patch) | |
tree | f190471ceb2bc35c076cc65159141813da73c8ee /encoding.c | |
parent | 789259a1b6850d30acffbb62b11456b9ed7a8f59 (diff) | |
download | libxml2-58f9d16e3a77d5207d9ccc413b61e2cb45190018.tar.gz |
Load /tmp/libxml2-2.6.29 intoupstream/2.6.29.dfsg
libxml2/branches/upstream/current.
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1761,19 +1761,20 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, if (out == NULL) return(-1); if (in == NULL) return(-1); + /* calculate space available */ written = out->size - out->use; toconv = in->use; - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv); - written = out->size - out->use - 1; - } - /* * 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. */ - written = 45; + if (toconv > 45) + toconv = 45; + if (toconv * 2 >= written) { + xmlBufferGrow(out, toconv); + written = out->size - out->use - 1; + } if (handler->input != NULL) { ret = handler->input(&out->content[out->use], &written, |