Revise string literal usage

PR #16703.
This commit is contained in:
Chocobo1
2022-03-26 11:53:50 +08:00
committed by GitHub
parent e1abcc684a
commit 4ca6de2b54
55 changed files with 485 additions and 472 deletions

View File

@@ -36,13 +36,13 @@
#include "base/logger.h"
#include "base/utils/string.h"
const char KEY_LOG_ID[] = "id";
const char KEY_LOG_TIMESTAMP[] = "timestamp";
const char KEY_LOG_MSG_TYPE[] = "type";
const char KEY_LOG_MSG_MESSAGE[] = "message";
const char KEY_LOG_PEER_IP[] = "ip";
const char KEY_LOG_PEER_BLOCKED[] = "blocked";
const char KEY_LOG_PEER_REASON[] = "reason";
const QString KEY_LOG_ID = u"id"_qs;
const QString KEY_LOG_TIMESTAMP = u"timestamp"_qs;
const QString KEY_LOG_MSG_TYPE = u"type"_qs;
const QString KEY_LOG_MSG_MESSAGE = u"message"_qs;
const QString KEY_LOG_PEER_IP = u"ip"_qs;
const QString KEY_LOG_PEER_BLOCKED = u"blocked"_qs;
const QString KEY_LOG_PEER_REASON = u"reason"_qs;
// Returns the log in JSON format.
// The return value is an array of dictionaries.
@@ -84,10 +84,10 @@ void LogController::mainAction()
msgList.append(QJsonObject
{
{QLatin1String(KEY_LOG_ID), msg.id},
{QLatin1String(KEY_LOG_TIMESTAMP), msg.timestamp},
{QLatin1String(KEY_LOG_MSG_TYPE), msg.type},
{QLatin1String(KEY_LOG_MSG_MESSAGE), msg.message}
{KEY_LOG_ID, msg.id},
{KEY_LOG_TIMESTAMP, msg.timestamp},
{KEY_LOG_MSG_TYPE, msg.type},
{KEY_LOG_MSG_MESSAGE, msg.message}
});
}
@@ -118,11 +118,11 @@ void LogController::peersAction()
{
peerList.append(QJsonObject
{
{QLatin1String(KEY_LOG_ID), peer.id},
{QLatin1String(KEY_LOG_TIMESTAMP), peer.timestamp},
{QLatin1String(KEY_LOG_PEER_IP), peer.ip},
{QLatin1String(KEY_LOG_PEER_BLOCKED), peer.blocked},
{QLatin1String(KEY_LOG_PEER_REASON), peer.reason}
{KEY_LOG_ID, peer.id},
{KEY_LOG_TIMESTAMP, peer.timestamp},
{KEY_LOG_PEER_IP, peer.ip},
{KEY_LOG_PEER_BLOCKED, peer.blocked},
{KEY_LOG_PEER_REASON, peer.reason}
});
}