From ba5137bf2d3b1bcca9269e3a7f5f194243c87d23 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 12 Nov 2015 17:37:22 +0900 Subject: [PATCH] Use always "COMMENT" field when updating XiphComment. The recommended field name for additional comments is "COMMENT". It's the same behavior as "DATE" or "TRACKNUMBER" field. --- taglib/ogg/xiphcomment.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/taglib/ogg/xiphcomment.cpp b/taglib/ogg/xiphcomment.cpp index 39903b04..5630d25b 100644 --- a/taglib/ogg/xiphcomment.cpp +++ b/taglib/ogg/xiphcomment.cpp @@ -36,7 +36,6 @@ class Ogg::XiphComment::XiphCommentPrivate public: FieldListMap fieldListMap; String vendorID; - String commentField; }; //////////////////////////////////////////////////////////////////////////////// @@ -82,16 +81,10 @@ String Ogg::XiphComment::album() const String Ogg::XiphComment::comment() const { - if(!d->fieldListMap["DESCRIPTION"].isEmpty()) { - d->commentField = "DESCRIPTION"; - return d->fieldListMap["DESCRIPTION"].toString(); - } - - if(!d->fieldListMap["COMMENT"].isEmpty()) { - d->commentField = "COMMENT"; + if(!d->fieldListMap["COMMENT"].isEmpty()) return d->fieldListMap["COMMENT"].toString(); - } - + if(!d->fieldListMap["DESCRIPTION"].isEmpty()) + return d->fieldListMap["DESCRIPTION"].toString(); return String::null; } @@ -137,14 +130,8 @@ void Ogg::XiphComment::setAlbum(const String &s) void Ogg::XiphComment::setComment(const String &s) { - if(d->commentField.isEmpty()) { - if(!d->fieldListMap["DESCRIPTION"].isEmpty()) - d->commentField = "DESCRIPTION"; - else - d->commentField = "COMMENT"; - } - - addField(d->commentField, s); + removeField("DESCRIPTION"); + addField("COMMENT", s); } void Ogg::XiphComment::setGenre(const String &s)