diff options
author | Daniel Veillard <veillard@redhat.com> | 2013-05-10 14:01:46 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2013-05-10 14:01:46 +0800 |
commit | 63588f476f2dc89d4c6ef70a474d7230fbf4d45e (patch) | |
tree | 6d52a3cca99b189c0c9917b7df083e13a2d7af36 /xzlib.c | |
parent | 1ba80b7b6f1c89873fa319461954727a7bef2441 (diff) | |
download | libxml2-63588f476f2dc89d4c6ef70a474d7230fbf4d45e.tar.gz |
Fix a regression in xmlGetDocCompressMode()
The switch to xzlib had for consequence that the compression
level of the input was not gathered anymore in ctxt->input->buf,
then the parser compression flags was left to -1 and propagated
to the resulting document.
Fix the I/O layer to get compression detection in xzlib,
then carry it in the input buffer and the resulting document
This should fix
https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=3456
Diffstat (limited to 'xzlib.c')
-rw-r--r-- | xzlib.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -182,12 +182,37 @@ xz_open(const char *path, int fd, const char *mode ATTRIBUTE_UNUSED) return (xzFile) state; } +static int +xz_compressed(xzFile f) { + xz_statep state; + + if (f == NULL) + return(-1); + state = (xz_statep) f; + if (state->init <= 0) + return(-1); + + switch (state->how) { + case COPY: + return(0); + case GZIP: + case LZMA: + return(1); + } + return(-1); +} + xzFile __libxml2_xzopen(const char *path, const char *mode) { return xz_open(path, -1, mode); } +int +__libxml2_xzcompressed(xzFile f) { + return xz_compressed(f); +} + xzFile __libxml2_xzdopen(int fd, const char *mode) { |