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 */
46 #define LZMA_RESULT_OK 0
47 #define LZMA_RESULT_DATA_ERROR 1
50 typedef struct _ILzmaInCallback
52 int (*Read
)(void *object
, const unsigned char **buffer
, SizeT
*bufferSize
);
56 #define LZMA_BASE_SIZE 1846
57 #define LZMA_LIT_SIZE 768
59 #define LZMA_PROPERTIES_SIZE 5
61 typedef struct _CLzmaProperties
67 UInt32 DictionarySize
;
71 int LzmaDecodeProperties(CLzmaProperties
*propsRes
, const unsigned char *propsData
, int size
);
73 #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
75 #define kLzmaNeedInitId (-2)
77 typedef struct _CLzmaDecoderState
79 CLzmaProperties Properties
;
83 const unsigned char *Buffer
;
84 const unsigned char *BufferLim
;
88 unsigned char *Dictionary
;
97 unsigned char TempDictionary
[4];
101 #ifdef _LZMA_OUT_READ
102 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
105 int LzmaDecode(CLzmaDecoderState
*vs
,
107 ILzmaInCallback
*inCallback
,
109 const unsigned char *inStream
, SizeT inSize
, SizeT
*inSizeProcessed
,
111 unsigned char *outStream
, SizeT outSize
, SizeT
*outSizeProcessed
);