mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Don't save ID3v2.2 frames.
Patch by Marc Halbruegge BUG:176373 git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@994842 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
parent
0f11c5ab0c
commit
f7fc585665
@ -352,6 +352,11 @@ ByteVector ID3v2::Tag::render() const
|
||||
// Loop through the frames rendering them and adding them to the tagData.
|
||||
|
||||
for(FrameList::Iterator it = d->frameList.begin(); it != d->frameList.end(); it++) {
|
||||
if ((*it)->header()->frameID().size() != 4) {
|
||||
debug("A frame of unsupported or unknown type \'"
|
||||
+ String((*it)->header()->frameID()) + "\' has been discarded");
|
||||
continue;
|
||||
}
|
||||
if(!(*it)->header()->tagAlterPreservation())
|
||||
tagData.append((*it)->render());
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testParseAPIC);
|
||||
CPPUNIT_TEST(testParseAPIC_UTF16_BOM);
|
||||
CPPUNIT_TEST(testParseAPICv22);
|
||||
CPPUNIT_TEST(testDontRender22);
|
||||
CPPUNIT_TEST(testParseGEOB);
|
||||
CPPUNIT_TEST(testPOPMtoString);
|
||||
CPPUNIT_TEST(testParsePOPM);
|
||||
@ -152,6 +153,26 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(String("d"), frame->description());
|
||||
}
|
||||
|
||||
void testDontRender22()
|
||||
{
|
||||
ID3v2::FrameFactory *factory = ID3v2::FrameFactory::instance();
|
||||
ByteVector data = ByteVector("FOO"
|
||||
"\x00\x00\x08"
|
||||
"\x00"
|
||||
"JPG"
|
||||
"\x01"
|
||||
"d\x00"
|
||||
"\x00", 18);
|
||||
ID3v2::AttachedPictureFrame *frame =
|
||||
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, TagLib::uint(2)));
|
||||
|
||||
CPPUNIT_ASSERT(frame);
|
||||
|
||||
ID3v2::Tag tag;
|
||||
tag.addFrame(frame);
|
||||
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1034), tag.render().size());
|
||||
}
|
||||
|
||||
// http://bugs.kde.org/show_bug.cgi?id=151078
|
||||
void testParseGEOB()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user