mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-30 12:18:05 -06:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,10 +226,10 @@ void prefjson::setPreferences(const QString& json)
|
||||
|
||||
if (ec == ScanFoldersModel::Ok) {
|
||||
scanDirs.insert(folder, (downloadType == ScanFoldersModel::CUSTOM_LOCATION) ? QVariant(downloadPath) : QVariant(downloadType));
|
||||
qDebug("New watched folder: %s to %s", qPrintable(folder), qPrintable(downloadPath));
|
||||
qDebug("New watched folder: %s to %s", qUtf8Printable(folder), qUtf8Printable(downloadPath));
|
||||
}
|
||||
else {
|
||||
qDebug("Watched folder %s failed with error %d", qPrintable(folder), ec);
|
||||
qDebug("Watched folder %s failed with error %d", qUtf8Printable(folder), ec);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void prefjson::setPreferences(const QString& json)
|
||||
QString folder = folderVariant.toString();
|
||||
if (!scanDirs.contains(folder)) {
|
||||
model->removePath(folder);
|
||||
qDebug("Removed watched folder %s", qPrintable(folder));
|
||||
qDebug("Removed watched folder %s", qUtf8Printable(folder));
|
||||
}
|
||||
}
|
||||
pref->setScanDirs(scanDirs);
|
||||
@@ -387,9 +387,9 @@ void prefjson::setPreferences(const QString& json)
|
||||
if (pref->getLocale() != locale) {
|
||||
QTranslator *translator = new QTranslator;
|
||||
if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) {
|
||||
qDebug("%s locale recognized, using translation.", qPrintable(locale));
|
||||
qDebug("%s locale recognized, using translation.", qUtf8Printable(locale));
|
||||
}else{
|
||||
qDebug("%s locale unrecognized, using default (en).", qPrintable(locale));
|
||||
qDebug("%s locale unrecognized, using default (en).", qUtf8Printable(locale));
|
||||
}
|
||||
qApp->installTranslator(translator);
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ void WebApplication::action_public_login()
|
||||
else {
|
||||
QString addr = env().clientAddress.toString();
|
||||
increaseFailedAttempts();
|
||||
qDebug("client IP: %s (%d failed attempts)", qPrintable(addr), failedAttempts());
|
||||
qDebug("client IP: %s (%d failed attempts)", qUtf8Printable(addr), failedAttempts());
|
||||
print(QByteArray("Fails."), Http::CONTENT_TYPE_TXT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user