GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / tools / misc / xz / src / liblzma / common / filter_flags_decoder.c
blobcaae10ce79a00f6d74167ae73195beeb8b996f5c
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file filter_flags_decoder.c
4 /// \brief Decodes a Filter Flags field
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
11 ///////////////////////////////////////////////////////////////////////////////
13 #include "filter_decoder.h"
16 extern LZMA_API(lzma_ret)
17 lzma_filter_flags_decode(
18 lzma_filter *filter, lzma_allocator *allocator,
19 const uint8_t *in, size_t *in_pos, size_t in_size)
21 // Set the pointer to NULL so the caller can always safely free it.
22 filter->options = NULL;
24 // Filter ID
25 return_if_error(lzma_vli_decode(&filter->id, NULL,
26 in, in_pos, in_size));
28 if (filter->id >= LZMA_FILTER_RESERVED_START)
29 return LZMA_DATA_ERROR;
31 // Size of Properties
32 lzma_vli props_size;
33 return_if_error(lzma_vli_decode(&props_size, NULL,
34 in, in_pos, in_size));
36 // Filter Properties
37 if (in_size - *in_pos < props_size)
38 return LZMA_DATA_ERROR;
40 const lzma_ret ret = lzma_properties_decode(
41 filter, allocator, in + *in_pos, props_size);
43 *in_pos += props_size;
45 return ret;