[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kfilemetadata] src/writers: remove own implementation of QString to TString conversion for taglibwr
From:       Alexander Stippich <null () kde ! org>
Date:       2018-09-28 20:48:25
Message-ID: E1g5zgX-0003Jr-6w () code ! kde ! org
[Download RAW message or body]

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 string
to QString is unsafe and will break if size(wchar) == 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/c413d83851c5e3726c2eb087c4685bdd390851f6

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 = {
@@ -54,17 +49,17 @@ void TagLibWriter::write(const WriteData& data)
     TagLib::String comment;
 
     if (properties.contains(Property::Title)) {
-        title = q2t(properties.value(Property::Title).toString());
+        title = QStringToTString(properties.value(Property::Title).toString());
         tags->setTitle(title);
     }
 
     if (properties.contains(Property::Artist)) {
-        artist = q2t(properties.value(Property::Artist).toString());
+        artist = QStringToTString(properties.value(Property::Artist).toString());
         tags->setArtist(artist);
     }
 
     if (properties.contains(Property::Album)) {
-        album = q2t(properties.value(Property::Album).toString());
+        album = QStringToTString(properties.value(Property::Album).toString());
         tags->setAlbum(album);
     }
 
@@ -85,12 +80,12 @@ void TagLibWriter::write(const WriteData& data)
     }
 
     if (properties.contains(Property::Genre)) {
-        genre = q2t(properties.value(Property::Genre).toString());
+        genre = QStringToTString(properties.value(Property::Genre).toString());
         tags->setGenre(genre);
     }
 
     if (properties.contains(Property::Comment)) {
-        comment = q2t(properties.value(Property::Comment).toString());
+        comment = QStringToTString(properties.value(Property::Comment).toString());
         tags->setComment(comment);
     }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic