132
int cli_LzmaInitUPX(CLI_LZMA **Lp, uint32_t dictsz) {
136
*Lp = L = cli_calloc(sizeof(*L), 1);
138
return LZMA_RESULT_DATA_ERROR;
142
L->state.Properties.pb = 2; /* FIXME: these */
143
L->state.Properties.lp = 0; /* values may */
144
L->state.Properties.lc = 3; /* not be static */
146
L->state.Properties.DictionarySize = dictsz;
148
if (!(L->state.Probs = (CProb *)cli_malloc(LzmaGetNumProbs(&L->state.Properties) * sizeof(CProb))))
149
return LZMA_RESULT_DATA_ERROR;
151
if (!(L->state.Dictionary = (unsigned char *)cli_malloc(L->state.Properties.DictionarySize))) {
152
free(L->state.Probs);
153
return LZMA_RESULT_DATA_ERROR;
158
LzmaDecoderInit(&L->state);
159
return LZMA_RESULT_OK;