From 45f66167fe96de219aac91d842f3e64d857340f6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 1 Jul 2010 05:12:28 +0200 Subject: xz compression detection: avoid the need to seek function old new delta unpack_unxz 12 67 +55 unpack_xz_stream 2357 2373 +16 xmalloc_read 197 199 +2 setup_unzip_on_fd 118 99 -19 rpm2cpio_main 222 203 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 73/-38) Total: 35 bytes Signed-off-by: Denys Vlasenko --- archival/libunarchive/decompress_unxz.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'archival/libunarchive') diff --git a/archival/libunarchive/decompress_unxz.c b/archival/libunarchive/decompress_unxz.c index 5d7513a..721acd9 100644 --- a/archival/libunarchive/decompress_unxz.c +++ b/archival/libunarchive/decompress_unxz.c @@ -56,9 +56,11 @@ unpack_xz_stream(int src_fd, int dst_fd) if (!crc32_table) crc32_table = crc32_filltable(NULL, /*endian:*/ 0); - membuf = xmalloc(2 * BUFSIZ); memset(&iobuf, 0, sizeof(iobuf)); + /* Preload XZ file signature */ + membuf = (void*) strcpy(xmalloc(2 * BUFSIZ), HEADER_MAGIC); iobuf.in = membuf; + iobuf.in_size = HEADER_MAGIC_SIZE; iobuf.out = membuf + BUFSIZ; iobuf.out_size = BUFSIZ; -- cgit v1.1