easy_buffer_encoder.c 771 B

1234567891011121314151617181920212223242526
  1. // SPDX-License-Identifier: 0BSD
  2. ///////////////////////////////////////////////////////////////////////////////
  3. //
  4. /// \file easy_buffer_encoder.c
  5. /// \brief Easy single-call .xz Stream encoder
  6. //
  7. // Author: Lasse Collin
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #include "easy_preset.h"
  11. extern LZMA_API(lzma_ret)
  12. lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
  13. const lzma_allocator *allocator, const uint8_t *in,
  14. size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
  15. {
  16. lzma_options_easy opt_easy;
  17. if (lzma_easy_preset(&opt_easy, preset))
  18. return LZMA_OPTIONS_ERROR;
  19. return lzma_stream_buffer_encode(opt_easy.filters, check,
  20. allocator, in, in_size, out, out_pos, out_size);
  21. }