Browse Source

Use move construct for large data

adaptive-webui-19844
Chocobo1 1 year ago
parent
commit
715a4f3eb6
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 4
      src/base/bittorrent/customstorage.cpp
  2. 2
      src/base/bittorrent/portforwarderimpl.cpp

4
src/base/bittorrent/customstorage.cpp

@ -141,7 +141,7 @@ void CustomDiskIOThread::async_check_files(lt::storage_index_t storage, const lt
, std::function<void (lt::status_t, const lt::storage_error &)> handler) , std::function<void (lt::status_t, const lt::storage_error &)> handler)
{ {
handleCompleteFiles(storage, m_storageData[storage].savePath); 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<void ()> handler) void CustomDiskIOThread::async_stop_torrent(lt::storage_index_t storage, std::function<void ()> 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<lt::download_priority_t, lt::file_index_t> priorities void CustomDiskIOThread::async_set_file_priority(lt::storage_index_t storage, lt::aux::vector<lt::download_priority_t, lt::file_index_t> priorities
, 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, std::move(priorities)
, [=, handler = std::move(handler)](const lt::storage_error &error, const 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;

2
src/base/bittorrent/portforwarderimpl.cpp

@ -67,7 +67,7 @@ void PortForwarderImpl::setPorts(const QString &profile, QSet<quint16> ports)
{ {
const QSet<quint16> oldForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet<quint16>()); const QSet<quint16> oldForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet<quint16>());
m_portProfiles[profile] = ports; m_portProfiles[profile] = std::move(ports);
const QSet<quint16> newForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet<quint16>()); const QSet<quint16> newForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet<quint16>());
m_provider->removeMappedPorts(oldForwardedPorts - newForwardedPorts); m_provider->removeMappedPorts(oldForwardedPorts - newForwardedPorts);

Loading…
Cancel
Save