From 9a1f37ecbe86f0340f61ee2c3d5bb05ff51876a0 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 8 Mar 2023 15:38:11 -0800 Subject: [PATCH] get rid of Key() move operations Because of Impl, there's no way this can work properly. Signed-off-by: Rosen Penev --- app/actions.cpp | 9 +++------ include/exiv2/metadatum.hpp | 4 ++-- include/exiv2/tags.hpp | 3 --- src/properties.cpp | 2 +- src/tags.cpp | 11 ----------- 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/app/actions.cpp b/app/actions.cpp index b14a8562..63302fc6 100644 --- a/app/actions.cpp +++ b/app/actions.cpp @@ -624,12 +624,9 @@ int Rename::run(const std::string& path) { std::cerr << path << ": " << _("No Exif data found in the file\n"); return -3; } - Exiv2::ExifKey key("Exif.Photo.DateTimeOriginal"); - auto md = exifData.findKey(key); - if (md == exifData.end()) { - key = Exiv2::ExifKey("Exif.Image.DateTime"); - md = exifData.findKey(key); - } + auto md = exifData.findKey(Exiv2::ExifKey("Exif.Photo.DateTimeOriginal")); + if (md == exifData.end()) + md = exifData.findKey(Exiv2::ExifKey("Exif.Image.DateTime")); if (md == exifData.end()) { std::cerr << _("Neither tag") << " `Exif.Photo.DateTimeOriginal' " << _("nor") << " `Exif.Image.DateTime' " << _("found in the file") << " " << path << "\n"; diff --git a/include/exiv2/metadatum.hpp b/include/exiv2/metadatum.hpp index 8543b834..33ffbc32 100644 --- a/include/exiv2/metadatum.hpp +++ b/include/exiv2/metadatum.hpp @@ -33,6 +33,8 @@ class EXIV2API Key { //! Destructor virtual ~Key() = default; //@} + Key(Key&&) = delete; + Key& operator=(Key&&) = delete; //! @name Accessors //@{ /*! @@ -74,8 +76,6 @@ class EXIV2API Key { protected: Key() = default; Key(const Key&) = default; - Key(Key&&) = default; - Key& operator=(Key&&) = default; //! @name Manipulators //@{ /*! diff --git a/include/exiv2/tags.hpp b/include/exiv2/tags.hpp index 7c735a82..cfcff104 100644 --- a/include/exiv2/tags.hpp +++ b/include/exiv2/tags.hpp @@ -308,9 +308,6 @@ class EXIV2API ExifKey : public Key { ~ExifKey() override; //@} - ExifKey(ExifKey&& rhs); - ExifKey& operator=(ExifKey&& rhs); - //! @name Manipulators //@{ /*! diff --git a/src/properties.cpp b/src/properties.cpp index b9f82fbf..a7c414d9 100644 --- a/src/properties.cpp +++ b/src/properties.cpp @@ -5149,7 +5149,7 @@ XmpKey::XmpKey(const std::string& prefix, const std::string& property) : p_(std: XmpKey::~XmpKey() = default; -XmpKey::XmpKey(const XmpKey& rhs) : p_(std::make_unique(*rhs.p_)) { +XmpKey::XmpKey(const XmpKey& rhs) : Key(rhs), p_(std::make_unique(*rhs.p_)) { } XmpKey& XmpKey::operator=(const XmpKey& rhs) { diff --git a/src/tags.cpp b/src/tags.cpp index 9264869a..5b89f928 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -264,9 +264,6 @@ ExifKey::ExifKey(const std::string& key) : p_(std::make_unique()) { ExifKey::ExifKey(const ExifKey& rhs) : p_(std::make_unique(*rhs.p_)) { } -ExifKey::ExifKey(ExifKey&& rhs) : p_(std::make_unique(*rhs.p_)) { -} - ExifKey::~ExifKey() = default; ExifKey& ExifKey::operator=(const ExifKey& rhs) { @@ -277,14 +274,6 @@ ExifKey& ExifKey::operator=(const ExifKey& rhs) { return *this; } -ExifKey& ExifKey::operator=(ExifKey&& rhs) { - if (this == &rhs) - return *this; - *p_ = *rhs.p_; - Key::operator=(std::move(rhs)); - return *this; -} - void ExifKey::setIdx(int idx) { p_->idx_ = idx; }