Replace single-character string with character literal

Also remove unnecessary dynamic allocation.
This commit is contained in:
Chocobo1 2018-07-21 13:28:13 +08:00
parent 7e3cf99bb9
commit 0217d5b4c0
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
32 changed files with 96 additions and 96 deletions

View file

@ -688,7 +688,7 @@ QString Session::torrentTempPath(const TorrentInfo &torrentInfo) const
if ((torrentInfo.filesCount() > 1) && !torrentInfo.hasRootFolder())
return tempPath()
+ QString::fromStdString(torrentInfo.nativeInfo()->orig_files().name())
+ "/";
+ '/';
return tempPath();
}
@ -793,7 +793,7 @@ bool Session::removeCategory(const QString &name)
bool result = false;
if (isSubcategoriesEnabled()) {
// remove subcategories
const QString test = name + "/";
const QString test = name + '/';
Dict::removeIf(m_categories, [this, &test, &result](const QString &category, const QString &)
{
if (category.startsWith(test)) {
@ -3664,7 +3664,7 @@ void Session::handleTorrentFinished(TorrentHandle *const torrent)
const QString torrentRelpath = torrent->filePath(i);
if (torrentRelpath.endsWith(".torrent", Qt::CaseInsensitive)) {
qDebug("Found possible recursive torrent download.");
const QString torrentFullpath = torrent->savePath(true) + "/" + torrentRelpath;
const QString torrentFullpath = torrent->savePath(true) + '/' + torrentRelpath;
qDebug("Full subtorrent path is %s", qUtf8Printable(torrentFullpath));
TorrentInfo torrentInfo = TorrentInfo::loadFromFile(torrentFullpath);
if (torrentInfo.isValid()) {
@ -3814,7 +3814,7 @@ void Session::recursiveTorrentDownload(const InfoHash &hash)
tr("Recursive download of file '%1' embedded in torrent '%2'"
, "Recursive download of 'test.torrent' embedded in torrent 'test2'")
.arg(Utils::Fs::toNativePath(torrentRelpath), torrent->name()));
const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath;
const QString torrentFullpath = torrent->savePath() + '/' + torrentRelpath;
AddTorrentParams params;
// Passing the save path along to the sub torrent file
@ -4309,7 +4309,7 @@ void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p)
proto = "TCP";
else if (p->sock_type == libt::listen_succeeded_alert::tcp_ssl)
proto = "TCP_SSL";
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
qDebug() << "Successfully listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
Logger::instance()->addMessage(
tr("qBittorrent is successfully listening on interface %1 port: %2/%3", "e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881")
.arg(p->endpoint.address().to_string(ec).c_str(), proto, QString::number(p->endpoint.port())), Log::INFO);
@ -4336,7 +4336,7 @@ void Session::handleListenFailedAlert(libt::listen_failed_alert *p)
proto = "I2P";
else if (p->sock_type == libt::listen_failed_alert::socks5)
proto = "SOCKS5";
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << "/" << p->endpoint.port();
qDebug() << "Failed listening on " << proto << p->endpoint.address().to_string(ec).c_str() << '/' << p->endpoint.port();
Logger::instance()->addMessage(
tr("qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4.",
"e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use.")