Implemented detection of compressed files, setting doc->compressed
* xmlIO.c include/libxml/xmlIO.h parser.c: Implemented detection
of compressed files, setting doc->compressed appropriately
(bug #120503).
diff --git a/parser.c b/parser.c
index b5ae4a8..830a29a 100644
--- a/parser.c
+++ b/parser.c
@@ -2923,7 +2923,7 @@
SHRINK;
GROW;
in = ctxt->input->cur;
- } while ((*in >= 0x20) && (*in <= 0x7F) || (*in == 0x09));
+ } while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09));
nbchar = 0;
}
ctxt->input->line = line;
@@ -11345,7 +11345,13 @@
xmlParseDocument(ctxt);
- if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc;
+ if ((ctxt->wellFormed) || recovery) {
+ ret = ctxt->myDoc;
+ if (ctxt->input->buf->compressed > 0)
+ ret->compression = 9;
+ else
+ ret->compression = ctxt->input->buf->compressed;
+ }
else {
ret = NULL;
xmlFreeDoc(ctxt->myDoc);