Debian Codegraph @

Utilities/cmliblzma/liblzma/simple/simple_encoder.c

raw symbols SCIP
1 // SPDX-License-Identifier: 0BSD
2
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 /// \file simple_encoder.c
6 /// \brief Properties encoder for simple filters
7 //
8 // Author: Lasse Collin
9 //
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include "simple_encoder.h"
13
14
15 extern lzma_ret
16 lzma_simple_props_size(uint32_t *size, const void *options)
17 {
18 const lzma_options_bcj *const opt = options;
19 *size = (opt == NULL || opt->start_offset == 0) ? 0 : 4;
20 return LZMA_OK;
21 }
22
23
24 extern lzma_ret
25 lzma_simple_props_encode(const void *options, uint8_t *out)
26 {
27 const lzma_options_bcj *const opt = options;
28
29 // The default start offset is zero, so we don't need to store any
30 // options unless the start offset is non-zero.
31 if (opt == NULL || opt->start_offset == 0)
32 return LZMA_OK;
33
34 write32le(out, opt->start_offset);
35
36 return LZMA_OK;
37 }