minlzma.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #if defined (__cplusplus)
  5. extern "C" {
  6. #endif
  7. /*!
  8. * @brief Decompresses an XZ stream from InputBuffer into OutputBuffer.
  9. *
  10. * @detail The XZ stream must contain a single block with an LZMA2 filter
  11. * and no BJC2 filters, using default LZMA properties, and using
  12. * either CRC32 or None as the checksum type.
  13. *
  14. * @param[in] InputBuffer - A fully formed buffer containing the XZ stream.
  15. * @param[in] InputSize - The size of the input buffer.
  16. * @param[in] OutputBuffer - A fully allocated buffer to receive the output.
  17. * Callers can pass in NULL if they do not intend to decompress,
  18. * in combination with setting OutputSize to 0, in order to query
  19. * the final expected size of the decompressed buffer.
  20. * @param[in,out] OutputSize - On input, the size of the buffer. On output, the
  21. * size of the decompressed result.
  22. *
  23. * @return true - The input buffer was fully decompressed in OutputBuffer,
  24. * or no decompression was requested, the size of the decompressed
  25. * buffer was returned in OutputSize.
  26. * false - A failure occurred during the decompression process.
  27. */
  28. bool
  29. XzDecode (
  30. const uint8_t* InputBuffer,
  31. uint32_t InputSize,
  32. uint8_t* OutputBuffer,
  33. uint32_t* OutputSize
  34. );
  35. /*!
  36. * @brief Returns if the last call to XzDecode resulted in an integrity
  37. * error.
  38. *
  39. * @detail Checksum errors can indicate either the uncompressed block's
  40. * CRC-32 or CRC-64 checksum being corrupt, or any of the meta-
  41. * data CRC-32 checksums in the header, footer, or index.
  42. *
  43. * @return true - A checksum error was encountered at some point.
  44. * false - No error was encountered or integrity checks are not
  45. * enabled.
  46. */
  47. bool
  48. XzChecksumError (
  49. void
  50. );
  51. #if defined (__cplusplus)
  52. }
  53. #endif