diff options
author | Boyuan Yang <byang@debian.org> | 2023-11-27 22:46:29 -0500 |
---|---|---|
committer | Boyuan Yang <byang@debian.org> | 2023-11-27 22:46:29 -0500 |
commit | 19564cb4f77660cdb2f980ca619d4b979b9fe342 (patch) | |
tree | ff97ccd1471553f1e861c8ea747faa45a023e119 /examples | |
parent | d4dbf19f6b0181ee78034bfe4caf189d1c016998 (diff) | |
download | libgav1-19564cb4f77660cdb2f980ca619d4b979b9fe342.tar.gz libgav1-19564cb4f77660cdb2f980ca619d4b979b9fe342.tar.bz2 libgav1-19564cb4f77660cdb2f980ca619d4b979b9fe342.zip |
New upstream version 0.19.0
Diffstat (limited to 'examples')
-rw-r--r-- | examples/file_reader.cc | 9 | ||||
-rw-r--r-- | examples/file_writer_test.cc | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/examples/file_reader.cc b/examples/file_reader.cc index b096722..a01b7ab 100644 --- a/examples/file_reader.cc +++ b/examples/file_reader.cc @@ -82,7 +82,14 @@ std::unique_ptr<FileReaderInterface> FileReader::Open( return nullptr; } - return file; + // With C++11, to return |file|, an explicit move is required as the return + // type differs from the local variable. Overload resolution isn't guaranteed + // in this case, though some compilers may adopt the C++14 behavior (C++ + // Standard Core Language Issue #1579, Return by converting move + // constructor): + // https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579 + // To keep things simple we opt for the following compatible form. + return std::unique_ptr<FileReaderInterface>(file.release()); } // IVF Frame Header format, from https://wiki.multimedia.cx/index.php/IVF diff --git a/examples/file_writer_test.cc b/examples/file_writer_test.cc index 481808c..df5be17 100644 --- a/examples/file_writer_test.cc +++ b/examples/file_writer_test.cc @@ -18,6 +18,7 @@ #include <cstdint> #include <cstring> #include <memory> +#include <new> #include <ostream> #include <string> #include <utility> @@ -64,7 +65,7 @@ const char* const // TODO(tomfinegan): Add a bitdepth arg, and test writing 10 bit frame buffers. std::unique_ptr<DecoderBuffer> GetFakeDecoderBuffer(ImageFormat image_format) { - auto buffer = absl::make_unique<DecoderBuffer>(); + auto buffer = absl::WrapUnique(new (std::nothrow) DecoderBuffer); if (buffer == nullptr) return nullptr; buffer->chroma_sample_position = kChromaSamplePositionUnknown; buffer->image_format = image_format; |