5 LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
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 #include "LzmaTypes.h"
27 /* #define _LZMA_IN_CB */
28 /* Use callback for input data */
30 #define _LZMA_OUT_READ
31 /* Use read function for output data */
33 /* #define _LZMA_PROB32 */
34 /* It can increase speed on some 32-bit CPUs,
35 but memory usage will be doubled in that case */
37 /* #define _LZMA_LOC_OPT */
38 /* Enable local speed optimizations inside code */
47 #define LZMA_RESULT_OK 0
48 #define LZMA_RESULT_DATA_ERROR 1
51 typedef struct _ILzmaInCallback
53 int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
57 #define LZMA_BASE_SIZE 1846
58 #define LZMA_LIT_SIZE 768
60 #define LZMA_PROPERTIES_SIZE 5
62 typedef struct _CLzmaProperties
68 UInt32 DictionarySize;
72 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
74 #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
76 #define kLzmaNeedInitId (-2)
78 typedef struct _CLzmaDecoderState
80 CLzmaProperties Properties;
84 const unsigned char *Buffer;
85 const unsigned char *BufferLim;
89 unsigned char *Dictionary;
98 unsigned char TempDictionary[4];
102 #ifdef _LZMA_OUT_READ
103 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
106 int LzmaDecode(CLzmaDecoderState *vs,
108 ILzmaInCallback *inCallback,
110 const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
112 unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);