diff --git a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp index f45792db..4630c6f9 100644 --- a/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp +++ b/taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp @@ -50,30 +50,6 @@ public: FrameList embeddedFrameList; }; -namespace { - - // These functions are needed to try to aim for backward compatibility with - // an API that previously (unreasonably) required null bytes to be appended - // at the end of identifiers explicitly by the API user. - - // BIC: remove these - - ByteVector &strip(ByteVector &b) - { - if(b.endsWith('\0')) - b.resize(b.size() - 1); - return b; - } - - ByteVectorList &strip(ByteVectorList &l) - { - for(auto &v : l) { - strip(v); - } - return l; - } -} // namespace - //////////////////////////////////////////////////////////////////////////////// // public methods //////////////////////////////////////////////////////////////////////////////// @@ -93,7 +69,6 @@ TableOfContentsFrame::TableOfContentsFrame(const ByteVector &elementID, d(std::make_unique()) { d->elementID = elementID; - strip(d->elementID); d->childElements = children; for(const auto &frame : embeddedFrames) @@ -130,7 +105,6 @@ ByteVectorList TableOfContentsFrame::childElements() const void TableOfContentsFrame::setElementID(const ByteVector &eID) { d->elementID = eID; - strip(d->elementID); } void TableOfContentsFrame::setIsTopLevel(const bool &t) @@ -146,13 +120,11 @@ void TableOfContentsFrame::setIsOrdered(const bool &o) void TableOfContentsFrame::setChildElements(const ByteVectorList &l) { d->childElements = l; - strip(d->childElements); } void TableOfContentsFrame::addChildElement(const ByteVector &cE) { d->childElements.append(cE); - strip(d->childElements); } void TableOfContentsFrame::removeChildElement(const ByteVector &cE) diff --git a/taglib/mpeg/id3v2/frames/tableofcontentsframe.h b/taglib/mpeg/id3v2/frames/tableofcontentsframe.h index 5ed2b86f..9d895e54 100644 --- a/taglib/mpeg/id3v2/frames/tableofcontentsframe.h +++ b/taglib/mpeg/id3v2/frames/tableofcontentsframe.h @@ -70,8 +70,8 @@ namespace TagLib { TableOfContentsFrame &operator=(const TableOfContentsFrame &) = delete; /*! - * Returns the elementID of the frame. Element ID - * is a null terminated string, however it's not human-readable. + * Returns the elementID of the frame. + * Element ID is not intended to be human readable. * * \see setElementID() */ @@ -109,8 +109,7 @@ namespace TagLib { ByteVectorList childElements() const; /*! - * Sets the elementID of the frame to \a eID. If \a eID isn't - * null terminated, a null char is appended automatically. + * Sets the elementID of the frame to \a eID. * * \see elementID() */ diff --git a/tests/test_id3v2.cpp b/tests/test_id3v2.cpp index 7b72e1fa..d16748f1 100644 --- a/tests/test_id3v2.cpp +++ b/tests/test_id3v2.cpp @@ -1533,11 +1533,11 @@ public: { ID3v2::Header header; ID3v2::TableOfContentsFrame f(&header, "CTOC"); - f.setElementID(ByteVector("\x54\x00", 2)); + f.setElementID("T"); f.setIsTopLevel(false); f.setIsOrdered(true); - f.addChildElement(ByteVector("\x43\x00", 2)); - f.addChildElement(ByteVector("\x44\x00", 2)); + f.addChildElement("C"); + f.addChildElement("D"); auto eF = new ID3v2::TextIdentificationFrame("TIT2"); eF->setText("TC1"); f.addEmbeddedFrame(eF);