Coverage Report

Created: 2026-04-29 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Utilities/cmliblzma/liblzma/simple/simple_decoder.c
Line
Count
Source
1
// SPDX-License-Identifier: 0BSD
2
3
///////////////////////////////////////////////////////////////////////////////
4
//
5
/// \file       simple_decoder.c
6
/// \brief      Properties decoder for simple filters
7
//
8
//  Author:     Lasse Collin
9
//
10
///////////////////////////////////////////////////////////////////////////////
11
12
#include "simple_decoder.h"
13
14
15
extern lzma_ret
16
lzma_simple_props_decode(void **options, const lzma_allocator *allocator,
17
    const uint8_t *props, size_t props_size)
18
123k
{
19
123k
  if (props_size == 0)
20
121k
    return LZMA_OK;
21
22
1.56k
  if (props_size != 4)
23
4
    return LZMA_OPTIONS_ERROR;
24
25
1.56k
  lzma_options_bcj *opt = lzma_alloc(
26
1.56k
      sizeof(lzma_options_bcj), allocator);
27
1.56k
  if (opt == NULL)
28
0
    return LZMA_MEM_ERROR;
29
30
1.56k
  opt->start_offset = read32le(props);
31
32
  // Don't leave an options structure allocated if start_offset is zero.
33
1.56k
  if (opt->start_offset == 0)
34
2
    lzma_free(opt, allocator);
35
1.55k
  else
36
1.55k
    *options = opt;
37
38
1.56k
  return LZMA_OK;
39
1.56k
}