From cf5ad669224277e78bc828a9b32ecc91d98a894c Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 15 Sep 2023 23:25:04 -0700 Subject: [PATCH] default some more (#1135) * remove defaulted constructor It gets implicitly generated. Signed-off-by: Rosen Penev * default some more swap is not needed here as shared_ptr is copyable. Signed-off-by: Rosen Penev --------- Signed-off-by: Rosen Penev --- taglib/asf/asfattribute.cpp | 8 ++------ taglib/asf/asfpicture.cpp | 9 ++------- taglib/fileref.cpp | 8 ++------ taglib/mp4/mp4coverart.cpp | 10 ++-------- taglib/mp4/mp4item.cpp | 10 ++-------- taglib/mpeg/mpegheader.cpp | 3 +-- taglib/toolkit/tiostream.cpp | 2 +- taglib/toolkit/tlist.tcc | 4 +--- taglib/toolkit/tmap.tcc | 13 ++----------- taglib/toolkit/tstring.cpp | 8 ++------ taglib/xm/xmfile.cpp | 2 -- 11 files changed, 17 insertions(+), 60 deletions(-) diff --git a/taglib/asf/asfattribute.cpp b/taglib/asf/asfattribute.cpp index 6a2a1114..e5b62ab0 100644 --- a/taglib/asf/asfattribute.cpp +++ b/taglib/asf/asfattribute.cpp @@ -58,7 +58,7 @@ ASF::Attribute::Attribute() : d->type = UnicodeType; } -ASF::Attribute::Attribute(const ASF::Attribute &other) = default; +ASF::Attribute::Attribute(const ASF::Attribute &) = default; ASF::Attribute::Attribute(const String &value) : d(std::make_shared()) @@ -109,11 +109,7 @@ ASF::Attribute::Attribute(bool value) : d->numericValue = value; } -ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &other) -{ - Attribute(other).swap(*this); - return *this; -} +ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &) = default; void ASF::Attribute::swap(Attribute &other) { diff --git a/taglib/asf/asfpicture.cpp b/taglib/asf/asfpicture.cpp index c99ec924..64e52baa 100644 --- a/taglib/asf/asfpicture.cpp +++ b/taglib/asf/asfpicture.cpp @@ -50,8 +50,7 @@ ASF::Picture::Picture() : d->valid = true; } -ASF::Picture::Picture(const Picture &other) = default; - +ASF::Picture::Picture(const Picture &) = default; ASF::Picture::~Picture() = default; bool ASF::Picture::isValid() const @@ -106,11 +105,7 @@ int ASF::Picture::dataSize() const d->picture.size(); } -ASF::Picture& ASF::Picture::operator=(const ASF::Picture& other) -{ - Picture(other).swap(*this); - return *this; -} +ASF::Picture &ASF::Picture::operator=(const ASF::Picture &) = default; void ASF::Picture::swap(Picture &other) { diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp index ac64406b..dad426d2 100644 --- a/taglib/fileref.cpp +++ b/taglib/fileref.cpp @@ -341,7 +341,7 @@ FileRef::FileRef(File *file) : d->file = file; } -FileRef::FileRef(const FileRef &ref) = default; +FileRef::FileRef(const FileRef &) = default; FileRef::~FileRef() = default; @@ -427,11 +427,7 @@ bool FileRef::isNull() const return (!d->file || !d->file->isValid()); } -FileRef &FileRef::operator=(const FileRef &ref) -{ - FileRef(ref).swap(*this); - return *this; -} +FileRef &FileRef::operator=(const FileRef &) = default; void FileRef::swap(FileRef &ref) { diff --git a/taglib/mp4/mp4coverart.cpp b/taglib/mp4/mp4coverart.cpp index c4c8039a..56ec0ca0 100644 --- a/taglib/mp4/mp4coverart.cpp +++ b/taglib/mp4/mp4coverart.cpp @@ -45,14 +45,8 @@ MP4::CoverArt::CoverArt(Format format, const ByteVector &data) : d->data = data; } -MP4::CoverArt::CoverArt(const CoverArt &item) = default; - -MP4::CoverArt & -MP4::CoverArt::operator=(const CoverArt &item) -{ - CoverArt(item).swap(*this); - return *this; -} +MP4::CoverArt::CoverArt(const CoverArt &) = default; +MP4::CoverArt &MP4::CoverArt::operator=(const CoverArt &) = default; void MP4::CoverArt::swap(CoverArt &item) diff --git a/taglib/mp4/mp4item.cpp b/taglib/mp4/mp4item.cpp index 2e14fba8..1987fd13 100644 --- a/taglib/mp4/mp4item.cpp +++ b/taglib/mp4/mp4item.cpp @@ -51,14 +51,8 @@ MP4::Item::Item() : d->valid = false; } -MP4::Item::Item(const Item &item) = default; - -MP4::Item & -MP4::Item::operator=(const Item &item) -{ - Item(item).swap(*this); - return *this; -} +MP4::Item::Item(const Item &) = default; +MP4::Item &MP4::Item::operator=(const Item &) = default; void MP4::Item::swap(Item &item) diff --git a/taglib/mpeg/mpegheader.cpp b/taglib/mpeg/mpegheader.cpp index 4a4d25cb..210ce512 100644 --- a/taglib/mpeg/mpegheader.cpp +++ b/taglib/mpeg/mpegheader.cpp @@ -61,8 +61,7 @@ MPEG::Header::Header(File *file, offset_t offset, bool checkLength) : parse(file, offset, checkLength); } -MPEG::Header::Header(const Header &h) = default; - +MPEG::Header::Header(const Header &) = default; MPEG::Header::~Header() = default; bool MPEG::Header::isValid() const diff --git a/taglib/toolkit/tiostream.cpp b/taglib/toolkit/tiostream.cpp index f13ae9ee..6b7e3b1b 100644 --- a/taglib/toolkit/tiostream.cpp +++ b/taglib/toolkit/tiostream.cpp @@ -59,7 +59,7 @@ FileName::FileName(const char *name) : { } -FileName::FileName(const FileName &name) = default; +FileName::FileName(const FileName &) = default; FileName::operator const wchar_t *() const { diff --git a/taglib/toolkit/tlist.tcc b/taglib/toolkit/tlist.tcc index 879dcde7..04778ac4 100644 --- a/taglib/toolkit/tlist.tcc +++ b/taglib/toolkit/tlist.tcc @@ -94,9 +94,7 @@ List::List() : } template -List::List(const List &l) : d(l.d) -{ -} +List::List(const List &) = default; template List::~List() = default; diff --git a/taglib/toolkit/tmap.tcc b/taglib/toolkit/tmap.tcc index c98909a3..532dd136 100644 --- a/taglib/toolkit/tmap.tcc +++ b/taglib/toolkit/tmap.tcc @@ -51,9 +51,7 @@ Map::Map() : } template -Map::Map(const Map &m) : d(m.d) -{ -} +Map::Map(const Map &) = default; template Map::~Map() = default; @@ -180,14 +178,7 @@ T &Map::operator[](const Key &key) } template -Map &Map::operator=(const Map &m) -{ - if (this == &m) - return *this; - - Map(m).swap(*this); - return *this; -} +Map &Map::operator=(const Map &) = default; template void Map::swap(Map &m) diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index f5d7caea..3135753d 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -158,7 +158,7 @@ String::String() : { } -String::String(const String &s) = default; +String::String(const String &) = default; String::String(const std::string &s, Type t) : d(std::make_shared()) @@ -611,11 +611,7 @@ String &String::operator+=(char c) return *this; } -String &String::operator=(const String &s) -{ - String(s).swap(*this); - return *this; -} +String &String::operator=(const String &) = default; String &String::operator=(const std::string &s) { diff --git a/taglib/xm/xmfile.cpp b/taglib/xm/xmfile.cpp index 9eaf8cdc..490695e1 100644 --- a/taglib/xm/xmfile.cpp +++ b/taglib/xm/xmfile.cpp @@ -225,8 +225,6 @@ public: class StructReader : public Reader { public: - StructReader() = default; - /*! * Add a nested reader. This reader takes ownership. */