Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
Lzma2Dec.h
Go to the documentation of this file.
1/* Lzma2Dec.h -- LZMA2 Decoder
22023-03-03 : Igor Pavlov : Public domain */
3
4#ifndef ZIP7_INC_LZMA2_DEC_H
5#define ZIP7_INC_LZMA2_DEC_H
6
7#include "LzmaDec.h"
8
10
11/* ---------- State Interface ---------- */
12
13typedef struct
14{
15 unsigned state;
16 Byte control;
17 Byte needInitLevel;
18 Byte isExtraMode;
19 Byte _pad_;
20 UInt32 packSize;
21 UInt32 unpackSize;
22 CLzmaDec decoder;
23} CLzma2Dec;
24
25#define Lzma2Dec_CONSTRUCT(p) LzmaDec_CONSTRUCT(&(p)->decoder)
26#define Lzma2Dec_Construct(p) Lzma2Dec_CONSTRUCT(p)
27#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc)
28#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc)
29
33
34/*
35finishMode:
36 It has meaning only if the decoding reaches output limit (*destLen or dicLimit).
37 LZMA_FINISH_ANY - use smallest number of input bytes
38 LZMA_FINISH_END - read EndOfStream marker after decoding
39
40Returns:
41 SZ_OK
42 status:
43 LZMA_STATUS_FINISHED_WITH_MARK
44 LZMA_STATUS_NOT_FINISHED
45 LZMA_STATUS_NEEDS_MORE_INPUT
46 SZ_ERROR_DATA - Data error
47*/
48
50 const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
51
53 const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
54
55
56/* ---------- LZMA2 block and chunk parsing ---------- */
57
58/*
59Lzma2Dec_Parse() parses compressed data stream up to next independent block or next chunk data.
60It can return LZMA_STATUS_* code or LZMA2_PARSE_STATUS_* code:
61 - LZMA2_PARSE_STATUS_NEW_BLOCK - there is new block, and 1 additional byte (control byte of next block header) was read from input.
62 - LZMA2_PARSE_STATUS_NEW_CHUNK - there is new chunk, and only lzma2 header of new chunk was read.
63 CLzma2Dec::unpackSize contains unpack size of that chunk
64*/
65
66typedef enum
67{
68/*
69 LZMA_STATUS_NOT_SPECIFIED // data error
70 LZMA_STATUS_FINISHED_WITH_MARK
71 LZMA_STATUS_NOT_FINISHED //
72 LZMA_STATUS_NEEDS_MORE_INPUT
73 LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK // unused
74*/
78
80 SizeT outSize, // output size
81 const Byte *src, SizeT *srcLen,
82 int checkFinishBlock // set (checkFinishBlock = 1), if it must read full input data, if decoder.dicPos reaches blockMax position.
83 );
84
85/*
86LZMA2 parser doesn't decode LZMA chunks, so we must read
87 full input LZMA chunk to decode some part of LZMA chunk.
88
89Lzma2Dec_GetUnpackExtra() returns the value that shows
90 max possible number of output bytes that can be output by decoder
91 at current input positon.
92*/
93
94#define Lzma2Dec_GetUnpackExtra(p) ((p)->isExtraMode ? (p)->unpackSize : 0)
95
96
97/* ---------- One Call Interface ---------- */
98
99/*
100finishMode:
101 It has meaning only if the decoding reaches output limit (*destLen).
102 LZMA_FINISH_ANY - use smallest number of input bytes
103 LZMA_FINISH_END - read EndOfStream marker after decoding
104
105Returns:
106 SZ_OK
107 status:
108 LZMA_STATUS_FINISHED_WITH_MARK
109 LZMA_STATUS_NOT_FINISHED
110 SZ_ERROR_DATA - Data error
111 SZ_ERROR_MEM - Memory allocation error
112 SZ_ERROR_UNSUPPORTED - Unsupported properties
113 SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
114*/
115
116SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
117 Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAllocPtr alloc);
118
120
121#endif
size_t SizeT
Definition 7zTypes.h:247
#define EXTERN_C_BEGIN
Definition 7zTypes.h:20
int SRes
Definition 7zTypes.h:45
#define EXTERN_C_END
Definition 7zTypes.h:21
SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
Definition Lzma2Dec.c:71
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
Definition Lzma2Dec.c:430
void Lzma2Dec_Init(CLzma2Dec *p)
Definition Lzma2Dec.c:85
SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
Definition Lzma2Dec.c:178
ELzma2ParseStatus Lzma2Dec_Parse(CLzma2Dec *p, SizeT outSize, const Byte *src, SizeT *srcLen, int checkFinishBlock)
Definition Lzma2Dec.c:309
SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
Definition Lzma2Dec.c:78
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAllocPtr alloc)
Definition Lzma2Dec.c:471
ELzma2ParseStatus
Definition Lzma2Dec.h:67
@ LZMA2_PARSE_STATUS_NEW_CHUNK
Definition Lzma2Dec.h:76
@ LZMA2_PARSE_STATUS_NEW_BLOCK
Definition Lzma2Dec.h:75
ELzmaFinishMode
Definition LzmaDec.h:86
ELzmaStatus
Definition LzmaDec.h:107
@ LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
Definition LzmaDec.h:112
const char * src
Definition lz4.h:866
char * dest
Definition lz4.h:806
Definition Lzma2Dec.h:14
Definition LzmaDec.h:54
Definition 7zTypes.h:460
unsigned int UInt32
Definition bzlib_private.h:45
unsigned char Byte
Definition zconf.h:391