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