File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 88
99#include < avif/avif.h>
1010#include < fstream>
11+ #include < memory>
1112
1213#include < opencv2/core/utils/configuration.private.hpp>
1314#include " opencv2/imgproc.hpp"
@@ -159,16 +160,16 @@ size_t AvifDecoder::signatureLength() const { return kAvifSignatureSize; }
159160 }
160161
161162bool AvifDecoder::checkSignature (const String &signature) const {
162- avifDecoder *decoder = avifDecoderCreate ();
163+ std::unique_ptr<avifDecoder, decltype (&avifDecoderDestroy)> decoder (
164+ avifDecoderCreate (), avifDecoderDestroy);
163165 if (!decoder) return false ;
164166 OPENCV_AVIF_CHECK_STATUS (
165167 avifDecoderSetIOMemory (
166- decoder, reinterpret_cast <const uint8_t *>(signature.c_str ()),
168+ decoder. get () , reinterpret_cast <const uint8_t *>(signature.c_str ()),
167169 signature.size ()),
168170 decoder);
169171 decoder->io ->sizeHint = 1e9 ;
170- const avifResult status = avifDecoderParse (decoder);
171- avifDecoderDestroy (decoder);
172+ const avifResult status = avifDecoderParse (decoder.get ());
172173 return (status == AVIF_RESULT_OK || status == AVIF_RESULT_TRUNCATED_DATA);
173174}
174175
You can’t perform that action at this time.
0 commit comments