Coverage Report

Created: 2026-09-01 06:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/brunsli/c/dec/state.cc
Line
Count
Source
1
// Copyright (c) Google LLC 2020
2
//
3
// Use of this source code is governed by an MIT-style
4
// license that can be found in the LICENSE file or at
5
// https://opensource.org/licenses/MIT.
6
7
#include "./state.h"
8
9
#include <brotli/decode.h>
10
#include <brunsli/brunsli_decode.h>
11
#include <brunsli/types.h>
12
13
#include "./state_internal.h"
14
15
namespace brunsli {
16
namespace internal {
17
namespace dec {
18
19
37.6k
State::State() : internal(new InternalState()) {}
20
21
0
State::State(State&&) = default;
22
23
37.6k
State::~State() {}
24
25
16.3k
void State::ApplyOptions(const BrunsliDecodeOptions& options) {
26
16.3k
  internal->metadata.metadata_size_limit =
27
16.3k
      options.max_uncompressed_metadata_size;
28
16.3k
}
29
30
37.6k
MetadataState::~MetadataState() {
31
37.6k
  if (brotli != nullptr) {
32
3.59k
    BrotliDecoderDestroyInstance(brotli);
33
3.59k
    brotli = nullptr;
34
3.59k
  }
35
37.6k
}
36
37
504k
bool HasSection(const State* state, uint32_t tag) {
38
504k
  return state->internal->section.tags_met & (1u << tag);
39
504k
}
40
41
}  // namespace dec
42
}  // namespace internal
43
}  // namespace brunsli