From 715a4f3eb63244bce7e466cce020cc04d503c52e Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 1 Jul 2023 13:47:15 +0800 Subject: [PATCH] Use move construct for large data --- src/base/bittorrent/customstorage.cpp | 4 ++-- src/base/bittorrent/portforwarderimpl.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/customstorage.cpp b/src/base/bittorrent/customstorage.cpp index d6f25cd1b..7d746da78 100644 --- a/src/base/bittorrent/customstorage.cpp +++ b/src/base/bittorrent/customstorage.cpp @@ -141,7 +141,7 @@ void CustomDiskIOThread::async_check_files(lt::storage_index_t storage, const lt , std::function handler) { handleCompleteFiles(storage, m_storageData[storage].savePath); - m_nativeDiskIO->async_check_files(storage, resume_data, links, std::move(handler)); + m_nativeDiskIO->async_check_files(storage, resume_data, std::move(links), std::move(handler)); } void CustomDiskIOThread::async_stop_torrent(lt::storage_index_t storage, std::function handler) @@ -170,7 +170,7 @@ void CustomDiskIOThread::async_delete_files(lt::storage_index_t storage, lt::rem void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt::aux::vector priorities , std::function)> handler) { - m_nativeDiskIO->async_set_file_priority(storage, priorities + m_nativeDiskIO->async_set_file_priority(storage, std::move(priorities) , [=, handler = std::move(handler)](const lt::storage_error &error, const lt::aux::vector &priorities) { m_storageData[storage].filePriorities = priorities; diff --git a/src/base/bittorrent/portforwarderimpl.cpp b/src/base/bittorrent/portforwarderimpl.cpp index 7dcb11201..803682f27 100644 --- a/src/base/bittorrent/portforwarderimpl.cpp +++ b/src/base/bittorrent/portforwarderimpl.cpp @@ -67,7 +67,7 @@ void PortForwarderImpl::setPorts(const QString &profile, QSet ports) { const QSet oldForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet()); - m_portProfiles[profile] = ports; + m_portProfiles[profile] = std::move(ports); const QSet newForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet()); m_provider->removeMappedPorts(oldForwardedPorts - newForwardedPorts);