ce188d4d |
1 | /* Lzma2Dec.h -- LZMA2 Decoder\r |
2 | 2015-05-13 : Igor Pavlov : Public domain */\r |
3 | \r |
4 | #ifndef __LZMA2_DEC_H\r |
5 | #define __LZMA2_DEC_H\r |
6 | \r |
7 | #include "LzmaDec.h"\r |
8 | \r |
9 | EXTERN_C_BEGIN\r |
10 | \r |
11 | /* ---------- State Interface ---------- */\r |
12 | \r |
13 | typedef struct\r |
14 | {\r |
15 | CLzmaDec decoder;\r |
16 | UInt32 packSize;\r |
17 | UInt32 unpackSize;\r |
18 | unsigned state;\r |
19 | Byte control;\r |
20 | Bool needInitDic;\r |
21 | Bool needInitState;\r |
22 | Bool needInitProp;\r |
23 | } CLzma2Dec;\r |
24 | \r |
25 | #define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder)\r |
26 | #define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc);\r |
27 | #define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc);\r |
28 | \r |
29 | SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);\r |
30 | SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);\r |
31 | void Lzma2Dec_Init(CLzma2Dec *p);\r |
32 | \r |
33 | \r |
34 | /*\r |
35 | finishMode:\r |
36 | It has meaning only if the decoding reaches output limit (*destLen or dicLimit).\r |
37 | LZMA_FINISH_ANY - use smallest number of input bytes\r |
38 | LZMA_FINISH_END - read EndOfStream marker after decoding\r |
39 | \r |
40 | Returns:\r |
41 | SZ_OK\r |
42 | status:\r |
43 | LZMA_STATUS_FINISHED_WITH_MARK\r |
44 | LZMA_STATUS_NOT_FINISHED\r |
45 | LZMA_STATUS_NEEDS_MORE_INPUT\r |
46 | SZ_ERROR_DATA - Data error\r |
47 | */\r |
48 | \r |
49 | SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,\r |
50 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);\r |
51 | \r |
52 | SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen,\r |
53 | const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);\r |
54 | \r |
55 | \r |
56 | /* ---------- One Call Interface ---------- */\r |
57 | \r |
58 | /*\r |
59 | finishMode:\r |
60 | It has meaning only if the decoding reaches output limit (*destLen).\r |
61 | LZMA_FINISH_ANY - use smallest number of input bytes\r |
62 | LZMA_FINISH_END - read EndOfStream marker after decoding\r |
63 | \r |
64 | Returns:\r |
65 | SZ_OK\r |
66 | status:\r |
67 | LZMA_STATUS_FINISHED_WITH_MARK\r |
68 | LZMA_STATUS_NOT_FINISHED\r |
69 | SZ_ERROR_DATA - Data error\r |
70 | SZ_ERROR_MEM - Memory allocation error\r |
71 | SZ_ERROR_UNSUPPORTED - Unsupported properties\r |
72 | SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).\r |
73 | */\r |
74 | \r |
75 | SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,\r |
76 | Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc);\r |
77 | \r |
78 | EXTERN_C_END\r |
79 | \r |
80 | #endif\r |