if (tag2->frameListMap()[frameID].isEmpty()) {
metadata_editor_info("The frame %s does not exist. Creating", frameID);
// This is a common frame type for textural frames except comment frame
- TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
- metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ auto fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
fr->setTextEncoding(TagLib::String::UTF8);
fr->setText(TagLib::String(value, TagLib::String::UTF8));
if (tag2->frameListMap()[frameID].isEmpty()) {
metadata_editor_info("The frame %s does not exist. Creating", frameID);
// This is a common frame type for textural frames except comment frame
- TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
- metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ auto fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
fr->setTextEncoding(TagLib::String::UTF8);
fr->setText(TagLib::String(value, TagLib::String::UTF8));
metadata_editor_info("The frame USLT exists");
TagLib::ID3v2::FrameList::Iterator it = lst.begin();
- TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
+ auto frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
TagLib::String str = frame->text();
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
// If the comment frame is empty - create the frame and add it to the list
if (tag2->frameListMap()["COMM"].isEmpty()) {
metadata_editor_info("The frame COMM does not exist. Creating");
- TagLib::ID3v2::CommentsFrame* fr = new TagLib::ID3v2::CommentsFrame;
- metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ auto fr = new TagLib::ID3v2::CommentsFrame;
+
fr->setText(TagLib::String(value, TagLib::String::UTF8));
fr->setTextEncoding(TagLib::String::UTF8);
tag2->addFrame(fr);
if (lst.isEmpty()) {
// No lyrics - create the frame and add it to the ID3v2 tag
metadata_editor_info("The frame USLT does not exist. Creating");
- TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame;
- metadata_editor_retvm_if(frame == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
+ auto frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame;
frame->setTextEncoding(TagLib::String::UTF8);
frame->setText(TagLib::String(value, TagLib::String::UTF8));
} else { // the lyrics frames exist - change the existing one
metadata_editor_info("USLT frames exist in file. Changing");
TagLib::ID3v2::FrameList::Iterator it = lst.begin();
- TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
+ auto frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
frame->setTextEncoding(TagLib::String::UTF8);
frame->setText(TagLib::String(value, TagLib::String::UTF8));
}