From 7d0a651f3e1569f554d709c067798df1981c5c8f Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu <tsuda.kageyu@gmail.com> Date: Fri, 20 Nov 2015 14:18:23 +0900 Subject: [PATCH] Revert "Use always "COMMENT" field when updating XiphComment." This reverts commit ba5137bf2d3b1bcca9269e3a7f5f194243c87d23. --- taglib/ogg/xiphcomment.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/taglib/ogg/xiphcomment.cpp b/taglib/ogg/xiphcomment.cpp index 5630d25b..39903b04 100644 --- a/taglib/ogg/xiphcomment.cpp +++ b/taglib/ogg/xiphcomment.cpp @@ -36,6 +36,7 @@ class Ogg::XiphComment::XiphCommentPrivate public: FieldListMap fieldListMap; String vendorID; + String commentField; }; //////////////////////////////////////////////////////////////////////////////// @@ -81,10 +82,16 @@ String Ogg::XiphComment::album() const String Ogg::XiphComment::comment() const { - if(!d->fieldListMap["COMMENT"].isEmpty()) - return d->fieldListMap["COMMENT"].toString(); - if(!d->fieldListMap["DESCRIPTION"].isEmpty()) + if(!d->fieldListMap["DESCRIPTION"].isEmpty()) { + d->commentField = "DESCRIPTION"; return d->fieldListMap["DESCRIPTION"].toString(); + } + + if(!d->fieldListMap["COMMENT"].isEmpty()) { + d->commentField = "COMMENT"; + return d->fieldListMap["COMMENT"].toString(); + } + return String::null; } @@ -130,8 +137,14 @@ void Ogg::XiphComment::setAlbum(const String &s) void Ogg::XiphComment::setComment(const String &s) { - removeField("DESCRIPTION"); - addField("COMMENT", s); + if(d->commentField.isEmpty()) { + if(!d->fieldListMap["DESCRIPTION"].isEmpty()) + d->commentField = "DESCRIPTION"; + else + d->commentField = "COMMENT"; + } + + addField(d->commentField, s); } void Ogg::XiphComment::setGenre(const String &s) -- 2.40.0