Fix 1.25 ND sources
[tomato.git] / release / src / linux / linux / fs / inflate_lzma / 7zlzma.c
blobf45d6c2276affe242c849d987216e3258f086146
1 #include "7z.h"
3 #ifdef _HOST_TOOL
4 #include "stdio.h"
5 #endif
7 #include "LZMADecoder.h"
10 static LzmaDecoder cc;
11 ISequentialInStream in_stream;
12 ISequentialOutStream out_stream;
13 int decompress_lzma_7z( unsigned char* in_data,
14 unsigned in_size,
15 unsigned char* out_data,
16 unsigned out_size) {
17 // LzmaDecoder cc;
18 int RC;
19 UINT64 in_size_l = in_size;
20 UINT64 out_size_l = out_size;
23 InStreamInit(in_data, in_size);
25 OutStreamInit((char *)out_data, out_size);
27 LzmaDecoderConstructor(&cc);
29 if ((RC = LzmaDecoderReadCoderProperties(&cc)) != S_OK)
31 return RC;
34 if (LzmaDecoderCode(&cc, &in_size_l, &out_size_l) != S_OK)
36 return -2;
39 if (out_stream.size != out_size)
41 return -3;
44 if ( out_stream.overflow )
46 return -4;
49 return 0;
52 //BRCM modification
53 #ifdef __KERNEL__
54 EXPORT_SYMBOL(decompress_lzma_7z);
55 #endif