diff --git a/libtransmission/announcer.cc b/libtransmission/announcer.cc index b1517fbf5..580b455bf 100644 --- a/libtransmission/announcer.cc +++ b/libtransmission/announcer.cc @@ -419,7 +419,7 @@ struct tr_tier return currentTracker(); } - [[nodiscard]] std::optional indexOf(tr_interned_string const& announce_url) const + [[nodiscard]] std::optional indexOf(tr_interned_string announce_url) const { for (size_t i = 0, n = std::size(trackers); i < n; ++i) { @@ -579,7 +579,7 @@ struct tr_torrent_announcer return nullptr; } - tr_tier* getTierFromScrape(tr_interned_string const& scrape_url) + tr_tier* getTierFromScrape(tr_interned_string scrape_url) { for (auto& tier : tiers) { @@ -600,7 +600,7 @@ struct tr_torrent_announcer } [[nodiscard]] bool findTracker( - tr_interned_string const& announce_url, + tr_interned_string announce_url, tr_tier const** setme_tier, tr_tracker const** setme_tracker) const { diff --git a/libtransmission/cache.cc b/libtransmission/cache.cc index ab73f0cd4..47d06441e 100644 --- a/libtransmission/cache.cc +++ b/libtransmission/cache.cc @@ -161,7 +161,7 @@ int Cache::writeBlock(tr_torrent_id_t tor_id, tr_block_index_t block, std::uniqu return cacheTrim(); } -Cache::CIter Cache::getBlock(tr_torrent const* torrent, tr_block_info::Location loc) noexcept +Cache::CIter Cache::getBlock(tr_torrent const* torrent, tr_block_info::Location const& loc) noexcept { if (auto const [begin, end] = std::equal_range( std::begin(blocks_), @@ -176,7 +176,7 @@ Cache::CIter Cache::getBlock(tr_torrent const* torrent, tr_block_info::Location return std::end(blocks_); } -int Cache::readBlock(tr_torrent* torrent, tr_block_info::Location loc, uint32_t len, uint8_t* setme) +int Cache::readBlock(tr_torrent* torrent, tr_block_info::Location const& loc, uint32_t len, uint8_t* setme) { if (auto const iter = getBlock(torrent, loc); iter != std::end(blocks_)) { @@ -187,7 +187,7 @@ int Cache::readBlock(tr_torrent* torrent, tr_block_info::Location loc, uint32_t return tr_ioRead(torrent, loc, len, setme); } -int Cache::prefetchBlock(tr_torrent* torrent, tr_block_info::Location loc, uint32_t len) +int Cache::prefetchBlock(tr_torrent* torrent, tr_block_info::Location const& loc, uint32_t len) { if (auto const iter = getBlock(torrent, loc); iter != std::end(blocks_)) { diff --git a/libtransmission/cache.h b/libtransmission/cache.h index 9d6455610..255a2780d 100644 --- a/libtransmission/cache.h +++ b/libtransmission/cache.h @@ -38,8 +38,8 @@ public: // @return any error code from cacheTrim() int writeBlock(tr_torrent_id_t tor, tr_block_index_t block, std::unique_ptr> writeme); - int readBlock(tr_torrent* torrent, tr_block_info::Location loc, uint32_t len, uint8_t* setme); - int prefetchBlock(tr_torrent* torrent, tr_block_info::Location loc, uint32_t len); + int readBlock(tr_torrent* torrent, tr_block_info::Location const& loc, uint32_t len, uint8_t* setme); + int prefetchBlock(tr_torrent* torrent, tr_block_info::Location const& loc, uint32_t len); int flushTorrent(tr_torrent const* torrent); int flushFile(tr_torrent const* torrent, tr_file_index_t file); @@ -86,7 +86,7 @@ private: [[nodiscard]] static size_t getMaxBlocks(int64_t max_bytes) noexcept; - [[nodiscard]] CIter getBlock(tr_torrent const* torrent, tr_block_info::Location loc) noexcept; + [[nodiscard]] CIter getBlock(tr_torrent const* torrent, tr_block_info::Location const& loc) noexcept; tr_torrents& torrents_; diff --git a/libtransmission/inout.cc b/libtransmission/inout.cc index 8eac8dd1d..9444b9843 100644 --- a/libtransmission/inout.cc +++ b/libtransmission/inout.cc @@ -282,17 +282,17 @@ std::optional recalculateHash(tr_torrent* tor, tr_piece_index_ } // namespace -int tr_ioRead(tr_torrent* tor, tr_block_info::Location loc, size_t len, uint8_t* setme) +int tr_ioRead(tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t* setme) { return readOrWritePiece(tor, IoMode::Read, loc, setme, len); } -int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location loc, size_t len) +int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location const& loc, size_t len) { return readOrWritePiece(tor, IoMode::Prefetch, loc, nullptr, len); } -int tr_ioWrite(tr_torrent* tor, tr_block_info::Location loc, size_t len, uint8_t const* writeme) +int tr_ioWrite(tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t const* writeme) { return readOrWritePiece(tor, IoMode::Write, loc, const_cast(writeme), len); } diff --git a/libtransmission/inout.h b/libtransmission/inout.h index 94c9c7237..6034910ca 100644 --- a/libtransmission/inout.h +++ b/libtransmission/inout.h @@ -26,15 +26,15 @@ struct tr_torrent; * Reads the block specified by the piece index, offset, and length. * @return 0 on success, or an errno value on failure. */ -[[nodiscard]] int tr_ioRead(struct tr_torrent* tor, tr_block_info::Location loc, size_t len, uint8_t* setme); +[[nodiscard]] int tr_ioRead(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t* setme); -int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location loc, size_t len); +int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location const& loc, size_t len); /** * Writes the block specified by the piece index, offset, and length. * @return 0 on success, or an errno value on failure. */ -[[nodiscard]] int tr_ioWrite(struct tr_torrent* tor, tr_block_info::Location loc, size_t len, uint8_t const* writeme); +[[nodiscard]] int tr_ioWrite(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t const* writeme); /** * @brief Test to see if the piece matches its metainfo's SHA1 checksum. diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index 80fed1322..45b5a8231 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -2559,8 +2559,8 @@ void renameTorrentFileString(tr_torrent* tor, std::string_view oldpath, std::str void torrentRenamePath( tr_torrent* const tor, - std::string oldpath, // NOLINT performance-unnecessary-value-param - std::string newname, // NOLINT performance-unnecessary-value-param + std::string const& oldpath, // NOLINT performance-unnecessary-value-param + std::string const& newname, // NOLINT performance-unnecessary-value-param tr_torrent_rename_done_func callback, void* const callback_user_data) {