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