]> granicus.if.org Git - taglib/commitdiff
Use always "COMMENT" field when updating XiphComment.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 12 Nov 2015 08:37:22 +0000 (17:37 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Thu, 12 Nov 2015 08:37:22 +0000 (17:37 +0900)
The recommended field name for additional comments is "COMMENT".
It's the same behavior as "DATE" or "TRACKNUMBER" field.

taglib/ogg/xiphcomment.cpp

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