Charles Kerr
59335eac03
fix: sonarcloud cpp:S6004 ( #4270 )
...
reduce scope of variables by using if-based initializer
2022-11-28 21:03:28 -06:00
Charles Kerr
f27c5fa0fa
refactor: make some local pointer vars pointer-to-const ( #4262 )
2022-11-28 09:45:39 -06:00
Charles Kerr
14dfafde32
refactor: add std::unique_ptr<evhttp> handler to utils-ev ( #4261 )
2022-11-28 08:07:04 -06:00
Charles Kerr
8a35aa0903
refactor: add tr_rand_obj() ( #4238 )
...
* refactor: add tr_rand_obj()
There are a lot of places in the codebase where we need to populate
an integral type or a fixed-size array with random data. To do this,
we instantiate a local on the stack, fill it with tr_rand_buffer(),
and then use it.
This PR creates a helper function to make this a one-liner.
2022-11-25 15:04:37 -06:00
Charles Kerr
4d8509c180
refactor: add libtransmission::evhelpers ( #4104 )
2022-11-06 15:11:30 -06:00
Charles Kerr
257d98545b
refactor: add tr_port_forwarding::Mediator ( #3855 )
...
* refactor: add a Mediator class to decouple tr_session and tr_port_forwarding
* refactor: add tr_port_forwarding::Mediator::privatePeerPort()
* refactor: add tr_port_forwarding::Mediator::onPortForwarded()
* chore: avoid unnecessary include of timer.h in other headers
* refactor: use a uniform timerMaker() API in mediators
2022-10-01 09:12:49 -05:00
Charles Kerr
56e0a1bda8
chore: add cppcoreguidelines-pro-type-member-init to libtransmission/.clang-tidy ( #3840 )
2022-09-23 00:51:15 -05:00
Charles Kerr
1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy ( #3784 )
2022-09-07 11:04:28 -05:00
Charles Kerr
8eab7d3ae7
chore: remove dead "fast set" code ( #3764 )
...
* chore: remove old fast set code
* chore: remove TR_SHA1_DIGEST_LEN declaration
* chore: remove TR_SHA256_DIGEST_LEN declaration
2022-09-05 08:55:17 -05:00
Charles Kerr
1062ae8f1f
refactor: split tr_parseNum inout var into two vars ( #3748 )
...
build: re-enable cert-err34-c warning
2022-09-02 01:04:09 -05:00
Charles Kerr
377134f475
fix: lpd fixup ( #3704 )
...
* chore: fix copyright of lpd header file
* chore: remove unnecessary forward declarations
* fix: LSD messages use proper format even when no cookie
2022-08-24 22:18:58 -05:00
Charles Kerr
e8686095ed
refactor: local peer discovery ( #3696 )
2022-08-24 16:03:30 -05:00
Charles Kerr
29f57bc296
chore: iwyu headers ( #3661 )
2022-08-17 11:08:36 -05:00
Charles Kerr
44a291ca39
refactor: remove tr_session nonmember functions ( #3641 )
2022-08-14 14:41:57 -05:00
Charles Kerr
08ec882055
refactor: remove tr_isSession() ( #3638 )
2022-08-14 09:16:08 -05:00
Charles Kerr
63eab54fd5
refactor: timer pt 2 ( #3617 )
...
* feat: add convenience variants of TimerMaker::create()
* refactor: use libtransmission::Timer in peer-mgr
* refactor: use libtransmission::Timer in peer-msgs
* refactor: use libtransmission::Timer in tr-utp
* refactor: use libtransmission::Timer in tr-dht
* refactor: use libtransmission::Timer in port-forwarding
* refactor: use libtransmission::Timer in webseed
* refactor: use libtransmission::Timer in tr-lpd
* refactor: use libtransmission::Timer in rpc-server
* chore: remove unused function tr_timerAdd()
* chore: remove unused function tr_gettimeofday()
* fixup! chore: remove unused function tr_timerAdd()
* fixup! refactor: use libtransmission::Timer in port-forwarding
2022-08-11 12:28:37 -05:00
Charles Kerr
b49cccbd3e
refactor: add timer class ( #3603 )
...
Wraps around evtimer so that some of the codebase can use libevent without coupling to it.
2022-08-08 17:53:20 -05:00
Charles Kerr
ec79a2a888
fix: clang-tidy misc-const-correctness warnings ( #3529 )
2022-07-27 09:03:13 -05:00
Charles Kerr
1a0afbe95e
refactor: iwyu ( #3525 )
2022-07-25 21:45:54 -05:00
Charles Kerr
46eb379205
fix: ESPIPE "illegal seek" error while seeding ( #3137 )
...
* fix: ESPIPE "illegal seek" error while seeding
The root cause is createSocket returning `{}` instead of `TR_BAD_SOCKET`
when we have too many peers in use. This defaulted to fd 0, which wound
up closing stdin.
Commit also includes some const-correctness changes made while tracking
the problem down.
2022-05-25 18:16:15 -05:00
Charles Kerr
41cb8cbc91
refactor: add tr_address.readable ( #2962 )
2022-04-21 18:37:02 -05:00
Charles Kerr
32f854a7cf
refactor: add a tr_port safety class ( #2952 )
2022-04-21 10:58:13 -05:00
Antoine Cœur
bdac708762
docs: fix various typos and misspellings ( #2955 )
2022-04-21 09:28:38 -05:00
Charles Kerr
205abbbcce
refactor: iwyu string, vector, cstdint ( #2898 )
...
* refactor: use cstdint for intX_t types
* refactor: iwyu sstring_view
* refactor: iwyu <cstring>
* refactor: iwyu <vector>
2022-04-07 20:50:26 -05:00
Charles Kerr
b256da02e3
refactor: remove unused macros ( #2897 )
...
* refactor: remove unused fu nction tr_lowerBound()
* refactor: tr_timerAdd() takes a reference, not a pointer
* refactor: tr_timerAddMsec() takes a reference, not a pointer
* refactor: tr_moveFile() takes a reference, not a pointer
* refactor: tr_wildmat() takes std::string_views
* refactor: remove unused macro TR_GNUC_NONNULL
* refactor: remove unused macro TR_GNUC_PRINTF
* refactor: remove unused macro TR_GNUC_NULL_TERMINATED
* refactor: remove unused macro TR_GNUC_HOT
* refactor: remove unused macro __has_feature
* refactor: remove unused macro __has_attribute
* refactor: remove unused macro TR_DEPRECATED
* refactor: remove unused macro TR_DISABLE_COPY_MOVE
2022-04-07 19:20:29 -05:00
Charles Kerr
68bec3f8e3
refactor: remove tr_snprintf() ( #2872 )
2022-04-04 13:36:48 -05:00
Charles Kerr
46cc95f72e
refactor: remove unused functions ( #2863 )
...
* refactor: annotate nodiscard, constexpr, noexcept methods
* refactor: remove unused tr_blocklistFileExists()
* refactor: remove unused tr_blocklistFileIsEnabled()
* refactor: remove unused tr_ctorGetContents
* refactor: remove unused tr_error_is_set()
* refactor: remove unused tr_handshakeGetAddr()
* refactor: remove unused tr_ctorSetLabels()
* refactor: remove unused tr_http_escape_sha1()
* refactor: remove unused tr_lpdEnabled()
* refactor: remove unused tr_ptrArrayPop()
* refactor: remove unused tr_torrentClearIdleLimitHitCallback()
* refactor: remove unused tr_torrentFindFromHash()
* refactor: remove unused tr_sha1_to_string()
* refactor: remove unused tr_torrents::get()
* refactor: remove unused tr_isEncryptionMode()
* refactor: remove unused tr_isPreallocationMode()
* refactor: remove unused tr_ptrArrayBack()
* refactor: remove unused tr_ptrArrayClear()
* refactor: remove unused tr_torrents::get()
* refactor: remove unused Session::torrentSet()
* refactor: remove unused peer_atom comparison operators
* refactor: remove unused peer_atom::compare()
* refactor: remove unused Qt variantInit(tr_variant*, unsigned)
2022-04-01 21:55:30 -05:00
Charles Kerr
fa8aaf7631
refactor: remove remaining vararg log messages ( #2776 )
2022-03-17 17:39:06 -05:00
Charles Kerr
0be920156b
refactor: fmt part 3 ( #2773 )
2022-03-15 19:51:36 -05:00
Charles Kerr
af339a15ed
refactor: remove deep logging ( #2749 )
...
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr
60ef1abadf
refactor: tr_torrents ( #2722 )
...
* refactor: add tr_torrents container
2022-03-01 15:06:29 -08:00
Charles Kerr
ecef0feb0c
refactor: clang-tidy in libtransmission ( #2578 )
...
* chore: enable cppcoreguidelines-slicing warning
* chore: enable readability-named-parameter warning
* chore: enable bugprone-reserved-identifier check
* chore: enable bugprone-not-null-terminated-result check
* chore: enable bugprone-sizeof-expression check
* chore: enable bugprone-incorrect-roundings check
* chore: enable misc-misplaced-const check
* chore: enable bugprone-suspicious-include check
* chore: enable bugprone-signed-char-misuse check
* chore: enable modernize-raw-string-literal check
* chore: enable readability-static-accessed-through-instance check
* chore: enable readability-implicit-bool-conversion check
* fixup! Merge branch 'main' into refactor/clang-tidy
2022-02-06 22:28:36 -06:00
Charles Kerr
878405f862
Revert "fix: sonarcloud ( #2558 )" ( #2562 )
...
This reverts commit 8b9483f7fb
.
2022-02-01 11:30:51 -06:00
Charles Kerr
8b9483f7fb
fix: sonarcloud ( #2558 )
...
* fix: add const modifier for functions
* fix: many sonarcloud use-init-statement warnings
2022-01-31 22:46:27 -06:00
Charles Kerr
df1cca9b57
chore: update copyright years, make notices consistent ( #2463 )
2022-01-20 12:27:56 -06:00
Charles Kerr
b0ee4007ff
refactor: include cleanups ( #2392 )
...
* refactor: include <memory> when using shared_ptr or unique_ptr
* refactor: include <cstdio> iff we use it
* refactor: include <cstring> iff we use it
* refactor: include <cstdlib> iff we use it
* refactor: include <string_view> or <string> iff we use it
* refactor: include <array> iff we use it
* refactor: include <ctime> iff we use it
* refactor: include <cctype> iff we use it
* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr
49f2823d6f
refactor: use std::string in tr_info ( #2384 )
2022-01-08 17:41:05 -06:00
Charles Kerr
f3228e9670
refactor: further decouple tr_torrent and tr_info ( #2336 )
2021-12-24 15:12:33 -06:00
Charles Kerr
b9406dfebb
refactor: even more torrent housekeeping ( #2323 )
2021-12-16 22:51:53 -06:00
Charles Kerr
42b1362760
refactor: tidy libtransmission includes ( #2316 )
2021-12-15 15:25:42 -06:00
Charles Kerr
1c848cf174
refactor: add tr_info accessors to tr_torrent ( #2314 )
...
* refactor: add tr_info accessors to tr_torrent
2021-12-15 09:53:20 -06:00
Charles Kerr
68518bc307
refactor: make some tr_torrentFoo() methods member functions ( #2312 )
2021-12-14 23:48:56 -06:00
Charles Kerr
c472cbd88d
refactor: only use [[maybe_unused]] if arg might be used ( #2033 )
...
* refactor: [[maybe_unused]] iff arg _might_ be used
If the arg is never used, comment out its name.
If the arg is _sometimes_ used e.g. with ifdefs, use [[maybe_unused]].
2021-10-24 11:41:54 -05:00
Charles Kerr
a127826d76
refactor: cppcoreguidelines-init-variables pt. 11 ( #2012 )
...
* refactor: uninit vars in bandwidth.cc
* refactor: uninit vars in cache.cc
* refactor: uninit vars in fdlimit.cc
* refactor: uninit vars in inout.cc
* refactor: uninit vars in platform.cc
* refactor: uninit vars in log.cc
* refactor: uninit vars in tr-utp.cc
* refactor: uninit vars in stats.cc
* refactor: uninit vars in trevent.cc
* refactor: uninit vars in session-id.cc
* fixup! refactor: uninit vars in cache.cc
* refactor: uninit vars in upnp.cc
* refactor: uninit vars in file.cc
* refactor: uninit vars in tr-lpd.cc
* refactor: uninit vars in tr-udp.cc
2021-10-23 10:43:15 -05:00
Charles Kerr
850b3caa61
refactor: prefer constexpr over enum for non enumerated constants ( #1996 )
...
refactor: prefer constexpr over enum for non-enumerated constants
2021-10-20 19:39:05 -05:00
Charles Kerr
f0171668c6
refactor: use C++ static_assert; remove TR_STATIC_ASERT ( #1959 )
2021-10-14 15:40:35 -05:00
Charles Kerr
fd5804fbb7
refactor: add readability-else-after-return to clang-tidy ( #1956 )
...
* refactor: add readability-else-after-return to clang-tidy
2021-10-14 14:26:38 -05:00
Charles Kerr
65a3a7d042
build: have clang-tidy check for NULL in libtransmission ( #1945 )
2021-10-13 18:12:51 -05:00
Charles Kerr
1fb5a79813
refactor: use maybe unused attribute ( #1918 )
...
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr
f876a100a0
refactor: add [[fallthrough]] annotation ( #1886 )
2021-10-06 12:24:02 -05:00