Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 1 | /* |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 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) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 11 | It means that you can select one of these two licenses and |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 12 | follow rules of that license. |
| 13 | |
| 14 | SPECIAL EXCEPTION: |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 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 |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 19 | to this file, however, are subject to the LGPL or CPL terms. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __LZMADECODE_H |
| 23 | #define __LZMADECODE_H |
| 24 | |
Arthur Heymans | 7552eb2 | 2022-11-30 23:24:31 +0100 | [diff] [blame] | 25 | #include <types.h> |
| 26 | |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 27 | typedef unsigned char Byte; |
| 28 | typedef unsigned short UInt16; |
| 29 | typedef unsigned int UInt32; |
Arthur Heymans | 7552eb2 | 2022-11-30 23:24:31 +0100 | [diff] [blame] | 30 | typedef size_t SizeT; |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 31 | |
| 32 | #define CProb UInt16 |
| 33 | |
| 34 | #define LZMA_RESULT_OK 0 |
| 35 | #define LZMA_RESULT_DATA_ERROR 1 |
| 36 | |
| 37 | |
| 38 | #define LZMA_BASE_SIZE 1846 |
| 39 | #define LZMA_LIT_SIZE 768 |
| 40 | |
| 41 | #define LZMA_PROPERTIES_SIZE 5 |
| 42 | |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 43 | typedef struct _CLzmaProperties { |
| 44 | int lc; |
| 45 | int lp; |
| 46 | int pb; |
Lee Leahy | 35af5c4 | 2017-03-09 17:35:28 -0800 | [diff] [blame] | 47 | } CLzmaProperties; |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 48 | |
Lee Leahy | 7340217 | 2017-03-10 15:23:24 -0800 | [diff] [blame] | 49 | int LzmaDecodeProperties(CLzmaProperties *propsRes, |
| 50 | const unsigned char *propsData, int size); |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 51 | |
Lee Leahy | 7340217 | 2017-03-10 15:23:24 -0800 | [diff] [blame] | 52 | #define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE \ |
| 53 | << ((Properties)->lc + (Properties)->lp))) |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 54 | |
| 55 | #define kLzmaNeedInitId (-2) |
| 56 | |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 57 | typedef struct _CLzmaDecoderState { |
| 58 | CLzmaProperties Properties; |
| 59 | CProb *Probs; |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 60 | } CLzmaDecoderState; |
| 61 | |
| 62 | |
| 63 | int LzmaDecode(CLzmaDecoderState *vs, |
Lee Leahy | e20a319 | 2017-03-09 16:21:34 -0800 | [diff] [blame] | 64 | const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, |
| 65 | unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); |
Carl-Daniel Hailfinger | cba07dd | 2006-09-14 15:12:36 +0000 | [diff] [blame] | 66 | |
| 67 | #endif |