[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/taglib
From:       Scott Wheeler <wheeler () kde ! org>
Date:       2005-04-03 16:35:56
Message-ID: 20050403163556.07E1F637 () office ! kde ! org
[Download RAW message or body]

CVS commit by wheeler: 

fix memory leaks


  M +5 -0      ape/apeitem.cpp   1.12
  M +5 -0      ape/apeitem.h   1.6
  M +2 -0      examples/Makefile.am   1.8
  M +54 -33    examples/framelist.cpp   1.3
  M +6 -3      mpc/mpcfile.cpp   1.11


--- kdesupport/taglib/ape/apeitem.cpp  #1.11:1.12
@@ -63,4 +63,9 @@ APE::Item::Item(const Item &item)
 }
 
+APE::Item::~Item()
+{
+  delete d;
+}
+
 Item &APE::Item::operator=(const Item &item)
 {

--- kdesupport/taglib/ape/apeitem.h  #1.5:1.6
@@ -71,4 +71,9 @@ namespace TagLib {
 
       /*!
+       * Destroys the item.
+       */
+      virtual ~Item();
+
+      /*!
        * Copies the contents of \a item into this item.
        */

--- kdesupport/taglib/examples/Makefile.am  #1.7:1.8
@@ -12,4 +12,6 @@
         -I$(top_srcdir)/taglib/mpeg/id3v1 \
         -I$(top_srcdir)/taglib/mpeg/id3v2 \
+        -I$(top_srcdir)/taglib/ogg \
+        -I$(top_srcdir)/taglib/ogg/vorbis \
         -I$(top_srcdir)/taglib/bindings/c
 

--- kdesupport/taglib/examples/framelist.cpp  #1.2:1.3
@@ -28,4 +28,5 @@
 
 #include <tbytevector.h>
+#include <fileref.h>
 
 #include <mpegfile.h>
@@ -37,4 +38,7 @@
 #include <id3v1tag.h>
 
+#include <vorbisfile.h>
+#include <xiphcomment.h>
+
 using namespace std;
 using namespace TagLib;
@@ -49,7 +52,10 @@ int main(int argc, char *argv[])
     cout << "******************** \"" << argv[i] << "\"********************" << endl;
 
-    MPEG::File f(argv[i]);
+    FileRef file(argv[i]);
 
-    ID3v2::Tag *id3v2tag = f.ID3v2Tag();
+    if(dynamic_cast<MPEG::File *>(file.file())) {
+      MPEG::File *f = static_cast<MPEG::File *>(file.file());
+
+      ID3v2::Tag *id3v2tag = f->ID3v2Tag();
 
     if(id3v2tag) {
@@ -73,5 +79,5 @@ int main(int argc, char *argv[])
     cout << endl << "ID3v1" << endl;
 
-    ID3v1::Tag *id3v1tag = f.ID3v1Tag();
+      ID3v1::Tag *id3v1tag = f->ID3v1Tag();
 
     if(id3v1tag) {
@@ -87,4 +93,19 @@ int main(int argc, char *argv[])
       cout << "file does not have a valid id3v1 tag" << endl;
 
+    }
+    else if(dynamic_cast<Ogg::Vorbis::File *>(file.file())) {
+      Ogg::Vorbis::File *f = static_cast<Ogg::Vorbis::File *>(file.file());
+      Ogg::XiphComment *tag = f->tag();
+
+      const Ogg::FieldListMap fields = tag->fieldListMap();
+      for(Ogg::FieldListMap::ConstIterator it = fields.begin(); it != fields.end(); ++it) {
+        cout << (*it).first << " -";
+        StringList values = (*it).second;
+        for(StringList::ConstIterator valueIt = values.begin(); valueIt != values.end(); ++valueIt)
+          cout << " \"" << *valueIt << '"';
+        cout << endl;
+      }
+    }
+    
     cout << endl;
   }

--- kdesupport/taglib/mpc/mpcfile.cpp  #1.10:1.11
@@ -55,4 +55,7 @@ public:
   {
     delete ID3v1Tag;
+    delete APETag;
+    delete tag;
+    delete ID3v2Header;
     delete properties;
   }
@@ -228,5 +231,5 @@ void MPC::File::remove(int tags)
       d->tag = d->APETag;
     else
-      d->tag = d->APETag = new APE::Tag();
+      d->tag = d->APETag = new APE::Tag;
   }
 
@@ -243,5 +246,5 @@ void MPC::File::remove(int tags)
       d->tag = d->ID3v1Tag;
     else
-      d->tag = d->APETag = new APE::Tag();
+      d->tag = d->APETag = new APE::Tag;
   }
 }
@@ -285,5 +288,5 @@ void MPC::File::read(bool readProperties
         d->tag = d->APETag;
       else
-        d->tag = d->APETag = new APE::Tag();
+        d->tag = d->APETag = new APE::Tag;
     }
   }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic