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