Skip to content

Commit

Permalink
Merge pull request qbittorrent#19260 from Chocobo1/func
Browse files Browse the repository at this point in the history
Fix code defects
  • Loading branch information
Chocobo1 authored Jul 2, 2023
2 parents c3fc96d + 715a4f3 commit 08a7714
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/base/bittorrent/customstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bool CustomDiskIOThread::async_write(lt::storage_index_t storage, const lt::peer
, const char *buf, std::shared_ptr<lt::disk_observer> diskObserver
, std::function<void (const lt::storage_error &)> handler, lt::disk_job_flags_t flags)
{
return m_nativeDiskIO->async_write(storage, peerRequest, buf, diskObserver, std::move(handler), flags);
return m_nativeDiskIO->async_write(storage, peerRequest, buf, std::move(diskObserver), std::move(handler), flags);
}

void CustomDiskIOThread::async_hash(lt::storage_index_t storage, lt::piece_index_t piece
Expand Down Expand Up @@ -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)
{
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)
Expand Down Expand Up @@ -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
, 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)
{
m_storageData[storage].filePriorities = priorities;
Expand Down
2 changes: 1 addition & 1 deletion src/base/bittorrent/portforwarderimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>());

m_portProfiles[profile] = ports;
m_portProfiles[profile] = std::move(ports);
const QSet<quint16> newForwardedPorts = std::accumulate(m_portProfiles.cbegin(), m_portProfiles.cend(), QSet<quint16>());

m_provider->removeMappedPorts(oldForwardedPorts - newForwardedPorts);
Expand Down
5 changes: 3 additions & 2 deletions src/base/bittorrent/sessionimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ void SessionImpl::processNextResumeData(ResumeSessionContext *context)
std::shared_ptr<lt::torrent_info> ti = resumeData.ltAddTorrentParams.ti;
resumeData = *loadPreferredResumeDataResult;
if (!resumeData.ltAddTorrentParams.ti)
resumeData.ltAddTorrentParams.ti = ti;
resumeData.ltAddTorrentParams.ti = std::move(ti);
}
}
}
Expand Down Expand Up @@ -6091,7 +6091,8 @@ void SessionImpl::processTrackerStatuses()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
updatedTrackerEntries[trackerEntry.url] = std::move(trackerEntry);
#else
updatedTrackerEntries.emplace(trackerEntry.url, std::move(trackerEntry));
const QString url = trackerEntry.url;
updatedTrackerEntries.emplace(url, std::move(trackerEntry));
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/base/digest32.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Digest32
class Data;

explicit Digest32(QSharedDataPointer<Data> dataPtr)
: m_dataPtr {dataPtr}
: m_dataPtr {std::move(dataPtr)}
{
}

Expand Down

0 comments on commit 08a7714

Please sign in to comment.