Avoid binding constant reference to returned object

In such cases, it makes no sense doing so.
This commit is contained in:
Chocobo1
2018-07-21 15:07:11 +08:00
committed by sledgehammer999
parent 9e99a0d3f5
commit d5430adaaa
6 changed files with 13 additions and 13 deletions

View File

@@ -246,8 +246,8 @@ QString PeerInfo::connectionType() const
void PeerInfo::calcRelevance(const TorrentHandle *torrent)
{
const QBitArray &allPieces = torrent->pieces();
const QBitArray &peerPieces = pieces();
const QBitArray allPieces = torrent->pieces();
const QBitArray peerPieces = pieces();
int localMissing = 0;
int remoteHaves = 0;

View File

@@ -75,7 +75,7 @@ void ReverseResolution::resolve(const QString &ip)
void ReverseResolution::hostResolved(const QHostInfo &host)
{
const QString &ip = m_lookups.take(host.lookupId());
const QString ip = m_lookups.take(host.lookupId());
Q_ASSERT(!ip.isNull());
if (host.error() != QHostInfo::NoError) {
@@ -83,7 +83,7 @@ void ReverseResolution::hostResolved(const QHostInfo &host)
return;
}
const QString &hostname = host.hostName();
const QString hostname = host.hostName();
qDebug() << Q_FUNC_INFO << ip << QString("->") << hostname;
m_cache.insert(ip, new QString(hostname));

View File

@@ -212,11 +212,11 @@ ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &watchPath,
if (!watchDir.exists()) return DoesNotExist;
if (!watchDir.isReadable()) return CannotRead;
const QString &canonicalWatchPath = watchDir.canonicalPath();
const QString canonicalWatchPath = watchDir.canonicalPath();
if (findPathData(canonicalWatchPath) != -1) return AlreadyInList;
QDir downloadDir(downloadPath);
const QString &canonicalDownloadPath = downloadDir.canonicalPath();
const QString canonicalDownloadPath = downloadDir.canonicalPath();
if (!m_fsWatcher) {
m_fsWatcher = new FileSystemWatcher(this);
@@ -236,12 +236,12 @@ ScanFoldersModel::PathStatus ScanFoldersModel::addPath(const QString &watchPath,
ScanFoldersModel::PathStatus ScanFoldersModel::updatePath(const QString &watchPath, const PathType &downloadType, const QString &downloadPath)
{
QDir watchDir(watchPath);
const QString &canonicalWatchPath = watchDir.canonicalPath();
const QString canonicalWatchPath = watchDir.canonicalPath();
int row = findPathData(canonicalWatchPath);
if (row == -1) return DoesNotExist;
QDir downloadDir(downloadPath);
const QString &canonicalDownloadPath = downloadDir.canonicalPath();
const QString canonicalDownloadPath = downloadDir.canonicalPath();
m_pathList.at(row)->downloadType = downloadType;
m_pathList.at(row)->downloadPath = Utils::Fs::toNativePath(canonicalDownloadPath);
@@ -256,7 +256,7 @@ void ScanFoldersModel::addToFSWatcher(const QStringList &watchPaths)
foreach (const QString &path, watchPaths) {
QDir watchDir(path);
const QString &canonicalWatchPath = watchDir.canonicalPath();
const QString canonicalWatchPath = watchDir.canonicalPath();
m_fsWatcher->addPath(canonicalWatchPath);
}
}