LzmaDecodeInno.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. LzmaDecodeInno.c = LzmaDecodeSize.c + additional helper functions used by
  3. Inno Setup's Compression.LZMA1SmallDecompressor.pas
  4. */
  5. #include "LzmaDecodeSize.c"
  6. int LzmaMyDecodeProperties(CLzmaDecoderState *vs, int vsSize,
  7. const unsigned char *propsData, int propsDataSize, UInt32 *outProbsSize,
  8. UInt32 *outDictionarySize)
  9. {
  10. int retval;
  11. /*
  12. First verify that the state structure passed by the caller is the
  13. correct size.
  14. */
  15. if (sizeof(*vs) != vsSize)
  16. return LZMA_RESULT_DATA_ERROR; /* for lack of a better error code */
  17. retval = LzmaDecodeProperties(&vs->Properties, propsData, propsDataSize);
  18. if (retval == LZMA_RESULT_OK)
  19. {
  20. *outProbsSize = LzmaGetNumProbs(&vs->Properties) * sizeof(CProb);
  21. *outDictionarySize = vs->Properties.DictionarySize;
  22. }
  23. return retval;
  24. }
  25. void LzmaMyDecoderInit(CLzmaDecoderState *vs, void *probsPtr,
  26. void *dictionaryPtr)
  27. {
  28. vs->Probs = (CProb*)probsPtr;
  29. vs->Dictionary = (unsigned char*)dictionaryPtr;
  30. LzmaDecoderInit(vs);
  31. }