Path: blob/master/Utilities/cmliblzma/liblzma/simple/simple_decoder.c
3156 views
// SPDX-License-Identifier: 0BSD12///////////////////////////////////////////////////////////////////////////////3//4/// \file simple_decoder.c5/// \brief Properties decoder for simple filters6//7// Author: Lasse Collin8//9///////////////////////////////////////////////////////////////////////////////1011#include "simple_decoder.h"121314extern lzma_ret15lzma_simple_props_decode(void **options, const lzma_allocator *allocator,16const uint8_t *props, size_t props_size)17{18if (props_size == 0)19return LZMA_OK;2021if (props_size != 4)22return LZMA_OPTIONS_ERROR;2324lzma_options_bcj *opt = lzma_alloc(25sizeof(lzma_options_bcj), allocator);26if (opt == NULL)27return LZMA_MEM_ERROR;2829opt->start_offset = read32le(props);3031// Don't leave an options structure allocated if start_offset is zero.32if (opt->start_offset == 0)33lzma_free(opt, allocator);34else35*options = opt;3637return LZMA_OK;38}394041