From 5ec4ca550e5b7ccfa620a6434c5034cc338c52e6 Mon Sep 17 00:00:00 2001 From: tearfur <46261767+tearfur@users.noreply.github.com> Date: Sat, 8 Jul 2023 23:24:03 +0800 Subject: [PATCH] chore: iwyu (#5746) --- daemon/daemon-posix.cc | 17 +++-- daemon/daemon-win32.cc | 4 ++ daemon/daemon.cc | 17 ++++- daemon/daemon.h | 13 ++-- libtransmission/announce-list.cc | 2 + libtransmission/announce-list.h | 7 +- libtransmission/announcer-common.h | 10 +-- libtransmission/announcer-http.cc | 5 ++ libtransmission/announcer-udp.cc | 16 +++-- libtransmission/announcer.cc | 4 ++ libtransmission/announcer.h | 18 +++-- libtransmission/bandwidth.cc | 1 + libtransmission/bitfield.cc | 10 ++- libtransmission/bitfield.h | 8 +-- libtransmission/block-info.cc | 4 +- libtransmission/blocklist.cc | 13 +++- libtransmission/blocklist.h | 2 - libtransmission/cache.cc | 4 +- libtransmission/clients.cc | 2 - libtransmission/completion.cc | 3 +- libtransmission/completion.h | 7 +- libtransmission/crypto-utils-fallback.cc | 3 - libtransmission/crypto-utils-openssl.cc | 5 +- libtransmission/crypto-utils.cc | 2 - libtransmission/crypto-utils.h | 3 +- libtransmission/error.cc | 2 - libtransmission/error.h | 2 - libtransmission/file-piece-map.cc | 1 + libtransmission/file-piece-map.h | 6 +- libtransmission/file-posix.cc | 9 +-- libtransmission/file.cc | 3 - libtransmission/file.h | 2 - libtransmission/global-ip-cache.h | 1 - libtransmission/handshake.cc | 4 +- libtransmission/handshake.h | 14 ++-- libtransmission/inout.cc | 8 ++- libtransmission/inout.h | 4 +- libtransmission/log.cc | 5 +- libtransmission/magnet-metainfo.cc | 6 +- libtransmission/magnet-metainfo.h | 12 ++-- libtransmission/makemeta.cc | 5 ++ libtransmission/makemeta.h | 16 +++-- libtransmission/net.h | 2 +- libtransmission/open-files.cc | 1 + libtransmission/open-files.h | 2 - libtransmission/peer-io.cc | 17 +++-- libtransmission/peer-io.h | 20 +++--- libtransmission/peer-mgr-active-requests.cc | 3 + libtransmission/peer-mgr-active-requests.h | 5 +- libtransmission/peer-mgr-wishlist.cc | 2 + libtransmission/peer-mgr-wishlist.h | 4 +- libtransmission/peer-mgr.cc | 9 ++- libtransmission/peer-mgr.h | 17 ++--- libtransmission/peer-mse.cc | 5 +- libtransmission/peer-mse.h | 7 +- libtransmission/peer-msgs.cc | 12 +++- libtransmission/peer-msgs.h | 10 +-- libtransmission/port-forwarding-natpmp.cc | 8 ++- libtransmission/port-forwarding-natpmp.h | 7 +- libtransmission/port-forwarding-upnp.cc | 4 +- libtransmission/port-forwarding-upnp.h | 5 +- libtransmission/port-forwarding.cc | 4 +- libtransmission/port-forwarding.h | 4 +- libtransmission/quark.cc | 2 - libtransmission/resume.cc | 4 +- libtransmission/rpc-server.cc | 10 ++- libtransmission/rpc-server.h | 13 ++-- libtransmission/rpcimpl.cc | 3 +- libtransmission/rpcimpl.h | 3 +- libtransmission/session-alt-speeds.cc | 3 + libtransmission/session-alt-speeds.h | 4 +- libtransmission/session-id.cc | 3 +- libtransmission/session-id.h | 2 +- libtransmission/session-settings.cc | 4 -- libtransmission/session-settings.h | 8 +-- libtransmission/session-thread.cc | 4 -- libtransmission/session.cc | 20 +++--- libtransmission/session.h | 68 ++++++++++--------- libtransmission/stats.cc | 1 + libtransmission/stats.h | 2 +- libtransmission/subprocess-posix.cc | 6 +- libtransmission/timer-ev.cc | 10 ++- libtransmission/timer-ev.h | 2 +- libtransmission/torrent-ctor.cc | 4 +- libtransmission/torrent-files.cc | 4 +- libtransmission/torrent-files.h | 7 +- libtransmission/torrent-magnet.cc | 7 +- libtransmission/torrent-magnet.h | 3 +- libtransmission/torrent.cc | 1 + libtransmission/torrents.cc | 1 + libtransmission/torrents.h | 5 +- libtransmission/tr-assert.h | 2 +- libtransmission/tr-dht.cc | 12 ++-- libtransmission/tr-dht.h | 11 ++- libtransmission/tr-getopt.cc | 6 +- libtransmission/tr-lpd.cc | 4 +- libtransmission/tr-lpd.h | 4 +- libtransmission/tr-udp.cc | 11 ++- libtransmission/utils-ev.cc | 2 - libtransmission/utils.cc | 11 +-- libtransmission/utils.h | 2 +- libtransmission/variant-benc.cc | 8 ++- libtransmission/variant-converters.cc | 8 +++ libtransmission/variant-json.cc | 7 +- libtransmission/variant.cc | 4 -- libtransmission/variant.h | 2 +- libtransmission/watchdir-generic.cc | 7 +- libtransmission/watchdir-inotify.cc | 8 ++- libtransmission/watchdir.cc | 6 +- libtransmission/web-utils.cc | 3 +- libtransmission/web-utils.h | 2 +- libtransmission/web.cc | 13 +++- libtransmission/web.h | 2 - libtransmission/webseed.cc | 11 ++- libtransmission/webseed.h | 4 +- tests/libtransmission/announce-list-test.cc | 12 ++-- tests/libtransmission/announcer-test.cc | 3 + tests/libtransmission/announcer-udp-test.cc | 26 ++++++- tests/libtransmission/benc-test.cc | 4 ++ tests/libtransmission/bitfield-test.cc | 3 +- tests/libtransmission/blocklist-test.cc | 10 ++- tests/libtransmission/buffer-test.cc | 7 ++ tests/libtransmission/clients-test.cc | 4 +- tests/libtransmission/completion-test.cc | 2 + tests/libtransmission/copy-test.cc | 7 +- tests/libtransmission/crypto-test.cc | 9 ++- tests/libtransmission/dht-test.cc | 32 ++++++++- tests/libtransmission/error-test.cc | 3 +- tests/libtransmission/file-piece-map-test.cc | 6 +- tests/libtransmission/file-test.cc | 9 ++- tests/libtransmission/getopt-test.cc | 5 +- tests/libtransmission/global-ip-cache-test.cc | 3 +- tests/libtransmission/handshake-test.cc | 22 ++++++ tests/libtransmission/history-test.cc | 3 +- tests/libtransmission/json-test.cc | 6 +- tests/libtransmission/lpd-test.cc | 7 +- tests/libtransmission/magnet-metainfo-test.cc | 4 +- tests/libtransmission/makemeta-test.cc | 18 +++-- tests/libtransmission/move-test.cc | 7 +- tests/libtransmission/net-test.cc | 14 +++- tests/libtransmission/open-files-test.cc | 8 +++ .../peer-mgr-active-requests-test.cc | 7 +- .../libtransmission/peer-mgr-wishlist-test.cc | 5 +- tests/libtransmission/platform-test.cc | 4 ++ tests/libtransmission/quark-test.cc | 10 +-- tests/libtransmission/remove-test.cc | 3 +- tests/libtransmission/rename-test.cc | 20 ++++-- tests/libtransmission/rpc-test.cc | 16 +++-- .../session-alt-speeds-test.cc | 8 +-- tests/libtransmission/session-test.cc | 24 ++++--- tests/libtransmission/settings-test.cc | 11 ++- tests/libtransmission/strbuf-test.cc | 4 +- .../subprocess-test-program.cc | 4 +- tests/libtransmission/subprocess-test.cc | 22 +++--- tests/libtransmission/timer-test.cc | 9 ++- tests/libtransmission/torrent-files-test.cc | 7 ++ tests/libtransmission/torrent-magnet-test.cc | 6 +- .../libtransmission/torrent-metainfo-test.cc | 6 ++ tests/libtransmission/torrents-test.cc | 7 +- tests/libtransmission/utils-test.cc | 8 ++- tests/libtransmission/variant-test.cc | 22 +++--- tests/libtransmission/watchdir-test.cc | 23 +++++-- tests/libtransmission/web-utils-test.cc | 9 +-- utils/create.cc | 8 ++- utils/edit.cc | 4 +- utils/remote.cc | 6 +- utils/show.cc | 8 ++- 167 files changed, 819 insertions(+), 458 deletions(-) diff --git a/daemon/daemon-posix.cc b/daemon/daemon-posix.cc index ed12d5471..f97408d77 100644 --- a/daemon/daemon-posix.cc +++ b/daemon/daemon-posix.cc @@ -5,20 +5,23 @@ #include #include -#include +#include +#include + +#include +#include /* fork(), setsid(), chdir(), dup2(), close(), pipe() */ + #ifdef HAVE_SYS_SIGNALFD_H #include #endif /* signalfd API */ -#include -#include -#include /* abort(), daemon(), exit() */ -#include /* open() */ -#include /* fork(), setsid(), chdir(), dup2(), close(), pipe() */ -#include +#include #include +#include +#include + #include "daemon.h" static void set_system_error(tr_error** error, int code, std::string_view message) diff --git a/daemon/daemon-win32.cc b/daemon/daemon-win32.cc index 2ce9a72ee..b28765852 100644 --- a/daemon/daemon-win32.cc +++ b/daemon/daemon-win32.cc @@ -10,6 +10,10 @@ #include +#include +#include +#include + #include "daemon.h" #ifndef SERVICE_ACCEPT_PRESHUTDOWN diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 600a82d81..d0747fd9d 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -8,7 +8,10 @@ #include /* printf */ #include /* atoi */ #include +#include /* std::back_inserter */ #include +#include +#include #ifdef HAVE_SYSLOG #include @@ -17,6 +20,7 @@ #ifdef _WIN32 #include /* getpid */ #else +#include /* timeval */ #include /* getpid */ #endif @@ -24,16 +28,25 @@ #include -#include "daemon.h" +#include +#include +#include +#include #include #include -#include #include #include +#include #include #include +#include "daemon.h" + +struct tr_ctor; +struct tr_session; +struct tr_torrent; + #ifdef USE_SYSTEMD #include diff --git a/daemon/daemon.h b/daemon/daemon.h index 2dac6990e..de2e5ac85 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -6,14 +6,17 @@ #pragma once #include -#include -#include +#ifdef HAVE_SYS_SIGNALFD_H +#include +#endif + #include -#include -#include +#include #include -#include + +struct tr_error; +struct tr_session; class tr_daemon { diff --git a/libtransmission/announce-list.cc b/libtransmission/announce-list.cc index b2da60edf..49e93bbea 100644 --- a/libtransmission/announce-list.cc +++ b/libtransmission/announce-list.cc @@ -7,6 +7,8 @@ #include #include +#include + #include "libtransmission/transmission.h" #include "libtransmission/announce-list.h" diff --git a/libtransmission/announce-list.h b/libtransmission/announce-list.h index b3b1f426a..aeb22adb1 100644 --- a/libtransmission/announce-list.h +++ b/libtransmission/announce-list.h @@ -11,10 +11,11 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "quark.h" -#include "interned-string.h" +#include "libtransmission/quark.h" +#include "libtransmission/interned-string.h" +#include "libtransmission/tr-macros.h" struct tr_error; struct tr_url_parsed_t; diff --git a/libtransmission/announcer-common.h b/libtransmission/announcer-common.h index cd976a78e..a5473ca7f 100644 --- a/libtransmission/announcer-common.h +++ b/libtransmission/announcer-common.h @@ -17,12 +17,12 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "announcer.h" -#include "interned-string.h" -#include "net.h" -#include "peer-mgr.h" // tr_pex +#include "libtransmission/announcer.h" +#include "libtransmission/interned-string.h" +#include "libtransmission/net.h" +#include "libtransmission/peer-mgr.h" // tr_pex struct tr_url_parsed_t; diff --git a/libtransmission/announcer-http.cc b/libtransmission/announcer-http.cc index bc09add03..002568550 100644 --- a/libtransmission/announcer-http.cc +++ b/libtransmission/announcer-http.cc @@ -5,6 +5,8 @@ #include // std::copy_n() #include +#include // std::byte, size_t +#include // int64_t, uint8_t, uint... #include /* fprintf() */ #include #include @@ -31,8 +33,11 @@ #include "libtransmission/log.h" #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 #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" #include "libtransmission/web.h" diff --git a/libtransmission/announcer-udp.cc b/libtransmission/announcer-udp.cc index 09d22dbef..f15da6fc2 100644 --- a/libtransmission/announcer-udp.cc +++ b/libtransmission/announcer-udp.cc @@ -4,13 +4,20 @@ // License text can be found in the licenses/ folder. #include // for std::find_if() -#include // for CHAR_BIT -#include // for memset() +#include +#include // operator""ms, literals +#include // CHAR_BIT +#include // std::byte +#include // uint32_t, uint64_t +#include // memcpy() #include #include #include #include +#include +#include #include +#include #include #ifdef _WIN32 @@ -19,17 +26,18 @@ #define gai_strerror gai_strerrorA #else #include // gai_strerror() +#include // IPPROTO_UDP, in_addr +#include // sockaddr_storage, AF_INET #endif #include #define LIBTRANSMISSION_ANNOUNCER_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/announcer.h" #include "libtransmission/announcer-common.h" #include "libtransmission/crypto-utils.h" // for tr_rand_obj() +#include "libtransmission/interned-string.h" #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/peer-mgr.h" // for tr_pex::fromCompact4() diff --git a/libtransmission/announcer.cc b/libtransmission/announcer.cc index 1c572af12..8c80632cc 100644 --- a/libtransmission/announcer.cc +++ b/libtransmission/announcer.cc @@ -5,6 +5,7 @@ #include #include +#include // operator""ms #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -27,11 +29,13 @@ #include "libtransmission/announcer-common.h" #include "libtransmission/announcer.h" #include "libtransmission/crypto-utils.h" /* tr_rand_int() */ +#include "libtransmission/interned-string.h" // tr_interned_string #include "libtransmission/log.h" #include "libtransmission/session.h" #include "libtransmission/timer.h" #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t, TR_C... #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" diff --git a/libtransmission/announcer.h b/libtransmission/announcer.h index 8c0f309aa..ff7f82672 100644 --- a/libtransmission/announcer.h +++ b/libtransmission/announcer.h @@ -19,19 +19,25 @@ #include #include -#include "transmission.h" +#ifdef _WIN32 +#include +#else +#include // socklen_t +#endif -#include "interned-string.h" -#include "net.h" +#include "libtransmission/transmission.h" -class tr_announcer; +#include "libtransmission/interned-string.h" +#include "libtransmission/peer-mgr.h" + +struct tr_address; class tr_announcer_udp; +struct tr_session; +struct tr_torrent; struct tr_torrent_announcer; // --- Tracker Publish / Subscribe -struct tr_pex; - /** @brief Notification object to tell listeners about announce or scrape occurrences */ struct tr_tracker_event { diff --git a/libtransmission/bandwidth.cc b/libtransmission/bandwidth.cc index 390702e72..99626c83a 100644 --- a/libtransmission/bandwidth.cc +++ b/libtransmission/bandwidth.cc @@ -4,6 +4,7 @@ // License text can be found in the licenses/ folder. #include +#include #include // for std::swap() #include diff --git a/libtransmission/bitfield.cc b/libtransmission/bitfield.cc index 434b33df2..19c08bb7d 100644 --- a/libtransmission/bitfield.cc +++ b/libtransmission/bitfield.cc @@ -3,14 +3,12 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include -#include - -#include "libtransmission/transmission.h" +#include // std::copy, std::fill_n, std::min, std::max +#include // std::vector #include "libtransmission/bitfield.h" -#include "libtransmission/tr-assert.h" -#include "libtransmission/tr-popcount.h" +#include "libtransmission/tr-assert.h" // TR_ASSERT, TR_ENABLE_ASSERTS +#include "libtransmission/tr-popcount.h" // tr_popcnt // --- diff --git a/libtransmission/bitfield.h b/libtransmission/bitfield.h index 88b0f8ea8..b3ca31600 100644 --- a/libtransmission/bitfield.h +++ b/libtransmission/bitfield.h @@ -9,11 +9,11 @@ #error only libtransmission should #include this header. #endif -#include -#include -#include +#include // size_t +#include // uint8_t +#include // std::vector -#include "tr-macros.h" +#include "tr-macros.h" // TR_CONSTEXPR20 /** * @brief Implementation of the BitTorrent spec's Bitfield array of bits. diff --git a/libtransmission/block-info.cc b/libtransmission/block-info.cc index 3ead4b39e..9edd466d5 100644 --- a/libtransmission/block-info.cc +++ b/libtransmission/block-info.cc @@ -3,10 +3,8 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include "libtransmission/transmission.h" - #include "libtransmission/block-info.h" -#include "libtransmission/tr-assert.h" +#include "libtransmission/tr-assert.h" // TR_ASSERT void tr_block_info::init_sizes(uint64_t total_size_in, uint32_t piece_size_in) noexcept { diff --git a/libtransmission/blocklist.cc b/libtransmission/blocklist.cc index 9889d58ee..480fd4303 100644 --- a/libtransmission/blocklist.cc +++ b/libtransmission/blocklist.cc @@ -5,13 +5,22 @@ #include #include +#include +#include #include +#include #include #include -#include +#ifdef _WIN32 +#include +#else +#include +#include +#include +#endif -#include "libtransmission/transmission.h" +#include #include "libtransmission/blocklist.h" #include "libtransmission/error.h" diff --git a/libtransmission/blocklist.h b/libtransmission/blocklist.h index 3093f4832..8b082c4ab 100644 --- a/libtransmission/blocklist.h +++ b/libtransmission/blocklist.h @@ -17,8 +17,6 @@ #include "net.h" // for tr_address -struct tr_address; - namespace libtransmission { diff --git a/libtransmission/cache.cc b/libtransmission/cache.cc index e01a2b4c4..ad067de83 100644 --- a/libtransmission/cache.cc +++ b/libtransmission/cache.cc @@ -4,7 +4,8 @@ // License text can be found in the licenses/ folder. #include -#include // std::lldiv() +#include +#include // uint8_t #include // std::distance(), std::next(), std::prev() #include #include // std::accumulate() @@ -12,6 +13,7 @@ #include #include +#include #include "libtransmission/transmission.h" diff --git a/libtransmission/clients.cc b/libtransmission/clients.cc index 422447001..1404b17ef 100644 --- a/libtransmission/clients.cc +++ b/libtransmission/clients.cc @@ -16,8 +16,6 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/clients.h" #include "libtransmission/utils.h" diff --git a/libtransmission/completion.cc b/libtransmission/completion.cc index b64358b16..1137f3920 100644 --- a/libtransmission/completion.cc +++ b/libtransmission/completion.cc @@ -9,8 +9,9 @@ #include "libtransmission/transmission.h" +#include "libtransmission/bitfield.h" +#include "libtransmission/block-info.h" #include "libtransmission/completion.h" -#include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" uint64_t tr_completion::compute_has_valid() const diff --git a/libtransmission/completion.h b/libtransmission/completion.h index 1495ba22a..b2a7a4706 100644 --- a/libtransmission/completion.h +++ b/libtransmission/completion.h @@ -15,10 +15,11 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "block-info.h" -#include "bitfield.h" +#include "libtransmission/block-info.h" +#include "libtransmission/bitfield.h" +#include "libtransmission/tr-macros.h" /** * @brief knows which blocks and pieces we have diff --git a/libtransmission/crypto-utils-fallback.cc b/libtransmission/crypto-utils-fallback.cc index ff8801336..41c8b5712 100644 --- a/libtransmission/crypto-utils-fallback.cc +++ b/libtransmission/crypto-utils-fallback.cc @@ -9,10 +9,7 @@ #ifdef TR_CRYPTO_X509_FALLBACK -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" -#include "libtransmission/tr-macros.h" tr_x509_store_t tr_ssl_get_x509_store(tr_ssl_ctx_t /*handle*/) { diff --git a/libtransmission/crypto-utils-openssl.cc b/libtransmission/crypto-utils-openssl.cc index f60e25cac..88ed3cc8a 100644 --- a/libtransmission/crypto-utils-openssl.cc +++ b/libtransmission/crypto-utils-openssl.cc @@ -8,6 +8,8 @@ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif +#include +#include // size_t #include #include @@ -20,11 +22,10 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" #include "libtransmission/log.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t, tr_sha25... #include "libtransmission/utils.h" namespace diff --git a/libtransmission/crypto-utils.cc b/libtransmission/crypto-utils.cc index 060ce21ab..d06507884 100644 --- a/libtransmission/crypto-utils.cc +++ b/libtransmission/crypto-utils.cc @@ -20,8 +20,6 @@ extern "C" #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils.h" diff --git a/libtransmission/crypto-utils.h b/libtransmission/crypto-utils.h index 3e6c6f6b3..14f46eaa9 100644 --- a/libtransmission/crypto-utils.h +++ b/libtransmission/crypto-utils.h @@ -16,8 +16,7 @@ #include #include -#include "libtransmission/transmission.h" // tr_sha1_digest_t - +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t, tr_sha256_d... #include "libtransmission/tr-strbuf.h" /** diff --git a/libtransmission/error.cc b/libtransmission/error.cc index f60f9f25e..ca63f990a 100644 --- a/libtransmission/error.cc +++ b/libtransmission/error.cc @@ -8,8 +8,6 @@ #include -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils.h" diff --git a/libtransmission/error.h b/libtransmission/error.h index 22697a21c..9704e13e8 100644 --- a/libtransmission/error.h +++ b/libtransmission/error.h @@ -7,8 +7,6 @@ #include -#include "tr-macros.h" - /** * @addtogroup error Error reporting * @{ diff --git a/libtransmission/file-piece-map.cc b/libtransmission/file-piece-map.cc index 9fa0b6e6d..83f6cb954 100644 --- a/libtransmission/file-piece-map.cc +++ b/libtransmission/file-piece-map.cc @@ -9,6 +9,7 @@ #include "libtransmission/transmission.h" +#include "libtransmission/bitfield.h" #include "libtransmission/block-info.h" #include "libtransmission/file-piece-map.h" #include "libtransmission/torrent-metainfo.h" diff --git a/libtransmission/file-piece-map.h b/libtransmission/file-piece-map.h index d08ffaa38..33cacae0a 100644 --- a/libtransmission/file-piece-map.h +++ b/libtransmission/file-piece-map.h @@ -14,10 +14,10 @@ #include // for size_t #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "bitfield.h" -#include "torrent-metainfo.h" +#include "libtransmission/bitfield.h" +#include "libtransmission/tr-macros.h" // TR_CONSTEXPR20 struct tr_block_info; struct tr_torrent_metainfo; diff --git a/libtransmission/file-posix.cc b/libtransmission/file-posix.cc index 5102d030d..db40e36a1 100644 --- a/libtransmission/file-posix.cc +++ b/libtransmission/file-posix.cc @@ -6,24 +6,24 @@ #undef _GNU_SOURCE #define _GNU_SOURCE // NOLINT +#include #include #include #include /* PATH_MAX */ #include /* SIZE_MAX */ -#include +#include // mkdtemp, mkstemp, realpath +#include #include #include #include #include #include /* O_LARGEFILE, posix_fadvise(), [posix_]fallocate(), fcntl() */ -#include /* basename(), dirname() */ -#include /* flock() */ #include -#include #include /* lseek(), write(), ftruncate(), pread(), pwrite(), pathconf(), etc */ #ifdef HAVE_XFS_XFS_H +#include /* flock() */ #include #endif @@ -56,6 +56,7 @@ #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" #ifndef O_LARGEFILE diff --git a/libtransmission/file.cc b/libtransmission/file.cc index 05bb7b3e2..a4569e910 100644 --- a/libtransmission/file.cc +++ b/libtransmission/file.cc @@ -7,9 +7,6 @@ #include #include -#include "libtransmission/transmission.h" - -#include "libtransmission/error.h" #include "libtransmission/file.h" #include "libtransmission/tr-assert.h" diff --git a/libtransmission/file.h b/libtransmission/file.h index e1b885443..a62efd0ef 100644 --- a/libtransmission/file.h +++ b/libtransmission/file.h @@ -17,8 +17,6 @@ #include #endif -#include "tr-macros.h" - struct tr_error; /** diff --git a/libtransmission/global-ip-cache.h b/libtransmission/global-ip-cache.h index aed5c33bb..4b9b40851 100644 --- a/libtransmission/global-ip-cache.h +++ b/libtransmission/global-ip-cache.h @@ -7,7 +7,6 @@ #include #include // std::chrono::milliseconds #include -#include // size_t #include // std::unique_ptr #include #include diff --git a/libtransmission/handshake.cc b/libtransmission/handshake.cc index 45e40d7e5..679fe39e2 100644 --- a/libtransmission/handshake.cc +++ b/libtransmission/handshake.cc @@ -5,6 +5,7 @@ #include #include +#include // ECONNREFUSED, ETIMEDOUT #include #include @@ -15,13 +16,14 @@ #include "libtransmission/bitfield.h" #include "libtransmission/clients.h" #include "libtransmission/crypto-utils.h" +#include "libtransmission/error.h" #include "libtransmission/handshake.h" #include "libtransmission/log.h" #include "libtransmission/peer-io.h" +#include "libtransmission/peer-mse.h" // tr_message_stream_encryption::DH #include "libtransmission/timer.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-buffer.h" -#include "libtransmission/utils.h" #define tr_logAddTraceHand(handshake, msg) tr_logAddTrace(msg, (handshake)->peer_io_->display_name()) diff --git a/libtransmission/handshake.h b/libtransmission/handshake.h index 386aef6d7..19a2f5540 100644 --- a/libtransmission/handshake.h +++ b/libtransmission/handshake.h @@ -19,13 +19,17 @@ #include #include #include +#include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "net.h" -#include "peer-mse.h" // tr_message_stream_encryption::DH -#include "peer-io.h" -#include "timer.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; // 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 2c5f7d619..f0ec23689 100644 --- a/libtransmission/inout.cc +++ b/libtransmission/inout.cc @@ -7,19 +7,25 @@ #include #include #include +#include +#include // std::move #include #include "libtransmission/transmission.h" -#include "libtransmission/cache.h" /* tr_cacheReadBlock() */ +#include "libtransmission/block-info.h" // tr_block_info #include "libtransmission/crypto-utils.h" #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" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t +#include "libtransmission/tr-strbuf.h" // tr_pathbuf #include "libtransmission/utils.h" using namespace std::literals; diff --git a/libtransmission/inout.h b/libtransmission/inout.h index b6874a9f8..dce14ccd3 100644 --- a/libtransmission/inout.h +++ b/libtransmission/inout.h @@ -12,9 +12,9 @@ #include // size_t #include // uint8_t, uint32_t -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "block-info.h" +#include "libtransmission/block-info.h" struct tr_torrent; diff --git a/libtransmission/log.cc b/libtransmission/log.cc index 6ee0e7895..4a414629f 100644 --- a/libtransmission/log.cc +++ b/libtransmission/log.cc @@ -6,7 +6,8 @@ #include #include #include -#include +#include // size_t +#include // back_insert_iterator, empty #include #include #include @@ -20,8 +21,6 @@ #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/file.h" #include "libtransmission/log.h" #include "libtransmission/tr-assert.h" diff --git a/libtransmission/magnet-metainfo.cc b/libtransmission/magnet-metainfo.cc index 39615ceab..26f9d4acb 100644 --- a/libtransmission/magnet-metainfo.cc +++ b/libtransmission/magnet-metainfo.cc @@ -5,19 +5,19 @@ #include #include +#include // uint8_t #include #include // back_inserter -#include +#include #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" #include "libtransmission/error.h" #include "libtransmission/error-types.h" #include "libtransmission/magnet-metainfo.h" +#include "libtransmission/tr-strbuf.h" // for tr_urlbuf #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" diff --git a/libtransmission/magnet-metainfo.h b/libtransmission/magnet-metainfo.h index 9e3448d96..820a209b1 100644 --- a/libtransmission/magnet-metainfo.h +++ b/libtransmission/magnet-metainfo.h @@ -10,15 +10,13 @@ #include #include -#include "transmission.h" - -#include "announce-list.h" -#include "crypto-utils.h" -#include "tr-strbuf.h" // tr_urlbuf -#include "utils.h" // tr_strv_convert_utf8() +#include "libtransmission/announce-list.h" +#include "libtransmission/crypto-utils.h" +#include "libtransmission/tr-macros.h" // TR_CONSTEXPR20, tr_sha1_digest_t +#include "libtransmission/tr-strbuf.h" // tr_urlbuf +#include "libtransmission/utils.h" // tr_strv_convert_utf8() struct tr_error; -struct tr_variant; class tr_magnet_metainfo { diff --git a/libtransmission/makemeta.cc b/libtransmission/makemeta.cc index 99f7bbb4a..cdf15d3d2 100644 --- a/libtransmission/makemeta.cc +++ b/libtransmission/makemeta.cc @@ -6,6 +6,7 @@ #include #include // for ENOENT #include +#include // time() #include #include #include @@ -17,13 +18,17 @@ #include "libtransmission/transmission.h" +#include "libtransmission/block-info.h" // tr_block_info #include "libtransmission/crypto-utils.h" #include "libtransmission/error.h" #include "libtransmission/file.h" #include "libtransmission/log.h" #include "libtransmission/makemeta.h" +#include "libtransmission/quark.h" // TR_KEY_length, TR_KEY_a... #include "libtransmission/session.h" // TR_NAME +#include "libtransmission/torrent-files.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-strbuf.h" // tr_pathbuf #include "libtransmission/utils.h" // for _() #include "libtransmission/variant.h" #include "libtransmission/version.h" diff --git a/libtransmission/makemeta.h b/libtransmission/makemeta.h index af6b7598f..ac9930510 100644 --- a/libtransmission/makemeta.h +++ b/libtransmission/makemeta.h @@ -5,7 +5,6 @@ #pragma once -#include // std::move #include // std::byte #include #include @@ -14,13 +13,16 @@ #include // std::pair #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "announce-list.h" -#include "block-info.h" -#include "file.h" -#include "torrent-files.h" -#include "utils.h" // for tr_file_save() +#include "libtransmission/announce-list.h" +#include "libtransmission/block-info.h" +#include "libtransmission/file.h" +#include "libtransmission/torrent-files.h" +#include "libtransmission/tr-macros.h" // TR_CONSTEXPR20 +#include "libtransmission/utils.h" // for tr_file_save() + +struct tr_error; class tr_metainfo_builder { diff --git a/libtransmission/net.h b/libtransmission/net.h index 527a9a3a6..edf490e39 100644 --- a/libtransmission/net.h +++ b/libtransmission/net.h @@ -19,10 +19,10 @@ #ifdef _WIN32 #include #else +#include #include #include #include -#include #endif #ifdef _WIN32 diff --git a/libtransmission/open-files.cc b/libtransmission/open-files.cc index c6b00cd06..62b3b4732 100644 --- a/libtransmission/open-files.cc +++ b/libtransmission/open-files.cc @@ -3,6 +3,7 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::min #include #include // uint8_t, uint64_t #include diff --git a/libtransmission/open-files.h b/libtransmission/open-files.h index 65d90843f..4b54b8554 100644 --- a/libtransmission/open-files.h +++ b/libtransmission/open-files.h @@ -20,8 +20,6 @@ #include "file.h" // tr_sys_file_t #include "lru-cache.h" -struct tr_session; - // 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 072c925f6..d10e0d9a4 100644 --- a/libtransmission/peer-io.cc +++ b/libtransmission/peer-io.cc @@ -6,11 +6,14 @@ #include #include #include -#include -#include + +#ifdef _WIN32 +#include +#else +#include // ntohl, ntohs +#endif #include -#include #include @@ -18,15 +21,19 @@ #include "libtransmission/transmission.h" -#include "libtransmission/session.h" #include "libtransmission/bandwidth.h" +#include "libtransmission/block-info.h" // tr_block_info +#include "libtransmission/error.h" // tr_error_clear, tr_error_s... #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/peer-io.h" +#include "libtransmission/peer-socket.h" // tr_peer_socket, tr_netOpen... +#include "libtransmission/session.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/tr-utp.h" #include "libtransmission/utils.h" // for _() +struct sockaddr; + #ifdef _WIN32 #undef EAGAIN #define EAGAIN WSAEWOULDBLOCK diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index c7ff0ae44..62a623a4c 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -9,6 +9,7 @@ #error only libtransmission should #include this header. #endif +#include #include // size_t #include // uintX_t #include @@ -17,17 +18,20 @@ #include // for evutil_socket_t -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "bandwidth.h" -#include "block-info.h" -#include "net.h" // tr_address -#include "peer-mse.h" -#include "peer-socket.h" -#include "tr-buffer.h" -#include "utils-ev.h" +#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" +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t, TR_CONSTEXPR20 +#include "libtransmission/utils-ev.h" struct struct_utp_context; +struct tr_error; +struct tr_session; namespace libtransmission::test { diff --git a/libtransmission/peer-mgr-active-requests.cc b/libtransmission/peer-mgr-active-requests.cc index a45dba884..fecbef353 100644 --- a/libtransmission/peer-mgr-active-requests.cc +++ b/libtransmission/peer-mgr-active-requests.cc @@ -4,6 +4,7 @@ // License text can be found in the licenses/ folder. #include +#include // size_t #include #include #include @@ -20,6 +21,8 @@ #include "libtransmission/peer-mgr-wishlist.h" #include "libtransmission/tr-assert.h" +class tr_peer; + class ActiveRequests::Impl { public: diff --git a/libtransmission/peer-mgr-active-requests.h b/libtransmission/peer-mgr-active-requests.h index 10ac27152..7740d823d 100644 --- a/libtransmission/peer-mgr-active-requests.h +++ b/libtransmission/peer-mgr-active-requests.h @@ -15,8 +15,9 @@ #include #include -#include "transmission.h" // tr_block_index_t -#include "peer-common.h" // tr_peer* +#include "libtransmission/transmission.h" // tr_block_index_t + +class tr_peer; /** * Bookkeeping for the active requests we have -- diff --git a/libtransmission/peer-mgr-wishlist.cc b/libtransmission/peer-mgr-wishlist.cc index 6c4d668d9..aab22f749 100644 --- a/libtransmission/peer-mgr-wishlist.cc +++ b/libtransmission/peer-mgr-wishlist.cc @@ -3,6 +3,7 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::min, std::partial_sort #include #include #include @@ -14,6 +15,7 @@ #include "libtransmission/crypto-utils.h" // for tr_salt_shaker #include "libtransmission/peer-mgr-wishlist.h" +#include "libtransmission/utils.h" namespace { diff --git a/libtransmission/peer-mgr-wishlist.h b/libtransmission/peer-mgr-wishlist.h index dcb8d9e75..77fa74c6e 100644 --- a/libtransmission/peer-mgr-wishlist.h +++ b/libtransmission/peer-mgr-wishlist.h @@ -12,9 +12,7 @@ #include // size_t #include -#include "transmission.h" - -#include "torrent.h" +#include "libtransmission/transmission.h" /** * Figures out what blocks we want to request next. diff --git a/libtransmission/peer-mgr.cc b/libtransmission/peer-mgr.cc index e5f03b4d7..9f37ee937 100644 --- a/libtransmission/peer-mgr.cc +++ b/libtransmission/peer-mgr.cc @@ -28,21 +28,21 @@ #include "libtransmission/transmission.h" #include "libtransmission/announcer.h" -#include "libtransmission/bandwidth.h" -#include "libtransmission/blocklist.h" -#include "libtransmission/cache.h" +#include "libtransmission/block-info.h" // tr_block_info #include "libtransmission/clients.h" -#include "libtransmission/completion.h" #include "libtransmission/crypto-utils.h" #include "libtransmission/handshake.h" #include "libtransmission/interned-string.h" #include "libtransmission/log.h" #include "libtransmission/net.h" +#include "libtransmission/observable.h" +#include "libtransmission/peer-common.h" #include "libtransmission/peer-io.h" #include "libtransmission/peer-mgr-active-requests.h" #include "libtransmission/peer-mgr-wishlist.h" #include "libtransmission/peer-mgr.h" #include "libtransmission/peer-msgs.h" +#include "libtransmission/peer-socket.h" #include "libtransmission/quark.h" #include "libtransmission/session.h" #include "libtransmission/timer.h" @@ -50,7 +50,6 @@ #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-macros.h" -#include "libtransmission/tr-utp.h" #include "libtransmission/utils.h" #include "libtransmission/webseed.h" diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index a8fd5cb71..1bdab441a 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -12,29 +12,22 @@ #include // size_t #include // uint8_t, uint64_t #include -#include #include -#ifdef _WIN32 -#include /* struct in_addr */ -#endif +#include "libtransmission/transmission.h" // tr_block_span_t (ptr only) -#include "net.h" /* tr_address */ -#include "peer-common.h" -#include "peer-socket.h" +#include "libtransmission/net.h" /* tr_address */ /** * @addtogroup peers Peers * @{ */ -class tr_peerIo; -class tr_peerMsgs; -class tr_swarm; -struct UTPSocket; -struct peer_atom; +class tr_peer; struct tr_peerMgr; +class tr_peer_socket; struct tr_peer_stat; +struct tr_session; struct tr_torrent; /* added_f's bitwise-or'ed flags */ diff --git a/libtransmission/peer-mse.cc b/libtransmission/peer-mse.cc index b1f56f640..3458dca21 100644 --- a/libtransmission/peer-mse.cc +++ b/libtransmission/peer-mse.cc @@ -4,14 +4,15 @@ // License text can be found in the licenses/ folder. #include +#include // std::numeric_limits +#include #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" // tr_sha1 #include "libtransmission/peer-mse.h" #include "libtransmission/tr-arc4.h" +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t using namespace std::literals; diff --git a/libtransmission/peer-mse.h b/libtransmission/peer-mse.h index f6b774e9d..07b9c25a3 100644 --- a/libtransmission/peer-mse.h +++ b/libtransmission/peer-mse.h @@ -14,11 +14,10 @@ #include // for std::copy_n() #include #include // size_t, std::byte +#include // uint8_t -#include "tr-macros.h" // tr_sha1_digest_t -#include "tr-arc4.h" - -class tr_arc4; +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t +#include "libtransmission/tr-arc4.h" // Spec: https://wiki.vuze.com/w/Message_Stream_Encryption namespace tr_message_stream_encryption diff --git a/libtransmission/peer-msgs.cc b/libtransmission/peer-msgs.cc index bfd7c20ec..2b3d84327 100644 --- a/libtransmission/peer-msgs.cc +++ b/libtransmission/peer-msgs.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -14,6 +15,8 @@ #include // std::unique_ptr #include #include +#include +#include #include #include @@ -22,10 +25,12 @@ #include "libtransmission/transmission.h" #include "libtransmission/bitfield.h" +#include "libtransmission/block-info.h" #include "libtransmission/cache.h" #include "libtransmission/crypto-utils.h" -#include "libtransmission/file.h" +#include "libtransmission/interned-string.h" #include "libtransmission/log.h" +#include "libtransmission/peer-common.h" #include "libtransmission/peer-io.h" #include "libtransmission/peer-mgr.h" #include "libtransmission/peer-msgs.h" @@ -36,11 +41,14 @@ #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-buffer.h" -#include "libtransmission/tr-dht.h" +#include "libtransmission/tr-macros.h" #include "libtransmission/utils.h" #include "libtransmission/variant.h" #include "libtransmission/version.h" +struct peer_atom; +struct tr_error; + #ifndef EBADMSG #define EBADMSG EINVAL #endif diff --git a/libtransmission/peer-msgs.h b/libtransmission/peer-msgs.h index 20ab11be2..7153d53c6 100644 --- a/libtransmission/peer-msgs.h +++ b/libtransmission/peer-msgs.h @@ -15,12 +15,14 @@ #include #include // for std::pair<> -#include "interned-string.h" -#include "peer-common.h" // for tr_peer +#include "libtransmission/transmission.h" // for tr_direction, tr_block_ind... -class tr_peer; +#include "libtransmission/interned-string.h" +#include "libtransmission/net.h" // tr_socket_address +#include "libtransmission/peer-common.h" // for tr_peer + +struct peer_atom; class tr_peerIo; -struct tr_address; struct tr_torrent; /** diff --git a/libtransmission/port-forwarding-natpmp.cc b/libtransmission/port-forwarding-natpmp.cc index 8cc0c2bc6..db68508a9 100644 --- a/libtransmission/port-forwarding-natpmp.cc +++ b/libtransmission/port-forwarding-natpmp.cc @@ -6,6 +6,12 @@ #include #include +#ifdef _WIN32 +#include +#else +#include // AF_INET +#endif + #include /* evutil_inet_ntop() */ #include @@ -18,8 +24,8 @@ #include "libtransmission/transmission.h" #include "libtransmission/log.h" +#include "libtransmission/net.h" #include "libtransmission/port-forwarding-natpmp.h" -#include "libtransmission/port-forwarding.h" #include "libtransmission/utils.h" namespace diff --git a/libtransmission/port-forwarding-natpmp.h b/libtransmission/port-forwarding-natpmp.h index a7f915c5d..9b03adc36 100644 --- a/libtransmission/port-forwarding-natpmp.h +++ b/libtransmission/port-forwarding-natpmp.h @@ -12,10 +12,11 @@ #include // time_t #include -#include "transmission.h" // tr_port_forwarding_state - #include "natpmp.h" -#include "net.h" // tr_port + +#include "libtransmission/transmission.h" // tr_port_forwarding_state + +#include "libtransmission/net.h" // tr_port class tr_natpmp { diff --git a/libtransmission/port-forwarding-upnp.cc b/libtransmission/port-forwarding-upnp.cc index ce73c7315..6d5698e6b 100644 --- a/libtransmission/port-forwarding-upnp.cc +++ b/libtransmission/port-forwarding-upnp.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -26,9 +27,10 @@ #include "libtransmission/transmission.h" #include "libtransmission/log.h" +#include "libtransmission/net.h" #include "libtransmission/port-forwarding-upnp.h" -#include "libtransmission/port-forwarding.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" // TR_ADDRSTRLEN #include "libtransmission/utils.h" // for _(), tr_strerror() namespace diff --git a/libtransmission/port-forwarding-upnp.h b/libtransmission/port-forwarding-upnp.h index 11f79e751..9b779f4f1 100644 --- a/libtransmission/port-forwarding-upnp.h +++ b/libtransmission/port-forwarding-upnp.h @@ -16,10 +16,9 @@ #include -#include "transmission.h" - -#include "net.h" // tr_port +#include "libtransmission/transmission.h" +class tr_port; struct tr_upnp; tr_upnp* tr_upnpInit(); diff --git a/libtransmission/port-forwarding.cc b/libtransmission/port-forwarding.cc index e6bbf0f63..a502f18d2 100644 --- a/libtransmission/port-forwarding.cc +++ b/libtransmission/port-forwarding.cc @@ -14,15 +14,15 @@ #include "libtransmission/transmission.h" #include "libtransmission/log.h" -#include "libtransmission/net.h" #include "libtransmission/port-forwarding-natpmp.h" #include "libtransmission/port-forwarding-upnp.h" #include "libtransmission/port-forwarding.h" #include "libtransmission/timer.h" -#include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils.h" // for _() +struct tr_upnp; + using namespace std::literals; class tr_port_forwarding_impl final : public tr_port_forwarding diff --git a/libtransmission/port-forwarding.h b/libtransmission/port-forwarding.h index 33b76964c..27b99a3aa 100644 --- a/libtransmission/port-forwarding.h +++ b/libtransmission/port-forwarding.h @@ -11,9 +11,9 @@ #include // for std::unique_ptr -#include "transmission.h" // for tr_port_forwarding_state +#include "libtransmission/transmission.h" // for tr_port_forwarding_state -#include "net.h" +#include "libtransmission/net.h" namespace libtransmission { diff --git a/libtransmission/quark.cc b/libtransmission/quark.cc index c69a26525..41bf3f2a7 100644 --- a/libtransmission/quark.cc +++ b/libtransmission/quark.cc @@ -9,8 +9,6 @@ #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/quark.h" using namespace std::literals; diff --git a/libtransmission/resume.cc b/libtransmission/resume.cc index 8b99ed9e9..17ea5fa88 100644 --- a/libtransmission/resume.cc +++ b/libtransmission/resume.cc @@ -8,7 +8,7 @@ #include #include -#include // fmt::ptr +#include #include "libtransmission/transmission.h" @@ -919,7 +919,7 @@ void save(tr_torrent* tor) auto const resume_file = tor->resume_file(); if (auto const err = tr_variantToFile(&top, TR_VARIANT_FMT_BENC, resume_file); err != 0) { - tor->set_local_error(fmt::format(FMT_STRING("Unable to save resume file: {:s}"), tr_strerror(err))); + tor->set_local_error(fmt::format("Unable to save resume file: {:s}", tr_strerror(err))); } tr_variantClear(&top); diff --git a/libtransmission/rpc-server.cc b/libtransmission/rpc-server.cc index 961ad562d..4291363c9 100644 --- a/libtransmission/rpc-server.cc +++ b/libtransmission/rpc-server.cc @@ -14,9 +14,12 @@ #include #include -#ifndef _WIN32 -#include +#ifdef _WIN32 +#include +#else +#include #include +#include #include #endif @@ -46,7 +49,8 @@ #include "libtransmission/utils.h" #include "libtransmission/variant.h" #include "libtransmission/web-utils.h" -#include "libtransmission/web.h" + +struct evbuffer; /* session-id is used to make cross-site request forgery attacks difficult. * Don't disable this feature unless you really know what you're doing! diff --git a/libtransmission/rpc-server.h b/libtransmission/rpc-server.h index 678bcedc4..92d63e700 100644 --- a/libtransmission/rpc-server.h +++ b/libtransmission/rpc-server.h @@ -15,14 +15,15 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "net.h" -#include "utils-ev.h" +#include "libtransmission/net.h" +#include "libtransmission/quark.h" +#include "libtransmission/utils-ev.h" -struct evhttp; -struct tr_variant; class tr_rpc_address; +struct tr_session; +struct tr_variant; struct libdeflate_compressor; namespace libtransmission @@ -154,7 +155,7 @@ public: std::vector whitelist_; std::string const web_client_dir_; - std::unique_ptr bind_address_; + std::unique_ptr bind_address_; std::unique_ptr start_retry_timer; libtransmission::evhelpers::evhttp_unique_ptr httpd; diff --git a/libtransmission/rpcimpl.cc b/libtransmission/rpcimpl.cc index 960e0d390..8223e4a50 100644 --- a/libtransmission/rpcimpl.cc +++ b/libtransmission/rpcimpl.cc @@ -6,11 +6,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -32,7 +34,6 @@ #include "libtransmission/session.h" #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/tr-macros.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" #include "libtransmission/variant.h" diff --git a/libtransmission/rpcimpl.h b/libtransmission/rpcimpl.h index ae7ce9bd6..2c5020de2 100644 --- a/libtransmission/rpcimpl.h +++ b/libtransmission/rpcimpl.h @@ -7,8 +7,7 @@ #include -#include "transmission.h" - +struct tr_session; struct tr_variant; using tr_rpc_response_func = void (*)(tr_session* session, tr_variant* response, void* user_data); diff --git a/libtransmission/session-alt-speeds.cc b/libtransmission/session-alt-speeds.cc index aaa3590f2..9806ec7c1 100644 --- a/libtransmission/session-alt-speeds.cc +++ b/libtransmission/session-alt-speeds.cc @@ -3,6 +3,9 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include // size_t + #include #include "libtransmission/transmission.h" diff --git a/libtransmission/session-alt-speeds.h b/libtransmission/session-alt-speeds.h index 1682e89ba..0dd723a03 100644 --- a/libtransmission/session-alt-speeds.h +++ b/libtransmission/session-alt-speeds.h @@ -14,9 +14,9 @@ #include // for time_t #include -#include "transmission.h" // for TR_SCHED_ALL +#include "libtransmission/transmission.h" // for TR_SCHED_ALL -#include "quark.h" +#include "libtransmission/quark.h" struct tr_variant; diff --git a/libtransmission/session-id.cc b/libtransmission/session-id.cc index 9d329c124..a8334b16a 100644 --- a/libtransmission/session-id.cc +++ b/libtransmission/session-id.cc @@ -7,13 +7,12 @@ #include // for std::back_inserter #ifndef _WIN32 +#include #include #endif #include -#include "libtransmission/transmission.h" - #include "libtransmission/crypto-utils.h" // for tr_rand_obj() #include "libtransmission/error-types.h" #include "libtransmission/error.h" diff --git a/libtransmission/session-id.h b/libtransmission/session-id.h index 64eac2266..e7bdcd438 100644 --- a/libtransmission/session-id.h +++ b/libtransmission/session-id.h @@ -10,7 +10,7 @@ #include // for time_t #include -#include "file.h" // tr_sys_file_t +#include "libtransmission/file.h" // tr_sys_file_t class tr_session_id { diff --git a/libtransmission/session-settings.cc b/libtransmission/session-settings.cc index 41b4cb818..e02852fc8 100644 --- a/libtransmission/session-settings.cc +++ b/libtransmission/session-settings.cc @@ -3,10 +3,6 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include - -#include "libtransmission/transmission.h" - #include "libtransmission/session-settings.h" #include "libtransmission/variant.h" diff --git a/libtransmission/session-settings.h b/libtransmission/session-settings.h index 871ed8d57..f9fd72511 100644 --- a/libtransmission/session-settings.h +++ b/libtransmission/session-settings.h @@ -8,11 +8,11 @@ #include // for size_t #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "log.h" // for tr_log_level -#include "net.h" // for tr_port, tr_tos_t -#include "quark.h" +#include "libtransmission/log.h" // for tr_log_level +#include "libtransmission/net.h" // for tr_port, tr_tos_t +#include "libtransmission/quark.h" struct tr_variant; diff --git a/libtransmission/session-thread.cc b/libtransmission/session-thread.cc index 4d08a3e56..94e65b53f 100644 --- a/libtransmission/session-thread.cc +++ b/libtransmission/session-thread.cc @@ -22,12 +22,8 @@ #include #include -#include "libtransmission/transmission.h" - -#include "libtransmission/log.h" #include "libtransmission/session-thread.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/utils.h" // for tr_net_init() #include "libtransmission/utils-ev.h" using namespace std::literals; diff --git a/libtransmission/session.cc b/libtransmission/session.cc index 7380d34ea..3da4204d3 100644 --- a/libtransmission/session.cc +++ b/libtransmission/session.cc @@ -6,11 +6,12 @@ #include // std::partial_sort(), std::min(), std::max() #include #include +#include // size_t #include -#include // atoi() #include #include #include // for std::back_inserter +#include // std::numeric_limits #include #include // for std::accumulate() #include @@ -19,43 +20,46 @@ #include #ifndef _WIN32 -#include /* umask() */ #include /* umask() */ #endif #include -#include // fmt::ptr +#include // fmt::ptr #include "libtransmission/transmission.h" -#include "libtransmission/announcer.h" #include "libtransmission/bandwidth.h" #include "libtransmission/blocklist.h" #include "libtransmission/cache.h" #include "libtransmission/crypto-utils.h" #include "libtransmission/file.h" #include "libtransmission/global-ip-cache.h" +#include "libtransmission/interned-string.h" #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/port-forwarding.h" +#include "libtransmission/quark.h" #include "libtransmission/rpc-server.h" -#include "libtransmission/session-id.h" #include "libtransmission/session.h" +#include "libtransmission/session-alt-speeds.h" +#include "libtransmission/session-settings.h" #include "libtransmission/timer-ev.h" #include "libtransmission/torrent.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-dht.h" #include "libtransmission/tr-lpd.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/tr-utp.h" #include "libtransmission/utils.h" #include "libtransmission/variant.h" -#include "libtransmission/verify.h" #include "libtransmission/version.h" #include "libtransmission/web.h" +struct tr_ctor; + using namespace std::literals; namespace @@ -245,7 +249,7 @@ bool tr_session::LpdMediator::onPeerFound(std::string_view info_hash_str, tr_add // we found a suitable peer, add it to the torrent auto pex = tr_pex{ address, port }; tr_peerMgrAddPex(tor, TR_PEER_FROM_LPD, &pex, 1U); - tr_logAddDebugTor(tor, fmt::format(FMT_STRING("Found a local peer from LPD ({:s})"), address.display_name(port))); + tr_logAddDebugTor(tor, fmt::format("Found a local peer from LPD ({:s})", address.display_name(port))); return true; } diff --git a/libtransmission/session.h b/libtransmission/session.h index fca71043f..59ea8384b 100644 --- a/libtransmission/session.h +++ b/libtransmission/session.h @@ -12,6 +12,8 @@ #define TR_NAME "Transmission" #include +#include +#include #include // size_t #include // uintX_t #include // time_t @@ -26,51 +28,53 @@ #include // for std::pair #include +#ifdef _WIN32 +#include +#else +#include // socklen_t +#endif + #include // for evutil_socket_t -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "announce-list.h" -#include "announcer.h" -#include "bandwidth.h" -#include "bitfield.h" -#include "cache.h" -#include "global-ip-cache.h" -#include "interned-string.h" -#include "net.h" // tr_socket_t -#include "observable.h" -#include "open-files.h" -#include "port-forwarding.h" -#include "quark.h" -#include "session-alt-speeds.h" -#include "session-id.h" -#include "session-settings.h" -#include "session-thread.h" -#include "stats.h" -#include "torrents.h" -#include "tr-dht.h" -#include "tr-lpd.h" -#include "utils-ev.h" -#include "verify.h" -#include "web.h" +#include "libtransmission/announce-list.h" +#include "libtransmission/announcer.h" +#include "libtransmission/bandwidth.h" +#include "libtransmission/blocklist.h" +#include "libtransmission/cache.h" +#include "libtransmission/global-ip-cache.h" +#include "libtransmission/interned-string.h" +#include "libtransmission/net.h" // tr_socket_t +#include "libtransmission/observable.h" +#include "libtransmission/open-files.h" +#include "libtransmission/port-forwarding.h" +#include "libtransmission/quark.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/torrents.h" +#include "libtransmission/tr-assert.h" +#include "libtransmission/tr-dht.h" +#include "libtransmission/tr-lpd.h" +#include "libtransmission/tr-macros.h" +#include "libtransmission/utils-ev.h" +#include "libtransmission/verify.h" +#include "libtransmission/web.h" tr_peer_id_t tr_peerIdInit(); -struct event_base; - -class tr_lpd; class tr_peer_socket; -class tr_port_forwarding; +struct tr_pex; class tr_rpc_server; -class tr_session_thread; -class tr_web; +struct tr_torrent; struct struct_utp_context; struct tr_variant; namespace libtransmission { -class Blocklist; -class Dns; class Timer; class TimerMaker; } // namespace libtransmission diff --git a/libtransmission/stats.cc b/libtransmission/stats.cc index cf744ea81..b37a8a064 100644 --- a/libtransmission/stats.cc +++ b/libtransmission/stats.cc @@ -6,6 +6,7 @@ #include "libtransmission/transmission.h" #include "libtransmission/file.h" +#include "libtransmission/quark.h" #include "libtransmission/stats.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" // for tr_getRatio(), tr_time() diff --git a/libtransmission/stats.h b/libtransmission/stats.h index a60cfe67d..502a74a6f 100644 --- a/libtransmission/stats.h +++ b/libtransmission/stats.h @@ -14,7 +14,7 @@ #include #include -#include "transmission.h" // for tr_session_stats +#include "libtransmission/transmission.h" // for tr_session_stats // per-session data structure for bandwidth use statistics class tr_stats diff --git a/libtransmission/subprocess-posix.cc b/libtransmission/subprocess-posix.cc index ba0e769ff..02d0513c0 100644 --- a/libtransmission/subprocess-posix.cc +++ b/libtransmission/subprocess-posix.cc @@ -6,22 +6,20 @@ #include #include #include +#include #include +#include #include #include -#include #include #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" #include "libtransmission/subprocess.h" #include "libtransmission/tr-assert.h" -#include "libtransmission/tr-macros.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" diff --git a/libtransmission/timer-ev.cc b/libtransmission/timer-ev.cc index 9a7f752da..d578fb5fb 100644 --- a/libtransmission/timer-ev.cc +++ b/libtransmission/timer-ev.cc @@ -4,13 +4,19 @@ // License text can be found in the licenses/ folder. #include +#include #include #include +#ifdef _WIN32 +#include +#else +#include +#endif + #include -#include "libtransmission/transmission.h" - +#include "libtransmission/timer.h" #include "libtransmission/timer-ev.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils-ev.h" diff --git a/libtransmission/timer-ev.h b/libtransmission/timer-ev.h index 9630f74c9..ac65d9c5a 100644 --- a/libtransmission/timer-ev.h +++ b/libtransmission/timer-ev.h @@ -7,7 +7,7 @@ #include -#include "timer.h" +#include "libtransmission/timer.h" extern "C" { diff --git a/libtransmission/torrent-ctor.cc b/libtransmission/torrent-ctor.cc index df9231b97..5d5f3644c 100644 --- a/libtransmission/torrent-ctor.cc +++ b/libtransmission/torrent-ctor.cc @@ -4,6 +4,8 @@ // License text can be found in the licenses/ folder. #include // EINVAL +#include // size_t +#include //uint16_t #include #include #include @@ -13,7 +15,7 @@ #include "libtransmission/transmission.h" #include "libtransmission/error.h" -#include "libtransmission/magnet-metainfo.h" +#include "libtransmission/quark.h" #include "libtransmission/session.h" #include "libtransmission/torrent-metainfo.h" #include "libtransmission/torrent.h" diff --git a/libtransmission/torrent-files.cc b/libtransmission/torrent-files.cc index e43ca9816..ffcae88fe 100644 --- a/libtransmission/torrent-files.cc +++ b/libtransmission/torrent-files.cc @@ -4,6 +4,7 @@ // License text can be found in the licenses/ folder. #include // std::find() +#include #include #include #include @@ -17,9 +18,10 @@ #include "libtransmission/transmission.h" -#include "libtransmission/error.h" +#include "libtransmission/file.h" #include "libtransmission/log.h" #include "libtransmission/torrent-files.h" +#include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" using namespace std::literals; diff --git a/libtransmission/torrent-files.h b/libtransmission/torrent-files.h index ab79984b8..cd0750d60 100644 --- a/libtransmission/torrent-files.h +++ b/libtransmission/torrent-files.h @@ -16,10 +16,11 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "file.h" -#include "tr-strbuf.h" +#include "libtransmission/file.h" +#include "libtransmission/tr-macros.h" +#include "libtransmission/tr-strbuf.h" struct tr_error; diff --git a/libtransmission/torrent-magnet.cc b/libtransmission/torrent-magnet.cc index 32add375f..5fe8046a4 100644 --- a/libtransmission/torrent-magnet.cc +++ b/libtransmission/torrent-magnet.cc @@ -5,11 +5,11 @@ #include #include /* INT_MAX */ +#include #include #include #include #include -#include #include #include @@ -18,9 +18,8 @@ #include "libtransmission/crypto-utils.h" // for tr_sha1() #include "libtransmission/error.h" -#include "libtransmission/log.h" -#include "libtransmission/magnet-metainfo.h" -#include "libtransmission/resume.h" +#include "libtransmission/file.h" +#include "libtransmission/quark.h" #include "libtransmission/torrent-magnet.h" #include "libtransmission/torrent-metainfo.h" #include "libtransmission/torrent.h" diff --git a/libtransmission/torrent-magnet.h b/libtransmission/torrent-magnet.h index cb5d7e1fc..4bc4ef109 100644 --- a/libtransmission/torrent-magnet.h +++ b/libtransmission/torrent-magnet.h @@ -15,8 +15,7 @@ #include #include -#include "transmission.h" - +struct tr_error; struct tr_torrent; struct tr_torrent_metainfo; diff --git a/libtransmission/torrent.cc b/libtransmission/torrent.cc index caa118d1b..c3097005d 100644 --- a/libtransmission/torrent.cc +++ b/libtransmission/torrent.cc @@ -38,6 +38,7 @@ #include "libtransmission/inout.h" // tr_ioTestPiece() #include "libtransmission/log.h" #include "libtransmission/magnet-metainfo.h" +#include "libtransmission/peer-common.h" #include "libtransmission/peer-mgr.h" #include "libtransmission/resume.h" #include "libtransmission/session.h" diff --git a/libtransmission/torrents.cc b/libtransmission/torrents.cc index b9e3c6c0a..10bc171be 100644 --- a/libtransmission/torrents.cc +++ b/libtransmission/torrents.cc @@ -3,6 +3,7 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include #include #include diff --git a/libtransmission/torrents.h b/libtransmission/torrents.h index 1b46b6b7d..d591c5ce1 100644 --- a/libtransmission/torrents.h +++ b/libtransmission/torrents.h @@ -15,9 +15,10 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "torrent-metainfo.h" +#include "libtransmission/torrent-metainfo.h" +#include "libtransmission/tr-macros.h" struct tr_torrent; struct tr_torrent_metainfo; diff --git a/libtransmission/tr-assert.h b/libtransmission/tr-assert.h index 12911776e..1bca312b8 100644 --- a/libtransmission/tr-assert.h +++ b/libtransmission/tr-assert.h @@ -9,7 +9,7 @@ #include -#include "tr-macros.h" +#include "libtransmission/tr-macros.h" [[noreturn]] bool tr_assert_report(std::string_view file, long line, std::string_view message); diff --git a/libtransmission/tr-dht.cc b/libtransmission/tr-dht.cc index 87c5e56c6..50e22efa9 100644 --- a/libtransmission/tr-dht.cc +++ b/libtransmission/tr-dht.cc @@ -3,10 +3,10 @@ // License text can be found in the licenses/ folder. #include +#include #include -#include -#include // for abort() -#include // for memcpy() +#include // uint16_t +#include // memcpy() #include #include #include @@ -15,15 +15,14 @@ #include #include #include -#include // for std::tie() +#include // std::tie() +#include #ifdef _WIN32 #include #undef gai_strerror #define gai_strerror gai_strerrorA #else -#include // for `struct timezone` -#include #include /* socket(), bind() */ #include #include /* sockaddr_in */ @@ -38,6 +37,7 @@ #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/peer-mgr.h" // for tr_peerMgrCompactToPex() +#include "libtransmission/quark.h" #include "libtransmission/timer.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-dht.h" diff --git a/libtransmission/tr-dht.h b/libtransmission/tr-dht.h index acc93e436..233fc6ba4 100644 --- a/libtransmission/tr-dht.h +++ b/libtransmission/tr-dht.h @@ -14,11 +14,18 @@ #include #include +#ifdef _WIN32 +#include +#else +#include +#endif + #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "net.h" // tr_port +#include "libtransmission/net.h" // tr_port +#include "libtransmission/tr-macros.h" struct tr_pex; diff --git a/libtransmission/tr-getopt.cc b/libtransmission/tr-getopt.cc index 7b6c158dd..25e6855c3 100644 --- a/libtransmission/tr-getopt.cc +++ b/libtransmission/tr-getopt.cc @@ -3,16 +3,16 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include #include /* exit() */ #include +#include #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/tr-getopt.h" -#include "libtransmission/tr-macros.h" #include "libtransmission/utils.h" using namespace std::literals; diff --git a/libtransmission/tr-lpd.cc b/libtransmission/tr-lpd.cc index 97bae2d27..576a4bd52 100644 --- a/libtransmission/tr-lpd.cc +++ b/libtransmission/tr-lpd.cc @@ -5,15 +5,17 @@ #include #include #include +#include +#include #include #include #include +#include #ifdef _WIN32 #include #else #include -#include #include /* socket(), bind() */ #include /* sockaddr_in */ #endif diff --git a/libtransmission/tr-lpd.h b/libtransmission/tr-lpd.h index 74d30a66e..7eac40fb6 100644 --- a/libtransmission/tr-lpd.h +++ b/libtransmission/tr-lpd.h @@ -14,9 +14,9 @@ #include #include -#include "transmission.h" +#include "libtransmission/transmission.h" -#include "net.h" // for tr_address, tr_port +#include "libtransmission/net.h" // for tr_address, tr_port struct event_base; diff --git a/libtransmission/tr-udp.cc b/libtransmission/tr-udp.cc index 77afe7303..1e560437e 100644 --- a/libtransmission/tr-udp.cc +++ b/libtransmission/tr-udp.cc @@ -4,14 +4,19 @@ #include #include -#include /* memcmp(), memset() */ +#include + +#ifdef _WIN32 +#include +#else +#include // IPV6_V6ONLY, IPPROTO_IPV6 +#include // setsockopt, SOL_SOCKET, bind +#endif #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/session.h" diff --git a/libtransmission/utils-ev.cc b/libtransmission/utils-ev.cc index 0ee2c7aa9..cb2ef9b63 100644 --- a/libtransmission/utils-ev.cc +++ b/libtransmission/utils-ev.cc @@ -7,8 +7,6 @@ #include #include -#include "libtransmission/transmission.h" - #include "libtransmission/utils-ev.h" namespace libtransmission::evhelpers diff --git a/libtransmission/utils.cc b/libtransmission/utils.cc index 9637283dd..578c56a84 100644 --- a/libtransmission/utils.cc +++ b/libtransmission/utils.cc @@ -11,6 +11,7 @@ #include // SIZE_MAX #include // getenv() #include /* strerror() */ +#include #include #include // for std::back_inserter #include @@ -18,16 +19,16 @@ #include #include #include +#include #include #ifdef _WIN32 #include /* Sleep(), GetEnvironmentVariable() */ +#include /* htonl(), ntohl() */ #include /* CommandLineToArgv() */ -#endif - -#ifndef _WIN32 -#include // mode_t +#else +#include #endif #define UTF_CPP_CPLUSPLUS 201703L @@ -47,7 +48,7 @@ #include "libtransmission/file.h" #include "libtransmission/log.h" #include "libtransmission/mime-types.h" -#include "libtransmission/net.h" // ntohl() +#include "libtransmission/quark.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 5baafda33..d57669e41 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -17,7 +17,7 @@ #include #include -#include "tr-macros.h" +#include "libtransmission/tr-macros.h" struct tr_error; diff --git a/libtransmission/variant-benc.cc b/libtransmission/variant-benc.cc index 03469922f..ed0fcc206 100644 --- a/libtransmission/variant-benc.cc +++ b/libtransmission/variant-benc.cc @@ -3,9 +3,13 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include #include /* isdigit() */ +#include // size_t, std::byte +#include // int64_t #include +#include #include #include @@ -14,8 +18,6 @@ #define LIBTRANSMISSION_VARIANT_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/benc.h" #include "libtransmission/quark.h" #include "libtransmission/tr-buffer.h" @@ -23,6 +25,8 @@ #include "libtransmission/variant-common.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-converters.cc b/libtransmission/variant-converters.cc index 0cdbcd90b..7e2bcc917 100644 --- a/libtransmission/variant-converters.cc +++ b/libtransmission/variant-converters.cc @@ -3,6 +3,14 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include // size_t +#include // int64_t, uint32_t +#include +#include +#include +#include + #include #include "libtransmission/transmission.h" diff --git a/libtransmission/variant-json.cc b/libtransmission/variant-json.cc index fd2f3f662..33af3bfef 100644 --- a/libtransmission/variant-json.cc +++ b/libtransmission/variant-json.cc @@ -3,13 +3,17 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include #include #include /* EILSEQ, EINVAL */ #include /* fabs() */ +#include // std::byte +#include // uint16_t #include #include #include +#include // std::back_inserter #include #include #include @@ -24,10 +28,7 @@ #define LIBTRANSMISSION_VARIANT_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" -#include "libtransmission/log.h" #include "libtransmission/quark.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-buffer.h" diff --git a/libtransmission/variant.cc b/libtransmission/variant.cc index a66caf045..12ff4ed75 100644 --- a/libtransmission/variant.cc +++ b/libtransmission/variant.cc @@ -4,7 +4,6 @@ // License text can be found in the licenses/ folder. #include // std::sort -#include #include #include #include @@ -19,10 +18,7 @@ #define LIBTRANSMISSION_VARIANT_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/error.h" -#include "libtransmission/file.h" #include "libtransmission/log.h" #include "libtransmission/quark.h" #include "libtransmission/tr-assert.h" diff --git a/libtransmission/variant.h b/libtransmission/variant.h index 08db4b2c2..f376ad24f 100644 --- a/libtransmission/variant.h +++ b/libtransmission/variant.h @@ -11,7 +11,7 @@ #include #include -#include "quark.h" +#include "libtransmission/quark.h" struct tr_error; diff --git a/libtransmission/watchdir-generic.cc b/libtransmission/watchdir-generic.cc index 1161d4908..80d34824f 100644 --- a/libtransmission/watchdir-generic.cc +++ b/libtransmission/watchdir-generic.cc @@ -3,12 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include +#include #include #define LIBTRANSMISSION_WATCHDIR_MODULE -#include "libtransmission/transmission.h" - +#include "libtransmission/timer.h" +#include "libtransmission/watchdir.h" #include "libtransmission/watchdir-base.h" namespace libtransmission diff --git a/libtransmission/watchdir-inotify.cc b/libtransmission/watchdir-inotify.cc index ed6c0978e..f863c358d 100644 --- a/libtransmission/watchdir-inotify.cc +++ b/libtransmission/watchdir-inotify.cc @@ -4,7 +4,10 @@ // License text can be found in the licenses/ folder. #include +#include // uint32_t #include +#include +#include #include #include /* close() */ @@ -18,8 +21,6 @@ #define LIBTRANSMISSION_WATCHDIR_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/log.h" #include "libtransmission/tr-assert.h" #include "libtransmission/tr-strbuf.h" @@ -28,6 +29,9 @@ namespace libtransmission { + +class TimerMaker; + namespace { class INotifyWatchdir final : public impl::BaseWatchdir diff --git a/libtransmission/watchdir.cc b/libtransmission/watchdir.cc index 281ca827b..cdc4cd0d6 100644 --- a/libtransmission/watchdir.cc +++ b/libtransmission/watchdir.cc @@ -4,11 +4,13 @@ // License text can be found in the licenses/ folder. #include +#include +#include + +#include #define LIBTRANSMISSION_WATCHDIR_MODULE -#include "libtransmission/transmission.h" - #include "libtransmission/error-types.h" #include "libtransmission/error.h" #include "libtransmission/file.h" diff --git a/libtransmission/web-utils.cc b/libtransmission/web-utils.cc index 84a8d933b..70012576e 100644 --- a/libtransmission/web-utils.cc +++ b/libtransmission/web-utils.cc @@ -18,11 +18,10 @@ #define PSL_STATIC #include -#include "libtransmission/transmission.h" - #include "libtransmission/log.h" #include "libtransmission/net.h" #include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" #include "libtransmission/tr-strbuf.h" #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" diff --git a/libtransmission/web-utils.h b/libtransmission/web-utils.h index fb2b8e273..99d046bbe 100644 --- a/libtransmission/web-utils.h +++ b/libtransmission/web-utils.h @@ -13,7 +13,7 @@ #include -#include "tr-macros.h" // tr_sha1_digest_t +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t /** @brief convenience function to determine if an address is an IP address (IPv4 or IPv6) */ bool tr_addressIsIP(char const* address); diff --git a/libtransmission/web.cc b/libtransmission/web.cc index fdea4f8d6..aed8dcafd 100644 --- a/libtransmission/web.cc +++ b/libtransmission/web.cc @@ -4,9 +4,12 @@ // License text can be found in the licenses/ folder. #include +#ifdef _WIN32 #include +#endif #include #include +#include // uint64_t #include #include #include @@ -19,17 +22,21 @@ #ifdef _WIN32 #include #include +#include +#else +#include // setsockopt, SOL_SOCKET, SO_RC... #endif #include +#include + #include -#include "libtransmission/transmission.h" - +#ifdef _WIN32 #include "libtransmission/crypto-utils.h" +#endif #include "libtransmission/log.h" -#include "libtransmission/peer-io.h" #include "libtransmission/tr-assert.h" #include "libtransmission/utils-ev.h" #include "libtransmission/utils.h" diff --git a/libtransmission/web.h b/libtransmission/web.h index afff12f5f..b68ebfb6f 100644 --- a/libtransmission/web.h +++ b/libtransmission/web.h @@ -15,8 +15,6 @@ #include #include -#include - struct evbuffer; class tr_web diff --git a/libtransmission/webseed.cc b/libtransmission/webseed.cc index eb2212d4c..bf0df32a0 100644 --- a/libtransmission/webseed.cc +++ b/libtransmission/webseed.cc @@ -4,6 +4,8 @@ // License text can be found in the licenses/ folder. #include +#include // uint64_t, uint32_t +#include #include #include #include // std::accumulate() @@ -13,16 +15,23 @@ #include #include +#include + #include #include "libtransmission/transmission.h" #include "libtransmission/bandwidth.h" +#include "libtransmission/bitfield.h" +#include "libtransmission/block-info.h" #include "libtransmission/cache.h" -#include "libtransmission/peer-io.h" +#include "libtransmission/peer-common.h" #include "libtransmission/peer-mgr.h" +#include "libtransmission/session.h" #include "libtransmission/timer.h" #include "libtransmission/torrent.h" +#include "libtransmission/tr-assert.h" +#include "libtransmission/tr-macros.h" #include "libtransmission/utils-ev.h" #include "libtransmission/utils.h" #include "libtransmission/web-utils.h" diff --git a/libtransmission/webseed.h b/libtransmission/webseed.h index bc13d17a9..8e34a469a 100644 --- a/libtransmission/webseed.h +++ b/libtransmission/webseed.h @@ -11,7 +11,9 @@ #include -#include "peer-common.h" +#include "libtransmission/transmission.h" + +#include "libtransmission/peer-common.h" tr_peer* tr_webseedNew(struct tr_torrent* torrent, std::string_view, tr_peer_callback callback, void* callback_data); diff --git a/tests/libtransmission/announce-list-test.cc b/tests/libtransmission/announce-list-test.cc index 81647a258..f48ab4577 100644 --- a/tests/libtransmission/announce-list-test.cc +++ b/tests/libtransmission/announce-list-test.cc @@ -3,23 +3,27 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::equal #include -#include +#include #include +#include #include #include +#include + #include #include #include +#include #include #include -#include - -#include "test-fixtures.h" +#include #include "gtest/gtest.h" +#include "test-fixtures.h" using AnnounceListTest = ::testing::Test; using namespace std::literals; diff --git a/tests/libtransmission/announcer-test.cc b/tests/libtransmission/announcer-test.cc index 10e033605..a7461723f 100644 --- a/tests/libtransmission/announcer-test.cc +++ b/tests/libtransmission/announcer-test.cc @@ -5,6 +5,8 @@ #include #include +#include +#include // std::byte #include #define LIBTRANSMISSION_ANNOUNCER_MODULE @@ -14,6 +16,7 @@ #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using AnnouncerTest = ::testing::Test; diff --git a/tests/libtransmission/announcer-udp-test.cc b/tests/libtransmission/announcer-udp-test.cc index 277982ce8..87a90bb96 100644 --- a/tests/libtransmission/announcer-udp-test.cc +++ b/tests/libtransmission/announcer-udp-test.cc @@ -3,24 +3,44 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include +#include +#include // std::byte +#include // uint32_t, uint64_t #include // for std::memcpy() +#include #include #include +#include +#include +#include +#include #include -#include +#ifdef _WIN32 +#include +#else +#include // socklen_t, sockaddr_st... +#endif + +#include #define LIBTRANSMISSION_ANNOUNCER_MODULE -#include - #include #include #include // for tr_rand_obj() +#include #include // for tr_pex +#include // tr_peerIdInit +#include "libtransmission/timer.h" #include #include +#include "libtransmission/tr-macros.h" // tr_sha1_digest_t, tr_p... +#include "libtransmission/utils.h" +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/benc-test.cc b/tests/libtransmission/benc-test.cc index 0208b2e13..c28fee9b5 100644 --- a/tests/libtransmission/benc-test.cc +++ b/tests/libtransmission/benc-test.cc @@ -3,11 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // int64_t +#include + #include #include #include +#include #include "gtest/gtest.h" diff --git a/tests/libtransmission/bitfield-test.cc b/tests/libtransmission/bitfield-test.cc index 7d97c4a97..83d62129a 100644 --- a/tests/libtransmission/bitfield-test.cc +++ b/tests/libtransmission/bitfield-test.cc @@ -5,10 +5,11 @@ #include #include +#include // size_t +#include // uint8_t #include #include -#include #include #include diff --git a/tests/libtransmission/blocklist-test.cc b/tests/libtransmission/blocklist-test.cc index 05082bf25..e1beae379 100644 --- a/tests/libtransmission/blocklist-test.cc +++ b/tests/libtransmission/blocklist-test.cc @@ -3,18 +3,16 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include // strlen() -// #include // sync() +#include +#include #include -#include -#include #include -#include -#include // tr_session.tr_session.addressIsBlocked() +#include // tr_session.addressIsBlocked() #include +#include "gtest/gtest.h" #include "test-fixtures.h" namespace libtransmission::test diff --git a/tests/libtransmission/buffer-test.cc b/tests/libtransmission/buffer-test.cc index 84f0b83bc..316d16415 100644 --- a/tests/libtransmission/buffer-test.cc +++ b/tests/libtransmission/buffer-test.cc @@ -3,10 +3,17 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // std::byte +#include // uint16_t, uint32_t, uint64_t +#include +#include + #include +#include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using BufferTest = ::testing::Test; diff --git a/tests/libtransmission/clients-test.cc b/tests/libtransmission/clients-test.cc index 34f2cc27d..2ce7659d2 100644 --- a/tests/libtransmission/clients-test.cc +++ b/tests/libtransmission/clients-test.cc @@ -5,12 +5,12 @@ #include #include +#include // size_t #include -#include - #include // tr_rand_obj() #include +#include #include "gtest/gtest.h" diff --git a/tests/libtransmission/completion-test.cc b/tests/libtransmission/completion-test.cc index 3dd1e8c49..25f0a826c 100644 --- a/tests/libtransmission/completion-test.cc +++ b/tests/libtransmission/completion-test.cc @@ -5,11 +5,13 @@ #include #include +#include // size_t #include #include #include +#include #include #include // for tr_rand_obj() #include diff --git a/tests/libtransmission/copy-test.cc b/tests/libtransmission/copy-test.cc index 846f2dad9..e6f285223 100644 --- a/tests/libtransmission/copy-test.cc +++ b/tests/libtransmission/copy-test.cc @@ -4,13 +4,18 @@ // License text can be found in the licenses/ folder. #include +#include // uint64_t #include +#include #include -#include +#include #include #include +#include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" namespace libtransmission::test diff --git a/tests/libtransmission/crypto-test.cc b/tests/libtransmission/crypto-test.cc index fe3296c16..12bf1c940 100644 --- a/tests/libtransmission/crypto-test.cc +++ b/tests/libtransmission/crypto-test.cc @@ -3,20 +3,19 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include #include +#include +#include // std::byte, size_t +#include // uint8_t #include #include -#include -#include #include #include #include -#include - #include #include +#include #include #include "crypto-test-ref.h" diff --git a/tests/libtransmission/dht-test.cc b/tests/libtransmission/dht-test.cc index a54c39928..c8f52a0b6 100644 --- a/tests/libtransmission/dht-test.cc +++ b/tests/libtransmission/dht-test.cc @@ -4,19 +4,47 @@ // License text can be found in the licenses/ folder. #include +#include +#include #include +#include // size_t, std::byte +#include // time(), time_t #include +#include // std::back_inserter +#include #include +#include +#include #include +#include + +#ifdef _WIN32 +#include +#else +#include // addrinfo, freeaddrinfo +#include // AF_INET, AF_INET6, AF_UN... +#endif + +#include // dht_callback_t #include +#include + #include +#include // tr_rand_obj #include -#include -#include +#include +#include #include // for tr_evthread_init(); +#include +#include +#include +#include +#include +#include +#include // tr_variantDictAddRaw #include "gtest/gtest.h" #include "test-fixtures.h" diff --git a/tests/libtransmission/error-test.cc b/tests/libtransmission/error-test.cc index 8ec6a76ee..6056e550d 100644 --- a/tests/libtransmission/error-test.cc +++ b/tests/libtransmission/error-test.cc @@ -3,7 +3,8 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include + #include #include "test-fixtures.h" diff --git a/tests/libtransmission/file-piece-map-test.cc b/tests/libtransmission/file-piece-map-test.cc index a42f1088b..fecdbfe45 100644 --- a/tests/libtransmission/file-piece-map-test.cc +++ b/tests/libtransmission/file-piece-map-test.cc @@ -3,12 +3,16 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include +#include // size_t +#include // uint64_t #include -#include +#include #include +#include #include #include diff --git a/tests/libtransmission/file-test.cc b/tests/libtransmission/file-test.cc index 2349e0159..71f3d5fff 100644 --- a/tests/libtransmission/file-test.cc +++ b/tests/libtransmission/file-test.cc @@ -4,27 +4,32 @@ // License text can be found in the licenses/ folder. #include +#include +#include // uint64_t +#include // stderr #include +#include // time() #include +#include #include #include #include #ifndef _WIN32 -#include #include #include #else #include #endif -#include +#include #include #include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" #if !defined(__OpenBSD__) diff --git a/tests/libtransmission/getopt-test.cc b/tests/libtransmission/getopt-test.cc index 52a9ebcba..7125a1087 100644 --- a/tests/libtransmission/getopt-test.cc +++ b/tests/libtransmission/getopt-test.cc @@ -3,13 +3,12 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include + #include #include "gtest/gtest.h" -#include - namespace { diff --git a/tests/libtransmission/global-ip-cache-test.cc b/tests/libtransmission/global-ip-cache-test.cc index 625379f2b..0263980a6 100644 --- a/tests/libtransmission/global-ip-cache-test.cc +++ b/tests/libtransmission/global-ip-cache-test.cc @@ -5,9 +5,10 @@ #include #include -#include +#include // size_t #include #include +#include #include #include diff --git a/tests/libtransmission/handshake-test.cc b/tests/libtransmission/handshake-test.cc index dfe5cd110..e274f9f09 100644 --- a/tests/libtransmission/handshake-test.cc +++ b/tests/libtransmission/handshake-test.cc @@ -6,17 +6,39 @@ #include #include #include +#include +#include // size_t, std::byte +#include // uint8_t +#include +#include +#include #include +#include + +#ifdef _WIN32 +#include +#else +#include +#include // write() +#endif #include #include +#include // tr_sha1_to_string, tr_base... #include +#include #include +#include +#include #include // tr_peerIdInit() #include +#include +#include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/history-test.cc b/tests/libtransmission/history-test.cc index 4990e7376..6dc20047f 100644 --- a/tests/libtransmission/history-test.cc +++ b/tests/libtransmission/history-test.cc @@ -3,7 +3,8 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include // size_t + #include #include "gtest/gtest.h" diff --git a/tests/libtransmission/json-test.cc b/tests/libtransmission/json-test.cc index 49120e59b..20ff62a77 100644 --- a/tests/libtransmission/json-test.cc +++ b/tests/libtransmission/json-test.cc @@ -5,15 +5,15 @@ #define LIBTRANSMISSION_VARIANT_MODULE +#include // int64_t #include #include +#include // std::runtime_error #include #include -#include -#include +#include #include -#include #include "gtest/gtest.h" diff --git a/tests/libtransmission/lpd-test.cc b/tests/libtransmission/lpd-test.cc index 917247342..db60e0f1f 100644 --- a/tests/libtransmission/lpd-test.cc +++ b/tests/libtransmission/lpd-test.cc @@ -3,18 +3,23 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include +#include #include #include #include #include -#include +#include // tr_torrent_activity #include // tr_rand_obj() +#include #include #include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/magnet-metainfo-test.cc b/tests/libtransmission/magnet-metainfo-test.cc index 9a98686c4..7c9403135 100644 --- a/tests/libtransmission/magnet-metainfo-test.cc +++ b/tests/libtransmission/magnet-metainfo-test.cc @@ -4,14 +4,16 @@ // License text can be found in the licenses/ folder. #include +#include // size_t, std::byte #include #include "gtest/gtest.h" #include -#include #include // tr_rand_buffer() +#include +#include using namespace std::literals; diff --git a/tests/libtransmission/makemeta-test.cc b/tests/libtransmission/makemeta-test.cc index 2f6054f3e..7036c832e 100644 --- a/tests/libtransmission/makemeta-test.cc +++ b/tests/libtransmission/makemeta-test.cc @@ -4,26 +4,30 @@ // License text can be found in the licenses/ folder. #include -#include -#include // mktemp() -#include +#include // size_t, std::byte +#include // uint32_t +#include #include #include #include #include -#include - -#include - +#include #include #include #include +#include #include // TR_NAME #include +#include +#include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" +struct tr_error; + using namespace std::literals; namespace libtransmission::test diff --git a/tests/libtransmission/move-test.cc b/tests/libtransmission/move-test.cc index cd88afc79..7bcf0b871 100644 --- a/tests/libtransmission/move-test.cc +++ b/tests/libtransmission/move-test.cc @@ -3,7 +3,7 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include #include #include #include @@ -11,11 +11,16 @@ #include +#include #include // tr_cacheWriteBlock() #include // tr_sys_path_*() +#include +#include +#include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/net-test.cc b/tests/libtransmission/net-test.cc index d7742f7fb..f49e34b93 100644 --- a/tests/libtransmission/net-test.cc +++ b/tests/libtransmission/net-test.cc @@ -3,17 +3,25 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include #include -#include +#include +#include +#include // std::byte, size_t #include #include #include +#ifdef _WIN32 +#include +#else +#include +#include +#endif + #include #include -#include "test-fixtures.h" +#include "gtest/gtest.h" using NetTest = ::testing::Test; using namespace std::literals; diff --git a/tests/libtransmission/open-files-test.cc b/tests/libtransmission/open-files-test.cc index 83e6695c6..cf6ca1a71 100644 --- a/tests/libtransmission/open-files-test.cc +++ b/tests/libtransmission/open-files-test.cc @@ -4,14 +4,22 @@ // License text can be found in the licenses/ folder. #include +#include +#include +#include // size_t +#include // uint64_t #include +#include + #include #include #include +#include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/peer-mgr-active-requests-test.cc b/tests/libtransmission/peer-mgr-active-requests-test.cc index 1ded8bd47..88dbbdf7e 100644 --- a/tests/libtransmission/peer-mgr-active-requests-test.cc +++ b/tests/libtransmission/peer-mgr-active-requests-test.cc @@ -6,14 +6,17 @@ #define LIBTRANSMISSION_PEER_MODULE #include -#include +#include // time_t +#include -#include +#include // tr_block_index_t #include #include "gtest/gtest.h" +class tr_peer; + class PeerMgrActiveRequestsTest : public ::testing::Test { protected: diff --git a/tests/libtransmission/peer-mgr-wishlist-test.cc b/tests/libtransmission/peer-mgr-wishlist-test.cc index 8dd201434..7b2ce3997 100644 --- a/tests/libtransmission/peer-mgr-wishlist-test.cc +++ b/tests/libtransmission/peer-mgr-wishlist-test.cc @@ -3,14 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include // size_t #include -#include +#include #define LIBTRANSMISSION_PEER_MODULE #include +#include #include #include "gtest/gtest.h" diff --git a/tests/libtransmission/platform-test.cc b/tests/libtransmission/platform-test.cc index 8832f46cc..1e98ec842 100644 --- a/tests/libtransmission/platform-test.cc +++ b/tests/libtransmission/platform-test.cc @@ -6,12 +6,16 @@ #include #include +#include + #include #include #include #include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/quark-test.cc b/tests/libtransmission/quark-test.cc index c2abc1f84..98d5c28b5 100644 --- a/tests/libtransmission/quark-test.cc +++ b/tests/libtransmission/quark-test.cc @@ -3,15 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include +#include // size_t +#include +#include + #include #include "gtest/gtest.h" -#include -#include -#include - class QuarkTest : public ::testing::Test { protected: diff --git a/tests/libtransmission/remove-test.cc b/tests/libtransmission/remove-test.cc index 101d62aec..600be61fa 100644 --- a/tests/libtransmission/remove-test.cc +++ b/tests/libtransmission/remove-test.cc @@ -4,7 +4,7 @@ // License text can be found in the licenses/ folder. #include -#include +#include // uint64_t #include #include #include @@ -15,6 +15,7 @@ #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/rename-test.cc b/tests/libtransmission/rename-test.cc index 2495a71d6..72853a06e 100644 --- a/tests/libtransmission/rename-test.cc +++ b/tests/libtransmission/rename-test.cc @@ -3,22 +3,28 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include +#include // size_t +#include // uint32_t, uint64_t +#include +#include +#include + #include +#include #include #include #include // tr_isTorrent() -#include #include -#include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" -#include -#include -#include // fopen() -#include -#include +struct tr_ctor; +struct tr_error; using namespace std::literals; diff --git a/tests/libtransmission/rpc-test.cc b/tests/libtransmission/rpc-test.cc index c0fa7e1fd..7f584845b 100644 --- a/tests/libtransmission/rpc-test.cc +++ b/tests/libtransmission/rpc-test.cc @@ -3,17 +3,23 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include +#include // size_t +#include // int64_t +#include // std::inserter +#include +#include +#include + #include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" -#include -#include -#include -#include -#include +struct tr_session; using namespace std::literals; diff --git a/tests/libtransmission/session-alt-speeds-test.cc b/tests/libtransmission/session-alt-speeds-test.cc index a6c64e4e8..4944978ba 100644 --- a/tests/libtransmission/session-alt-speeds-test.cc +++ b/tests/libtransmission/session-alt-speeds-test.cc @@ -3,17 +3,15 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include #include #include -#include - #include #include -#include -#include +#include -#include "test-fixtures.h" +#include "gtest/gtest.h" using namespace std::literals; diff --git a/tests/libtransmission/session-test.cc b/tests/libtransmission/session-test.cc index 4be34eafc..c515ea9ed 100644 --- a/tests/libtransmission/session-test.cc +++ b/tests/libtransmission/session-test.cc @@ -3,23 +3,27 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include - -#include -#include -#include -#include - -#include "test-fixtures.h" - -#include #include #include #include +#include +#include #include #include #include +#include + +#include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "test-fixtures.h" + using namespace std::literals; namespace libtransmission::test diff --git a/tests/libtransmission/settings-test.cc b/tests/libtransmission/settings-test.cc index fe860eae6..a7a950a70 100644 --- a/tests/libtransmission/settings-test.cc +++ b/tests/libtransmission/settings-test.cc @@ -3,11 +3,20 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // size_t +#include // int64_t +#include +#include + #include +#include +#include +#include #include +#include -#include "test-fixtures.h" +#include "gtest/gtest.h" using namespace std::literals; diff --git a/tests/libtransmission/strbuf-test.cc b/tests/libtransmission/strbuf-test.cc index 064728c59..72f16fd14 100644 --- a/tests/libtransmission/strbuf-test.cc +++ b/tests/libtransmission/strbuf-test.cc @@ -6,11 +6,9 @@ #include #include -#include - #include -#include "test-fixtures.h" +#include "gtest/gtest.h" using StrbufTest = ::testing::Test; using namespace std::literals; diff --git a/tests/libtransmission/subprocess-test-program.cc b/tests/libtransmission/subprocess-test-program.cc index 5363b97fd..e263a4ddd 100644 --- a/tests/libtransmission/subprocess-test-program.cc +++ b/tests/libtransmission/subprocess-test-program.cc @@ -3,9 +3,7 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include "transmission.h" -#include "file.h" -#include "subprocess.h" +#include "file.h" // tr_sys_file_write_line(), tr_sys_file_close(), tr_sy... #include "utils.h" // tr_env_get_string() #include diff --git a/tests/libtransmission/subprocess-test.cc b/tests/libtransmission/subprocess-test.cc index 8d8245fda..5305ecd1d 100644 --- a/tests/libtransmission/subprocess-test.cc +++ b/tests/libtransmission/subprocess-test.cc @@ -3,22 +3,24 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include -#include -#include -#include -#include - -#include "gtest/internal/gtest-port.h" // GetArgvs() - -#include "test-fixtures.h" - #include +#include +#include // setenv +#include // strerror #include #include #include #include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "test-fixtures.h" + #ifdef _WIN32 #include #define setenv(key, value, unused) SetEnvironmentVariableA(key, value) diff --git a/tests/libtransmission/timer-test.cc b/tests/libtransmission/timer-test.cc index c08cb34b4..914a5e813 100644 --- a/tests/libtransmission/timer-test.cc +++ b/tests/libtransmission/timer-test.cc @@ -3,15 +3,18 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#include +#include +#include // size_t +#include + +#include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" -using namespace std::literals; - namespace libtransmission::test { diff --git a/tests/libtransmission/torrent-files-test.cc b/tests/libtransmission/torrent-files-test.cc index 2f7b86888..815a2ae33 100644 --- a/tests/libtransmission/torrent-files-test.cc +++ b/tests/libtransmission/torrent-files-test.cc @@ -4,13 +4,20 @@ // License text can be found in the licenses/ folder. #include +#include +#include // size_t +#include #include #include +#include #include +#include #include +#include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/torrent-magnet-test.cc b/tests/libtransmission/torrent-magnet-test.cc index f38ed9bd6..38d0f792a 100644 --- a/tests/libtransmission/torrent-magnet-test.cc +++ b/tests/libtransmission/torrent-magnet-test.cc @@ -3,16 +3,14 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include // size_t #include -#include - -#include #include #include #include -#include +#include "gtest/gtest.h" #include "test-fixtures.h" namespace libtransmission::test diff --git a/tests/libtransmission/torrent-metainfo-test.cc b/tests/libtransmission/torrent-metainfo-test.cc index e08a0f760..ce5b24859 100644 --- a/tests/libtransmission/torrent-metainfo-test.cc +++ b/tests/libtransmission/torrent-metainfo-test.cc @@ -4,17 +4,23 @@ // License text can be found in the licenses/ folder. #include +#include +#include // size_t #include +#include #include #include #include +#include +#include #include #include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/torrents-test.cc b/tests/libtransmission/torrents-test.cc index e3696a9d8..ba33878c0 100644 --- a/tests/libtransmission/torrents-test.cc +++ b/tests/libtransmission/torrents-test.cc @@ -3,17 +3,22 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include // time, size_t, time_t +#include #include #include +#include #include #include #include #include +#include +#include #include "gtest/gtest.h" - #include "test-fixtures.h" using namespace std::literals; diff --git a/tests/libtransmission/utils-test.cc b/tests/libtransmission/utils-test.cc index 96bbfd514..4e9e15720 100644 --- a/tests/libtransmission/utils-test.cc +++ b/tests/libtransmission/utils-test.cc @@ -9,10 +9,10 @@ #include // setenv(), unsetenv() #include #include -#include #include #include #include +#include #ifdef _WIN32 #include @@ -20,13 +20,17 @@ #define unsetenv(key) SetEnvironmentVariableA(key, nullptr) #endif +#include + #include #include // tr_rand_int() -#include +#include +#include #include #include +#include "gtest/gtest.h" #include "test-fixtures.h" using UtilsTest = ::testing::Test; diff --git a/tests/libtransmission/variant-test.cc b/tests/libtransmission/variant-test.cc index 067c88782..c52e5037e 100644 --- a/tests/libtransmission/variant-test.cc +++ b/tests/libtransmission/variant-test.cc @@ -3,23 +3,25 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. -#define LIBTRANSMISSION_VARIANT_MODULE +#include +#include +#include +#include +#include // lrint() +#include // isspace() +#include // size_t +#include // int64_t +#include +#include -#include +#define LIBTRANSMISSION_VARIANT_MODULE #include #include // tr_rand_buffer(), tr_rand_int() #include -#include +#include #include -#include -#include -#include // lrint() -#include // isspace() -#include -#include - #include "gtest/gtest.h" using namespace std::literals; diff --git a/tests/libtransmission/watchdir-test.cc b/tests/libtransmission/watchdir-test.cc index 07192c166..884c47473 100644 --- a/tests/libtransmission/watchdir-test.cc +++ b/tests/libtransmission/watchdir-test.cc @@ -5,23 +5,34 @@ #include #include +#include #include +#include +#include #include +#ifdef _WIN32 +#include +#else +#include // timeval +#endif + +#include + #define LIBTRANSMISSION_WATCHDIR_MODULE -#include - #include -#include +#include +#include +#include +#include +#include #include #include -#include +#include "gtest/gtest.h" #include "test-fixtures.h" -#include - using namespace std::literals; /*** diff --git a/tests/libtransmission/web-utils-test.cc b/tests/libtransmission/web-utils-test.cc index 27a5fa028..f84848cf9 100644 --- a/tests/libtransmission/web-utils-test.cc +++ b/tests/libtransmission/web-utils-test.cc @@ -3,7 +3,11 @@ // or any future license endorsed by Mnemosyne LLC. // License text can be found in the licenses/ folder. +#include +#include // size_t #include +#include +#include #ifdef _WIN32 #include @@ -11,13 +15,10 @@ #define unsetenv(key) SetEnvironmentVariableA(key, nullptr) #endif -#include - #include -#include #include -#include "test-fixtures.h" +#include "gtest/gtest.h" using namespace std::literals; diff --git a/utils/create.cc b/utils/create.cc index 8dab0c402..632e89fe1 100644 --- a/utils/create.cc +++ b/utils/create.cc @@ -4,21 +4,27 @@ // License text can be found in the licenses/ folder. #include +#include #include // for strtoul() #include #include // for uint32_t #include +#include #include #include +#include +#include #include #include +#include #include #include #include #include +#include #include #include #include @@ -43,7 +49,7 @@ auto constexpr Options = std::array{ { 'c', "comment", "Add a comment", "c", true, "" }, { 't', "tracker", "Add a tracker's announce URL", "t", true, "" }, { 'w', "webseed", "Add a webseed URL", "w", true, "" }, - { 'x', "anonymize", "Omit \"Creation date\" and \"Created by\" info", nullptr, false, nullptr }, + { 'x', "anonymize", R"(Omit "Creation date" and "Created by" info)", nullptr, false, nullptr }, { 'V', "version", "Show version number and exit", "V", false, nullptr }, { 0, nullptr, nullptr, nullptr, false, nullptr } } }; diff --git a/utils/edit.cc b/utils/edit.cc index c1f908e8d..159ae5938 100644 --- a/utils/edit.cc +++ b/utils/edit.cc @@ -4,6 +4,7 @@ // License text can be found in the licenses/ folder. #include +#include // stderr #include // EXIT_FAILURE #include #include @@ -11,10 +12,9 @@ #include -#include - #include #include +#include #include #include #include diff --git a/utils/remote.cc b/utils/remote.cc index 80a69454f..9d9a77558 100644 --- a/utils/remote.cc +++ b/utils/remote.cc @@ -7,11 +7,13 @@ #include #include #include /* isspace */ -#include // PRId64 #include +#include // floor +#include // int64_t #include #include #include /* strcmp */ +#include #include #include #include @@ -26,9 +28,9 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/utils/show.cc b/utils/show.cc index bfa2fec6c..cb97b350e 100644 --- a/utils/show.cc +++ b/utils/show.cc @@ -6,11 +6,17 @@ #include #include #include +#include // int64_t +#include +#include #include #include +#include // std::back_inserter #include +#include #include #include +#include #include #include @@ -19,9 +25,9 @@ #include #include +#include #include #include -#include #include #include #include