]> granicus.if.org Git - taglib/commitdiff
Revert "Remove some private data members not needed to carry."
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 23 Aug 2015 09:21:51 +0000 (18:21 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 23 Aug 2015 09:21:51 +0000 (18:21 +0900)
This reverts commit 7c17d32b3a8bc3ed718af3790452fec33ebd307b.

taglib/ape/apetag.cpp
taglib/ape/apetag.h

index 00934dbb6524c370fa39fb56e01383cc16a1824d..e0c2a24e0c1cfc24c74b6300d60c5abecc4d40b1 100644 (file)
@@ -46,7 +46,14 @@ 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;
 };
 
@@ -54,17 +61,18 @@ public:
 // public methods
 ////////////////////////////////////////////////////////////////////////////////
 
-APE::Tag::Tag() :
-  TagLib::Tag(),
-  d(new TagPrivate())
+APE::Tag::Tag() : TagLib::Tag()
 {
+  d = new TagPrivate;
 }
 
-APE::Tag::Tag(TagLib::File *file, long footerLocation) :
-  TagLib::Tag(),
-  d(new TagPrivate())
+APE::Tag::Tag(TagLib::File *file, long footerLocation) : TagLib::Tag()
 {
-  read(file, footerLocation);
+  d = new TagPrivate;
+  d->file = file;
+  d->footerLocation = footerLocation;
+
+  read();
 }
 
 APE::Tag::~Tag()
@@ -319,19 +327,19 @@ bool APE::Tag::isEmpty() const
 // protected methods
 ////////////////////////////////////////////////////////////////////////////////
 
-void APE::Tag::read(TagLib::File *file, long footerLocation)
+void APE::Tag::read()
 {
-  if(file && file->isValid()) {
+  if(d->file && d->file->isValid()) {
 
-    file->seek(footerLocation);
-    d->footer.setData(file->readBlock(Footer::size()));
+    d->file->seek(d->footerLocation);
+    d->footer.setData(d->file->readBlock(Footer::size()));
 
     if(d->footer.tagSize() <= Footer::size() ||
-       d->footer.tagSize() > uint(file->length()))
+       d->footer.tagSize() > uint(d->file->length()))
       return;
 
-    file->seek(footerLocation + Footer::size() - d->footer.tagSize());
-    parse(file->readBlock(d->footer.tagSize() - Footer::size()));
+    d->file->seek(d->footerLocation + Footer::size() - d->footer.tagSize());
+    parse(d->file->readBlock(d->footer.tagSize() - Footer::size()));
   }
 }
 
index 6c9999cf24e2cb90fc03046427235b12861c93c5..55572612818cf672689e515565c15fa682b71378 100644 (file)
@@ -188,7 +188,7 @@ namespace TagLib {
       /*!
        * Reads from the file specified in the constructor.
        */
-      void read(TagLib::File *file, long footerLocation);
+      void read();
 
       /*!
        * Parses the body of the tag in \a data.