From ae633105d64067ac6562f37108c19e77be5ce0d5 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Sun, 22 Nov 2015 19:43:17 +0900 Subject: [PATCH] Fix an instance reference to a static data member. --- taglib/ape/apefooter.cpp | 38 +++++++++++++++---------------- taglib/mpeg/id3v2/id3v2footer.cpp | 19 +++++++--------- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/taglib/ape/apefooter.cpp b/taglib/ape/apefooter.cpp index 539832ba..c9880cdd 100644 --- a/taglib/ape/apefooter.cpp +++ b/taglib/ape/apefooter.cpp @@ -38,14 +38,13 @@ using namespace APE; class APE::Footer::FooterPrivate { public: - FooterPrivate() : version(0), - footerPresent(true), - headerPresent(false), - isHeader(false), - itemCount(0), - tagSize(0) {} - - ~FooterPrivate() {} + FooterPrivate() : + version(0), + footerPresent(true), + headerPresent(false), + isHeader(false), + itemCount(0), + tagSize(0) {} uint version; @@ -56,8 +55,6 @@ public: uint itemCount; uint tagSize; - - static const uint size = 32; }; //////////////////////////////////////////////////////////////////////////////// @@ -66,26 +63,26 @@ public: TagLib::uint APE::Footer::size() { - return FooterPrivate::size; + return 32; } ByteVector APE::Footer::fileIdentifier() { - return ByteVector::fromCString("APETAGEX"); + return ByteVector("APETAGEX"); } //////////////////////////////////////////////////////////////////////////////// // public members //////////////////////////////////////////////////////////////////////////////// -APE::Footer::Footer() +APE::Footer::Footer() : + d(new FooterPrivate()) { - d = new FooterPrivate; } -APE::Footer::Footer(const ByteVector &data) +APE::Footer::Footer(const ByteVector &data) : + d(new FooterPrivate()) { - d = new FooterPrivate; parse(data); } @@ -137,7 +134,7 @@ TagLib::uint APE::Footer::tagSize() const TagLib::uint APE::Footer::completeTagSize() const { if(d->headerPresent) - return d->tagSize + d->size; + return d->tagSize + size(); else return d->tagSize; } @@ -154,13 +151,14 @@ void APE::Footer::setData(const ByteVector &data) ByteVector APE::Footer::renderFooter() const { - return render(false); + return render(false); } ByteVector APE::Footer::renderHeader() const { - if (!d->headerPresent) return ByteVector(); - + if(!d->headerPresent) + return ByteVector(); + else return render(true); } diff --git a/taglib/mpeg/id3v2/id3v2footer.cpp b/taglib/mpeg/id3v2/id3v2footer.cpp index defbb17e..abbe054b 100644 --- a/taglib/mpeg/id3v2/id3v2footer.cpp +++ b/taglib/mpeg/id3v2/id3v2footer.cpp @@ -31,30 +31,27 @@ using namespace ID3v2; class Footer::FooterPrivate { -public: - static const uint size = 10; }; -Footer::Footer() +Footer::Footer() : + d(0) { - } Footer::~Footer() { - } TagLib::uint Footer::size() { - return FooterPrivate::size; + return 10; } ByteVector Footer::render(const Header *header) const { - ByteVector headerData = header->render(); - headerData[0] = '3'; - headerData[1] = 'D'; - headerData[2] = 'I'; - return headerData; + ByteVector headerData = header->render(); + headerData[0] = '3'; + headerData[1] = 'D'; + headerData[2] = 'I'; + return headerData; }