poppler/Annot.cc | 2 +- poppler/Movie.cc | 6 +++--- poppler/Movie.h | 6 ++++-- qt5/src/poppler-movie.cc | 6 +++--- qt6/src/poppler-movie.cc | 6 +++--- 5 files changed, 14 insertions(+), 12 deletions(-)
New commits: commit e3a4636aad98b2abbb6e6e87f20f8d0156c82ac0 Author: Albert Astals Cid <[email protected]> Date: Tue Feb 15 15:45:48 2022 +0100 Make Movie::copy return an unique_ptr diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 7e595607..9d170784 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -5289,7 +5289,7 @@ AnnotMovie::AnnotMovie(PDFDoc *docA, PDFRectangle *rectA, Movie *movieA) : Annot type = typeMovie; annotObj.dictSet("Subtype", Object(objName, "Movie")); - movie.reset(movieA->copy()); + movie = movieA->copy(); // TODO: create movie dict from movieA initialize(docA, annotObj.getDict()); diff --git a/poppler/Movie.cc b/poppler/Movie.cc index e8047b8e..8708d48a 100644 --- a/poppler/Movie.cc +++ b/poppler/Movie.cc @@ -6,7 +6,7 @@ // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008 // Pino Toscano <[email protected]> (c) 2008 // Carlos Garcia Campos <[email protected]> (c) 2010 -// Albert Astals Cid <[email protected]> (c) 2010, 2017-2019 +// Albert Astals Cid <[email protected]> (c) 2010, 2017-2019, 2022 // Evgeny Stambulchik <[email protected]> (c) 2019 // // This program is free software; you can redistribute it and/or modify @@ -276,7 +276,7 @@ void Movie::getFloatingWindowSize(int *widthA, int *heightA) *heightA = int(height * double(MA.znum) / MA.zdenum); } -Movie *Movie::copy() const +std::unique_ptr<Movie> Movie::copy() const { - return new Movie(*this); + return std::make_unique<Movie>(*this); } diff --git a/poppler/Movie.h b/poppler/Movie.h index bfb71c60..0c36510e 100644 --- a/poppler/Movie.h +++ b/poppler/Movie.h @@ -5,7 +5,7 @@ //--------------------------------------------------------------------------------- // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008 // Carlos Garcia Campos <[email protected]> (c) 2010 -// Albert Astals Cid <[email protected]> (c) 2017-2019, 2021 +// Albert Astals Cid <[email protected]> (c) 2017-2019, 2021, 2022 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -28,6 +28,8 @@ #include "Object.h" #include "poppler_private_export.h" +#include <memory> + struct MovieActivationParameters { @@ -99,7 +101,7 @@ public: bool getUseFloatingWindow() const { return MA.floatingWindow; } void getFloatingWindowSize(int *width, int *height); - Movie *copy() const; + std::unique_ptr<Movie> copy() const; private: void parseMovie(const Object *movieDict); diff --git a/qt5/src/poppler-movie.cc b/qt5/src/poppler-movie.cc index eade5161..2e477c58 100644 --- a/qt5/src/poppler-movie.cc +++ b/qt5/src/poppler-movie.cc @@ -1,6 +1,6 @@ /* poppler-sound.cc: qt interface to poppler * Copyright (C) 2008, 2010, Pino Toscano <[email protected]> - * Copyright (C) 2008, 2018, Albert Astals Cid <[email protected]> + * Copyright (C) 2008, 2018, 2022, Albert Astals Cid <[email protected]> * Copyright (C) 2010, Carlos Garcia Campos <[email protected]> * Copyright (C) 2012, Tobias Koenig <[email protected]> * @@ -34,12 +34,12 @@ class MovieData public: MovieData() : m_movieObj(nullptr) { } - ~MovieData() { delete m_movieObj; } + ~MovieData() = default; MovieData(const MovieData &) = delete; MovieData &operator=(const MovieData &) = delete; - Movie *m_movieObj; + std::unique_ptr<Movie> m_movieObj; QSize m_size; int m_rotation; QImage m_posterImage; diff --git a/qt6/src/poppler-movie.cc b/qt6/src/poppler-movie.cc index 8663b202..96822c6d 100644 --- a/qt6/src/poppler-movie.cc +++ b/qt6/src/poppler-movie.cc @@ -1,6 +1,6 @@ /* poppler-sound.cc: qt interface to poppler * Copyright (C) 2008, 2010, Pino Toscano <[email protected]> - * Copyright (C) 2008, 2018, Albert Astals Cid <[email protected]> + * Copyright (C) 2008, 2018, 2022, Albert Astals Cid <[email protected]> * Copyright (C) 2010, Carlos Garcia Campos <[email protected]> * Copyright (C) 2012, Tobias Koenig <[email protected]> * @@ -34,12 +34,12 @@ class MovieData public: MovieData() : m_movieObj(nullptr) { } - ~MovieData() { delete m_movieObj; } + ~MovieData() = default; MovieData(const MovieData &) = delete; MovieData &operator=(const MovieData &) = delete; - Movie *m_movieObj; + std::unique_ptr<Movie> m_movieObj; QSize m_size; int m_rotation; QImage m_posterImage;
