]> icculus.org git repositories - icculus/xz.git/blob - src/liblzma/common/easy_buffer_encoder.c
Added lzma_easy_buffer_encode(). Splitted easy.c into small
[icculus/xz.git] / src / liblzma / common / easy_buffer_encoder.c
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.
12 //
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.
17 //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #include "easy_preset.h"
21
22
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)
27 {
28         lzma_options_easy opt_easy;
29         if (lzma_easy_preset(&opt_easy, preset))
30                 return LZMA_OPTIONS_ERROR;
31
32         return lzma_stream_buffer_encode(opt_easy.filters, check,
33                         allocator, in, in_size, out, out_pos, out_size);
34 }