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