]> granicus.if.org Git - taglib/commitdiff
Revert "Use always "COMMENT" field when updating XiphComment."
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Fri, 20 Nov 2015 05:18:23 +0000 (14:18 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Fri, 20 Nov 2015 05:18:23 +0000 (14:18 +0900)
This reverts commit ba5137bf2d3b1bcca9269e3a7f5f194243c87d23.

taglib/ogg/xiphcomment.cpp

index 5630d25b3ada5acf8c309e645afb83244a4c6d14..39903b04ac4afa2baaaec6747ca73421709f61f9 100644 (file)
@@ -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)