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
committed by sledgehammer999
parent 0b6cf54508
commit 8fc931a61b
28 changed files with 100 additions and 99 deletions

View File

@@ -143,7 +143,7 @@ Http::Response AbstractWebApplication::processRequest(const Http::Request &reque
void AbstractWebApplication::UnbanTimerEvent()
{
UnbanTimer* ubantimer = static_cast<UnbanTimer*>(sender());
qDebug("Ban period has expired for %s", qPrintable(ubantimer->peerIp().toString()));
qDebug("Ban period has expired for %s", qUtf8Printable(ubantimer->peerIp().toString()));
clientFailedAttempts_.remove(ubantimer->peerIp());
ubantimer->deleteLater();
}
@@ -201,7 +201,7 @@ bool AbstractWebApplication::readFile(const QString& path, QByteArray &data, QSt
else {
QFile file(path);
if (!file.open(QIODevice::ReadOnly)) {
qDebug("File %s was not found!", qPrintable(path));
qDebug("File %s was not found!", qUtf8Printable(path));
return false;
}