]> granicus.if.org Git - taglib/commitdiff
Accept both "ID3 " and "id3 " as valid ID3 chunk IDs in RIFF files
authorLukáš Lalinský <lalinsky@gmail.com>
Mon, 1 Nov 2010 16:32:37 +0000 (16:32 +0000)
committerLukáš Lalinský <lalinsky@gmail.com>
Mon, 1 Nov 2010 16:32:37 +0000 (16:32 +0000)
Patch by Stephen F. Booth

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1191982 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

taglib/riff/aiff/aifffile.cpp
taglib/riff/wav/wavfile.cpp

index 9bc5cd18961f70ab9d2df198b88f5f2417f5c1c6..70040e8eeabb1670a9a12adb19a20cd45c628287 100644 (file)
@@ -36,7 +36,8 @@ class RIFF::AIFF::File::FilePrivate
 public:
   FilePrivate() :
     properties(0),
-    tag(0)
+    tag(0),
+    tagChunkID("ID3 ")
   {
 
   }
@@ -49,6 +50,7 @@ public:
 
   Properties *properties;
   ID3v2::Tag *tag;
+  ByteVector tagChunkID;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -85,7 +87,7 @@ bool RIFF::AIFF::File::save()
     return false;
   }
 
-  setChunkData("ID3 ", d->tag->render());
+  setChunkData(d->tagChunkID, d->tag->render());
 
   return true;
 }
@@ -97,8 +99,10 @@ bool RIFF::AIFF::File::save()
 void RIFF::AIFF::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
 {
   for(uint i = 0; i < chunkCount(); i++) {
-    if(chunkName(i) == "ID3 ")
+    if(chunkName(i) == "ID3 " || chunkName(i) == "id3 ") {
+      d->tagChunkID = chunkName(i);
       d->tag = new ID3v2::Tag(this, chunkOffset(i));
+    }
     else if(chunkName(i) == "COMM" && readProperties)
       d->properties = new Properties(chunkData(i), propertiesStyle);
   }
index f323a27d31b7e293ec36f42d669e94cc1a3aace3..c4e62fa308b653c4611a863e6a4e71978b0bcbee 100644 (file)
@@ -36,7 +36,8 @@ class RIFF::WAV::File::FilePrivate
 public:
   FilePrivate() :
     properties(0),
-    tag(0)
+    tag(0),
+    tagChunkID("ID3 ")
   {
 
   }
@@ -49,6 +50,7 @@ public:
 
   Properties *properties;
   ID3v2::Tag *tag;
+  ByteVector tagChunkID;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -85,7 +87,7 @@ bool RIFF::WAV::File::save()
     return false;
   }
 
-  setChunkData("ID3 ", d->tag->render());
+  setChunkData(d->tagChunkID, d->tag->render());
 
   return true;
 }
@@ -99,8 +101,10 @@ void RIFF::WAV::File::read(bool readProperties, Properties::ReadStyle properties
   ByteVector formatData;
   uint streamLength = 0;
   for(uint i = 0; i < chunkCount(); i++) {
-    if(chunkName(i) == "ID3 ")
+    if(chunkName(i) == "ID3 " || chunkName(i) == "id3 ") {
+      d->tagChunkID = chunkName(i);
       d->tag = new ID3v2::Tag(this, chunkOffset(i));
+    }
     else if(chunkName(i) == "fmt " && readProperties)
       formatData = chunkData(i);
     else if(chunkName(i) == "data" && readProperties)