summaryrefslogtreecommitdiff
path: root/xzlib.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2013-05-10 14:01:46 +0800
committerDaniel Veillard <veillard@redhat.com>2013-05-10 14:01:46 +0800
commit63588f476f2dc89d4c6ef70a474d7230fbf4d45e (patch)
tree6d52a3cca99b189c0c9917b7df083e13a2d7af36 /xzlib.c
parent1ba80b7b6f1c89873fa319461954727a7bef2441 (diff)
downloadlibxml2-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.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xzlib.c b/xzlib.c
index 928bd17c..150e8033 100644
--- a/xzlib.c
+++ b/xzlib.c
@@ -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)
{