wok-4.x view busybox/stuff/busybox-1.18-zmodules.u @ rev 11277

Up: lxtask, lxrandr, lxmenu-data
author Alexander Medvedev <devl547@gmail.com>
date Thu Nov 10 03:21:19 2011 +0000 (2011-11-10)
parents
children
line source
1 Add LZMA_DEFAULT_MAGIC support
2 --- busybox-1.18.0/include/archive.h
3 +++ busybox-1.18.0/include/archive.h
4 @@ -9,6 +9,8 @@
5 COMPRESS_MAGIC = 0x1f9d,
6 GZIP_MAGIC = 0x1f8b,
7 BZIP2_MAGIC = 'B' * 256 + 'Z',
8 + /* lzma default options: lc=3 lp=0 pb=2, historic % 256 == 0 */
9 + LZMA_DEFAULT_MAGIC = 0x5d00,
10 /* .xz signature: 0xfd, '7', 'z', 'X', 'Z', 0x00 */
11 /* More info at: http://tukaani.org/xz/xz-file-format.txt */
12 XZ_MAGIC1 = 0xfd * 256 + '7',
13 @@ -20,6 +22,8 @@
14 COMPRESS_MAGIC = 0x9d1f,
15 GZIP_MAGIC = 0x8b1f,
16 BZIP2_MAGIC = 'Z' * 256 + 'B',
17 + /* lzma default options: lc=3 lp=0 pb=2, historic % 256 == 0 */
18 + LZMA_DEFAULT_MAGIC = 0x5d,
19 XZ_MAGIC1 = '7' * 256 + 0xfd,
20 XZ_MAGIC2 = ((0 * 256 + 'Z') * 256 + 'X') * 256 + 'z',
21 XZ_MAGIC1a = (('X' * 256 + 'z') * 256 + '7') * 256 + 0xfd,
23 --- busybox-1.17.1/libbb/read_printf.c
24 +++ busybox-1.17.1/libbb/read_printf.c
25 @@ -286,6 +286,17 @@
26 # endif
27 goto found_magic;
28 }
29 + if (ENABLE_FEATURE_SEAMLESS_LZMA
30 + && magic.b16[0] == LZMA_DEFAULT_MAGIC
31 + ) {
32 +# if BB_MMU
33 + xformer = unpack_lzma_stream;
34 + xlseek(fd, offset, SEEK_CUR);
35 +# else
36 + xformer_prog = "unlzma";
37 +# endif
38 + goto found_magic;
39 + }
40 if (ENABLE_FEATURE_SEAMLESS_XZ
41 && magic.b16[0] == XZ_MAGIC1
42 ) {
43 @@ -342,7 +353,8 @@
44 /* .lzma has no header/signature, just trust it */
45 open_transformer(fd, unpack_lzma_stream, "unlzma");
46 else
47 - if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
48 + if (((ENABLE_FEATURE_SEAMLESS_GZ|ENABLE_FEATURE_SEAMLESS_LZMA)
49 + && strcmp(sfx, "gz") == 0)
50 || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
51 || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
52 ) {