]> granicus.if.org Git - taglib/commitdiff
Remove some private data members not needed to be carried.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Mon, 30 Nov 2015 03:35:29 +0000 (12:35 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Mon, 30 Nov 2015 03:35:29 +0000 (12:35 +0900)
taglib/mpeg/id3v1/id3v1tag.cpp
taglib/mpeg/id3v1/id3v1tag.h

index f4004184ff17f95f4f3e0e7fde184dc552427cd9..4a7d50d62acc72719aed797c6b55247771b3bd9a 100644 (file)
@@ -35,10 +35,9 @@ using namespace ID3v1;
 class ID3v1::Tag::TagPrivate
 {
 public:
-  TagPrivate() : file(0), tagOffset(-1), track(0), genre(255) {}
-
-  File *file;
-  long tagOffset;
+  TagPrivate() :
+    track(0),
+    genre(255) {}
 
   String title;
   String artist;
@@ -81,18 +80,17 @@ ByteVector ID3v1::StringHandler::render(const String &s) const
 // public methods
 ////////////////////////////////////////////////////////////////////////////////
 
-ID3v1::Tag::Tag() : TagLib::Tag()
+ID3v1::Tag::Tag() :
+  TagLib::Tag(),
+  d(new TagPrivate())
 {
-  d = new TagPrivate;
 }
 
-ID3v1::Tag::Tag(File *file, long tagOffset) : TagLib::Tag()
+ID3v1::Tag::Tag(File *file, long tagOffset) :
+  TagLib::Tag(),
+  d(new TagPrivate())
 {
-  d = new TagPrivate;
-  d->file = file;
-  d->tagOffset = tagOffset;
-
-  read();
+  read(file, tagOffset);
 }
 
 ID3v1::Tag::~Tag()
@@ -214,12 +212,12 @@ void ID3v1::Tag::setStringHandler(const StringHandler *handler)
 // protected methods
 ////////////////////////////////////////////////////////////////////////////////
 
-void ID3v1::Tag::read()
+void ID3v1::Tag::read(File *file, long tagOffset)
 {
-  if(d->file && d->file->isValid()) {
-    d->file->seek(d->tagOffset);
+  if(file && file->isValid()) {
+    file->seek(tagOffset);
     // read the tag -- always 128 bytes
-    ByteVector data = d->file->readBlock(128);
+    const ByteVector data = file->readBlock(128);
 
     // some initial sanity checking
     if(data.size() == 128 && data.startsWith("TAG"))
index 4cba00dbf29a0a11db1c83f9ae436dfc68fec8f0..02642ca56562798d6d7cb32a3b0af42b0f6373b2 100644 (file)
@@ -183,7 +183,7 @@ namespace TagLib {
       /*!
        * Reads from the file specified in the constructor.
        */
-      void read();
+      void read(File *file, long tagOffset);
       /*!
        * Pareses the body of the tag in \a data.
        */