-
-
Notifications
You must be signed in to change notification settings - Fork 951
/
Copy pathISLzmaDec.c
58 lines (44 loc) · 1.38 KB
/
ISLzmaDec.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
/*
ISLzmaDec.c, by Jordan Russell for Inno Setup
This file is public domain (like the LZMA SDK)
LzmaDec.c + Lzma2Dec.c + additional helper functions used by Compression.LZMADecompressor.pas
*/
#include "../../../../Components/Lzma2/LzmaDec.c"
#include "../../../../Components/Lzma2/Lzma2Dec.c"
SRes IS_LzmaDec_Init(CLzmaDec *state, size_t stateSize, const Byte *props,
unsigned propsSize, ISzAlloc *alloc)
{
if (stateSize != sizeof(*state)) {
return SZ_ERROR_PARAM;
}
// Not needed; just sets fields to 0, which will leak memory if Init was already called previously
//LzmaDec_Construct(state);
RINOK(LzmaDec_Allocate(state, props, propsSize, alloc));
LzmaDec_Init(state);
return SZ_OK;
}
size_t IS_LzmaDec_StateSize()
{
return sizeof(CLzmaDec);
}
SRes IS_Lzma2Dec_Init(CLzma2Dec *state, size_t stateSize, Byte prop,
ISzAlloc *alloc)
{
if (stateSize != sizeof(*state)) {
return SZ_ERROR_PARAM;
}
// Not needed; just sets fields to 0, which will leak memory if Init was already called previously
//Lzma2Dec_Construct(state);
RINOK(Lzma2Dec_Allocate(state, prop, alloc));
Lzma2Dec_Init(state);
return SZ_OK;
}
size_t IS_Lzma2Dec_StateSize()
{
return sizeof(CLzma2Dec);
}
void IS_Lzma2Dec_Free(CLzma2Dec *state, ISzAlloc *alloc)
{
// This exists because Lzma2Dec_Free is a macro
Lzma2Dec_Free(state, alloc);
}