diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 5326a8a51..14a6136c8 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/libtransmission/announce-list.cc b/libtransmission/announce-list.cc index 580f36a41..829125bff 100644 --- a/libtransmission/announce-list.cc +++ b/libtransmission/announce-list.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -17,7 +18,6 @@ #include "libtransmission/error.h" #include "libtransmission/quark.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/torrent-metainfo.h" #include "libtransmission/utils.h" #include "libtransmission/variant.h" #include "libtransmission/web-utils.h" diff --git a/libtransmission/announce-list.h b/libtransmission/announce-list.h index c51d80b1b..32fe33b36 100644 --- a/libtransmission/announce-list.h +++ b/libtransmission/announce-list.h @@ -13,7 +13,6 @@ #include "libtransmission/transmission.h" -#include "libtransmission/quark.h" #include "libtransmission/interned-string.h" #include "libtransmission/tr-macros.h" #include "libtransmission/variant.h" diff --git a/libtransmission/announcer-http.cc b/libtransmission/announcer-http.cc index 967611bfe..1d00a4c38 100644 --- a/libtransmission/announcer-http.cc +++ b/libtransmission/announcer-http.cc @@ -7,7 +7,6 @@ #include #include // std::byte, size_t #include // int64_t, uint8_t, uint... -#include /* fprintf() */ #include #include #include @@ -34,7 +33,6 @@ #include "libtransmission/net.h" #include "libtransmission/peer-mgr.h" /* pex */ #include "libtransmission/session.h" -#include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" #include "libtransmission/tr-strbuf.h" // tr_strbuf, tr_urlbuf diff --git a/libtransmission/bandwidth.h b/libtransmission/bandwidth.h index 56d67d808..c8527a317 100644 --- a/libtransmission/bandwidth.h +++ b/libtransmission/bandwidth.h @@ -16,9 +16,9 @@ #include // for std::move() #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "tr-assert.h" +#include "libtransmission/tr-assert.h" class tr_peerIo; diff --git a/libtransmission/benc.h b/libtransmission/benc.h index e02e37d27..39749c087 100644 --- a/libtransmission/benc.h +++ b/libtransmission/benc.h @@ -14,7 +14,7 @@ #include #include // make_pair -#include "error.h" +#include "libtransmission/error.h" namespace transmission::benc { diff --git a/libtransmission/bitfield.h b/libtransmission/bitfield.h index e88a8b1f7..bdb7e7d6a 100644 --- a/libtransmission/bitfield.h +++ b/libtransmission/bitfield.h @@ -13,7 +13,7 @@ #include // uint8_t #include // std::vector -#include "tr-macros.h" // TR_CONSTEXPR20 +#include "libtransmission/tr-macros.h" // TR_CONSTEXPR20 /** * @brief Implementation of the BitTorrent spec's Bitfield array of bits. diff --git a/libtransmission/block-info.h b/libtransmission/block-info.h index 83228cc5e..9b2e3c9c6 100644 --- a/libtransmission/block-info.h +++ b/libtransmission/block-info.h @@ -7,7 +7,7 @@ #include // uint32_t, uint64_t -#include "transmission.h" +#include "libtransmission/transmission.h" struct tr_block_info { diff --git a/libtransmission/blocklist.h b/libtransmission/blocklist.h index ea7df6282..70a3083a7 100644 --- a/libtransmission/blocklist.h +++ b/libtransmission/blocklist.h @@ -9,6 +9,8 @@ #error only libtransmission should #include this header. #endif +#include // std::any_of +#include // size_t #include #include #include diff --git a/libtransmission/cache.h b/libtransmission/cache.h index b1d96e240..53b0467ef 100644 --- a/libtransmission/cache.h +++ b/libtransmission/cache.h @@ -17,9 +17,9 @@ #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "block-info.h" +#include "libtransmission/block-info.h" class tr_torrents; struct tr_torrent; diff --git a/libtransmission/clients.cc b/libtransmission/clients.cc index bf7609eb9..ce5348138 100644 --- a/libtransmission/clients.cc +++ b/libtransmission/clients.cc @@ -8,6 +8,7 @@ #include #include #include /* isprint() */ +#include // uint8_t #include #include #include @@ -17,6 +18,7 @@ #include #include "libtransmission/clients.h" +#include "libtransmission/tr-macros.h" // tr_peer_id_t #include "libtransmission/utils.h" using namespace std::literals; diff --git a/libtransmission/clients.h b/libtransmission/clients.h index 573c63709..44db1165e 100644 --- a/libtransmission/clients.h +++ b/libtransmission/clients.h @@ -11,7 +11,7 @@ #include // size_t -#include "tr-macros.h" // tr_peer_id_t +#include "libtransmission/tr-macros.h" // tr_peer_id_t /** * @brief parse a peer-id into a human-readable client name and version number diff --git a/libtransmission/file-capacity.cc b/libtransmission/file-capacity.cc index fa435e5c0..d0399a89f 100644 --- a/libtransmission/file-capacity.cc +++ b/libtransmission/file-capacity.cc @@ -5,6 +5,9 @@ #include #include +#include // int64_t +#include // FILE +#include #include #include @@ -63,12 +66,10 @@ #include #endif -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" #include "libtransmission/file.h" #include "libtransmission/tr-macros.h" -#include "libtransmission/utils.h" +#include "libtransmission/utils.h" // tr_win32_utf8_to_native namespace { diff --git a/libtransmission/file-posix.cc b/libtransmission/file-posix.cc index 3ac446717..19095e208 100644 --- a/libtransmission/file-posix.cc +++ b/libtransmission/file-posix.cc @@ -11,6 +11,7 @@ #include #include /* PATH_MAX */ #include /* SIZE_MAX */ +#include // remove, rename #include // mkdtemp, mkstemp, realpath #include #include @@ -50,11 +51,8 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" #include "libtransmission/file.h" -#include "libtransmission/log.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" // TR_UCLIBC_CHECK_VERSION #include "libtransmission/tr-strbuf.h" diff --git a/libtransmission/global-ip-cache.cc b/libtransmission/global-ip-cache.cc index 74ce99c98..f1fc3cd44 100644 --- a/libtransmission/global-ip-cache.cc +++ b/libtransmission/global-ip-cache.cc @@ -20,7 +20,6 @@ #include "libtransmission/log.h" #include "libtransmission/global-ip-cache.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/tr-macros.h" #include "libtransmission/utils.h" namespace diff --git a/libtransmission/handshake.h b/libtransmission/handshake.h index 7c788854b..e8692756c 100644 --- a/libtransmission/handshake.h +++ b/libtransmission/handshake.h @@ -23,13 +23,19 @@ #include "libtransmission/transmission.h" -#include "libtransmission/net.h" #include "libtransmission/peer-mse.h" // tr_message_stream_encryption::DH #include "libtransmission/peer-io.h" #include "libtransmission/timer.h" #include "libtransmission/tr-macros.h" // tr_sha1_digest_t, tr_peer_id_t struct tr_error; +struct tr_socket_address; + +namespace libtransmission +{ +template +class BufferWriter; +} // short-term class which manages the handshake phase of a tr_peerIo class tr_handshake diff --git a/libtransmission/inout.cc b/libtransmission/inout.cc index 56926b965..680b0e3d7 100644 --- a/libtransmission/inout.cc +++ b/libtransmission/inout.cc @@ -19,7 +19,6 @@ #include "libtransmission/error.h" #include "libtransmission/file.h" #include "libtransmission/inout.h" -#include "libtransmission/log.h" #include "libtransmission/session.h" #include "libtransmission/torrent.h" #include "libtransmission/torrent-files.h" diff --git a/libtransmission/interned-string.h b/libtransmission/interned-string.h index 5cc7efdf4..35cfd3620 100644 --- a/libtransmission/interned-string.h +++ b/libtransmission/interned-string.h @@ -9,7 +9,7 @@ #include -#include "quark.h" +#include "libtransmission/quark.h" /** * Helper functions wrapped around tr_quark diff --git a/libtransmission/net.cc b/libtransmission/net.cc index c6a236ece..a6938ba5e 100644 --- a/libtransmission/net.cc +++ b/libtransmission/net.cc @@ -12,8 +12,6 @@ #include #include // std::pair -#include - #ifdef _WIN32 #include #else @@ -24,15 +22,13 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/peer-socket.h" #include "libtransmission/session.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" -#include "libtransmission/tr-utp.h" +#include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" using namespace std::literals; diff --git a/libtransmission/net.h b/libtransmission/net.h index 5b1b1c2f0..7fb7c7a86 100644 --- a/libtransmission/net.h +++ b/libtransmission/net.h @@ -11,6 +11,7 @@ #include // for std::copy_n #include #include // size_t +#include // uint16_t, uint32_t, uint8_t #include #include #include @@ -269,7 +270,7 @@ struct tr_address [[nodiscard]] auto is_any() const noexcept { - return is_valid() ? *this == any(type) : false; + return is_valid() && *this == any(type); } }; diff --git a/libtransmission/observable.h b/libtransmission/observable.h index 97c5c80fb..fcff8967e 100644 --- a/libtransmission/observable.h +++ b/libtransmission/observable.h @@ -9,13 +9,13 @@ #error only libtransmission should #include this header. #endif -#include // for std::move #include // for size_t #include +#include // for std::move #include -#include "tr-assert.h" +#include "libtransmission/tr-assert.h" namespace libtransmission { @@ -30,13 +30,12 @@ public: ObserverTag() = default; - ObserverTag(ObserverTag&& that) + ObserverTag(ObserverTag&& that) noexcept { - on_destroy_ = std::move(that.on_destroy_); - that.on_destroy_ = nullptr; + *this = std::forward(that); } - ObserverTag& operator=(ObserverTag&& that) + ObserverTag& operator=(ObserverTag&& that) noexcept { on_destroy_ = std::move(that.on_destroy_); that.on_destroy_ = nullptr; @@ -46,7 +45,7 @@ public: ObserverTag(ObserverTag const&) = delete; ObserverTag& operator=(ObserverTag const&) = delete; - ObserverTag(Callback on_destroy) + explicit ObserverTag(Callback on_destroy) : on_destroy_{ std::move(on_destroy) } { } @@ -54,7 +53,9 @@ public: ~ObserverTag() { if (on_destroy_) + { on_destroy_(); + } } private: @@ -92,7 +93,7 @@ public: { for (auto& [tag, observer] : observers_) { - observer((args)...); + observer(args...); } } diff --git a/libtransmission/open-files.h b/libtransmission/open-files.h index f76d10aa1..852fbe0cb 100644 --- a/libtransmission/open-files.h +++ b/libtransmission/open-files.h @@ -15,10 +15,10 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "file.h" // tr_sys_file_t -#include "lru-cache.h" +#include "libtransmission/file.h" // tr_sys_file_t +#include "libtransmission/lru-cache.h" // A pool of open files that are cached while reading / writing torrents' data class tr_open_files diff --git a/libtransmission/peer-io.cc b/libtransmission/peer-io.cc index 782f39f12..b63e90407 100644 --- a/libtransmission/peer-io.cc +++ b/libtransmission/peer-io.cc @@ -3,10 +3,10 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include #include #include -#include +#include +#include // std::underlying_type_t #ifdef _WIN32 #include diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index d290a8856..068b558b4 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -22,7 +22,6 @@ #include "libtransmission/bandwidth.h" #include "libtransmission/block-info.h" -#include "libtransmission/net.h" // tr_address #include "libtransmission/peer-mse.h" #include "libtransmission/peer-socket.h" #include "libtransmission/tr-buffer.h" @@ -32,6 +31,7 @@ struct struct_utp_context; struct tr_error; struct tr_session; +struct tr_socket_address; namespace libtransmission::test { diff --git a/libtransmission/peer-mgr.cc b/libtransmission/peer-mgr.cc index 168cabbc5..c8454bc00 100644 --- a/libtransmission/peer-mgr.cc +++ b/libtransmission/peer-mgr.cc @@ -46,6 +46,7 @@ #include "libtransmission/timer.h" #include "libtransmission/torrent-magnet.h" #include "libtransmission/torrent.h" +#include "libtransmission/torrents.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" #include "libtransmission/utils.h" diff --git a/libtransmission/peer-msgs.cc b/libtransmission/peer-msgs.cc index a0477701b..56cc3f920 100644 --- a/libtransmission/peer-msgs.cc +++ b/libtransmission/peer-msgs.cc @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include +#include // uint8_t, uint32_t, int64_t #include #include #include @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/libtransmission/peer-socket.cc b/libtransmission/peer-socket.cc index f726e9fa9..2bcdb0756 100644 --- a/libtransmission/peer-socket.cc +++ b/libtransmission/peer-socket.cc @@ -3,12 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::min +#include + #include #include -#include "libtransmission/transmission.h" - +#include "libtransmission/error.h" +#include "libtransmission/log.h" #include "libtransmission/peer-socket.h" #include "libtransmission/net.h" #include "libtransmission/session.h" diff --git a/libtransmission/peer-socket.h b/libtransmission/peer-socket.h index 11bc3d3d7..30c3add4d 100644 --- a/libtransmission/peer-socket.h +++ b/libtransmission/peer-socket.h @@ -12,15 +12,10 @@ #include #include // size_t #include -#include #include // for std::make_pair() -#include "transmission.h" - -#include "error.h" -#include "net.h" -#include "tr-assert.h" -#include "tr-buffer.h" +#include "libtransmission/net.h" +#include "libtransmission/tr-buffer.h" struct UTPSocket; struct tr_session; diff --git a/libtransmission/platform.cc b/libtransmission/platform.cc index e85e2a964..a5f0a72f6 100644 --- a/libtransmission/platform.cc +++ b/libtransmission/platform.cc @@ -43,14 +43,11 @@ #include "libtransmission/log.h" #include "libtransmission/platform.h" #include "libtransmission/session.h" +#include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" using namespace std::literals; -// FIXME(ckerr) do not merge these three lines. -// This comment is to make CI think libtransmission has -// changed so that it will run the libtransmission CI tests - namespace { #ifdef _WIN32 diff --git a/libtransmission/resume.cc b/libtransmission/resume.cc index aa1e7b4a2..488a22351 100644 --- a/libtransmission/resume.cc +++ b/libtransmission/resume.cc @@ -3,6 +3,8 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::min +#include #include #include #include @@ -12,14 +14,17 @@ #include "libtransmission/transmission.h" +#include "libtransmission/bitfield.h" #include "libtransmission/error.h" #include "libtransmission/file.h" #include "libtransmission/log.h" -#include "libtransmission/magnet-metainfo.h" +#include "libtransmission/net.h" #include "libtransmission/peer-mgr.h" /* pex */ +#include "libtransmission/quark.h" #include "libtransmission/resume.h" #include "libtransmission/session.h" #include "libtransmission/torrent.h" +#include "libtransmission/torrent-metainfo.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils.h" #include "libtransmission/variant.h" diff --git a/libtransmission/session-alt-speeds.cc b/libtransmission/session-alt-speeds.cc index e1855e657..d9ef603f8 100644 --- a/libtransmission/session-alt-speeds.cc +++ b/libtransmission/session-alt-speeds.cc @@ -5,6 +5,7 @@ #include #include // size_t +#include #include diff --git a/libtransmission/session.h b/libtransmission/session.h index d29e3157e..fc99204ea 100644 --- a/libtransmission/session.h +++ b/libtransmission/session.h @@ -49,11 +49,13 @@ #include "libtransmission/open-files.h" #include "libtransmission/port-forwarding.h" #include "libtransmission/quark.h" +#include "libtransmission/rpc-server.h" #include "libtransmission/session-alt-speeds.h" #include "libtransmission/session-id.h" #include "libtransmission/session-settings.h" #include "libtransmission/session-thread.h" #include "libtransmission/stats.h" +#include "libtransmission/timer.h" #include "libtransmission/torrents.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-dht.h" @@ -67,17 +69,10 @@ tr_peer_id_t tr_peerIdInit(); class tr_peer_socket; struct tr_pex; -class tr_rpc_server; struct tr_torrent; struct struct_utp_context; struct tr_variant; -namespace libtransmission -{ -class Timer; -class TimerMaker; -} // namespace libtransmission - namespace libtransmission::test { diff --git a/libtransmission/stats.cc b/libtransmission/stats.cc index 39635e034..9c7a5666c 100644 --- a/libtransmission/stats.cc +++ b/libtransmission/stats.cc @@ -3,6 +3,10 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include +#include + #include "libtransmission/transmission.h" #include "libtransmission/file.h" diff --git a/libtransmission/torrent-ctor.cc b/libtransmission/torrent-ctor.cc index 3ff9275fb..adeeabd9b 100644 --- a/libtransmission/torrent-ctor.cc +++ b/libtransmission/torrent-ctor.cc @@ -3,9 +3,10 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include // EINVAL #include // size_t -#include //uint16_t +#include // uint16_t #include #include #include @@ -15,7 +16,6 @@ #include "libtransmission/transmission.h" #include "libtransmission/error.h" -#include "libtransmission/quark.h" #include "libtransmission/session.h" #include "libtransmission/torrent-metainfo.h" #include "libtransmission/torrent.h" diff --git a/libtransmission/torrent-magnet.cc b/libtransmission/torrent-magnet.cc index 68bb24771..7f9ee786d 100644 --- a/libtransmission/torrent-magnet.cc +++ b/libtransmission/torrent-magnet.cc @@ -9,7 +9,9 @@ #include #include #include +#include #include +#include // std::move #include #include diff --git a/libtransmission/torrent-metainfo.h b/libtransmission/torrent-metainfo.h index db688570d..d8340298c 100644 --- a/libtransmission/torrent-metainfo.h +++ b/libtransmission/torrent-metainfo.h @@ -11,11 +11,12 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "block-info.h" -#include "magnet-metainfo.h" -#include "torrent-files.h" +#include "libtransmission/block-info.h" +#include "libtransmission/magnet-metainfo.h" +#include "libtransmission/torrent-files.h" +#include "libtransmission/tr-macros.h" struct tr_error; diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index ed29a6b95..1936b947a 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -7,6 +7,7 @@ #include #include // EINVAL #include /* INT_MAX */ +#include // size_t #include #include #include @@ -15,13 +16,6 @@ #include #include -#ifndef _WIN32 -#include /* wait() */ -#include /* fork(), execvp(), _exit() */ -#else -#include /* CreateProcess(), GetLastError() */ -#endif - #include #include @@ -47,10 +41,13 @@ #include "libtransmission/torrent-metainfo.h" #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" #include "libtransmission/version.h" #include "libtransmission/web-utils.h" +struct tr_ctor; + using namespace std::literals; // --- diff --git a/libtransmission/torrent.h b/libtransmission/torrent.h index 82c05ea30..000ed674f 100644 --- a/libtransmission/torrent.h +++ b/libtransmission/torrent.h @@ -10,6 +10,7 @@ #endif #include // size_t +#include // uint64_t, uint16_t #include #include #include @@ -32,17 +33,16 @@ #include "libtransmission/log.h" #include "libtransmission/observable.h" #include "libtransmission/session.h" +#include "libtransmission/torrent-files.h" #include "libtransmission/torrent-magnet.h" #include "libtransmission/torrent-metainfo.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" #include "libtransmission/verify.h" +struct tr_ctor; class tr_swarm; struct tr_error; -struct tr_magnet_info; -struct tr_metainfo_parsed; -struct tr_session; struct tr_torrent; struct tr_torrent_announcer; diff --git a/libtransmission/torrents.h b/libtransmission/torrents.h index da643acb0..9874fec0b 100644 --- a/libtransmission/torrents.h +++ b/libtransmission/torrents.h @@ -24,7 +24,6 @@ #include "libtransmission/tr-macros.h" struct tr_torrent; -struct tr_torrent_metainfo; // A helper class to manage tracking sets of tr_torrent objects. class tr_torrents diff --git a/libtransmission/tr-assert.mm b/libtransmission/tr-assert.mm index ada037cd8..d85c855dc 100644 --- a/libtransmission/tr-assert.mm +++ b/libtransmission/tr-assert.mm @@ -9,7 +9,7 @@ #include -#include "tr-assert.h" +#include "libtransmission/tr-assert.h" #if !defined(NDEBUG) || defined(TR_FORCE_ASSERTIONS) diff --git a/libtransmission/tr-buffer.h b/libtransmission/tr-buffer.h index fc1067d65..7382d4dc5 100644 --- a/libtransmission/tr-buffer.h +++ b/libtransmission/tr-buffer.h @@ -14,9 +14,9 @@ #include -#include "error.h" -#include "net.h" // tr_socket_t -#include "utils.h" // for tr_htonll(), tr_ntohll() +#include "libtransmission/error.h" +#include "libtransmission/net.h" // tr_socket_t +#include "libtransmission/utils.h" // for tr_htonll(), tr_ntohll() namespace libtransmission { diff --git a/libtransmission/tr-lpd.cc b/libtransmission/tr-lpd.cc index c66f84c98..bfc89ea46 100644 --- a/libtransmission/tr-lpd.cc +++ b/libtransmission/tr-lpd.cc @@ -5,8 +5,10 @@ #include #include #include -#include +#include // std::byte +#include // uint16_t #include +#include // time_t #include #include #include @@ -15,7 +17,6 @@ #ifdef _WIN32 #include #else -#include #include /* socket(), bind() */ #include /* sockaddr_in */ #endif diff --git a/libtransmission/tr-utp.cc b/libtransmission/tr-utp.cc index f9210a34e..191955b49 100644 --- a/libtransmission/tr-utp.cc +++ b/libtransmission/tr-utp.cc @@ -9,16 +9,12 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" // tr_rand_int() #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/peer-io.h" -#include "libtransmission/peer-mgr.h" #include "libtransmission/peer-socket.h" #include "libtransmission/session.h" -#include "libtransmission/timer.h" #include "libtransmission/tr-utp.h" #include "libtransmission/utils.h" diff --git a/libtransmission/tr-utp.h b/libtransmission/tr-utp.h index 35b0d2976..2cb658536 100644 --- a/libtransmission/tr-utp.h +++ b/libtransmission/tr-utp.h @@ -10,6 +10,12 @@ #include // size_t +#ifndef _WIN32 +#include +#else +#include +#endif + struct tr_session; void tr_utpInit(tr_session* session); diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index d4397c2ea..1b5ed6263 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -21,7 +21,7 @@ #include // bool #endif -#include "tr-macros.h" +#include "libtransmission/tr-macros.h" using tr_file_index_t = size_t; using tr_piece_index_t = uint32_t; diff --git a/libtransmission/utils.cc b/libtransmission/utils.cc index c71f473f4..065efc1de 100644 --- a/libtransmission/utils.cc +++ b/libtransmission/utils.cc @@ -17,9 +17,11 @@ #include #include #include +#include // std::runtime_error #include #include #include +#include #include #ifdef _WIN32 diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 3a55a7347..4c5351445 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -5,7 +5,6 @@ #pragma once -#include #include #include // uint8_t, uint32_t, uint64_t #include // size_t @@ -19,6 +18,7 @@ #include #include "libtransmission/tr-macros.h" +#include "libtransmission/variant.h" struct tr_error; diff --git a/libtransmission/utils.mm b/libtransmission/utils.mm index 669ca50b7..89acec815 100644 --- a/libtransmission/utils.mm +++ b/libtransmission/utils.mm @@ -8,7 +8,7 @@ #include #include -#include "utils.h" +#include "libtransmission/utils.h" // macOS implementation of tr_strv_convert_utf8() that autodetects the encoding. // This replaces the generic implementation of the function in utils.cc. diff --git a/libtransmission/variant-benc.cc b/libtransmission/variant-benc.cc index 547bdbda2..7cae56af1 100644 --- a/libtransmission/variant-benc.cc +++ b/libtransmission/variant-benc.cc @@ -9,9 +9,10 @@ #include // size_t, std::byte #include // int64_t #include +#include #include #include -#include +#include #include #include @@ -24,8 +25,6 @@ #include "libtransmission/utils.h" #include "libtransmission/variant.h" -struct tr_error; - using namespace std::literals; auto constexpr MaxBencStrLength = size_t{ 128 * 1024 * 1024 }; // arbitrary diff --git a/libtransmission/variant.h b/libtransmission/variant.h index 96faacb3b..aa9cbbfc9 100644 --- a/libtransmission/variant.h +++ b/libtransmission/variant.h @@ -9,7 +9,6 @@ #include // size_t #include // int64_t #include -#include #include #include #include // std::is_same_v diff --git a/libtransmission/verify.cc b/libtransmission/verify.cc index 0d82b5f81..13f006c02 100644 --- a/libtransmission/verify.cc +++ b/libtransmission/verify.cc @@ -5,17 +5,15 @@ #include #include -#include +#include // std::byte +#include // uint64_t, uint32_t #include #include #include #include -#include - #include "libtransmission/transmission.h" -#include "libtransmission/completion.h" #include "libtransmission/crypto-utils.h" #include "libtransmission/file.h" #include "libtransmission/verify.h" diff --git a/libtransmission/verify.h b/libtransmission/verify.h index 8dbb5b107..1790a6c5f 100644 --- a/libtransmission/verify.h +++ b/libtransmission/verify.h @@ -11,16 +11,18 @@ #include #include -#include -#include -#include #include #include #include #include +#include #include +#include // std::move + +#include "libtransmission/transmission.h" #include "libtransmission/torrent-metainfo.h" +#include "libtransmission/tr-macros.h" class tr_verify_worker { diff --git a/libtransmission/watchdir-base.h b/libtransmission/watchdir-base.h index e9db7f8b8..6dcf74936 100644 --- a/libtransmission/watchdir-base.h +++ b/libtransmission/watchdir-base.h @@ -20,8 +20,8 @@ #include #include -#include "timer.h" -#include "watchdir.h" +#include "libtransmission/timer.h" +#include "libtransmission/watchdir.h" namespace libtransmission::impl { diff --git a/libtransmission/watchdir-inotify.cc b/libtransmission/watchdir-inotify.cc index 35b5d7951..b820afe8a 100644 --- a/libtransmission/watchdir-inotify.cc +++ b/libtransmission/watchdir-inotify.cc @@ -25,8 +25,11 @@ #include "libtransmission/tr-assert.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" +#include "libtransmission/watchdir.h" #include "libtransmission/watchdir-base.h" +struct event_base; + namespace libtransmission { diff --git a/libtransmission/watchdir.h b/libtransmission/watchdir.h index 7e4467fe7..d9718c6b2 100644 --- a/libtransmission/watchdir.h +++ b/libtransmission/watchdir.h @@ -10,10 +10,7 @@ #include #include -extern "C" -{ - struct event_base; -} +struct event_base; namespace libtransmission { diff --git a/libtransmission/webseed.cc b/libtransmission/webseed.cc index 730bd969e..b2979b095 100644 --- a/libtransmission/webseed.cc +++ b/libtransmission/webseed.cc @@ -13,7 +13,6 @@ #include #include #include -#include #include @@ -32,17 +31,19 @@ #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" +#include "libtransmission/tr-strbuf.h" #include "libtransmission/utils-ev.h" #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" #include "libtransmission/web.h" #include "libtransmission/webseed.h" +struct evbuffer; + using namespace std::literals; namespace { - class tr_webseed; void on_idle(tr_webseed* w); diff --git a/tests/libtransmission/announce-list-test.cc b/tests/libtransmission/announce-list-test.cc index b92e8fda5..2b9263088 100644 --- a/tests/libtransmission/announce-list-test.cc +++ b/tests/libtransmission/announce-list-test.cc @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/tests/libtransmission/announcer-test.cc b/tests/libtransmission/announcer-test.cc index 6c280a855..b0b7efb40 100644 --- a/tests/libtransmission/announcer-test.cc +++ b/tests/libtransmission/announcer-test.cc @@ -11,13 +11,10 @@ #define LIBTRANSMISSION_ANNOUNCER_MODULE -#include - #include #include #include "gtest/gtest.h" -#include "test-fixtures.h" using AnnouncerTest = ::testing::Test; diff --git a/tests/libtransmission/benc-test.cc b/tests/libtransmission/benc-test.cc index c28fee9b5..7f66bba82 100644 --- a/tests/libtransmission/benc-test.cc +++ b/tests/libtransmission/benc-test.cc @@ -8,8 +8,6 @@ #include -#include - #include #include diff --git a/tests/libtransmission/buffer-test.cc b/tests/libtransmission/buffer-test.cc index 316d16415..715177fad 100644 --- a/tests/libtransmission/buffer-test.cc +++ b/tests/libtransmission/buffer-test.cc @@ -8,13 +8,10 @@ #include #include -#include - #include #include #include "gtest/gtest.h" -#include "test-fixtures.h" using BufferTest = ::testing::Test; using namespace std::literals; diff --git a/tests/libtransmission/dht-test.cc b/tests/libtransmission/dht-test.cc index 048f83645..6c6fc0b2d 100644 --- a/tests/libtransmission/dht-test.cc +++ b/tests/libtransmission/dht-test.cc @@ -10,6 +10,7 @@ #include // size_t, std::byte #include // time(), time_t #include +#include #include // std::back_inserter #include #include @@ -35,6 +36,7 @@ #include // tr_rand_obj #include +#include #include #include #include // for tr_evthread_init(); diff --git a/tests/libtransmission/file-test.cc b/tests/libtransmission/file-test.cc index 109aad6d2..1a4c7936d 100644 --- a/tests/libtransmission/file-test.cc +++ b/tests/libtransmission/file-test.cc @@ -14,6 +14,7 @@ #include #include #include +#include #ifndef _WIN32 #include diff --git a/tests/libtransmission/global-ip-cache-test.cc b/tests/libtransmission/global-ip-cache-test.cc index 73bba1b6b..ea6078cd1 100644 --- a/tests/libtransmission/global-ip-cache-test.cc +++ b/tests/libtransmission/global-ip-cache-test.cc @@ -6,6 +6,7 @@ #include #include #include // size_t +#include #include #include #include diff --git a/tests/libtransmission/json-test.cc b/tests/libtransmission/json-test.cc index 5f614d33c..b8a2be052 100644 --- a/tests/libtransmission/json-test.cc +++ b/tests/libtransmission/json-test.cc @@ -8,7 +8,6 @@ #include // int64_t #include #include -#include // std::runtime_error #include #include diff --git a/tests/libtransmission/lpd-test.cc b/tests/libtransmission/lpd-test.cc index c035a0f24..77b01201d 100644 --- a/tests/libtransmission/lpd-test.cc +++ b/tests/libtransmission/lpd-test.cc @@ -16,6 +16,7 @@ #include // tr_rand_obj() #include #include +#include #include #include diff --git a/tests/libtransmission/magnet-metainfo-test.cc b/tests/libtransmission/magnet-metainfo-test.cc index 7c9403135..8e59b5efc 100644 --- a/tests/libtransmission/magnet-metainfo-test.cc +++ b/tests/libtransmission/magnet-metainfo-test.cc @@ -9,8 +9,6 @@ #include "gtest/gtest.h" -#include - #include // tr_rand_buffer() #include #include diff --git a/tests/libtransmission/peer-msgs-test.cc b/tests/libtransmission/peer-msgs-test.cc index 86f0b8869..4c45e55e9 100644 --- a/tests/libtransmission/peer-msgs-test.cc +++ b/tests/libtransmission/peer-msgs-test.cc @@ -3,11 +3,6 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include - -#include -#include - #include "gtest/gtest.h" TEST(PeerMsgs, placeholder) diff --git a/tests/libtransmission/remove-test.cc b/tests/libtransmission/remove-test.cc index 600be61fa..6e5c02744 100644 --- a/tests/libtransmission/remove-test.cc +++ b/tests/libtransmission/remove-test.cc @@ -6,6 +6,7 @@ #include #include // uint64_t #include +#include #include #include diff --git a/tests/libtransmission/session-alt-speeds-test.cc b/tests/libtransmission/session-alt-speeds-test.cc index 4944978ba..1b39decb9 100644 --- a/tests/libtransmission/session-alt-speeds-test.cc +++ b/tests/libtransmission/session-alt-speeds-test.cc @@ -8,7 +8,6 @@ #include #include -#include #include #include "gtest/gtest.h" diff --git a/tests/libtransmission/settings-test.cc b/tests/libtransmission/settings-test.cc index a61d530d3..b5282edee 100644 --- a/tests/libtransmission/settings-test.cc +++ b/tests/libtransmission/settings-test.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/tests/libtransmission/tr-peer-info-test.cc b/tests/libtransmission/tr-peer-info-test.cc index 31313e80d..8041c9a55 100644 --- a/tests/libtransmission/tr-peer-info-test.cc +++ b/tests/libtransmission/tr-peer-info-test.cc @@ -4,10 +4,13 @@ // License text can be found in the licenses/ folder. #include +#include #include #include #include +#include + #include #include diff --git a/tests/libtransmission/variant-test.cc b/tests/libtransmission/variant-test.cc index 225f8b5b1..49ac58b37 100644 --- a/tests/libtransmission/variant-test.cc +++ b/tests/libtransmission/variant-test.cc @@ -8,11 +8,11 @@ #include #include #include // lrint() -#include // isspace() #include // size_t #include // int64_t #include #include +#include #define LIBTRANSMISSION_VARIANT_MODULE