From 7c17d32b3a8bc3ed718af3790452fec33ebd307b Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Wed, 5 Aug 2015 11:54:30 +0900 Subject: [PATCH] Remove some private data members not needed to carry. --- taglib/ape/apetag.cpp | 36 ++++++++++++++---------------------- taglib/ape/apetag.h | 2 +- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index e0c2a24e..00934dbb 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -46,14 +46,7 @@ using namespace APE; class APE::Tag::TagPrivate { public: - TagPrivate() : file(0), footerLocation(-1), tagLength(0) {} - - TagLib::File *file; - long footerLocation; - long tagLength; - Footer footer; - ItemListMap itemListMap; }; @@ -61,18 +54,17 @@ public: // public methods //////////////////////////////////////////////////////////////////////////////// -APE::Tag::Tag() : TagLib::Tag() +APE::Tag::Tag() : + TagLib::Tag(), + d(new TagPrivate()) { - d = new TagPrivate; } -APE::Tag::Tag(TagLib::File *file, long footerLocation) : TagLib::Tag() +APE::Tag::Tag(TagLib::File *file, long footerLocation) : + TagLib::Tag(), + d(new TagPrivate()) { - d = new TagPrivate; - d->file = file; - d->footerLocation = footerLocation; - - read(); + read(file, footerLocation); } APE::Tag::~Tag() @@ -327,19 +319,19 @@ bool APE::Tag::isEmpty() const // protected methods //////////////////////////////////////////////////////////////////////////////// -void APE::Tag::read() +void APE::Tag::read(TagLib::File *file, long footerLocation) { - if(d->file && d->file->isValid()) { + if(file && file->isValid()) { - d->file->seek(d->footerLocation); - d->footer.setData(d->file->readBlock(Footer::size())); + file->seek(footerLocation); + d->footer.setData(file->readBlock(Footer::size())); if(d->footer.tagSize() <= Footer::size() || - d->footer.tagSize() > uint(d->file->length())) + d->footer.tagSize() > uint(file->length())) return; - d->file->seek(d->footerLocation + Footer::size() - d->footer.tagSize()); - parse(d->file->readBlock(d->footer.tagSize() - Footer::size())); + file->seek(footerLocation + Footer::size() - d->footer.tagSize()); + parse(file->readBlock(d->footer.tagSize() - Footer::size())); } } diff --git a/taglib/ape/apetag.h b/taglib/ape/apetag.h index 55572612..6c9999cf 100644 --- a/taglib/ape/apetag.h +++ b/taglib/ape/apetag.h @@ -188,7 +188,7 @@ namespace TagLib { /*! * Reads from the file specified in the constructor. */ - void read(); + void read(TagLib::File *file, long footerLocation); /*! * Parses the body of the tag in \a data. -- 2.40.0