Use qUtf8Printable() for logging strings

qDebug(), qInfo(), qWarning(), qCritical(), qFatal() expect %s arguments
to be UTF-8 encoded, while qPrintable() converts to local 8-bit encoding.
Therefore qUtf8Printable() should be used for logging strings instead of
qPrintable().
This commit is contained in:
Vladimir Golovnev (qlassez) 2017-08-13 13:56:03 +03:00
parent 219a6b3ad1
commit cff6a64e9f
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
28 changed files with 100 additions and 99 deletions

View file

@ -476,7 +476,7 @@ void AddNewTorrentDialog::renameSelectedFile()
const QString newFilePath = oldFilePath.leftRef(oldFilePath.size() - oldFileName.size()) + newName;
if (oldFileName == newName) {
qDebug("Name did not change: %s", qPrintable(oldFileName));
qDebug("Name did not change: %s", qUtf8Printable(oldFileName));
return;
}
@ -491,7 +491,7 @@ void AddNewTorrentDialog::renameSelectedFile()
}
}
qDebug("Renaming %s to %s", qPrintable(oldFilePath), qPrintable(newFilePath));
qDebug("Renaming %s to %s", qUtf8Printable(oldFilePath), qUtf8Printable(newFilePath));
m_torrentInfo.renameFile(fileIndex, newFilePath);
m_contentModel->setData(modelIndex, newName);
@ -535,7 +535,7 @@ void AddNewTorrentDialog::renameSelectedFile()
QString newName = currentName;
newName.replace(0, oldPath.length(), newPath);
newName = Utils::Fs::expandPath(newName);
qDebug("Rename %s to %s", qPrintable(currentName), qPrintable(newName));
qDebug("Rename %s to %s", qUtf8Printable(currentName), qUtf8Printable(newName));
m_torrentInfo.renameFile(i, newName);
}
}