Just the same way as WAV already does.
* Added String::clear().
* Added alternative functions to XiphComment::removeField().
* Better handling of duplicate ID3v2 tags in all kinds of files.
- * Better handling of duplicate tags in WAV files.
+ * Better handling of duplicate tag chunks in WAV files.
+ * Better handling of duplicate tag chunks in AIFF files.
* Fixed crash when calling File::properties() after strip().
* Fixed possible file corruptions when saving ASF files.
* Fixed updating the comment field of Vorbis comments.
FilePrivate() :
properties(0),
tag(0),
- tagChunkID("ID3 "),
hasID3v2(false) {}
~FilePrivate()
Properties *properties;
ID3v2::Tag *tag;
- ByteVector tagChunkID;
bool hasID3v2;
};
return false;
}
- setChunkData(d->tagChunkID, d->tag->render());
+ removeChunk("ID3 ");
+ removeChunk("id3 ");
+
+ setChunkData("ID3 ", d->tag->render());
d->hasID3v2 = true;
return true;
if(name == "ID3 " || name == "id3 ") {
if(!d->tag) {
d->tag = new ID3v2::Tag(this, chunkOffset(i));
- d->tagChunkID = name;
d->hasID3v2 = true;
}
else {
void testDuplicateID3v2()
{
- RIFF::AIFF::File f(TEST_FILE_PATH_C("duplicate_id3v2.aiff"));
+ ScopedFileCopy copy("duplicate_id3v2", ".aiff");
- // duplicate_id3v2.aiff has duplicate ID3v2 tags.
+ // duplicate_id3v2.aiff has duplicate ID3v2 tag chunks.
// title() returns "Title2" if can't skip the second tag.
+ RIFF::AIFF::File f(copy.fileName().c_str());
CPPUNIT_ASSERT(f.hasID3v2Tag());
CPPUNIT_ASSERT_EQUAL(String("Title1"), f.tag()->title());
+
+ f.save();
+ CPPUNIT_ASSERT_EQUAL(7030L, f.length());
+ CPPUNIT_ASSERT_EQUAL(-1L, f.find("Title2"));
}
void testFuzzedFile1()