From 0318201fbd2d79319a0b74ddfefa2c9f7ef139d7 Mon Sep 17 00:00:00 2001 From: Urs Fleisch Date: Tue, 2 Jan 2024 12:52:26 +0100 Subject: [PATCH] Make classes with destructor as only virtual member non-virtual These classes are probably not meant to be used polymorphically. --- taglib/ape/apefooter.h | 2 +- taglib/ape/apeitem.h | 2 +- taglib/asf/asfattribute.h | 2 +- taglib/asf/asfpicture.h | 2 +- taglib/mp4/mp4coverart.h | 2 +- taglib/mp4/mp4item.h | 2 +- taglib/mpeg/id3v2/id3v2extendedheader.h | 2 +- taglib/mpeg/id3v2/id3v2footer.h | 2 +- taglib/mpeg/id3v2/id3v2header.h | 2 +- taglib/mpeg/mpegheader.h | 2 +- taglib/mpeg/xingheader.h | 2 +- taglib/ogg/oggpage.h | 2 +- taglib/ogg/oggpageheader.h | 2 +- tests/test_sizes.cpp | 26 ++++++++++++------------- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/taglib/ape/apefooter.h b/taglib/ape/apefooter.h index 32f5397f..488f9692 100644 --- a/taglib/ape/apefooter.h +++ b/taglib/ape/apefooter.h @@ -59,7 +59,7 @@ namespace TagLib { /*! * Destroys the footer. */ - virtual ~Footer(); + ~Footer(); Footer(const Footer &) = delete; Footer &operator=(const Footer &) = delete; diff --git a/taglib/ape/apeitem.h b/taglib/ape/apeitem.h index 8e5e0664..af75704c 100644 --- a/taglib/ape/apeitem.h +++ b/taglib/ape/apeitem.h @@ -75,7 +75,7 @@ namespace TagLib { /*! * Destroys the item. */ - virtual ~Item(); + ~Item(); /*! * Copies the contents of \a item into this item. diff --git a/taglib/asf/asfattribute.h b/taglib/asf/asfattribute.h index 93e9e175..4f686253 100644 --- a/taglib/asf/asfattribute.h +++ b/taglib/asf/asfattribute.h @@ -123,7 +123,7 @@ namespace TagLib /*! * Destroys the attribute. */ - virtual ~Attribute(); + ~Attribute(); /*! * Returns the type of the value. diff --git a/taglib/asf/asfpicture.h b/taglib/asf/asfpicture.h index 9fbf8ee8..3ea09947 100644 --- a/taglib/asf/asfpicture.h +++ b/taglib/asf/asfpicture.h @@ -68,7 +68,7 @@ namespace TagLib /*! * Destroys the picture. */ - virtual ~Picture(); + ~Picture(); /*! * Copies the contents of \a other into this picture. diff --git a/taglib/mp4/mp4coverart.h b/taglib/mp4/mp4coverart.h index ec17e687..e1030db0 100644 --- a/taglib/mp4/mp4coverart.h +++ b/taglib/mp4/mp4coverart.h @@ -49,7 +49,7 @@ namespace TagLib { }; CoverArt(Format format, const ByteVector &data); - virtual ~CoverArt(); + ~CoverArt(); CoverArt(const CoverArt &item); diff --git a/taglib/mp4/mp4item.h b/taglib/mp4/mp4item.h index f584f009..4638ea94 100644 --- a/taglib/mp4/mp4item.h +++ b/taglib/mp4/mp4item.h @@ -53,7 +53,7 @@ namespace TagLib { */ void swap(Item &item) noexcept; - virtual ~Item(); + ~Item(); Item(int value); Item(unsigned char value); diff --git a/taglib/mpeg/id3v2/id3v2extendedheader.h b/taglib/mpeg/id3v2/id3v2extendedheader.h index 3b57925e..ef09f07c 100644 --- a/taglib/mpeg/id3v2/id3v2extendedheader.h +++ b/taglib/mpeg/id3v2/id3v2extendedheader.h @@ -57,7 +57,7 @@ namespace TagLib { /*! * Destroys the extended header. */ - virtual ~ExtendedHeader(); + ~ExtendedHeader(); ExtendedHeader(const ExtendedHeader &) = delete; ExtendedHeader &operator=(const ExtendedHeader &) = delete; diff --git a/taglib/mpeg/id3v2/id3v2footer.h b/taglib/mpeg/id3v2/id3v2footer.h index 8f1e5fa3..3902be67 100644 --- a/taglib/mpeg/id3v2/id3v2footer.h +++ b/taglib/mpeg/id3v2/id3v2footer.h @@ -57,7 +57,7 @@ namespace TagLib { /*! * Destroys the footer. */ - virtual ~Footer(); + ~Footer(); Footer(const Footer &) = delete; Footer &operator=(const Footer &) = delete; diff --git a/taglib/mpeg/id3v2/id3v2header.h b/taglib/mpeg/id3v2/id3v2header.h index 1d082ad1..e103ac82 100644 --- a/taglib/mpeg/id3v2/id3v2header.h +++ b/taglib/mpeg/id3v2/id3v2header.h @@ -63,7 +63,7 @@ namespace TagLib { /*! * Destroys the header. */ - virtual ~Header(); + ~Header(); Header(const Header &) = delete; Header &operator=(const Header &) = delete; diff --git a/taglib/mpeg/mpegheader.h b/taglib/mpeg/mpegheader.h index 23365698..ecc354d2 100644 --- a/taglib/mpeg/mpegheader.h +++ b/taglib/mpeg/mpegheader.h @@ -70,7 +70,7 @@ namespace TagLib { /*! * Destroys this Header instance. */ - virtual ~Header(); + ~Header(); /*! * Returns \c true if the frame is at least an appropriate size and has diff --git a/taglib/mpeg/xingheader.h b/taglib/mpeg/xingheader.h index 6c7f5a19..dea6e2d9 100644 --- a/taglib/mpeg/xingheader.h +++ b/taglib/mpeg/xingheader.h @@ -82,7 +82,7 @@ namespace TagLib { /*! * Destroy this XingHeader instance. */ - virtual ~XingHeader(); + ~XingHeader(); XingHeader(const XingHeader &) = delete; XingHeader &operator=(const XingHeader &) = delete; diff --git a/taglib/ogg/oggpage.h b/taglib/ogg/oggpage.h index 26bad56e..8c5e60aa 100644 --- a/taglib/ogg/oggpage.h +++ b/taglib/ogg/oggpage.h @@ -57,7 +57,7 @@ namespace TagLib { */ Page(File *file, offset_t pageOffset); - virtual ~Page(); + ~Page(); Page(const Page &) = delete; Page &operator=(const Page &) = delete; diff --git a/taglib/ogg/oggpageheader.h b/taglib/ogg/oggpageheader.h index 52c8a889..ae45a2df 100644 --- a/taglib/ogg/oggpageheader.h +++ b/taglib/ogg/oggpageheader.h @@ -57,7 +57,7 @@ namespace TagLib { /*! * Deletes this instance of the PageHeader. */ - virtual ~PageHeader(); + ~PageHeader(); PageHeader(const PageHeader &) = delete; PageHeader &operator=(const PageHeader &) = delete; diff --git a/tests/test_sizes.cpp b/tests/test_sizes.cpp index ef9610a4..64758622 100644 --- a/tests/test_sizes.cpp +++ b/tests/test_sizes.cpp @@ -149,13 +149,13 @@ public: // $ grep kind=\"class\" index.xml | sed -E -e 's/(.*|<\/name>.*)//g' CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::File)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::APE::Footer)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::APE::Item)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Footer)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::APE::Item)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::APE::Tag)); - CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Attribute)); + CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Attribute)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::File)); - CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Picture)); + CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::ASF::Picture)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ASF::Tag)); CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::AudioProperties)); @@ -185,12 +185,12 @@ public: CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::ChapterFrame)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::CommentsFrame)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::EventTimingCodesFrame)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::ExtendedHeader)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Footer)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::ExtendedHeader)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::Footer)); CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Frame)); CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::FrameFactory)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::GeneralEncapsulatedObjectFrame)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Header)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::ID3v2::Header)); CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::ID3v2::Latin1StringHandler)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::OwnershipFrame)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ID3v2::PodcastFrame)); @@ -211,18 +211,18 @@ public: CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::IT::File)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::IT::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::List)); - CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::CoverArt)); + CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::CoverArt)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::File)); - CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Item)); + CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MP4::Item)); CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::MP4::ItemFactory)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MP4::Tag)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::File)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPC::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::File)); - CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::Header)); + CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::MPEG::Header)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::MPEG::Properties)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::MPEG::XingHeader)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::MPEG::XingHeader)); CPPUNIT_ASSERT_EQUAL(classSize(1, false), sizeof(TagLib::Map)); CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Mod::File)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Mod::FileBase)); @@ -232,8 +232,8 @@ public: CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::File)); CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Opus::File)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Opus::Properties)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Ogg::Page)); - CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::Ogg::PageHeader)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Ogg::Page)); + CPPUNIT_ASSERT_EQUAL(classSize(0, false), sizeof(TagLib::Ogg::PageHeader)); CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Speex::File)); CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::Ogg::Speex::Properties)); CPPUNIT_ASSERT_EQUAL(classSize(2, true), sizeof(TagLib::Ogg::Vorbis::File));