unzip: optional support for xz
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 9 Jan 2017 10:12:01 +0000 (11:12 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 9 Jan 2017 10:12:01 +0000 (11:12 +0100)
function                                             old     new   delta
unzip_main                                          2476    2491     +15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/libarchive/Kbuild.src
archival/unzip.c

index 84117fa85d2bf3b0f16255251112ba9282dab1ee..eaf67451f7e342abf953ec2b0d9cb0edf83a3be2 100644 (file)
@@ -61,6 +61,7 @@ lib-$(CONFIG_FEATURE_UNZIP_LZMA)        += open_transformer.o decompress_unlzma.
 lib-$(CONFIG_UNXZ)                      += open_transformer.o decompress_unxz.o
 lib-$(CONFIG_XZCAT)                     += open_transformer.o decompress_unxz.o
 lib-$(CONFIG_XZ)                        += open_transformer.o decompress_unxz.o
+lib-$(CONFIG_FEATURE_UNZIP_XZ)          += open_transformer.o decompress_unxz.o
 lib-$(CONFIG_GUNZIP)                    += open_transformer.o decompress_gunzip.o
 lib-$(CONFIG_ZCAT)                      += open_transformer.o decompress_gunzip.o
 lib-$(CONFIG_UNCOMPRESS)                += open_transformer.o decompress_uncompress.o
index 997543c508f3944aa0a2cf51aaccacbe5a886108..6dc5d89c2a8c1960034c207c58b585f25c80ba75 100644 (file)
 //config:      bool "Support compression method 14 (lzma)"
 //config:      default y
 //config:      depends on FEATURE_UNZIP_CDF && DESKTOP
+//config:
+//config:config FEATURE_UNZIP_XZ
+//config:      bool "Support compression method 95 (xz)"
+//config:      default y
+//config:      depends on FEATURE_UNZIP_CDF && DESKTOP
 
 //applet:IF_UNZIP(APPLET(unzip, BB_DIR_USR_BIN, BB_SUID_DROP))
 //kbuild:lib-$(CONFIG_UNZIP) += unzip.o
@@ -371,6 +376,14 @@ static void unzip_extract(zip_header_t *zip, int dst_fd)
                if (xstate.bytes_out < 0)
                        bb_error_msg_and_die("inflate error");
        }
+#endif
+#if ENABLE_FEATURE_UNZIP_XZ
+       else if (zip->fmt.method == 95) {
+               /* Not tested yet */
+               xstate.bytes_out = unpack_xz_stream(&xstate);
+               if (xstate.bytes_out < 0)
+                       bb_error_msg_and_die("inflate error");
+       }
 #endif
        else {
                bb_error_msg_and_die("unsupported method %u", zip->fmt.method);