-
-
Notifications
You must be signed in to change notification settings - Fork 940
/
Copy pathLzmaDecodeInno.c
36 lines (31 loc) · 1.02 KB
/
LzmaDecodeInno.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
/*
LzmaDecodeInno.c = LzmaDecodeSize.c + additional helper functions used by
Inno Setup's Compression.LZMA1SmallDecompressor.pas
*/
#include "LzmaDecodeSize.c"
int LzmaMyDecodeProperties(CLzmaDecoderState *vs, int vsSize,
const unsigned char *propsData, int propsDataSize, UInt32 *outProbsSize,
UInt32 *outDictionarySize)
{
int retval;
/*
First verify that the state structure passed by the caller is the
correct size.
*/
if (sizeof(*vs) != vsSize)
return LZMA_RESULT_DATA_ERROR; /* for lack of a better error code */
retval = LzmaDecodeProperties(&vs->Properties, propsData, propsDataSize);
if (retval == LZMA_RESULT_OK)
{
*outProbsSize = LzmaGetNumProbs(&vs->Properties) * sizeof(CProb);
*outDictionarySize = vs->Properties.DictionarySize;
}
return retval;
}
void LzmaMyDecoderInit(CLzmaDecoderState *vs, void *probsPtr,
void *dictionaryPtr)
{
vs->Probs = (CProb*)probsPtr;
vs->Dictionary = (unsigned char*)dictionaryPtr;
LzmaDecoderInit(vs);
}