Commit Graph

6457 Commits

Author SHA1 Message Date
Charles Kerr
90402fd97b refactor: move StatsMode to tr::app (#8330)
* refactor: add StatsMode to libtransmission-app

* test: add display-mode unit tests

* feat: add apicompat for StatsMode

* refactor: use StatsMode in Qt client

* refactor: add template method for gtr_set_pref()

* refactor: use StatsMode in GTK client

* ci: use the all-tests alias instead of hardcoding tests

* ci: copy runtime DLLS into test output directory for Windows test binaries
2026-02-03 09:52:49 -06:00
Charles Kerr
64a53a8219 refactor: use sigslot (#8309)
* fix: warning: declaration shadows a variable in the global namespace [clang-diagnostic-shadow]

* fix: warning: use 'contains' to check for membership [readability-container-contains]

* fix: warning: variable gl_confdir can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

* warning: function 'TorrentFilter::match_mode' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]

* build: add sigslot dependency

* refactor: use sigslot for tr::Blocklists

* refactor: use sigslot for torrent, peer-mgr, wishlist

* refactor: remove tr::SimpleObservable

* chore: make lint happy

warning: method 'make_wishlist' can be made static [readability-convert-member-functions-to-static]

warning: invalid case style for function 'make_wishlist' [readability-identifier-naming]

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays]

* refactor: remove unused forward declaration of tr_peer

* chore: remove slop

* refactor: Blocklist::observe_changes() now returns a scoped connection

* build: use transmission/sigslot fork

* refactor: copyediting

* refactor: fix cyclical dependency loop between Wishlist and tr_peerMgr::WishlistMediator
2026-02-02 22:42:28 -06:00
Charles Kerr
2649e7acdd refactor: use std::filesystem for more file utils (#8296)
* fix: warning: declaration shadows a variable in the global namespace [clang-diagnostic-shadow]

* fix: warning: use 'contains' to check for membership [readability-container-contains]

* fix: warning: variable gl_confdir can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage]

* warning: function 'TorrentFilter::match_mode' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]

* refactor: use std::filesystem for tr_sys_path_is_same()

* refactor: use std::filesystem for tr_sys_path_exists()

* refactor: use std::filesystem for tr_sys_path_is_relative()

* refactor: use std::filesystem for tr_sys_path_get_info()

* refactor: use std::filesystem for tr_sys_dir_create()

* refactor: add `maybe_set_error()` helper

* refactor: change behavior to match previous impl

* fix: tr_sys_path_is_same() checks

refactor: address code review feedback

* refactor: address code review feedback

* chore: fix readability-else-after-return clang-tidy warning

* fix: warning: Value stored to 'created' during its initialization is never read [clang-analyzer-deadcode.DeadStores]

fix: warning: parameter 'permissions' is unused [misc-unused-parameters]

* ci: work around a MSVC STL 14.44.35207 clang-tidy false warning

* refactor: simplify return logic of tr_sys_path_is_same()
2026-02-01 15:37:37 -06:00
reardonia
c1e4221a75 introduce 3 priority levels to session event loop, set peer traffic t… (#7140)
* introduce 3 priority levels to session event loop, set peer traffic to lower priority than RPC events.

Co-authored-by: TR Reardon <reardonia@github.com>
2026-01-31 15:07:05 -06:00
Yat Ho
e38ace6b0f fix: -DENABLE_UTP=OFF FTBFS (#8301) 2026-01-31 12:53:58 -06:00
Yat Ho
28841f8d43 fix: periodically save queue position like other data files (#8299) 2026-01-31 07:39:06 -06:00
Yat Ho
7a070c2305 fix: update changed dates after setting torrent queue position (#8292)
* Revert "fix: put torrent in "recently active" set after changing queue position (#8290)"

This reverts commit c4283e0c8f.

* fix: update changed dates after setting torrent queue position
2026-01-30 13:05:05 -06:00
Yat Ho
3a8a4d9b86 refactor: wrap std::filesystem::space calls (#8284)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-01-30 11:18:04 -06:00
Yat Ho
c4283e0c8f fix: put torrent in "recently active" set after changing queue position (#8290) 2026-01-30 08:59:18 -06:00
Yat Ho
db08054522 refactor: remove XFS specific code to use more portable code (#8289) 2026-01-30 08:56:26 -06:00
Charles Kerr
a61bdc24da refactor: use std::filesystem for tr_sys_path_resolve() (#8282) 2026-01-30 08:55:37 -06:00
Yat Ho
63226411db build: improve building with system miniupnpc (#8190) 2026-01-29 15:29:52 -06:00
Yat Ho
19c52a3e61 fix: pass UTF-8 strings into std::filesystem::path (#8269)
* feat: temporary replacement for `std::filesystem::u8path()`

* fix: pass UTF-8 strings into `std::filesystem::path`
2026-01-29 08:43:50 -06:00
Charles Kerr
dd008ae1d0 refactor: C++ify tr_torrentStat() (#8257)
* refactor: callers now own the return value of tr_torrentStat()

fix one potential thread issue by simplifying ownership

* refactor: make tr_stat_errtype an enum class; move into tr_stat

* refactor: order tr_stat fields to reduce padding

* chore: fix branch shear

* fix: int-to-enum-class comparison

* fix: namespace regression

* chore: make clang-tidy happy
2026-01-29 08:07:11 -06:00
Yat Ho
7de2aadb41 refactor: simplify session-thread.h with std::bind_front (#8262)
* chore: housekeeping

* refactor: simplify `session-thread.h` with `std::bind_front`
2026-01-29 08:06:23 -06:00
Yat Ho
34bf2c5b21 refactor: remove tr_sys_path_get_capacity (#8249)
* refactor: remove `tr_sys_path_get_capacity`

* code review: remove unused definitions
2026-01-28 21:32:24 -06:00
Yat Ho
754b295d2a chore(core, tests): fix modernize-loop-convert (#8235)
* chore(core, tests): fix `modernize-loop-convert`

* ci: bump sanitizer-tests-ubuntu to 24.04

Get newer clang to fix FTBFS.
2026-01-28 18:53:40 -06:00
Charles Kerr
554cc56bdf refactor: rename our namespace to tr (#8256)
tr and tr::app are less cluttered than libtransmission:: and transmission::app
2026-01-28 18:11:34 -06:00
Yat Ho
ee1634ca47 refactor: shuffle peers before pumping (#8233)
* refactor: shuffle peers before pumping

* code review: use small vector
2026-01-28 18:11:19 -06:00
Charles Kerr
7559f7ffca refactor: C++ify tr_torrentPeers() (#8253)
* refactor: tr_torrentPeers() now returns a std::vector<tr_peer_stat>

* refactor: make tr_peer_stat.client a std::string_view

* refactor: make tr_peer_stat.flag_str a std::string

* refactor: make tr_peer_stat.addr a std::string

* refactor: rename tr_peer_stat field names to camel_case

* refactor: use Speed type for tr_peer_stat speed fields

* refactor: add default initializers to tr_peer_stat fields

* refactor: order tr_peer_stat fields to reduce padding

* fix: typo in [Torrent peers] getter

* refactor: make tr_peer_stat.user_agent a std::string

* refactor: pass by reference instead of by pointer in DetailsDialog

* fixup! refactor: add default initializers to tr_peer_stat fields
2026-01-28 15:16:12 -06:00
Yat Ho
63d6d670fd fix: some errors are not returned in tr_sys_path_get_capacity() (#8248)
* fix: some errors are not returned in `tr_sys_path_get_capacity()`

* test: disable well-formed free_space tests

There are no reliable way to test them.
2026-01-28 13:14:44 -06:00
Charles Kerr
4e1b092a17 refactor: use std::remove_cvref_t (#8240) 2026-01-27 20:14:47 -06:00
Charles Kerr
68e9049b17 refactor: tr_torrentRemove() now takes std::function args (#8229) 2026-01-27 14:37:11 -06:00
Yat Ho
cbc4e9dc3a refactor: mock udp announcer DNS resolver for tests (#8232)
* refactor: move udp tracker dns lookup to mediator

* test: mock udp announcer DNS resolver
2026-01-27 12:38:24 -06:00
Yat Ho
c738b9fe4d build: support building with system wide-integer (#8209) 2026-01-27 12:22:32 -06:00
Charles Kerr
78e733e7bd refactor: fix trivial modernize-use-ranges warnings (#8181) 2026-01-27 12:16:36 -06:00
Yat Ho
83e5e5842a refactor: remove tr-popcount.h (#8234) 2026-01-27 12:15:08 -06:00
Yat Ho
eeaa4d7412 chore(core): fix modernize-use-constraints (#8236) 2026-01-27 09:17:31 -06:00
Charles Kerr
c54dfd76fa refactor: make tr_web use std::chrono for deadline computation (#8224) 2026-01-26 19:14:13 -06:00
Yat Ho
316576cca1 refactor: remove TR_CONSTEXPR20 (#8228) 2026-01-26 14:36:04 -06:00
Yat Ho
bcac3bd461 build: support building with system small (#8208) 2026-01-26 10:01:51 -06:00
Yat Ho
2362afd113 refactor: remove tr_isDirection() (#8213) 2026-01-26 10:00:02 -06:00
Charles Kerr
dda5dc7ec3 refactor: remove some dead code (#8222)
* chore: remove unused tr_announcerCreate() declaration

added in d27c4c5 but never used

* chore: remove unused ParserStack::parentType()

added in 5efec26 but never used

* chore: remove tr_port::set_network()

added in 32f854a but never used

* chore: remove tr_torrent_metainfo::pieces_offset()

added in 52f6e80 but never used

* chore: remove unused `tr_session::setPeerCongestionAlgorithm()`

unused after 611d36a

chore: remove unused `tr_session::setAnnounceIP()`

unused after 611d36a
2026-01-26 07:22:20 -06:00
Charles Kerr
a7b2a72cca refactor: remove tr_pathbuf::popdir() (#8221) 2026-01-25 20:02:59 -06:00
Charles Kerr
03fdb6f48e refactor: migrate C strings to std::string_view in libtransmission/file.h (#8220)
* refactor: tr_sys_file_open() now takes a std::string_view arg

* refactor: tr_sys_path_copy() now takes a std::string_view arg

* refactor: tr_blocklistSetContent() now takes a std::string_view arg

* refactor: tr_sys_path_remove() now takes a std::string_view arg

* refactor: tr_sys_path_exists() now takes a std::string_view arg

* refactor: tr_sys_dir_create() now takes a std::string_view arg

* refactor: add private stat_sv(), lstat_sv() helpers in file-posix.cc

* refactor: tr_sys_path_is_same() now takes a std::string_view arg

* refactor: tr_sys_path_rename() now takes a std::string_view arg
2026-01-25 18:39:50 -06:00
Yat Ho
3636f5f35e fix: modernize-use-designated-initializers in core and tests (#8186)
* fix(core): `modernize-use-designated-initializers`

* fix(tests): `modernize-use-designated-initializers`
2026-01-23 21:50:08 -06:00
Yat Ho
b617dea8ad build: improve building with system libdeflate (#8188) 2026-01-23 11:05:03 -06:00
Yat Ho
665f689e44 build: support building with system {fmt} (#8187) 2026-01-23 11:04:16 -06:00
Charles Kerr
cccef8e2a6 refactor: use fewer raw C strings (#8202)
* refactor: tr_ctorGetDownloadDir() returns a std::optional<std::string>

* refactor: tr_sessionGetConfigDir() now returns a std::string

* refactor: tr_sessionGetDownloadDir() now returns a std::string

* refactor: tr_sessionGetIncompleteDir() now returns a std::string

* refactor: tr_sessionGetRPCWhitelist() now returns a std::string

* refactor: tr_sessionGetRPCPassword() now returns a std::string

* refactor: tr_sessionGetRPCUsername() now returns a std::string

* refactor: tr_sessionGetScript() now returns a std::string

* refactor: tr_blocklistGetURL() now returns a std::string

* refactor: tr_ctorGetSourceFile() now returns a std::optional<std::string>

* refactor: tr_torrentFile() now returns a std::string
2026-01-22 22:36:24 -06:00
Charles Kerr
e7129cfd54 refactor: use fewer raw C strings (#8201)
* refactor: tr_blocklistSetURL() takes a string_view

* refactor: tr_ctorSetMetainfoFromFile() takes a string_view

* refactor: tr_ctorSetMetainfoFromMagnetLink() takes a string_view

* refactor: tr_torrentSetDownloadDir() takes a string_view

* refactor: tr_ctorSetDownloadDir() takes a string_view

* refactor: tr_ctorSetIncompleteDir() takes a string_view

* refactor: tr_torrentSetTrackerList() takes a string_view

* refactor: tr_torrentRenamePath() now takes a std::string_view

* refactor: tr_torrentFindFromMagnetLink() takes a string_view
2026-01-22 16:31:08 -06:00
Charles Kerr
f6e9027da7 refactor: use fewer raw C strings (#8200)
* refactor: tr_sessionSaveSettings() takes a string_view

* refactor: tr_sessionSetDownloadDir() takes a string_view

* refactor: tr_sessionSetIncompleteDir() takes a string_view

* refactor: tr_sessionSetRPCCWhitelist() takes a string_view

* refactor: tr_sessionSetRPCPassword() takes a string_view

* refactor: tr_sessionSetRPCUsername() takes a string_view

* refactor: tr_sessionSetDefaultTrackers() takes a string_view

* refactor: tr_sessionSetScript() takes a string_view
2026-01-22 14:38:20 -06:00
Charles Kerr
46005038e6 refactor: tr_torrentGetCurrentDir() returns a std::string_view (#8173)
* refactor: gtr_open_file() now takes a std::string_view

refactor: gtr_open_file() now calls Glib::filename_to_uri()

refactor: add gtr_open_file() variant that takes basedir and relative path

refactor: gtr_open_uri() now takes a relative_path std::string_view

* refactor: tr_torrentGetCurrentDir() now returns a std::string_view

refactor: tr_torrentGetDownloadDir() now returns a std::string_view
2026-01-21 11:40:16 -06:00
Charles Kerr
7f5730984a refactor: add tr_strv_to_utf8_nsstring() (#8174)
* refactor: rename enum types in ip-cache private enum class is_updating_t

this avoids name collisions with YES and NO on macOS

* refactor: rename tr_strv_convert_utf8() to tr_strv_to_utf8_string()

use a name that is symmetrical with the upcoming tr_strv_to_utf8_nsstring()

* feat: add tr_strv_to_utf8_nsstring()

* test: add tests for the new tr_strv_to_utf8_nsstring() methods
2026-01-21 08:25:07 -06:00
Charles Kerr
62be679769 refactor: remove tr_session* argument from tr_rpc_response_func (#8160) 2026-01-20 19:44:06 -06:00
Yat Ho
cbc5388440 build: bump to C++20 (#7191)
* build: bump to C++20

Co-authored-by: Cœur <coeur@gmx.fr>

* refactor: use designated initializers

* refactor: remove redundant SFINAE

* fix: clang-tidy warnings

* chore: comments about min compiler versions for C++20 features

* build: clang objc++ modules build errors

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* refactor: add `TR_CONSTEXPR_VEC` and `TR_CONSTEXPR_STR`

* fix: don't use `std::rel_ops`

* chore: housekeeping

* fix: possible fix for macOS linker error

---------

Co-authored-by: Cœur <coeur@gmx.fr>
Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-01-20 16:27:34 -06:00
Yat Ho
a3202cbe47 fix: incorrectly set error when moving across filesystems (#8167) 2026-01-20 11:16:47 -06:00
Charles Kerr
49f6f20361 refactor: remove unused libtransmission api (#8169)
* refactor: remove tr_getDefaultConfigDirToBuf()

* refactor: remove tr_torrentFindFileToBuf()

* refactor: remove tr_torrentGetMagnetLinkToBuf()

* refactor: remove tr_getDefaultDownloadDirToBuf()

* refactor: remove tr_torrentGetTrackerListToBuf()

* refactor: remove tr_torrentFilenameToBuf()

* refactor: remove tr_strv_to_buf()
2026-01-19 17:35:12 -06:00
Yat Ho
4e03de7630 fix: use weak pointers for ip cache curl callback (#8157) 2026-01-16 17:11:03 -06:00
Charles Kerr
cfe9736a6e fix: potential use-after-free of NSString in tr_strv_convert_utf8() (#8131)
* fix: potential use-after-free bug when parsing torrent metainfo on macOS

* build: add -Warc-unsafe-retained-assign warning to detect any future ARC issues
2026-01-15 15:57:05 -06:00
Yat Ho
d83bb3bf45 chore: remove outdated comment in tr_num_parse (#8140) 2026-01-15 14:48:15 -06:00