1 #include <linux/init.h>
2 #include <linux/kernel.h>
3 #include <linux/vmalloc.h>
9 static void *SzAlloc(void *p
, size_t size
) { p
= p
; return vmalloc(size
); }
10 static void SzFree(void *p
, void *address
) { p
= p
; vfree(address
); }
11 static ISzAlloc g_Alloc
= { SzAlloc
, SzFree
};
13 int LzmaUncompress(void *dst
, int *dstlen
, void *src
, int srclen
)
19 if (srclen
< LZMA_PROPS_SIZE
)
21 memcpy(dst
, src
, srclen
);
24 inSizePure
= srclen
- LZMA_PROPS_SIZE
;
25 res
= LzmaDecode(dst
, dstlen
, src
+ LZMA_PROPS_SIZE
, &inSizePure
,
26 src
, LZMA_PROPS_SIZE
, LZMA_FINISH_ANY
, &status
, &g_Alloc
);
30 ((res
== SZ_ERROR_INPUT_EOF
) && (srclen
== inSizePure
)))