wok-stable view linux/stuff/linux-lzma-export.u @ rev 313

Linux: fox some warnings
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 02 23:16:29 2008 +0000 (2008-03-02)
parents bb5704323e2b
children 42f25f3bfca2
line source
1 --- linux-2.6.24.2/lib/decompress_unlzma.c
2 +++ linux-2.6.24.2/lib/decompress_unlzma.c
3 @@ -52,11 +52,6 @@ static void __init large_free(void *wher
4 }
6 #ifndef TEST
7 -static void __init *malloc(size_t size)
8 -{
9 - return kmalloc(size, GFP_KERNEL);
10 -}
11 -
12 static void __init free(void *where)
13 {
14 kfree(where);
15 @@ -321,7 +316,7 @@ typedef struct {
16 #define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS)
19 -STATIC int unlzma(char *inbuf, int in_len,
20 +int unlzma(char *inbuf, int in_len,
21 int(*fill)(void*,unsigned int),
22 int(*writebb)(char*,unsigned int),
23 int *posp)
24 @@ -348,10 +343,21 @@ STATIC int unlzma(char *inbuf, int in_le
26 rc_init(&rc, fill, inbuf, in_len);
28 - for (i = 0; i < sizeof(header); i++) {
29 - if (rc.ptr >= rc.buffer_end)
30 - rc_read(&rc);
31 - ((unsigned char *)&header)[i] = *rc.ptr++;
32 + header.dict_size = header.dst_size = in_len;
33 + if (inbuf && inbuf[0] == 0) {
34 + const int LZMA_LC = 3, LZMA_LP = 0, LZMA_PB = 2;
35 + header.pos = (LZMA_PB * 45) + (LZMA_LP * 5) + LZMA_LC;
36 + rc.ptr++;
37 + }
38 + else {
39 + int hdrsize = sizeof(header);
40 + if (inbuf && (1 + * (unsigned long *) &inbuf[9]) > 1U)
41 + hdrsize = 5;
42 + for (i = 0; i < hdrsize; i++) {
43 + if (rc.ptr >= rc.buffer_end)
44 + rc_read(&rc);
45 + ((unsigned char *)&header)[i] = *rc.ptr++;
46 + }
47 }
49 if (header.pos >= (9 * 5 * 5))
51 --- linux-2.6.24.2/lib/Makefile
52 +++ linux-2.6.24.2/lib/Makefile
53 @@ -51,7 +51,7 @@ obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
54 obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
56 obj-$(CONFIG_RD_BZIP2) += decompress_bunzip2.o
57 -obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o
58 +obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o unlzma_syms.o
61 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
63 --- linux-2.6.24.2/lib/unlzma_syms.c
64 +++ linux-2.6.24.2/lib/unlzma_syms.c
65 @@ -0,0 +1,14 @@
66 +/*
67 + * linux/lib/unlzma_syms.c
68 + *
69 + * Exported symbols for the unlzma functionality.
70 + *
71 + */
72 +
73 +#include <linux/module.h>
74 +#include <linux/init.h>
75 +
76 +#include <linux/decompress_unlzma.h>
77 +
78 +EXPORT_SYMBOL(unlzma);
79 +MODULE_LICENSE("GPL");