Remove deprecated (and now internally unused) createFrame declarations

This also finally marks this method as virtual, which has been a long standing
bug in TagLib 1
This commit is contained in:
Scott Wheeler 2014-09-25 20:48:30 +02:00
parent e1b5e2c9c3
commit 87040570c0
3 changed files with 16 additions and 40 deletions

View File

@ -81,19 +81,7 @@ FrameFactory *FrameFactory::instance()
return &factory;
}
Frame *FrameFactory::createFrame(const ByteVector &data, bool synchSafeInts) const
{
return createFrame(data, uint(synchSafeInts ? 4 : 3));
}
Frame *FrameFactory::createFrame(const ByteVector &data, uint version) const
{
Header tagHeader;
tagHeader.setMajorVersion(version);
return createFrame(data, &tagHeader);
}
Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader) const
Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHeader) const
{
ByteVector data = origData;
uint version = tagHeader->majorVersion();

View File

@ -66,32 +66,11 @@ namespace TagLib {
{
public:
static FrameFactory *instance();
/*!
* Create a frame based on \a data. \a synchSafeInts should only be set
* false if we are parsing an old tag (v2.3 or older) that does not support
* synchsafe ints.
*
* \deprecated Please use the method below that accepts a ID3v2::Header
* instance in new code.
*/
Frame *createFrame(const ByteVector &data, bool synchSafeInts) const;
/*!
* Create a frame based on \a data. \a version should indicate the ID3v2
* version of the tag. As ID3v2.4 is the most current version of the
* standard 4 is the default.
*
* \deprecated Please use the method below that accepts a ID3v2::Header
* instance in new code.
*/
Frame *createFrame(const ByteVector &data, uint version = 4) const;
/*!
* Create a frame based on \a data. \a tagHeader should be a valid
* ID3v2::Header instance.
*/
// BIC: make virtual
Frame *createFrame(const ByteVector &data, Header *tagHeader) const;
virtual Frame *createFrame(const ByteVector &data, const Header *tagHeader) const;
/*!
* Returns the default text encoding for text frames. If setTextEncoding()

View File

@ -202,8 +202,10 @@ public:
"\x01"
"d\x00"
"\x00", 18);
ID3v2::Header header;
header.setMajorVersion(2);
ID3v2::AttachedPictureFrame *frame =
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, TagLib::uint(2)));
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, &header));
CPPUNIT_ASSERT(frame);
CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), frame->mimeType());
@ -223,8 +225,10 @@ public:
"\x01"
"d\x00"
"\x00", 18);
ID3v2::Header header;
header.setMajorVersion(2);
ID3v2::AttachedPictureFrame *frame =
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, TagLib::uint(2)));
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, &header));
CPPUNIT_ASSERT(frame);
@ -587,8 +591,10 @@ public:
"\x00\x00" // Frame flags
"\x00" // Encoding
"(22)Death Metal", 26); // Text
ID3v2::Header header;
header.setMajorVersion(3);
ID3v2::TextIdentificationFrame *frame =
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, TagLib::uint(3)));
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
CPPUNIT_ASSERT_EQUAL(size_t(1), frame->fieldList().size());
CPPUNIT_ASSERT_EQUAL(String("Death Metal"), frame->fieldList()[0]);
@ -606,8 +612,10 @@ public:
"\x00\x00" // Frame flags
"\x00" // Encoding
"(4)Eurodisco", 23); // Text
ID3v2::Header header;
header.setMajorVersion(3);
ID3v2::TextIdentificationFrame *frame =
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, TagLib::uint(3)));
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
CPPUNIT_ASSERT_EQUAL(size_t(2), frame->fieldList().size());
CPPUNIT_ASSERT_EQUAL(String("4"), frame->fieldList()[0]);
CPPUNIT_ASSERT_EQUAL(String("Eurodisco"), frame->fieldList()[1]);
@ -625,8 +633,9 @@ public:
"\x00\x00" // Frame flags
"\0" // Encoding
"14\0Eurodisco", 23); // Text
ID3v2::Header header;
ID3v2::TextIdentificationFrame *frame =
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, TagLib::uint(4)));
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
CPPUNIT_ASSERT_EQUAL(size_t(2), frame->fieldList().size());
CPPUNIT_ASSERT_EQUAL(String("14"), frame->fieldList()[0]);
CPPUNIT_ASSERT_EQUAL(String("Eurodisco"), frame->fieldList()[1]);