mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
262580c92f
Enabled support for PPMD compression method
80 lines
2.2 KiB
C
80 lines
2.2 KiB
C
/* Lzma2Dec.h -- LZMA2 Decoder
|
|
2015-05-13 : Igor Pavlov : Public domain */
|
|
|
|
#ifndef __LZMA2_DEC_H
|
|
#define __LZMA2_DEC_H
|
|
|
|
#include "LzmaDec.h"
|
|
|
|
EXTERN_C_BEGIN
|
|
|
|
/* ---------- State Interface ---------- */
|
|
|
|
typedef struct
|
|
{
|
|
CLzmaDec decoder;
|
|
UInt32 packSize;
|
|
UInt32 unpackSize;
|
|
unsigned state;
|
|
Byte control;
|
|
Bool needInitDic;
|
|
Bool needInitState;
|
|
Bool needInitProp;
|
|
} CLzma2Dec;
|
|
|
|
#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder)
|
|
#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc);
|
|
#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc);
|
|
|
|
SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);
|
|
SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);
|
|
void Lzma2Dec_Init(CLzma2Dec *p);
|
|
|
|
|
|
/*
|
|
finishMode:
|
|
It has meaning only if the decoding reaches output limit (*destLen or dicLimit).
|
|
LZMA_FINISH_ANY - use smallest number of input bytes
|
|
LZMA_FINISH_END - read EndOfStream marker after decoding
|
|
|
|
Returns:
|
|
SZ_OK
|
|
status:
|
|
LZMA_STATUS_FINISHED_WITH_MARK
|
|
LZMA_STATUS_NOT_FINISHED
|
|
LZMA_STATUS_NEEDS_MORE_INPUT
|
|
SZ_ERROR_DATA - Data error
|
|
*/
|
|
|
|
SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
|
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
|
|
|
SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen,
|
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
|
|
|
|
|
/* ---------- One Call Interface ---------- */
|
|
|
|
/*
|
|
finishMode:
|
|
It has meaning only if the decoding reaches output limit (*destLen).
|
|
LZMA_FINISH_ANY - use smallest number of input bytes
|
|
LZMA_FINISH_END - read EndOfStream marker after decoding
|
|
|
|
Returns:
|
|
SZ_OK
|
|
status:
|
|
LZMA_STATUS_FINISHED_WITH_MARK
|
|
LZMA_STATUS_NOT_FINISHED
|
|
SZ_ERROR_DATA - Data error
|
|
SZ_ERROR_MEM - Memory allocation error
|
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
|
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
|
*/
|
|
|
|
SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
|
Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc);
|
|
|
|
EXTERN_C_END
|
|
|
|
#endif
|