* fix: queue torrent verification as soon as metadata complete
* fix: avoid heap-use-after-free in `tr_peerMsgsImpl::process_peer_message()`
Details: https://github.com/transmission/transmission/pull/6383#discussion_r1429202253
* code review: move `tr_torrent::do_magnet_idle_work()` to private
* code review: `std::deque::empty()` is not `constexpr`
* fix: test
* refactor: unset peer BEP-9 support if size hint is invalid
* fix: open torrent file in binary mode
* refactor: move metadata size check to method
* refactor: remove duplicate checks
* refactor: reduce temp variable scope in `parseLtepHandshake()`
* refactor: convert `get_piece_length()` to method
* refactor: convert `tr_torrentSetMetadataSizeHint()` to method
* refactor: convert `tr_torrentGetMetadataPiece()` to method
* refactor: convert `tr_torrentUseMetainfoFromFile()` to method
* refactor: convert `tr_torrentSetMetadataPiece()` to method
* refactor: convert `tr_torrentGetNextMetadataRequest()` to method
* refactor: convert `tr_torrentGetMetadataPercent()` to method
* refactor: add basic framework for MagnetMediator
* refactor: initialise `tr_incomplete_metadata` fields in constructor
* refactor: check metadata transfer completion in `set_metadata_piece()`
* refactor: convert `use_new_metainfo()` and `on_have_all_metainfo()` to methods
* refactor: move parts of `tr_torrent::set_metadata_piece()` into `tr_incomplete_metadata`
* refactor: move parts of `tr_torrent::get_next_metadata_request()` into `tr_incomplete_metadata`
* refactor: move parts of `tr_torrent::get_metadata_percent()` into `tr_incomplete_metadata`
* refactor: hide all `tr_incomplete_metadata` fields
* refactor: move `incomplete_metadata` to private
* feat: add test for `set_metadata_piece()`
* refactor: unify integer types
* refactor: rename `tr_incomplete_metadata` to `tr_metadata_download`
* chore: make clang-tidy happy
libtransmission/torrent-magnet.cc:117:68: warning: comparison of integers of different signs: 'long' and 'const uint64_t' (aka 'const unsigned long') [clang-diagnostic-sign-compare]
* refactor: pass log name to `tr_metadata_download` constructor
* chore: iwyu
* fix: thread-safe `TorrentMagnetTest.setMetadataPiece`
* chore: housekeeping
* Revert "fix: thread-safe `TorrentMagnetTest.setMetadataPiece`"
This reverts commit 2a7fcd93a262888f9f55d542b1a9a2da9ca72cea.
* fix: stop soon instead of stop now in `on_metainfo_completed()`
This is unreachable code now, but if it is ever reached, Transmission
will very likely crash.
* fix: maybe fix OpenBSD test failure
* refactor: remove the tr_error** idiom
* fix: tr_error::message() is only constexpr in c++20 and up
* chore: silence a couple of g++-12 Wshadow warnings
* refactor: tr_torrentGetMetadataPiece() returns an optional vector
* refactor: use tr_pathbuf in create_temp_path()
* refactor: use tr_pathbuf in win32 create_temp_path()
* refactor: use std::vector in isPeerInteresting()
* refactor: remove tr_new0 from tr_peerMgrPeerStats()
* refactor: remove tr_new0 from rechokeUploads()
* refactor: silence clang nullptr dereference warning
* refactor: make tr_natpmp a C++ class
* refactor: use std::string in tr_log_message
Simple change to silence warnings, changes the offending enums to be
constexprs. There is still more cleanup work to update other enums;
this just addresses the ones causing compiler warnings
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).
The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed
2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)
3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
The Berne Convention says that the copyright year is moot, so instead of adding another year to each file as in previous years, I've removed the year altogether from the source code comments in libtransmission, gtk, qt, utils, daemon, and cli.
Juliusz's copyright notice in tr-dht and Johannes' copyright notice in tr-lpd have been left alone; it didn't seem appropriate to modify them.