From kde-commits Fri Sep 28 20:48:25 2018 From: Alexander Stippich Date: Fri, 28 Sep 2018 20:48:25 +0000 To: kde-commits Subject: [kfilemetadata] src/writers: remove own implementation of QString to TString conversion for taglibwr Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=153816869726623 Git commit c413d83851c5e3726c2eb087c4685bdd390851f6 by Alexander Stippich. Committed on 28/09/2018 at 20:48. Pushed by astippich into branch 'master'. remove own implementation of QString to TString conversion for taglibwriter Summary: as pointed out in D13700, the custom function for conversion of taglib stri= ng to QString is unsafe and will break if size(wchar) =3D=3D 4 bytes. Use the = function provided by taglib for the conversion to TString. See also D15614 Test Plan: tests pass Reviewers: mgallien, bruns, svuorela Reviewed By: bruns Subscribers: kde-frameworks-devel, #baloo Tags: #frameworks, #baloo Differential Revision: https://phabricator.kde.org/D15715 M +5 -10 src/writers/taglibwriter.cpp https://commits.kde.org/kfilemetadata/c413d83851c5e3726c2eb087c4685bdd39085= 1f6 diff --git a/src/writers/taglibwriter.cpp b/src/writers/taglibwriter.cpp index f811ea6..d48d034 100644 --- a/src/writers/taglibwriter.cpp +++ b/src/writers/taglibwriter.cpp @@ -12,11 +12,6 @@ TagLibWriter::TagLibWriter(QObject* parent) { } = -TagLib::String q2t(const QString& q) -{ - return TagLib::String(q.toStdWString()); -} - QStringList TagLibWriter::writeMimetypes() const { QStringList types =3D { @@ -54,17 +49,17 @@ void TagLibWriter::write(const WriteData& data) TagLib::String comment; = if (properties.contains(Property::Title)) { - title =3D q2t(properties.value(Property::Title).toString()); + title =3D QStringToTString(properties.value(Property::Title).toStr= ing()); tags->setTitle(title); } = if (properties.contains(Property::Artist)) { - artist =3D q2t(properties.value(Property::Artist).toString()); + artist =3D QStringToTString(properties.value(Property::Artist).toS= tring()); tags->setArtist(artist); } = if (properties.contains(Property::Album)) { - album =3D q2t(properties.value(Property::Album).toString()); + album =3D QStringToTString(properties.value(Property::Album).toStr= ing()); tags->setAlbum(album); } = @@ -85,12 +80,12 @@ void TagLibWriter::write(const WriteData& data) } = if (properties.contains(Property::Genre)) { - genre =3D q2t(properties.value(Property::Genre).toString()); + genre =3D QStringToTString(properties.value(Property::Genre).toStr= ing()); tags->setGenre(genre); } = if (properties.contains(Property::Comment)) { - comment =3D q2t(properties.value(Property::Comment).toString()); + comment =3D QStringToTString(properties.value(Property::Comment).t= oString()); tags->setComment(comment); } =20