-
Notifications
You must be signed in to change notification settings - Fork 5
/
lzma_d_c.c
117 lines (99 loc) · 3.1 KB
/
lzma_d_c.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* lzma_d.c --
This file is part of the UPX executable compressor.
Copyright (C) 2006-2017 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
*/
/*************************************************************************
//
**************************************************************************/
#define ACC_LIBC_NAKED 1
/*#define ACC_OS_FREESTANDING 1*/
#include "miniacc.h"
#define UPX_LZMA_COMPAT 1
#define UPX_STUB_XOR_VARIANT
#if 0
#undef _LZMA_IN_CB
#undef _LZMA_OUT_READ
#undef _LZMA_PROB32
#undef _LZMA_LOC_OPT
#endif
#if (ACC_ARCH_I086)
# define Byte unsigned char
# define _7ZIP_BYTE_DEFINED 1
#endif
#if !defined(_LZMA_UINT32_IS_ULONG)
# if defined(__INT_MAX__) && ((__INT_MAX__)+0 == 32767)
# define _LZMA_UINT32_IS_ULONG 1
# endif
#endif
#if !defined(_LZMA_NO_SYSTEM_SIZE_T)
# define _LZMA_NO_SYSTEM_SIZE_T 1
#endif
#if 0
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
#if (ACC_ABI_LP64)
#else
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 16)
#endif
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
#else
#define CLzmaDecoderState CLzmaDecoderState_dummy
#define LzmaDecodeProperties LzmaDecodeProperties_dummy
#define LzmaDecode LzmaDecode_dummy
#if (ACC_CC_BORLANDC)
#include "LzmaDecode.h"
#else
#if (WITH_LZMA >= 0x449)
# include "C/Compress/Lzma/LzmaDecode.h"
#else
# include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
#endif
#endif
#undef CLzmaDecoderState
#undef LzmaDecodeProperties
#undef LzmaDecode
typedef struct {
struct { unsigned char lc, lp, pb, dummy; } Properties;
#ifdef _LZMA_PROB32
CProb Probs[8191];
#else
CProb Probs[16382];
#endif
} CLzmaDecoderState;
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 32768u)
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(SizeT) >= 4)
#if (ACC_ARCH_I086)
# define char char __huge
#elif (ACC_CC_WATCOMC)
#else
#define CLzmaDecoderState const CLzmaDecoderState
#endif
int LzmaDecodeProperties(CLzmaProperties *, const unsigned char *, int);
int LzmaDecode(CLzmaDecoderState *, const unsigned char *, SizeT, SizeT *, unsigned char *, SizeT, SizeT *);
#if (ACC_CC_BORLANDC)
#include "LzmaDecode.c"
#else
#if (WITH_LZMA >= 0x449)
# include "C/Compress/Lzma/LzmaDecode.c"
#else
# include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
#endif
#endif
#undef char
#undef CLzmaDecoderState
#endif
/* vim:set ts=4 sw=4 et: */