MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / BrotliDecoderWrapper

Class BrotliDecoderWrapper

src/bmffimage.cpp:181–201  ·  view source on GitHub ↗

Wrapper class for BrotliDecoderState that automatically calls BrotliDecoderDestroyInstance in its destructor.

Source from the content-addressed store, hash-verified

179// Wrapper class for BrotliDecoderState that automatically calls
180// BrotliDecoderDestroyInstance in its destructor.
181class BrotliDecoderWrapper {
182 BrotliDecoderState* decoder_;
183
184 public:
185 BrotliDecoderWrapper() : decoder_(BrotliDecoderCreateInstance(nullptr, nullptr, nullptr)) {
186 if (!decoder_) {
187 throw Error(ErrorCode::kerMallocFailed);
188 }
189 }
190
191 ~BrotliDecoderWrapper() {
192 BrotliDecoderDestroyInstance(decoder_);
193 }
194
195 BrotliDecoderWrapper(const BrotliDecoderWrapper&) = delete;
196 BrotliDecoderWrapper& operator=(const BrotliDecoderWrapper&) = delete;
197
198 [[nodiscard]] BrotliDecoderState* get() const {
199 return decoder_;
200 }
201};
202
203void BmffImage::brotliUncompress(const byte* compressedBuf, size_t compressedBufSize, DataBuf& arr) {
204 BrotliDecoderWrapper decoder;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected