| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 LzmaDecode.h | |
| 3 LZMA Decoder interface | |
| 4 | |
| 5 LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) | |
| 6 http://www.7-zip.org/ | |
| 7 | |
| 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. | |
| 13 | |
| 14 SPECIAL EXCEPTION: | |
| 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. | |
| 20 */ | |
| 21 | |
| 22 #ifndef __LZMADECODE_H | |
| 23 #define __LZMADECODE_H | |
| 24 | |
| 25 #include "LzmaTypes.h" | |
| 26 | |
| 27 /* #define _LZMA_IN_CB */ | |
| 28 /* Use callback for input data */ | |
| 29 | |
| 30 /* #define _LZMA_OUT_READ */ | |
| 31 /* Use read function for output data */ | |
| 32 | |
| 33 /* #define _LZMA_PROB32 */ | |
| 34 /* It can increase speed on some 32-bit CPUs, | |
| 35 but memory usage will be doubled in that case */ | |
| 36 | |
| 37 /* #define _LZMA_LOC_OPT */ | |
| 38 /* Enable local speed optimizations inside code */ | |
| 39 | |
| 40 #ifdef _LZMA_PROB32 | |
| 41 #define CProb UInt32 | |
| 42 #else | |
| 43 #define CProb UInt16 | |
| 44 #endif | |
| 45 | |
| 46 #define LZMA_RESULT_OK 0 | |
| 47 #define LZMA_RESULT_DATA_ERROR 1 | |
| 48 | |
| 49 #ifdef _LZMA_IN_CB | |
| 50 typedef struct _ILzmaInCallback | |
| 51 { | |
| 52 int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); | |
| 53 } ILzmaInCallback; | |
| 54 #endif | |
| 55 | |
| 56 #define LZMA_BASE_SIZE 1846 | |
| 57 #define LZMA_LIT_SIZE 768 | |
| 58 | |
| 59 #define LZMA_PROPERTIES_SIZE 5 | |
| 60 | |
| 61 typedef struct _CLzmaProperties | |
| 62 { | |
| 63 int lc; | |
| 64 int lp; | |
| 65 int pb; | |
| 66 #ifdef _LZMA_OUT_READ | |
| 67 UInt32 DictionarySize; | |
| 68 #endif | |
| 69 }CLzmaProperties; | |
| 70 | |
| 71 int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsDa
ta, int size); | |
| 72 | |
| 73 #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Proper
ties)->lc + (Properties)->lp))) | |
| 74 | |
| 75 #define kLzmaNeedInitId (-2) | |
| 76 | |
| 77 typedef struct _CLzmaDecoderState | |
| 78 { | |
| 79 CLzmaProperties Properties; | |
| 80 CProb *Probs; | |
| 81 | |
| 82 #ifdef _LZMA_IN_CB | |
| 83 const unsigned char *Buffer; | |
| 84 const unsigned char *BufferLim; | |
| 85 #endif | |
| 86 | |
| 87 #ifdef _LZMA_OUT_READ | |
| 88 unsigned char *Dictionary; | |
| 89 UInt32 Range; | |
| 90 UInt32 Code; | |
| 91 UInt32 DictionaryPos; | |
| 92 UInt32 GlobalPos; | |
| 93 UInt32 DistanceLimit; | |
| 94 UInt32 Reps[4]; | |
| 95 int State; | |
| 96 int RemainLen; | |
| 97 unsigned char TempDictionary[4]; | |
| 98 #endif | |
| 99 } CLzmaDecoderState; | |
| 100 | |
| 101 #ifdef _LZMA_OUT_READ | |
| 102 #define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } | |
| 103 #endif | |
| 104 | |
| 105 int LzmaDecode(CLzmaDecoderState *vs, | |
| 106 #ifdef _LZMA_IN_CB | |
| 107 ILzmaInCallback *inCallback, | |
| 108 #else | |
| 109 const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, | |
| 110 #endif | |
| 111 unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); | |
| 112 | |
| 113 #endif | |
| OLD | NEW |