Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.1 KiB

  1. /* Lzma2Dec.h -- LZMA2 Decoder
  2. 2013-01-18 : Igor Pavlov : Public domain */
  3. #ifndef __LZMA2_DEC_H
  4. #define __LZMA2_DEC_H
  5. #include "LzmaDec.h"
  6. EXTERN_C_BEGIN
  7. /* ---------- State Interface ---------- */
  8. typedef struct
  9. {
  10. CLzmaDec decoder;
  11. UInt32 packSize;
  12. UInt32 unpackSize;
  13. int state;
  14. Byte control;
  15. Bool needInitDic;
  16. Bool needInitState;
  17. Bool needInitProp;
  18. } CLzma2Dec;
  19. #define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder)
  20. #define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc);
  21. #define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc);
  22. SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);
  23. SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAlloc *alloc);
  24. void Lzma2Dec_Init(CLzma2Dec *p);
  25. /*
  26. finishMode:
  27. It has meaning only if the decoding reaches output limit (*destLen or dicLimit).
  28. LZMA_FINISH_ANY - use smallest number of input bytes
  29. LZMA_FINISH_END - read EndOfStream marker after decoding
  30. Returns:
  31. SZ_OK
  32. status:
  33. LZMA_STATUS_FINISHED_WITH_MARK
  34. LZMA_STATUS_NOT_FINISHED
  35. LZMA_STATUS_NEEDS_MORE_INPUT
  36. SZ_ERROR_DATA - Data error
  37. */
  38. SRes Lzma2Dec_DecodeToDic(CLzma2Dec *p, SizeT dicLimit,
  39. const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
  40. SRes Lzma2Dec_DecodeToBuf(CLzma2Dec *p, Byte *dest, SizeT *destLen,
  41. const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
  42. /* ---------- One Call Interface ---------- */
  43. /*
  44. finishMode:
  45. It has meaning only if the decoding reaches output limit (*destLen).
  46. LZMA_FINISH_ANY - use smallest number of input bytes
  47. LZMA_FINISH_END - read EndOfStream marker after decoding
  48. Returns:
  49. SZ_OK
  50. status:
  51. LZMA_STATUS_FINISHED_WITH_MARK
  52. LZMA_STATUS_NOT_FINISHED
  53. SZ_ERROR_DATA - Data error
  54. SZ_ERROR_MEM - Memory allocation error
  55. SZ_ERROR_UNSUPPORTED - Unsupported properties
  56. SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
  57. */
  58. SRes Lzma2Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
  59. Byte prop, ELzmaFinishMode finishMode, ELzmaStatus *status, ISzAlloc *alloc);
  60. EXTERN_C_END
  61. #endif