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

@@ -551,7 +551,7 @@ void AddNewTorrentDialog::renameSelectedFile()
if (!newPath.endsWith('/')) newPath += '/';
// Check for overwriting
for (int i = 0; i < m_torrentInfo.filesCount(); ++i) {
const QString &currentName = m_torrentInfo.filePath(i);
const QString currentName = m_torrentInfo.filePath(i);
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
if (currentName.startsWith(newPath, Qt::CaseSensitive)) {
#else
@@ -565,7 +565,7 @@ void AddNewTorrentDialog::renameSelectedFile()
}
// Replace path in all files
for (int i = 0; i < m_torrentInfo.filesCount(); ++i) {
const QString &currentName = m_torrentInfo.filePath(i);
const QString currentName = m_torrentInfo.filePath(i);
if (currentName.startsWith(oldPath)) {
QString newName = currentName;
newName.replace(0, oldPath.length(), newPath);

View File

@@ -751,7 +751,7 @@ void PropertiesWidget::renameSelectedFile()
if (!newPath.endsWith('/')) newPath += '/';
// Check for overwriting
for (int i = 0; i < m_torrent->filesCount(); ++i) {
const QString &currentName = m_torrent->filePath(i);
const QString currentName = m_torrent->filePath(i);
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
if (currentName.startsWith(newPath, Qt::CaseSensitive)) {
#else

View File

@@ -515,7 +515,7 @@ void TrackerFiltersList::torrentAboutToBeDeleted(BitTorrent::TorrentHandle *cons
QString TrackerFiltersList::trackerFromRow(int row) const
{
Q_ASSERT(row > 1);
const QString &tracker = item(row)->text();
const QString tracker = item(row)->text();
QStringList parts = tracker.split(' ');
Q_ASSERT(parts.size() >= 2);
parts.removeLast(); // Remove trailing number