Added lzma_easy_buffer_encode(). Splitted easy.c into small
[xz/debian.git] / src / liblzma / common / easy_buffer_encoder.c
blob4d909ee4caebf0f683c185ef5076060d5f67cfc3
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file easy_buffer_encoder.c
4 /// \brief Easy single-call .xz Stream encoder
5 //
6 // Copyright (C) 2009 Lasse Collin
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
18 ///////////////////////////////////////////////////////////////////////////////
20 #include "easy_preset.h"
23 extern LZMA_API(lzma_ret)
24 lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
25 lzma_allocator *allocator, const uint8_t *in, size_t in_size,
26 uint8_t *out, size_t *out_pos, size_t out_size)
28 lzma_options_easy opt_easy;
29 if (lzma_easy_preset(&opt_easy, preset))
30 return LZMA_OPTIONS_ERROR;
32 return lzma_stream_buffer_encode(opt_easy.filters, check,
33 allocator, in, in_size, out, out_pos, out_size);