3 LZMA Decoder interface
\r
5 LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
\r
6 http://www.7-zip.org/
\r
8 LZMA SDK is licensed under two licenses:
\r
9 1) GNU Lesser General Public License (GNU LGPL)
\r
10 2) Common Public License (CPL)
\r
11 It means that you can select one of these two licenses and
\r
12 follow rules of that license.
\r
15 Igor Pavlov, as the author of this code, expressly permits you to
\r
16 statically or dynamically link your code (or bind by name) to the
\r
17 interfaces of this file without subjecting your linked code to the
\r
18 terms of the CPL or GNU LGPL. Any modifications or additions
\r
19 to this file, however, are subject to the LGPL or CPL terms.
\r
22 #ifndef __LZMADECODE_H
\r
23 #define __LZMADECODE_H
\r
25 /* #define _LZMA_IN_CB */
\r
26 /* Use callback for input data */
\r
28 /* #define _LZMA_OUT_READ */
\r
29 /* Use read function for output data */
\r
31 /* #define _LZMA_PROB32 */
\r
32 /* It can increase speed on some 32-bit CPUs,
\r
33 but memory usage will be doubled in that case */
\r
35 /* #define _LZMA_LOC_OPT */
\r
36 /* Enable local speed optimizations inside code */
\r
38 /* #define _LZMA_SYSTEM_SIZE_T */
\r
39 /* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
\r
42 #ifdef _LZMA_UINT32_IS_ULONG
\r
43 #define UInt32 unsigned long
\r
45 #define UInt32 unsigned int
\r
50 #ifdef _LZMA_SYSTEM_SIZE_T
\r
52 #define SizeT size_t
\r
54 #define SizeT UInt32
\r
59 #define CProb UInt32
\r
61 #define CProb unsigned short
\r
64 #define LZMA_RESULT_OK 0
\r
65 #define LZMA_RESULT_DATA_ERROR 1
\r
68 typedef struct _ILzmaInCallback
\r
70 int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
\r
74 #define LZMA_BASE_SIZE 1846
\r
75 #define LZMA_LIT_SIZE 768
\r
77 #define LZMA_PROPERTIES_SIZE 5
\r
79 typedef struct _CLzmaProperties
\r
84 #ifdef _LZMA_OUT_READ
\r
85 UInt32 DictionarySize;
\r
89 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
\r
91 #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
\r
93 #define kLzmaNeedInitId (-2)
\r
95 typedef struct _CLzmaDecoderState
\r
97 CLzmaProperties Properties;
\r
101 const unsigned char *Buffer;
\r
102 const unsigned char *BufferLim;
\r
105 #ifdef _LZMA_OUT_READ
\r
106 unsigned char *Dictionary;
\r
109 UInt32 DictionaryPos;
\r
111 UInt32 DistanceLimit;
\r
115 unsigned char TempDictionary[4];
\r
117 } CLzmaDecoderState;
\r
119 #ifdef _LZMA_OUT_READ
\r
120 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
\r
123 int LzmaDecode(CLzmaDecoderState *vs,
\r
125 ILzmaInCallback *inCallback,
\r
127 const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
\r
129 unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
\r