Avoid multiple .arg usage as suggested by clazy

This commit is contained in:
Ilya Fedin 2021-03-13 15:50:34 +04:00 committed by John Preston
parent d9771d0f88
commit c4dcf064d5
35 changed files with 161 additions and 149 deletions

View File

@ -46,9 +46,9 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
return version;
}();
result.name = QString("%1%2")
.arg(appName)
.arg(appVer.isEmpty() ? QString() : (' ' + appVer));
result.name = QString("%1%2").arg(
appName,
appVer.isEmpty() ? QString() : (' ' + appVer));
const auto country = qs(data.vcountry());
const auto platform = qs(data.vplatform());
@ -61,10 +61,10 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
result.activeTime = data.vdate_active().v
? data.vdate_active().v
: data.vdate_created().v;
result.info = QString("%1, %2%3")
.arg(qs(data.vdevice_model()))
.arg(platform.isEmpty() ? QString() : platform + ' ')
.arg(qs(data.vsystem_version()));
result.info = QString("%1, %2%3").arg(
qs(data.vdevice_model()),
platform.isEmpty() ? QString() : platform + ' ',
qs(data.vsystem_version()));
result.ip = qs(data.vip())
+ (country.isEmpty()
? QString()

View File

@ -399,10 +399,10 @@ void Updates::feedChannelDifference(
void Updates::channelDifferenceFail(
not_null<ChannelData*> channel,
const MTP::Error &error) {
LOG(("RPC Error in getChannelDifference: %1 %2: %3"
).arg(error.code()
).arg(error.type()
).arg(error.description()));
LOG(("RPC Error in getChannelDifference: %1 %2: %3").arg(
QString::number(error.code()),
error.type(),
error.description()));
failDifferenceStartTimerFor(channel);
}

View File

@ -819,9 +819,9 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
return data.vlibrary_versions().v;
}).value(0, MTP_bytes(kDefaultVersion)).v;
LOG(("Call Info: Creating instance with version '%1', allowP2P: %2"
).arg(QString::fromUtf8(version)
).arg(Logs::b(descriptor.config.enableP2P)));
LOG(("Call Info: Creating instance with version '%1', allowP2P: %2").arg(
QString::fromUtf8(version),
Logs::b(descriptor.config.enableP2P)));
_instance = tgcalls::Meta::Create(
version.toStdString(),
std::move(descriptor));

View File

@ -261,8 +261,9 @@ void ApplyDifference(
}) | ranges::view::filter([&](const LangPackEmoji &entry) {
if (!entry.emoji) {
LOG(("API Warning: emoji %1 is not supported, word: %2."
).arg(entry.text
).arg(word));
).arg(
entry.text,
word));
}
return (entry.emoji != nullptr);
});
@ -419,9 +420,9 @@ void EmojiKeywords::LangPack::applyDifference(
const auto version = data.vversion().v;
const auto &keywords = data.vkeywords().v;
if (code != _id) {
LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2"
).arg(_id
).arg(code));
LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2").arg(
_id,
code));
_data.version = 0;
_state = State::Refreshed;
return;

View File

@ -1046,9 +1046,9 @@ bool FieldAutocomplete::Inner::chooseAtIndex(
const auto insertUsername = (botStatus == 0
|| botStatus == 2
|| _parent->filter().indexOf('@') > 0);
const auto commandString = QString("/%1%2")
.arg(command->command)
.arg(insertUsername ? ('@' + user->username) : QString());
const auto commandString = QString("/%1%2").arg(
command->command,
insertUsername ? ('@' + user->username) : QString());
_botCommandChosen.fire({ commandString, method });
return true;

View File

@ -251,9 +251,9 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id) {
QString DictPathByLangId(int langId) {
EnsurePath();
return qsl("%1/%2")
.arg(DictionariesPath())
.arg(Spellchecker::LocaleFromLangId(langId).name());
return qsl("%1/%2").arg(
DictionariesPath(),
Spellchecker::LocaleFromLangId(langId).name());
}
QString DictionariesPath() {
@ -281,9 +281,9 @@ bool RemoveDictionary(int langId) {
return true;
}
const auto fileName = Spellchecker::LocaleFromLangId(langId).name();
const auto folder = qsl("%1/%2/")
.arg(DictionariesPath())
.arg(fileName);
const auto folder = qsl("%1/%2/").arg(
DictionariesPath(),
fileName);
return QDir(folder).removeRecursively();
}
@ -294,9 +294,9 @@ bool WriteDefaultDictionary() {
return false;
}
const auto fileName = QLocale(en).name();
const auto folder = qsl("%1/%2/")
.arg(DictionariesPath())
.arg(fileName);
const auto folder = qsl("%1/%2/").arg(
DictionariesPath(),
fileName);
QDir(folder).removeRecursively();
const auto path = folder + fileName;

View File

@ -468,7 +468,11 @@ void LastCrashedWindow::onSendReport() {
}
QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:"));
_checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg(apiid).arg(version).arg(minidumpFileName().isEmpty() ? 0 : 1).arg(CrashReports::PlatformString())));
_checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg(
apiid,
version,
QString::number(minidumpFileName().isEmpty() ? 0 : 1),
CrashReports::PlatformString())));
connect(_checkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError)));
connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished()));

View File

@ -183,16 +183,14 @@ bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) {
const auto newFile = was + "/tdata/alpha";
if (QFile::exists(oldFile) && !QFile::exists(newFile)) {
if (!QFile(oldFile).copy(newFile)) {
LOG(("FATAL: Could not copy '%1' to '%2'"
).arg(oldFile
).arg(newFile));
LOG(("FATAL: Could not copy '%1' to '%2'").arg(
oldFile,
newFile));
return false;
}
}
if (!QDir().rename(was, now)) {
LOG(("FATAL: Could not rename '%1' to '%2'"
).arg(was
).arg(now));
LOG(("FATAL: Could not rename '%1' to '%2'").arg(was, now));
return false;
}
}

View File

@ -580,7 +580,7 @@ QString TryConvertUrlToLocal(QString url) {
return qsl("tg://bg?slug=") + bgMatch->captured(1) + (params.isEmpty() ? QString() : '&' + params);
} else if (auto postMatch = regex_match(qsl("^c/(\\-?\\d+)/(\\d+)(/?\\?|/?$)"), query, matchOptions)) {
auto params = query.mid(postMatch->captured(0).size()).toString();
return qsl("tg://privatepost?channel=%1&post=%2").arg(postMatch->captured(1)).arg(postMatch->captured(2)) + (params.isEmpty() ? QString() : '&' + params);
return qsl("tg://privatepost?channel=%1&post=%2").arg(postMatch->captured(1), postMatch->captured(2)) + (params.isEmpty() ? QString() : '&' + params);
} else if (auto usernameMatch = regex_match(qsl("^([a-zA-Z0-9\\.\\_]+)(/?\\?|/?$|/(\\d+)/?(?:\\?|$))"), query, matchOptions)) {
auto params = query.mid(usernameMatch->captured(0).size()).toString();
auto postParam = QString();

View File

@ -288,7 +288,7 @@ void Sandbox::socketError(QLocalSocket::LocalSocketError e) {
psCheckLocalSocket(_localServerName);
if (!_localServer.listen(_localServerName)) {
LOG(("Failed to start listening to %1 server: %2").arg(_localServerName).arg(_localServer.errorString()));
LOG(("Failed to start listening to %1 server: %2").arg(_localServerName, _localServer.errorString()));
return App::quit();
}
#endif // !Q_OS_WINRT

View File

@ -1443,9 +1443,9 @@ bool History::unreadCountRefreshNeeded(MsgId readTillId) const {
std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
if (isEmpty() || !folderKnown()) {
DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2."
).arg(Logs::b(isEmpty())
).arg(Logs::b(folderKnown())));
DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2.").arg(
Logs::b(isEmpty()),
Logs::b(folderKnown())));
return std::nullopt;
}
if (_inboxReadBefore) {
@ -1478,10 +1478,10 @@ std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
}
}
const auto minimalServerId = minMsgId();
DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3"
).arg(minimalServerId
).arg(Logs::b(loadedAtBottom())
).arg(Logs::b(loadedAtTop())));
DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3").arg(
QString::number(minimalServerId),
Logs::b(loadedAtBottom()),
Logs::b(loadedAtTop())));
if (!loadedAtBottom()
|| (!loadedAtTop() && !minimalServerId)
|| minimalServerId > readTillId) {

View File

@ -464,7 +464,7 @@ QString ReplyMarkupClickHandler::tooltip() const {
const auto url = button ? QString::fromUtf8(button->data) : QString();
const auto text = _fullDisplayed ? QString() : buttonText();
if (!url.isEmpty() && !text.isEmpty()) {
return QString("%1\n\n%2").arg(text).arg(url);
return QString("%1\n\n%2").arg(text, url);
} else if (url.isEmpty() != text.isEmpty()) {
return text + url;
} else {

View File

@ -2497,7 +2497,11 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
return;
}
LOG(("RPC Error: %1 %2: %3").arg(error.code()).arg(error.type()).arg(error.description()));
LOG(("RPC Error: %1 %2: %3").arg(
QString::number(error.code()),
error.type(),
error.description()));
if (_preloadRequest == requestId) {
_preloadRequest = 0;
} else if (_preloadDownRequest == requestId) {

View File

@ -290,9 +290,9 @@ void CloudManager::applyLangPackDifference(
}
} else {
LOG(("Lang Warning: "
"Ignoring update for '%1' because our language is '%2'"
).arg(langpackId
).arg(_langpack.id()));
"Ignoring update for '%1' because our language is '%2'").arg(
langpackId,
_langpack.id()));
}
}

View File

@ -155,7 +155,7 @@ bool FileParser::readKeyValue(const char *&from, const char *end) {
QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &relativePath) {
QFile file(QFileInfo(relativePath).exists() ? relativePath : absolutePath);
if (!file.open(QIODevice::ReadOnly)) {
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not open file at '%1' ('%2')"_q.arg(relativePath).arg(absolutePath));
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not open file at '%1' ('%2')"_q.arg(relativePath, absolutePath));
return QByteArray();
}
if (file.size() > kLangFileLimit) {
@ -166,7 +166,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
constexpr auto kCodecMagicSize = 3;
auto codecMagic = file.read(kCodecMagicSize);
if (codecMagic.size() < kCodecMagicSize) {
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Found bad file at '%1' ('%2')"_q.arg(relativePath).arg(absolutePath));
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Found bad file at '%1' ('%2')"_q.arg(relativePath, absolutePath));
return QByteArray();
}
file.seek(0);
@ -177,11 +177,11 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
stream.setCodec("UTF-16");
auto string = stream.readAll();
if (stream.status() != QTextStream::Ok) {
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not read UTF-16 data from '%1' ('%2')"_q.arg(relativePath).arg(absolutePath));
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not read UTF-16 data from '%1' ('%2')"_q.arg(relativePath, absolutePath));
return QByteArray();
}
if (string.isEmpty()) {
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-16 content in '%1' ('%2')"_q.arg(relativePath).arg(absolutePath));
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-16 content in '%1' ('%2')"_q.arg(relativePath, absolutePath));
return QByteArray();
}
return string.toUtf8();
@ -197,7 +197,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
data = data.mid(3); // skip UTF-8 BOM
}
if (data.isEmpty()) {
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-8 content in '%1' ('%2')"_q.arg(relativePath).arg(absolutePath));
Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-8 content in '%1' ('%2')"_q.arg(relativePath, absolutePath));
return QByteArray();
}
return data;

View File

@ -92,7 +92,7 @@ void ValueParser::appendToResult(const char *nextBegin) {
bool ValueParser::logError(const QString &text) {
_failed = true;
auto loggedKey = (_currentTag.size() > 0) ? (_key + QString(':') + _currentTag) : QString(_key);
LOG(("Lang Error: %1 (key '%2')").arg(text).arg(loggedKey));
LOG(("Lang Error: %1 (key '%2')").arg(text, loggedKey));
return false;
}

View File

@ -55,7 +55,7 @@ QString _logsEntryStart() {
const auto tm = QDateTime::currentDateTime();
return QString("[%1 %2-%3]").arg(tm.toString("hh:mm:ss.zzz")).arg(QString("%1").arg(threadId, 2, 10, QChar('0'))).arg(++index, 7, 10, QChar('0'));
return QString("[%1 %2-%3]").arg(tm.toString("hh:mm:ss.zzz"), QString("%1").arg(threadId, 2, 10, QChar('0'))).arg(++index, 7, 10, QChar('0'));
}
class LogsDataFields {
@ -136,12 +136,12 @@ private:
return false;
}
if (!QFile(files[type]->fileName()).copy(to->fileName())) { // don't close files[type] yet
LOG(("Could not copy '%1' to '%2' to start new logging!").arg(files[type]->fileName()).arg(to->fileName()));
LOG(("Could not copy '%1' to '%2' to start new logging!").arg(files[type]->fileName(), to->fileName()));
return false;
}
if (to->open(mode | QIODevice::Append)) {
std::swap(files[type], to);
LOG(("Moved logging from '%1' to '%2'!").arg(to->fileName()).arg(files[type]->fileName()));
LOG(("Moved logging from '%1' to '%2'!").arg(to->fileName(), files[type]->fileName()));
to->remove();
LogsStartIndexChosen = -1;
@ -152,7 +152,7 @@ private:
QString oldlog = cWorkingDir() + *i, oldlogend = i->mid(qstr("log_start").size());
if (oldlogend.size() == 1 + qstr(".txt").size() && oldlogend.at(0).isDigit() && oldlogend.midRef(1) == qstr(".txt")) {
bool removed = QFile(*i).remove();
LOG(("Old start log '%1' found, deleted: %2").arg(*i).arg(Logs::b(removed)));
LOG(("Old start log '%1' found, deleted: %2").arg(*i, Logs::b(removed)));
}
}
@ -266,7 +266,7 @@ bool DebugModeEnabled = false;
void MoveOldDataFiles(const QString &wasDir) {
QFile data(wasDir + "data"), dataConfig(wasDir + "data_config"), tdataConfig(wasDir + "tdata/config");
if (data.exists() && dataConfig.exists() && !QFileInfo(cWorkingDir() + "data").exists() && !QFileInfo(cWorkingDir() + "data_config").exists()) { // move to home dir
LOG(("Copying data to home dir '%1' from '%2'").arg(cWorkingDir()).arg(wasDir));
LOG(("Copying data to home dir '%1' from '%2'").arg(cWorkingDir(), wasDir));
if (data.copy(cWorkingDir() + "data")) {
LOG(("Copied 'data' to home dir"));
if (dataConfig.copy(cWorkingDir() + "data_config")) {
@ -419,7 +419,7 @@ void start(not_null<Core::Launcher*> launcher) {
).arg(Logs::b(cInstallBetaVersion())
).arg(cAlphaVersion()
).arg(Logs::b(DebugEnabled())));
LOG(("Executable dir: %1, name: %2").arg(cExeDir()).arg(cExeName()));
LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName()));
LOG(("Initial working dir: %1").arg(initialWorkingDir));
LOG(("Working dir: %1").arg(cWorkingDir()));
LOG(("Command line: %1").arg(launcher->argumentsString()));
@ -530,7 +530,7 @@ void writeMain(const QString &v) {
QString msg(QString("[%1.%2.%3 %4:%5:%6] %7\n").arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, QChar('0')).arg(tm.tm_mday, 2, 10, QChar('0')).arg(tm.tm_hour, 2, 10, QChar('0')).arg(tm.tm_min, 2, 10, QChar('0')).arg(tm.tm_sec, 2, 10, QChar('0')).arg(v));
_logsWrite(LogDataMain, msg);
QString debugmsg(QString("%1 %2\n").arg(_logsEntryStart()).arg(v));
QString debugmsg(QString("%1 %2\n").arg(_logsEntryStart(), v));
_logsWrite(LogDataDebug, debugmsg);
}
@ -549,7 +549,7 @@ void writeDebug(const char *file, int32 line, const QString &v) {
file = found + 1;
}
QString msg(QString("%1 %2 (%3 : %4)\n").arg(_logsEntryStart()).arg(v).arg(file).arg(line));
QString msg(QString("%1 %2 (%3 : %4)\n").arg(_logsEntryStart(), v, file, line));
_logsWrite(LogDataDebug, msg);
#ifdef Q_OS_WIN
@ -562,7 +562,7 @@ void writeDebug(const char *file, int32 line, const QString &v) {
}
void writeTcp(const QString &v) {
QString msg(QString("%1 %2\n").arg(_logsEntryStart()).arg(v));
QString msg(QString("%1 %2\n").arg(_logsEntryStart(), v));
_logsWrite(LogDataTcp, msg);
}

View File

@ -174,7 +174,7 @@ void PaintImageProfile(QPainter &p, const QImage &image, QRect rect, QRect fill)
}
}
push();
LOG(("FRAME (%1): %2 (copies: %3)").arg(label).arg(times.join(' ')).arg(copies));
LOG(("FRAME (%1): %2 (copies: %3)").arg(label, times.join(' ')).arg(copies));
times = QStringList();
now = crl::now();
};

View File

@ -72,10 +72,10 @@ void ResolvingConnection::setChild(ConnectionPointer &&child) {
&AbstractConnection::disconnected,
this,
&ResolvingConnection::handleDisconnected);
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'"
).arg(_protocolDcId
).arg(_proxy.host + ':' + QString::number(_proxy.port)
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'").arg(
QString::number(_protocolDcId),
_proxy.host + ':' + QString::number(_proxy.port),
(_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex]
: _proxy.host));
if (_protocolDcId) {
@ -227,10 +227,10 @@ void ResolvingConnection::connectToServer(
_port = port;
_protocolSecret = protocolSecret;
_protocolDcId = protocolDcId;
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'"
).arg(_protocolDcId
).arg(_proxy.host +':' + QString::number(_proxy.port)
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'").arg(
QString::number(_protocolDcId),
_proxy.host +':' + QString::number(_proxy.port),
(_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex]
: _proxy.host));
return _child->connectToServer(

View File

@ -380,7 +380,7 @@ void DcKeyCreator::dhParamsAnswered(
if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_ok)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
@ -426,12 +426,12 @@ void DcKeyCreator::dhParamsAnswered(
const auto &dh_inner_data(dh_inner.c_server_DH_inner_data());
if (dh_inner_data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in server_DH_inner_data)!"));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&dh_inner_data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&dh_inner_data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str()));
return failed();
}
if (dh_inner_data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_inner_data)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&dh_inner_data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&dh_inner_data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
const auto sha1Buffer = openssl::Sha1(
@ -443,7 +443,7 @@ void DcKeyCreator::dhParamsAnswered(
openssl::kSha1Size);
if (bytes::compare(sha1Dec, sha1Buffer)) {
LOG(("AuthKey Error: sha1 hash of encrypted part did not match!"));
DEBUG_LOG(("AuthKey Error: sha1 did not match, server_nonce: %1, new_nonce %2, encrypted data %3").arg(Logs::mb(&attempt->data.server_nonce, 16).str()).arg(Logs::mb(&attempt->data.new_nonce, 16).str()).arg(Logs::mb(encDHStr.constData(), encDHLen).str()));
DEBUG_LOG(("AuthKey Error: sha1 did not match, server_nonce: %1, new_nonce %2, encrypted data %3").arg(Logs::mb(&attempt->data.server_nonce, 16).str(), Logs::mb(&attempt->data.new_nonce, 16).str(), Logs::mb(encDHStr.constData(), encDHLen).str()));
return failed();
}
base::unixtime::update(dh_inner_data.vserver_time().v);
@ -466,12 +466,12 @@ void DcKeyCreator::dhParamsAnswered(
if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_fail)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
if (data.vnew_nonce_hash() != NonceDigest(bytes::object_as_span(&attempt->data.new_nonce))) {
LOG(("AuthKey Error: received new_nonce_hash did not match!"));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash: %1, new_nonce: %2").arg(Logs::mb(&data.vnew_nonce_hash(), 16).str()).arg(Logs::mb(&attempt->data.new_nonce, 32).str()));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash: %1, new_nonce: %2").arg(Logs::mb(&data.vnew_nonce_hash(), 16).str(), Logs::mb(&attempt->data.new_nonce, 32).str()));
return failed();
}
LOG(("AuthKey Error: server_DH_params_fail received!"));
@ -535,18 +535,18 @@ void DcKeyCreator::dhClientParamsAnswered(
data.match([&](const MTPDdh_gen_ok &data) {
if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_ok)!"));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str()));
return failed();
}
if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_ok)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
attempt->data.new_nonce_buf[32] = bytes::type(1);
if (data.vnew_nonce_hash1() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash1 did not match!"));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash1: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash1(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash1: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash1(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
return failed();
}
@ -557,19 +557,19 @@ void DcKeyCreator::dhClientParamsAnswered(
}, [&](const MTPDdh_gen_retry &data) {
if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_retry)!"));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str()));
return failed();
}
if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_retry)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
attempt->data.new_nonce_buf[32] = bytes::type(2);
uchar sha1Buffer[20];
if (data.vnew_nonce_hash2() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash2 did not match!"));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash2: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash2(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash2: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash2(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
return failed();
}
attempt->data.retry_id = attempt->data.auth_key_aux_hash;
@ -577,19 +577,19 @@ void DcKeyCreator::dhClientParamsAnswered(
}, [&](const MTPDdh_gen_fail &data) {
if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_fail)!"));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str()));
return failed();
}
if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_fail)!"));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str()));
DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str()));
return failed();
}
attempt->data.new_nonce_buf[32] = bytes::type(3);
uchar sha1Buffer[20];
if (data.vnew_nonce_hash3() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash3 did not match!"));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash3: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash3(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
DEBUG_LOG(("AuthKey Error: received new_nonce_hash3: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash3(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str()));
return failed();
}
LOG(("AuthKey Error: dh_gen_fail received!"));

View File

@ -1042,10 +1042,10 @@ void Instance::Private::processCallback(const Response &response) {
if (handler.done || handler.fail) {
const auto handleError = [&](const Error &error) {
DEBUG_LOG(("RPC Info: "
"error received, code %1, type %2, description: %3"
).arg(error.code()
).arg(error.type()
).arg(error.description()));
"error received, code %1, type %2, description: %3").arg(
QString::number(error.code()),
error.type(),
error.description()));
if (rpcErrorOccured(response, handler, error)) {
unregisterRequest(requestId);
} else {
@ -1112,11 +1112,11 @@ bool Instance::Private::rpcErrorOccured(
if (onErrorDefault(error, response)) {
return false;
}
LOG(("RPC Error: request %1 got fail with code %2, error %3%4"
).arg(response.requestId
).arg(error.code()
).arg(error.type()
).arg(error.description().isEmpty()
LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg(
QString::number(response.requestId),
QString::number(error.code()),
error.type(),
error.description().isEmpty()
? QString()
: QString(": %1").arg(error.description())));
if (onFail) {

View File

@ -1701,7 +1701,11 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
auto &ids = data.vmsg_ids().v;
auto &states = data.vinfo().v;
DEBUG_LOG(("Message Info: msgs all info received, msgId %1, reqMsgIds: %2, states %3").arg(msgId).arg(LogIdsVector(ids)).arg(Logs::mb(states.data(), states.length()).str()));
DEBUG_LOG(("Message Info: msgs all info received, msgId %1, reqMsgIds: %2, states %3").arg(
QString::number(msgId),
LogIdsVector(ids),
Logs::mb(states.data(), states.length()).str()));
handleMsgsStates(ids, states);
} return HandleResult::Success;
@ -2271,8 +2275,9 @@ void SessionPrivate::onConnected(
_testConnections,
[&](const TestConnection &test) { return test.priority > my; });
if (j != end(_testConnections)) {
DEBUG_LOG(("MTP Info: connection %1 succeed, "
"waiting for %2.").arg(i->data->tag()).arg(j->data->tag()));
DEBUG_LOG(("MTP Info: connection %1 succeed, waiting for %2.").arg(
i->data->tag(),
j->data->tag()));
_waitForBetterTimer.callOnce(kWaitForBetterTimeout);
} else {
DEBUG_LOG(("MTP Info: connection through IPv4 succeed."));

View File

@ -100,7 +100,7 @@ QByteArray ParseRemoteConfigResponse(const QByteArray &bytes) {
return document.object().value(
"entries"
).toObject().value(
qsl("%1%2").arg(kConfigKey).arg(kConfigSubKey)
qsl("%1%2").arg(kConfigKey, kConfigSubKey)
).toString().toLatin1();
}
@ -290,17 +290,17 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
case Type::Mozilla: {
url.setHost(attempt.data);
url.setPath(qsl("/dns-query"));
url.setQuery(qsl("name=%1&type=16&random_padding=%2"
).arg(_domainString
).arg(GenerateDnsRandomPadding()));
url.setQuery(qsl("name=%1&type=16&random_padding=%2").arg(
_domainString,
GenerateDnsRandomPadding()));
request.setRawHeader("accept", "application/dns-json");
} break;
case Type::Google: {
url.setHost(attempt.data);
url.setPath(qsl("/resolve"));
url.setQuery(qsl("name=%1&type=ANY&random_padding=%2"
).arg(_domainString
).arg(GenerateDnsRandomPadding()));
url.setQuery(qsl("name=%1&type=ANY&random_padding=%2").arg(
_domainString,
GenerateDnsRandomPadding()));
if (!attempt.host.isEmpty()) {
const auto host = attempt.host + ".google.com";
request.setRawHeader("Host", host.toLatin1());
@ -311,23 +311,24 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch"
).arg(kRemoteProject));
url.setQuery(qsl("key=%1").arg(kApiKey));
payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}"
).arg(kAppId
).arg(InstanceId()).toLatin1();
payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}").arg(
kAppId,
InstanceId()).toLatin1();
request.setRawHeader("Content-Type", "application/json");
} break;
case Type::Realtime: {
url.setHost(kFireProject + qsl(".%1").arg(attempt.data));
url.setPath(qsl("/%1%2.json").arg(kConfigKey).arg(kConfigSubKey));
url.setPath(qsl("/%1%2.json").arg(kConfigKey, kConfigSubKey));
} break;
case Type::FireStore: {
url.setHost(attempt.host.isEmpty()
? ApiDomain(attempt.data)
: attempt.data);
url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3"
).arg(kFireProject
).arg(kConfigKey
).arg(kConfigSubKey));
).arg(
kFireProject,
kConfigKey,
kConfigSubKey));
if (!attempt.host.isEmpty()) {
const auto host = ApiDomain(attempt.host);
request.setRawHeader("Host", host.toLatin1());

View File

@ -51,10 +51,9 @@ void Launcher::initHook() {
QApplication::setAttribute(Qt::AA_DisableSessionManager, true);
QApplication::setDesktopFileName([] {
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
const auto appimagePath = qsl("file://%1%2")
.arg(cExeDir())
.arg(cExeName())
.toUtf8();
const auto appimagePath = qsl("file://%1%2").arg(
cExeDir(),
cExeName()).toUtf8();
char md5Hash[33] = { 0 };
hashMd5Hex(

View File

@ -15,7 +15,7 @@ namespace {
QString GetEnv(const char *name) {
auto value = qEnvironmentVariable(name);
LOG(("Getting DE, %1: '%2'").arg(name).arg(value));
LOG(("Getting DE, %1: '%2'").arg(name, value));
return value;
}

View File

@ -395,13 +395,13 @@ NotificationData::NotificationData(
if (capabilities.contains(qsl("body-markup"))) {
_body = subtitle.isEmpty()
? msg.toHtmlEscaped().toStdString()
: qsl("<b>%1</b>\n%2")
.arg(subtitle.toHtmlEscaped())
.arg(msg.toHtmlEscaped()).toStdString();
: qsl("<b>%1</b>\n%2").arg(
subtitle.toHtmlEscaped(),
msg.toHtmlEscaped()).toStdString();
} else {
_body = subtitle.isEmpty()
? msg.toStdString()
: qsl("%1\n%2").arg(subtitle).arg(msg).toStdString();
: qsl("%1\n%2").arg(subtitle, msg).toStdString();
}
if (capabilities.contains("actions")) {

View File

@ -283,9 +283,9 @@ void FileWriteDescriptor::finish() {
return;
}
QFile::remove(safe);
LOG(("Storage Error: Could not rename '%1' to '%2', removing."
).arg(simple
).arg(safe));
LOG(("Storage Error: Could not rename '%1' to '%2', removing.").arg(
simple,
safe));
}
}
@ -360,9 +360,9 @@ bool ReadFile(
continue;
}
if (memcmp(magic, TdfMagic, TdfMagicLen)) {
DEBUG_LOG(("App Info: bad magic %1 in '%2'"
).arg(Logs::mb(magic, TdfMagicLen).str()
).arg(name));
DEBUG_LOG(("App Info: bad magic %1 in '%2'").arg(
Logs::mb(magic, TdfMagicLen).str(),
name));
continue;
}

View File

@ -338,7 +338,7 @@ QString peekUserPhone(int streamAppVersion, QDataStream &stream) {
QString first, last, phone;
stream >> first >> last >> phone;
DEBUG_LOG(("peekUserPhone.data: %1 %2 %3"
).arg(first).arg(last).arg(phone));
).arg(first, last, phone));
return phone;
}

View File

@ -36,7 +36,7 @@ auto Location(const QString &url) {
auto JsonUrl(not_null<SongData*> song) {
return QString("https://itunes.apple.com/search?term=" \
"%1 %2&entity=song&limit=4").arg(song->performer).arg(song->title);
"%1 %2&entity=song&limit=4").arg(song->performer, song->title);
}
// Dummy JSON responce.

View File

@ -378,10 +378,10 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) {
if (!delta.added.empty()) {
result += qstr("-------- Added --------\n\n");
for (const auto question : delta.added) {
result += qsl("Q: %1\nK: %2\nA: %3\n\n"
).arg(question->question
).arg(question->originalKeys.join(qsl(", "))
).arg(question->value.trimmed());
result += qsl("Q: %1\nK: %2\nA: %3\n\n").arg(
question->question,
question->originalKeys.join(qsl(", ")),
question->value.trimmed());
}
}
if (!delta.changed.empty()) {

View File

@ -60,9 +60,9 @@ QString CachedUserpics::get(
} else {
v.until = 0;
}
v.path = u"%1tdata/temp/%2.png"_q
.arg(cWorkingDir())
.arg(QString::number(openssl::RandomValue<uint64>(), 16));
v.path = u"%1tdata/temp/%2.png"_q.arg(
cWorkingDir(),
QString::number(openssl::RandomValue<uint64>(), 16));
if (key.first || key.second) {
if (peer->isSelf()) {
const auto method = (_type == Type::Rounded)

View File

@ -406,9 +406,9 @@ bool InitializeFromCache(
bool InitializeFromSaved(Saved &&saved) {
if (saved.object.content.size() < 4) {
LOG(("Theme Error: Could not load theme from '%1' (%2)"
).arg(saved.object.pathRelative
).arg(saved.object.pathAbsolute));
LOG(("Theme Error: Could not load theme from '%1' (%2)").arg(
saved.object.pathRelative,
saved.object.pathAbsolute));
return false;
}

View File

@ -611,7 +611,7 @@ void Editor::Inner::applyEditing(const QString &name, const QString &copyOf, QCo
auto plainValue = copyOf.isEmpty() ? ColorHexString(value) : copyOf.toLatin1();
auto newContent = ReplaceValueInPaletteContent(_paletteContent, plainName, plainValue);
if (newContent == "error") {
LOG(("Theme Error: could not replace '%1: %2' in content").arg(name).arg(copyOf.isEmpty() ? QString::fromLatin1(ColorHexString(value)) : copyOf));
LOG(("Theme Error: could not replace '%1: %2' in content").arg(name, copyOf.isEmpty() ? QString::fromLatin1(ColorHexString(value)) : copyOf));
error();
return;
}

View File

@ -221,7 +221,7 @@ bool EditorBlock::feedCopy(const QString &name, const QString &copyOf) {
}
addRow(name, copyOf, row->value());
} else {
LOG(("Theme Warning: Skipping value '%1: %2' (expected a color value in #rrggbb or #rrggbbaa or a previously defined key in the color scheme)").arg(name).arg(copyOf));
LOG(("Theme Warning: Skipping value '%1: %2' (expected a color value in #rrggbb or #rrggbbaa or a previously defined key in the color scheme)").arg(name, copyOf));
}
return true;
}

View File

@ -284,9 +284,9 @@ void ImportFromFile(
name,
ColorHexString(color->c));
if (data == "error") {
LOG(("Theme Error: could not adjust '%1: %2' in content"
).arg(QString::fromLatin1(name)
).arg(QString::fromLatin1(ColorHexString(color->c))));
LOG(("Theme Error: could not adjust '%1: %2' in content").arg(
QString::fromLatin1(name),
QString::fromLatin1(ColorHexString(color->c))));
return QByteArray();
}
}