1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/* Xz.h - Xz interface
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync2010-09-17 : Igor Pavlov : Public domain */
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __XZ_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __XZ_H
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Sha256.h"
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncEXTERN_C_BEGIN
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_Subblock 1
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_Delta 3
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_X86 4
14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_PPC 5
15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_IA64 6
16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_ARM 7
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_ARMT 8
18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_SPARC 9
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_ID_LZMA2 0x21
20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
21baa3858d3f5d128a5c8466b700098109edcad5f2repo syncunsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value);
22baa3858d3f5d128a5c8466b700098109edcad5f2repo syncunsigned Xz_WriteVarInt(Byte *buf, UInt64 v);
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/* ---------- xz block ---------- */
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_BLOCK_HEADER_SIZE_MAX 1024
27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_NUM_FILTERS_MAX 4
29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_BF_NUM_FILTERS_MASK 3
30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_BF_PACK_SIZE (1 << 6)
31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_BF_UNPACK_SIZE (1 << 7)
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_FILTER_PROPS_SIZE_MAX 20
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
35baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 id;
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 propsSize;
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte props[XZ_FILTER_PROPS_SIZE_MAX];
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzFilter;
41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
42baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 packSize;
45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 unpackSize;
46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte flags;
47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzFilter filters[XZ_NUM_FILTERS_MAX];
48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzBlock;
49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzBlock_GetNumFilters(p) (((p)->flags & XZ_BF_NUM_FILTERS_MASK) + 1)
51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzBlock_HasPackSize(p)   (((p)->flags & XZ_BF_PACK_SIZE) != 0)
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzBlock_HasUnpackSize(p) (((p)->flags & XZ_BF_UNPACK_SIZE) != 0)
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
54baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes XzBlock_Parse(CXzBlock *p, const Byte *header);
55baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes);
56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/* ---------- xz stream ---------- */
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_SIG_SIZE 6
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_FOOTER_SIG_SIZE 2
61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
62baa3858d3f5d128a5c8466b700098109edcad5f2repo syncextern Byte XZ_SIG[XZ_SIG_SIZE];
63baa3858d3f5d128a5c8466b700098109edcad5f2repo syncextern Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE];
64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_STREAM_FLAGS_SIZE 2
66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_STREAM_CRC_SIZE 4
67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_STREAM_HEADER_SIZE (XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE)
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_STREAM_FOOTER_SIZE (XZ_FOOTER_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE + 4)
70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_CHECK_MASK 0xF
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_CHECK_NO 0
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_CHECK_CRC32 1
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_CHECK_CRC64 4
75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_CHECK_SHA256 10
76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
77baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int mode;
80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 crc;
81baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 crc64;
82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CSha256 sha;
83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzCheck;
84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
85baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid XzCheck_Init(CXzCheck *p, int mode);
86baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid XzCheck_Update(CXzCheck *p, const void *data, size_t size);
87baa3858d3f5d128a5c8466b700098109edcad5f2repo syncint XzCheck_Final(CXzCheck *p, Byte *digest);
88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
89baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef UInt16 CXzStreamFlags;
90baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzFlags_IsSupported(f) ((f) <= XZ_CHECK_MASK)
92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzFlags_GetCheckType(f) ((f) & XZ_CHECK_MASK)
93baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XzFlags_HasDataCrc32(f) (Xz_GetCheckType(f) == XZ_CHECK_CRC32)
94baa3858d3f5d128a5c8466b700098109edcad5f2repo syncunsigned XzFlags_GetCheckSize(CXzStreamFlags f);
95baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
96baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf);
97baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream);
98baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
99baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
100baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
101baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 unpackSize;
102baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 totalSize;
103baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzBlockSizes;
104baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
105baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
106baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
107baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzStreamFlags flags;
108baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t numBlocks;
109baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t numBlocksAllocated;
110baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzBlockSizes *blocks;
111baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 startOffset;
112baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzStream;
113baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
114baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid Xz_Construct(CXzStream *p);
115baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid Xz_Free(CXzStream *p, ISzAlloc *alloc);
116baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
117baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define XZ_SIZE_OVERFLOW ((UInt64)(Int64)-1)
118baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
119baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt64 Xz_GetUnpackSize(const CXzStream *p);
120baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt64 Xz_GetPackSize(const CXzStream *p);
121baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
122baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
123baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
124baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t num;
125baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t numAllocated;
126baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzStream *streams;
127baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzs;
128baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
129baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid Xzs_Construct(CXzs *p);
130baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid Xzs_Free(CXzs *p, ISzAlloc *alloc);
131baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc);
132baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
133baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt64 Xzs_GetNumBlocks(const CXzs *p);
134baa3858d3f5d128a5c8466b700098109edcad5f2repo syncUInt64 Xzs_GetUnpackSize(const CXzs *p);
135baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
136baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef enum
137baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
138baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_STATUS_NOT_SPECIFIED,               /* use main error code instead */
139baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_STATUS_FINISHED_WITH_MARK,          /* stream was finished with end mark. */
140baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_STATUS_NOT_FINISHED,                /* stream was not finished */
141baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_STATUS_NEEDS_MORE_INPUT             /* you must provide more input bytes */
142baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} ECoderStatus;
143baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
144baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef enum
145baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
146baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_FINISH_ANY,   /* finish at any point */
147baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CODER_FINISH_END    /* block must be finished at the end */
148baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} ECoderFinishMode;
149baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
150baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct _IStateCoder
151baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
152baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void *p;
153baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void (*Free)(void *p, ISzAlloc *alloc);
154baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAlloc *alloc);
155baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  void (*Init)(void *p);
156baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SRes (*Code)(void *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
157baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished);
158baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} IStateCoder;
159baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
160baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define MIXCODER_NUM_FILTERS_MAX 4
161baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
162baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
163baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
164baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  ISzAlloc *alloc;
165baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte *buf;
166baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int numCoders;
167baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int finished[MIXCODER_NUM_FILTERS_MAX - 1];
168baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t pos[MIXCODER_NUM_FILTERS_MAX - 1];
169baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  size_t size[MIXCODER_NUM_FILTERS_MAX - 1];
170baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 ids[MIXCODER_NUM_FILTERS_MAX];
171baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  IStateCoder coders[MIXCODER_NUM_FILTERS_MAX];
172baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CMixCoder;
173baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
174baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc);
175baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid MixCoder_Free(CMixCoder *p);
176baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid MixCoder_Init(CMixCoder *p);
177baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes MixCoder_SetFromMethod(CMixCoder *p, int coderIndex, UInt64 methodId);
178baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen,
179baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    const Byte *src, SizeT *srcLen, int srcWasFinished,
180baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    ECoderFinishMode finishMode, ECoderStatus *status);
181baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
182baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef enum
183baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
184baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_STREAM_HEADER,
185baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_STREAM_INDEX,
186baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_STREAM_INDEX_CRC,
187baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_STREAM_FOOTER,
188baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_STREAM_PADDING,
189baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_BLOCK_HEADER,
190baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_BLOCK,
191baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  XZ_STATE_BLOCK_FOOTER
192baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} EXzState;
193baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
194baa3858d3f5d128a5c8466b700098109edcad5f2repo synctypedef struct
195baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
196baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  EXzState state;
197baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 pos;
198baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  unsigned alignPos;
199baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  unsigned indexPreSize;
200baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
201baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzStreamFlags streamFlags;
202baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
203baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 blockHeaderSize;
204baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 packSize;
205baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 unpackSize;
206baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
207baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 numBlocks;
208baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 indexSize;
209baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 indexPos;
210baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 padSize;
211baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
212baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 numStreams;
213baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
214baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt32 crc;
215baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMixCoder decoder;
216baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzBlock block;
217baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CXzCheck check;
218baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CSha256 sha;
219baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte shaDigest[SHA256_DIGEST_SIZE];
220baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte buf[XZ_BLOCK_HEADER_SIZE_MAX];
221baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} CXzUnpacker;
222baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
223baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes XzUnpacker_Create(CXzUnpacker *p, ISzAlloc *alloc);
224baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid XzUnpacker_Free(CXzUnpacker *p);
225baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
226baa3858d3f5d128a5c8466b700098109edcad5f2repo sync/*
227baa3858d3f5d128a5c8466b700098109edcad5f2repo syncfinishMode:
228baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  It has meaning only if the decoding reaches output limit (*destLen).
229baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  LZMA_FINISH_ANY - use smallest number of input bytes
230baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  LZMA_FINISH_END - read EndOfStream marker after decoding
231baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
232baa3858d3f5d128a5c8466b700098109edcad5f2repo syncReturns:
233baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SZ_OK
234baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    status:
235baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      LZMA_STATUS_FINISHED_WITH_MARK
236baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      LZMA_STATUS_NOT_FINISHED
237baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SZ_ERROR_DATA - Data error
238baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SZ_ERROR_MEM  - Memory allocation error
239baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SZ_ERROR_UNSUPPORTED - Unsupported properties
240baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
241baa3858d3f5d128a5c8466b700098109edcad5f2repo sync*/
242baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
243baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
244baa3858d3f5d128a5c8466b700098109edcad5f2repo syncSRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen,
245baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    const Byte *src, SizeT *srcLen, /* int srcWasFinished, */ int finishMode,
246baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    ECoderStatus *status);
247baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
248baa3858d3f5d128a5c8466b700098109edcad5f2repo syncBool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p);
249baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
250baa3858d3f5d128a5c8466b700098109edcad5f2repo syncEXTERN_C_END
251baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
252baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
253