Coverage Report

Created: 2026-09-28 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libheif/libheif/error.h
Line
Count
Source
1
/*
2
 * HEIF codec.
3
 * Copyright (c) 2017 Dirk Farin <dirk.farin@gmail.com>
4
 *
5
 * This file is part of libheif.
6
 *
7
 * libheif is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU Lesser General Public License as
9
 * published by the Free Software Foundation, either version 3 of
10
 * the License, or (at your option) any later version.
11
 *
12
 * libheif is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public License
18
 * along with libheif.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef LIBHEIF_ERROR_H
22
#define LIBHEIF_ERROR_H
23
24
#include <cinttypes>
25
#include <cstddef>
26
27
#include <vector>
28
#include <string>
29
#include <memory>
30
#include <limits>
31
#include <istream>
32
#include <ostream>
33
#include <sstream>
34
35
#include "libheif/heif.h"
36
#include <cassert>
37
#include <variant>
38
#include <utility>
39
40
41
extern const heif_error heif_error_null_pointer_argument;
42
43
// Predefined errors with string-literal messages (static storage, no allocation).
44
// Safe to return from a std::bad_alloc handler, where the allocator must not be used.
45
extern const heif_error heif_error_out_of_memory;
46
extern const heif_error heif_error_internal_exception;
47
48
49
class ErrorBuffer
50
{
51
public:
52
40.8k
  ErrorBuffer() = default;
53
54
  void set_success()
55
16.5k
  {
56
16.5k
    m_error_message = c_success;
57
16.5k
  }
58
59
  void set_error(const std::string& err)
60
18.5k
  {
61
18.5k
    m_buffer = err;
62
18.5k
    m_error_message = m_buffer.c_str();
63
18.5k
  }
64
65
  const char* get_error() const
66
35.0k
  {
67
35.0k
    return m_error_message;
68
35.0k
  }
69
70
private:
71
  constexpr static const char* c_success = "Success";
72
  std::string m_buffer;
73
  const char* m_error_message = c_success;
74
};
75
76
77
// The clang static analyzer reports a garbage value assigned in the implicit copy constructor
78
// when an Error is copied out of the std::variant inside Result<T>. All members have default
79
// initializers, so this is a false positive of its variant modeling.
80
class Error // NOLINT(clang-analyzer-core.uninitialized.Assign)
81
{
82
public:
83
  heif_error_code error_code = heif_error_Ok;
84
  heif_suberror_code sub_error_code = heif_suberror_Unspecified;
85
  std::string message;
86
87
  Error();
88
89
  Error(heif_error_code c,
90
        heif_suberror_code sc = heif_suberror_Unspecified,
91
        const std::string& msg = "");
92
93
  static Error from_heif_error(const heif_error&);
94
95
  static const Error Ok;
96
97
  static const Error InternalError;
98
99
  static const char kSuccess[];
100
101
333k
  bool operator==(const Error& other) const { return error_code == other.error_code; }
102
103
140k
  bool operator!=(const Error& other) const { return !(*this == other); }
104
105
2.12k
  Error operator||(const Error& other) const {
106
2.12k
    if (error_code != heif_error_Ok) {
107
0
      return *this;
108
0
    }
109
2.12k
    else {
110
2.12k
      return other;
111
2.12k
    }
112
2.12k
  }
113
114
  // 'explicit' so that an Error can only be tested in a boolean context (if/!/&&/...).
115
  // Without it, `int x = err;` or `return err;` from an int function silently compile
116
  // and yield 0/1 instead of the intended value.
117
882k
  explicit operator bool() const { return error_code != heif_error_Ok; }
118
119
  static const char* get_error_string(heif_error_code err);
120
121
  static const char* get_error_string(heif_suberror_code err);
122
123
  heif_error error_struct(ErrorBuffer* error_buffer) const;
124
};
125
126
127
inline std::ostream& operator<<(std::ostream& ostr, const Error& err)
128
0
{
129
0
  ostr << err.error_code << "/" << err.sub_error_code;
130
0
  return ostr;
131
0
}
132
133
134
template <typename T> class Result
135
{
136
public:
137
104k
  Result() = default;
Result<std::__1::shared_ptr<HeifPixelImage> >::Result()
Line
Count
Source
137
104k
  Result() = default;
Unexecuted instantiation: Result<Encoder::CodedImageData>::Result()
Unexecuted instantiation: Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result()
138
139
216k
  Result(T v) : m_data(std::move(v)) {}
Result<std::__1::shared_ptr<HeifPixelImage> >::Result(std::__1::shared_ptr<HeifPixelImage>)
Line
Count
Source
139
109k
  Result(T v) : m_data(std::move(v)) {}
Result<unsigned int>::Result(unsigned int)
Line
Count
Source
139
540
  Result(T v) : m_data(std::move(v)) {}
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Result(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)
Result<Fraction>::Result(Fraction)
Line
Count
Source
139
3.21k
  Result(T v) : m_data(std::move(v)) {}
Unexecuted instantiation: Result<Box_clap::Crop>::Result(Box_clap::Crop)
Unexecuted instantiation: Result<heif_tai_timestamp_packet>::Result(heif_tai_timestamp_packet)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::Result(std::__1::shared_ptr<Box_udes>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_imir> >::Result(std::__1::shared_ptr<Box_imir>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_irot> >::Result(std::__1::shared_ptr<Box_irot>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_clap> >::Result(std::__1::shared_ptr<Box_clap>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::Result(std::__1::shared_ptr<Box_other>)
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >)
Line
Count
Source
139
14.9k
  Result(T v) : m_data(std::move(v)) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::Result(std::__1::shared_ptr<Box_infe>)
Unexecuted instantiation: Result<unsigned long>::Result(unsigned long)
Unexecuted instantiation: Result<std::__1::shared_ptr<RegionItem> >::Result(std::__1::shared_ptr<RegionItem>)
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::Result(std::__1::shared_ptr<ImageItem>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::Result(std::__1::shared_ptr<Box_elng>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Track> >::Result(std::__1::shared_ptr<Track>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::Result(std::__1::shared_ptr<Track const>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::Result(std::__1::shared_ptr<Track_Visual>)
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::Result(std::__1::shared_ptr<Track_Metadata>)
Unexecuted instantiation: Result<std::__1::shared_ptr<TextItem> >::Result(std::__1::shared_ptr<TextItem>)
Unexecuted instantiation: Result<RegionCoordinateTransform>::Result(RegionCoordinateTransform)
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::Result(std::__1::shared_ptr<SEIMessage>)
Unexecuted instantiation: Result<Encoder::CodedImageData>::Result(Encoder::CodedImageData)
Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::Result(std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > >)
Line
Count
Source
139
1.31k
  Result(T v) : m_data(std::move(v)) {}
Result<std::__1::shared_ptr<Decoder> >::Result(std::__1::shared_ptr<Decoder>)
Line
Count
Source
139
74.4k
  Result(T v) : m_data(std::move(v)) {}
Result<std::__1::optional<ImageSize> >::Result(std::__1::optional<ImageSize>)
Line
Count
Source
139
6.26k
  Result(T v) : m_data(std::move(v)) {}
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::Result(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*)
Line
Count
Source
139
6.54k
  Result(T v) : m_data(std::move(v)) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Grid> >::Result(std::__1::shared_ptr<ImageItem_Grid>)
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::Result(std::__1::shared_ptr<ImageItem_Overlay>)
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::Result(std::__1::shared_ptr<HeifPixelImage const>)
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::Result(heif_raw_sequence_sample*)
Unexecuted instantiation: Result<bool>::Result(bool)
140
141
32.6k
  Result(const Error& e) : m_data(e) {}
Result<std::__1::shared_ptr<HeifPixelImage> >::Result(Error const&)
Line
Count
Source
141
17.6k
  Result(const Error& e) : m_data(e) {}
Result<unsigned int>::Result(Error const&)
Line
Count
Source
141
654
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::Result(Error const&)
Result<Fraction>::Result(Error const&)
Line
Count
Source
141
1.22k
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<Box_clap::Crop>::Result(Error const&)
Unexecuted instantiation: Result<heif_tai_timestamp_packet>::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_imir> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_irot> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_clap> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::Result(Error const&)
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::Result(Error const&)
Line
Count
Source
141
3.83k
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<RegionItem> >::Result(Error const&)
Result<std::__1::shared_ptr<Decoder> >::Result(Error const&)
Line
Count
Source
141
8.78k
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::Result(Error const&)
Result<std::__1::shared_ptr<Track> >::Result(Error const&)
Line
Count
Source
141
36
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<TextItem> >::Result(Error const&)
Unexecuted instantiation: Result<RegionCoordinateTransform>::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::Result(Error const&)
Unexecuted instantiation: Result<Encoder::CodedImageData>::Result(Error const&)
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::Result(Error const&)
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::Result(Error const&)
Line
Count
Source
141
431
  Result(const Error& e) : m_data(e) {}
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Grid> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::Result(Error const&)
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::Result(Error const&)
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::Result(Error const&)
Unexecuted instantiation: Result<bool>::Result(Error const&)
142
143
  // True if the Result holds a value, false if it holds an error.
144
  // 'explicit' so that the value can only be extracted with operator*: `id = result;` must
145
  // not compile, because it would store the boolean (this bug shipped several times, see
146
  // https://github.com/strukturag/libheif/pull/1885).
147
265k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Result<std::__1::shared_ptr<HeifPixelImage> >::operator bool() const
Line
Count
Source
147
146k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::operator bool() const
Result<Fraction>::operator bool() const
Line
Count
Source
147
3.85k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::operator bool() const
Result<unsigned int>::operator bool() const
Line
Count
Source
147
524
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_imir> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_irot> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_clap> >::operator bool() const
Unexecuted instantiation: Result<Box_clap::Crop>::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::operator bool() const
Unexecuted instantiation: Result<unsigned long>::operator bool() const
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator bool() const
Line
Count
Source
147
22.6k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_elng> >::operator bool() const
Result<std::__1::shared_ptr<Track> >::operator bool() const
Line
Count
Source
147
64
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::operator bool() const
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::operator bool() const
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::operator bool() const
Unexecuted instantiation: Result<Encoder::CodedImageData>::operator bool() const
Result<std::__1::shared_ptr<Decoder> >::operator bool() const
Line
Count
Source
147
83.3k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator bool() const
Line
Count
Source
147
1.31k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::operator bool() const
Line
Count
Source
147
7.40k
  explicit operator bool() const { return std::holds_alternative<T>(m_data); }
Unexecuted instantiation: Result<std::__1::optional<ImageSize> >::operator bool() const
Unexecuted instantiation: Result<heif_tai_timestamp_packet>::operator bool() const
Unexecuted instantiation: Result<bool>::operator bool() const
148
149
  //void set(const T& v) { m_data = v; }
150
151
  // Pointer-like access for `r->member`
152
  T* operator->()
153
24.9k
  {
154
24.9k
    assert(*this); // Uses the operator bool() above
155
24.9k
    return &std::get<T>(m_data);
156
24.9k
  }
Unexecuted instantiation: Result<Box_clap::Crop>::operator->()
Unexecuted instantiation: Result<Encoder::CodedImageData>::operator->()
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator->()
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator->()
Line
Count
Source
153
18.7k
  {
154
    assert(*this); // Uses the operator bool() above
155
18.7k
    return &std::get<T>(m_data);
156
18.7k
  }
Result<std::__1::optional<ImageSize> >::operator->()
Line
Count
Source
153
6.26k
  {
154
    assert(*this); // Uses the operator bool() above
155
6.26k
    return &std::get<T>(m_data);
156
6.26k
  }
157
158
  // Dereference access for `*r`
159
  T& operator*()
160
228k
  {
161
228k
    assert(*this);
162
228k
    return std::get<T>(m_data);
163
228k
  }
Result<std::__1::shared_ptr<HeifPixelImage> >::operator*()
Line
Count
Source
160
111k
  {
161
    assert(*this);
162
111k
    return std::get<T>(m_data);
163
111k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::operator*()
Result<Fraction>::operator*()
Line
Count
Source
160
1.13k
  {
161
    assert(*this);
162
1.13k
    return std::get<T>(m_data);
163
1.13k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::operator*()
Result<unsigned int>::operator*()
Line
Count
Source
160
540
  {
161
    assert(*this);
162
540
    return std::get<T>(m_data);
163
540
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_imir> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_irot> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_clap> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::operator*()
Unexecuted instantiation: Result<unsigned long>::operator*()
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::operator*()
Line
Count
Source
160
14.9k
  {
161
    assert(*this);
162
14.9k
    return std::get<T>(m_data);
163
14.9k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Track> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Track const> >::operator*()
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::operator*()
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::operator*()
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::operator*()
Unexecuted instantiation: Result<Encoder::CodedImageData>::operator*()
Result<std::__1::shared_ptr<Decoder> >::operator*()
Line
Count
Source
160
74.4k
  {
161
    assert(*this);
162
74.4k
    return std::get<T>(m_data);
163
74.4k
  }
Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::operator*()
Line
Count
Source
160
1.31k
  {
161
    assert(*this);
162
1.31k
    return std::get<T>(m_data);
163
1.31k
  }
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::operator*()
Line
Count
Source
160
13.0k
  {
161
    assert(*this);
162
13.0k
    return std::get<T>(m_data);
163
13.0k
  }
Result<std::__1::optional<ImageSize> >::operator*()
Line
Count
Source
160
11.7k
  {
161
    assert(*this);
162
11.7k
    return std::get<T>(m_data);
163
11.7k
  }
Unexecuted instantiation: Result<heif_tai_timestamp_packet>::operator*()
Unexecuted instantiation: Result<bool>::operator*()
164
165
7.46k
  [[nodiscard]] bool is_error() const {
166
7.46k
    return std::holds_alternative<Error>(m_data);
167
7.46k
  }
Result<std::__1::optional<ImageSize> >::is_error() const
Line
Count
Source
165
6.26k
  [[nodiscard]] bool is_error() const {
166
6.26k
    return std::holds_alternative<Error>(m_data);
167
6.26k
  }
Result<unsigned int>::is_error() const
Line
Count
Source
165
1.19k
  [[nodiscard]] bool is_error() const {
166
1.19k
    return std::holds_alternative<Error>(m_data);
167
1.19k
  }
Unexecuted instantiation: Result<bool>::is_error() const
168
169
  // Accessor for the error, if it exists
170
  [[nodiscard]] const Error& error() const
171
122k
  {
172
122k
    if (*this) {
173
101k
      return Error::Ok;
174
101k
    }
175
176
20.1k
    return std::get<Error>(m_data);
177
122k
  }
Result<std::__1::shared_ptr<HeifPixelImage> >::error() const
Line
Count
Source
171
116k
  {
172
116k
    if (*this) {
173
101k
      return Error::Ok;
174
101k
    }
175
176
14.4k
    return std::get<Error>(m_data);
177
116k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<HeifPixelImage const> >::error() const
Result<Fraction>::error() const
Line
Count
Source
171
825
  {
172
825
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
825
    return std::get<Error>(m_data);
177
825
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_infe> >::error() const
Result<unsigned int>::error() const
Line
Count
Source
171
524
  {
172
524
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
524
    return std::get<Error>(m_data);
177
524
  }
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >::error() const
Line
Count
Source
171
3.86k
  {
172
3.86k
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
3.86k
    return std::get<Error>(m_data);
177
3.86k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::error() const
Result<std::__1::shared_ptr<Track> >::error() const
Line
Count
Source
171
64
  {
172
64
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
64
    return std::get<Error>(m_data);
177
64
  }
Unexecuted instantiation: Result<Box_clap::Crop>::error() const
Unexecuted instantiation: Result<std::__1::shared_ptr<SEIMessage> >::error() const
Unexecuted instantiation: Result<Encoder::CodedImageData>::error() const
Result<std::__1::shared_ptr<Decoder> >::error() const
Line
Count
Source
171
66
  {
172
66
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
66
    return std::get<Error>(m_data);
177
66
  }
Unexecuted instantiation: Result<std::__1::vector<std::__1::shared_ptr<Box>, std::__1::allocator<std::__1::shared_ptr<Box> > > >::error() const
Result<std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >*>::error() const
Line
Count
Source
171
431
  {
172
431
    if (*this) {
173
0
      return Error::Ok;
174
0
    }
175
176
431
    return std::get<Error>(m_data);
177
431
  }
Unexecuted instantiation: Result<std::__1::optional<ImageSize> >::error() const
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::error() const
Unexecuted instantiation: Result<heif_tai_timestamp_packet>::error() const
Unexecuted instantiation: Result<bool>::error() const
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::error() const
178
179
  // Directly get the C error struct.
180
  heif_error error_struct(ErrorBuffer* error_buffer) const
181
5.40k
  {
182
5.40k
    if (*this) {
183
0
      return heif_error_success;
184
0
    }
185
186
5.40k
    return std::get<Error>(m_data).error_struct(error_buffer);
187
5.40k
  }
Result<std::__1::shared_ptr<HeifPixelImage> >::error_struct(ErrorBuffer*) const
Line
Count
Source
181
5.40k
  {
182
5.40k
    if (*this) {
183
0
      return heif_error_success;
184
0
    }
185
186
5.40k
    return std::get<Error>(m_data).error_struct(error_buffer);
187
5.40k
  }
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_udes> >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<unsigned int>::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::shared_ptr<Box_other> >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<heif_raw_sequence_sample*>::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Visual> >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::shared_ptr<Track_Metadata> >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem> >::error_struct(ErrorBuffer*) const
Unexecuted instantiation: Result<std::__1::shared_ptr<ImageItem_Overlay> >::error_struct(ErrorBuffer*) const
188
189
  std::variant<T, Error> m_data;
190
};
191
192
#endif