From 32a4ac6599169ca84563b56bd081ef4c48ceb299 Mon Sep 17 00:00:00 2001 From: "Stephen F. Booth" Date: Tue, 10 Apr 2012 18:06:58 -0400 Subject: [PATCH] Preserve source code backward compatibility --- taglib/ape/apeitem.cpp | 10 +++++++--- taglib/ape/apeitem.h | 5 +++-- taglib/ape/apetag.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/taglib/ape/apeitem.cpp b/taglib/ape/apeitem.cpp index 52e0f064..1e60bc52 100644 --- a/taglib/ape/apeitem.cpp +++ b/taglib/ape/apeitem.cpp @@ -62,12 +62,16 @@ APE::Item::Item(const String &key, const StringList &values) d->text = values; } -APE::Item::Item(const String &key, const ByteVector &value) +APE::Item::Item(const String &key, const ByteVector &value, bool binary) { d = new ItemPrivate; - d->type = Binary; d->key = key; - d->value = value; + if(binary) { + d->type = Binary; + d->value = value; + } + else + d->text.append(value); } APE::Item::Item(const Item &item) diff --git a/taglib/ape/apeitem.h b/taglib/ape/apeitem.h index a4280170..f7fd05e3 100644 --- a/taglib/ape/apeitem.h +++ b/taglib/ape/apeitem.h @@ -70,9 +70,10 @@ namespace TagLib { Item(const String &key, const StringList &values); /*! - * Constructs a binary item with \a key and \a value. + * Constructs an item with \a key and \a value. + * If \a binary is true a Binary item will be created, otherwise \a value will be interpreted as text */ - Item(const String &key, const ByteVector &value); + Item(const String &key, const ByteVector &value, bool binary); /*! * Construct an item as a copy of \a item. diff --git a/taglib/ape/apetag.cpp b/taglib/ape/apetag.cpp index e925235e..0676c9b6 100644 --- a/taglib/ape/apetag.cpp +++ b/taglib/ape/apetag.cpp @@ -294,7 +294,7 @@ void APE::Tag::setData(const String &key, const ByteVector &value) { removeItem(key); if(!key.isEmpty() && !value.isEmpty()) - setItem(key, Item(key, value)); + setItem(key, Item(key, value, true)); } void APE::Tag::setItem(const String &key, const Item &item)