Browse Source

Use reference whenever possible

adaptive-webui-19844
Chocobo1 2 years ago
parent
commit
8c9b6e2f2d
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 2
      src/base/bittorrent/customstorage.cpp
  2. 2
      src/base/bittorrent/sessionimpl.cpp
  3. 2
      src/base/bittorrent/torrentimpl.cpp
  4. 2
      src/base/net/smtp.cpp
  5. 4
      src/base/rss/rss_autodownloader.cpp
  6. 2
      src/base/rss/rss_parser.cpp
  7. 2
      src/base/rss/rss_parser.h
  8. 2
      src/base/search/searchpluginmanager.cpp
  9. 2
      src/base/search/searchpluginmanager.h
  10. 2
      src/gui/transferlistfilters/statusfilterwidget.cpp
  11. 2
      src/gui/transferlistfilters/statusfilterwidget.h
  12. 2
      src/webui/api/appcontroller.cpp

2
src/base/bittorrent/customstorage.cpp

@ -171,7 +171,7 @@ void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt
, std::function<void (const lt::storage_error &, lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler) , std::function<void (const lt::storage_error &, lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler)
{ {
m_nativeDiskIO->async_set_file_priority(storage, priorities m_nativeDiskIO->async_set_file_priority(storage, priorities
, [=, handler = std::move(handler)](const lt::storage_error &error, lt::aux::vector<lt::download_priority_t, lt::file_index_t> priorities) , [=, handler = std::move(handler)](const lt::storage_error &error, const lt::aux::vector<lt::download_priority_t, lt::file_index_t> &priorities)
{ {
m_storageData[storage].filePriorities = priorities; m_storageData[storage].filePriorities = priorities;
handler(error, priorities); handler(error, priorities);

2
src/base/bittorrent/sessionimpl.cpp

@ -4986,7 +4986,7 @@ void SessionImpl::upgradeCategories()
const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get(); const auto legacyCategories = SettingValue<QVariantMap>(u"BitTorrent/Session/Categories"_qs).get();
for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it) for (auto it = legacyCategories.cbegin(); it != legacyCategories.cend(); ++it)
{ {
const QString categoryName = it.key(); const QString &categoryName = it.key();
CategoryOptions categoryOptions; CategoryOptions categoryOptions;
categoryOptions.savePath = Path(it.value().toString()); categoryOptions.savePath = Path(it.value().toString());
m_categories[categoryName] = categoryOptions; m_categories[categoryName] = categoryOptions;

2
src/base/bittorrent/torrentimpl.cpp

@ -1632,7 +1632,7 @@ void TorrentImpl::endReceivedMetadataHandling(const Path &savePath, const PathLi
{ {
const auto nativeIndex = nativeIndexes.at(i); const auto nativeIndex = nativeIndexes.at(i);
const Path actualFilePath = fileNames.at(i); const Path &actualFilePath = fileNames.at(i);
p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString(); p.renamed_files[nativeIndex] = actualFilePath.toString().toStdString();
const Path filePath = actualFilePath.removedExtension(QB_EXT); const Path filePath = actualFilePath.removedExtension(QB_EXT);

2
src/base/net/smtp.cpp

@ -162,7 +162,7 @@ void Smtp::sendMail(const QString &from, const QString &to, const QString &subje
// Connect to SMTP server // Connect to SMTP server
const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':'); const QStringList serverEndpoint = pref->getMailNotificationSMTP().split(u':');
const QString serverAddress = serverEndpoint[0]; const QString &serverAddress = serverEndpoint[0];
const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1)); const std::optional<int> serverPort = Utils::String::parseInt(serverEndpoint.value(1));
#ifndef QT_NO_OPENSSL #ifndef QT_NO_OPENSSL

4
src/base/rss/rss_autodownloader.cpp

@ -382,13 +382,13 @@ void AutoDownloader::handleFeedURLChanged(Feed *feed, const QString &oldURL)
} }
} }
for (QSharedPointer<ProcessingJob> job : asConst(m_processingQueue)) for (const QSharedPointer<ProcessingJob> &job : asConst(m_processingQueue))
{ {
if (job->feedURL == oldURL) if (job->feedURL == oldURL)
job->feedURL = feed->url(); job->feedURL = feed->url();
} }
for (QSharedPointer<ProcessingJob> job : asConst(m_waitingJobs)) for (const QSharedPointer<ProcessingJob> &job : asConst(m_waitingJobs))
{ {
if (job->feedURL == oldURL) if (job->feedURL == oldURL)
job->feedURL = feed->url(); job->feedURL = feed->url();

2
src/base/rss/rss_parser.cpp

@ -541,7 +541,7 @@ namespace
const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>(); const int PARSINGRESULT_TYPEID = qRegisterMetaType<RSS::Private::ParsingResult>();
RSS::Private::Parser::Parser(const QString lastBuildDate) RSS::Private::Parser::Parser(const QString &lastBuildDate)
{ {
m_result.lastBuildDate = lastBuildDate; m_result.lastBuildDate = lastBuildDate;
} }

2
src/base/rss/rss_parser.h

@ -53,7 +53,7 @@ namespace RSS::Private
Q_DISABLE_COPY_MOVE(Parser) Q_DISABLE_COPY_MOVE(Parser)
public: public:
explicit Parser(QString lastBuildDate); explicit Parser(const QString &lastBuildDate);
void parse(const QByteArray &feedData); void parse(const QByteArray &feedData);
signals: signals:

2
src/base/search/searchpluginmanager.cpp

@ -609,7 +609,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
} }
} }
bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion newVersion) const bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const
{ {
const PluginInfo *plugin = pluginInfo(pluginName); const PluginInfo *plugin = pluginInfo(pluginName);
if (!plugin) return true; if (!plugin) return true;

2
src/base/search/searchpluginmanager.h

@ -109,7 +109,7 @@ private:
void updateNova(); void updateNova();
void parseVersionInfo(const QByteArray &info); void parseVersionInfo(const QByteArray &info);
void installPlugin_impl(const QString &name, const Path &path); void installPlugin_impl(const QString &name, const Path &path);
bool isUpdateNeeded(const QString &pluginName, PluginVersion newVersion) const; bool isUpdateNeeded(const QString &pluginName, const PluginVersion &newVersion) const;
void versionInfoDownloadFinished(const Net::DownloadResult &result); void versionInfoDownloadFinished(const Net::DownloadResult &result);
void pluginDownloadFinished(const Net::DownloadResult &result); void pluginDownloadFinished(const Net::DownloadResult &result);

2
src/gui/transferlistfilters/statusfilterwidget.cpp

@ -199,7 +199,7 @@ void StatusFilterWidget::hideZeroItems()
setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent); setCurrentRow(TorrentFilter::All, QItemSelectionModel::SelectCurrent);
} }
void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> torrents) void StatusFilterWidget::update(const QVector<BitTorrent::Torrent *> &torrents)
{ {
for (const BitTorrent::Torrent *torrent : torrents) for (const BitTorrent::Torrent *torrent : torrents)
updateTorrentStatus(torrent); updateTorrentStatus(torrent);

2
src/gui/transferlistfilters/statusfilterwidget.h

@ -58,7 +58,7 @@ private:
void configure(); void configure();
void update(QVector<BitTorrent::Torrent *> torrents); void update(const QVector<BitTorrent::Torrent *> &torrents);
void updateTorrentStatus(const BitTorrent::Torrent *torrent); void updateTorrentStatus(const BitTorrent::Torrent *torrent);
void updateTexts(); void updateTexts();
void hideZeroItems(); void hideZeroItems();

2
src/webui/api/appcontroller.cpp

@ -149,7 +149,7 @@ void AppController::preferencesAction()
QJsonObject nativeDirs; QJsonObject nativeDirs;
for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i) for (auto i = watchedFolders.cbegin(); i != watchedFolders.cend(); ++i)
{ {
const Path watchedFolder = i.key(); const Path &watchedFolder = i.key();
const BitTorrent::AddTorrentParams params = i.value().addTorrentParams; const BitTorrent::AddTorrentParams params = i.value().addTorrentParams;
if (params.savePath.isEmpty()) if (params.savePath.isEmpty())
nativeDirs.insert(watchedFolder.toString(), 1); nativeDirs.insert(watchedFolder.toString(), 1);

Loading…
Cancel
Save