~vcs-imports/openbox4/trunk

« back to all changes in this revision

Viewing changes to firmware_1.x/tools/nb4-mksquashfs/lzma/decompress/7zlzma.c

  • Committer: psolyca
  • Date: 2013-03-06 17:34:30 UTC
  • Revision ID: svn-v4:3124532d-43cb-4037-9335-164a1c69beb7:trunk:284
Reorganisation du depot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "7z.h"
 
2
 
 
3
#ifdef _HOST_TOOL
 
4
#include "stdio.h"
 
5
#endif
 
6
 
 
7
#include "LZMADecoder.h"
 
8
 
 
9
 
 
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;
 
21
 
 
22
 
 
23
        InStreamInit(in_data, in_size);
 
24
 
 
25
        OutStreamInit((char *)out_data, out_size);
 
26
 
 
27
        LzmaDecoderConstructor(&cc);
 
28
 
 
29
        if ((RC = LzmaDecoderReadCoderProperties(&cc)) != S_OK)
 
30
        {
 
31
                return RC;
 
32
        }
 
33
 
 
34
        if (LzmaDecoderCode(&cc, &in_size_l, &out_size_l) != S_OK)
 
35
        {
 
36
                return -2;
 
37
        }
 
38
 
 
39
        if (out_stream.size != out_size)
 
40
        {
 
41
                return -3;
 
42
        }
 
43
 
 
44
        if ( out_stream.overflow )
 
45
        {
 
46
            return -4;
 
47
        }
 
48
 
 
49
        return 0;
 
50
}
 
51
 
 
52
//BRCM modification
 
53
#ifdef __KERNEL__
 
54
EXPORT_SYMBOL(decompress_lzma_7z);
 
55
#endif
 
56
 
 
57