diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-10-31 23:10:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-11-02 00:12:56 +0100 |
| commit | 809fe8c8e6f28c87f48e6629560a2b52a148a8a7 (patch) | |
| tree | d2af064926ae732b7be3d82fb6fa4f4d412780e9 /src/mono_picture_frame.cc | |
| parent | 9e613ae8a3cd7994194d2d709f6ff9b88feac70b (diff) | |
Use some shared_ptr<> instead of raw pointers.
Diffstat (limited to 'src/mono_picture_frame.cc')
| -rw-r--r-- | src/mono_picture_frame.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mono_picture_frame.cc b/src/mono_picture_frame.cc index d9a89fe1..7d24ea63 100644 --- a/src/mono_picture_frame.cc +++ b/src/mono_picture_frame.cc @@ -57,7 +57,7 @@ using namespace dcp; MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path) { boost::uintmax_t const size = boost::filesystem::file_size (path); - _buffer = new ASDCP::JP2K::FrameBuffer (size); + _buffer.reset(new ASDCP::JP2K::FrameBuffer(size)); FILE* f = fopen_boost (path, "rb"); if (!f) { boost::throw_exception (FileError ("could not open JPEG2000 file", path, errno)); @@ -81,7 +81,7 @@ MonoPictureFrame::MonoPictureFrame (boost::filesystem::path path) MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, shared_ptr<DecryptionContext> c) { /* XXX: unfortunate guesswork on this buffer size */ - _buffer = new ASDCP::JP2K::FrameBuffer (4 * Kumu::Megabyte); + _buffer.reset(new ASDCP::JP2K::FrameBuffer(4 * Kumu::Megabyte)); ASDCP::Result_t const r = reader->ReadFrame (n, *_buffer, c->context(), c->hmac()); @@ -92,16 +92,11 @@ MonoPictureFrame::MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, share MonoPictureFrame::MonoPictureFrame (uint8_t const * data, int size) { - _buffer = new ASDCP::JP2K::FrameBuffer (size); + _buffer.reset(new ASDCP::JP2K::FrameBuffer(size)); _buffer->Size (size); memcpy (_buffer->Data(), data, size); } -/** MonoPictureFrame destructor */ -MonoPictureFrame::~MonoPictureFrame () -{ - delete _buffer; -} /** @return Pointer to JPEG2000 data */ uint8_t const * |
