xref: /dflybsd-src/contrib/xz/src/liblzma/common/easy_buffer_encoder.c (revision 4381ed9d7ee193d719c4e4a94a9d267d177981c1)
12940b44dSPeter Avalos ///////////////////////////////////////////////////////////////////////////////
22940b44dSPeter Avalos //
32940b44dSPeter Avalos /// \file       easy_buffer_encoder.c
42940b44dSPeter Avalos /// \brief      Easy single-call .xz Stream encoder
52940b44dSPeter Avalos //
62940b44dSPeter Avalos //  Author:     Lasse Collin
72940b44dSPeter Avalos //
82940b44dSPeter Avalos //  This file has been put into the public domain.
92940b44dSPeter Avalos //  You can do whatever you want with this file.
102940b44dSPeter Avalos //
112940b44dSPeter Avalos ///////////////////////////////////////////////////////////////////////////////
122940b44dSPeter Avalos 
132940b44dSPeter Avalos #include "easy_preset.h"
142940b44dSPeter Avalos 
152940b44dSPeter Avalos 
162940b44dSPeter Avalos extern LZMA_API(lzma_ret)
lzma_easy_buffer_encode(uint32_t preset,lzma_check check,const lzma_allocator * allocator,const uint8_t * in,size_t in_size,uint8_t * out,size_t * out_pos,size_t out_size)172940b44dSPeter Avalos lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
18*15ab8c86SJohn Marino 		const lzma_allocator *allocator, const uint8_t *in,
19*15ab8c86SJohn Marino 		size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
202940b44dSPeter Avalos {
212940b44dSPeter Avalos 	lzma_options_easy opt_easy;
222940b44dSPeter Avalos 	if (lzma_easy_preset(&opt_easy, preset))
232940b44dSPeter Avalos 		return LZMA_OPTIONS_ERROR;
242940b44dSPeter Avalos 
252940b44dSPeter Avalos 	return lzma_stream_buffer_encode(opt_easy.filters, check,
262940b44dSPeter Avalos 			allocator, in, in_size, out, out_pos, out_size);
272940b44dSPeter Avalos }
28