Commit Graph

16620 Commits

Author SHA1 Message Date
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
Yat Ho
f319bc6bf6 ci: update and test more Debian versions (#8153) 2026-01-22 09:06:41 -06:00
Yat Ho
16ec031a28 build: infrastructure for third party submodules (#8178) 2026-01-21 23:38:34 -06:00
Charles Kerr
87511c7123 test: add Session tests (#8185)
* build: disable some clang-tidy checks

we cannot use ranges while still supporting gcc 8

* refactor: add Prefs::keyval()

refactor: remove Prefs::getKey()

test: add Prefs::keyval() tests

* refactor: add Prefs::set(idx, tr_variant)

refactor: remove Prefs::type(idx)

refactor: remove Prefs::variant(idx)

* refactor: create RpcClient in main()

* test: add qt remote session tests
2026-01-21 22:36:41 -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
Yat Ho
35599a2d14 ci: bump to peter-evans/create-pull-request@v8 (#8177) 2026-01-21 11:06:54 -06:00
Yat Ho
6327cc6c2e build: add USE_SYSTEM_DEFAULT option (#8176)
* build: add `USE_SYSTEM_DEFAULT` option

* ci: use `USE_SYSTEM_DEFAULT`
2026-01-21 09:08:04 -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
83d49b3c7f ci: add run-tests composite action (#8159)
* ci: add run-tests composite action

* fixup! ci: add run-tests composite action

send sanitizer log messages to stderr

otherwise, they will break transmission-show tests

* fixup! ci: add run-tests composite action

fix windows, alpine breakage

* fixup! ci: add run-tests composite action

fix: sanitizer logging to stderr

* fixup! ci: add run-tests composite action

disable asan leak detection on macOS: the feature is unsupported there

* fixup! refactor: extract platform detection into its own composite action (#8158)

ensure bash is installed on alpine linux
2026-01-21 08:24:46 -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
Yat Ho
7de5795cde ci: only setup nodejs if make-web == true (#8171) 2026-01-20 11:12:41 -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
f6d4585b38 fix(remote): crash when number argument is invalid (#8156)
* fix: crash when `--global-seedratio` argument is invalid

* fix: crash when `--global-idle-seeding-limit` argument is invalid

* fix: crash when `--peers` argument is invalid

* fix: crash when `--tracker-remove` argument is invalid

* fix: crash when `--seedratio` argument is invalid

* fix: crash when `--idle-seeding-limit` argument is invalid
2026-01-16 17:56:02 -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
6248b9d303 refactor: extract platform detection into its own composite action (#8158) 2026-01-16 12:59:30 -06:00
Charles Kerr
36ea62cf6e ci: add install-deps composite action (#8152) 2026-01-16 10:10:00 -06:00
Charles Kerr
f200bedd57 fix: crash on invalid command-line value for --cache / -e arg (#8147)
* fix: crash on invalid command-line value for --cache arg

* Update utils/remote.cc

Co-authored-by: Yat Ho <lagoho7@gmail.com>

---------

Co-authored-by: Yat Ho <lagoho7@gmail.com>
2026-01-16 02:45:49 -06:00
Yat Ho
5f16036459 ci: update and test more Fedora versions (#8151) 2026-01-16 00:28:12 -06:00
Yat Ho
66a7dcff2e ci: use cmake --install (#8149) 2026-01-15 22:49:00 -06:00
Yat Ho
c0c3700ec2 ci: remove redundant QT_QPA_PLATFORM definitions (#8150) 2026-01-15 22:15:44 -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
Charles Kerr
a8f531b572 fix: remove unused tr_strbuf::join() (#8144) 2026-01-15 14:37:22 -06:00
Yat Ho
6ba8ec7e6f ci: bump actions and deps (#8141)
* ci: bump to `actions/checkout@v6`

* ci: bump to `actions/setup-node@v6`

* ci: bump to `actions/upload-artifact@v6`

* ci: bump to `actions/download-artifact@v7`

* ci: bump to `actions/cache@v5`

* ci: bump to `actions/setup-java@v5`

* ci: use gradle 8.13

* ci: bump to vcpkg `389d14fa0e0692f36967e9eb5499e909317644d5`

* ci: bump to `github/codeql-action@v4`

* ci: bump to ndk 27.3.13750724

* fix: define android namespace

* ci: don't pin ubuntu runner version for non-native builds
2026-01-15 14:15:47 -06:00
Yat Ho
1825a7fe46 chore: bump wide-integer (#8128) 2026-01-14 17:04:17 -06:00
Charles Kerr
677e0a6335 test: add tests for RpcClient (#8137)
* refactor do not cache style in convert_outgoing_data() -- not testing-friendly

* refactor: pass a QNetworkAccessManager into RpcClient constructor

this way we can inject a fake one in tests

* refactor: add RpcClient tests

* refactor: remove pointless QVERIFY call

* refactor: add api_compat::default_style()

* refactor: add api_compat::set_default_style()

* test: parameterize RpcClient tests for Tr4 and Tr5
2026-01-14 13:52:10 -06:00
Charles Kerr
0eb9032bee fix: typo in User-Agent from requests posted by trqt (#8135) 2026-01-14 12:29:52 -06:00
Yat Ho
5bf94ba45c chore: bump small (#8129) 2026-01-14 08:49:57 -06:00
Charles Kerr
140958a8a1 refactor: no macros in transmission.h (#8099)
* refactor: replace TR_RPC_SESSION_ID_HEADER macro with TrRpcSessionIdHeader constant

refactor: replace TR_RPC_RPC_VERSION_HEADER macro with TrRpcVersionHeader constant

* refactor: remove macro TR_DEFAULT_RPC_PORT_STR

* refactor: remove macro TR_DEFAULT_PEER_PORT_STR

* refactor: remove macro TR_DEFAULT_PEER_LIMIT_GLOBAL_STR

* refactor: remove macro TR_DEFAULT_PEER_LIMIT_TORRENT_STR

* refactor: remove macro TR_DEFAULT_PEER_SOCKET_TOS_STR

* refactor: replace DEFAULT_BLOCKLIST_FILENAME macro with TrDefaultBlocklistFilename constant

* refactor: rename TrHttpServerDefaultBasePath to TrDefaultHttpServerBasePath for consistency with other defaults

* refactor: group constants together near the top of transmission.h

* refactor: hardcode string lengths to avoid FTBFS on older C++17 compilers

* refactor: move macros to the tr_getopt clients

* refactor: explicitly specify the parameter index to avoid passing in TrRpcSessionIdHeader twice

* refactor: add an error message to new static_asserts
2026-01-14 07:52:57 -06:00
Charles Kerr
70bc3eec48 perf: faster tests (#8113)
* refactor: make libcurl thread shutdown faster during tests

* docs: fix out-of-date code comment in web.h

* refactor: tr_sessionClose() now takes fractions of seconds for deadline

refactor: make tr_web::startShutdown() deadline dependent on the tr_sessionClose() deadline arg

* test: set tr_sessionClose() deadline of 0.5 secs

* refactor: FileTest now inherits from SandboxedTest

* fixup! test: set tr_sessionClose() deadline of 0.5 secs
2026-01-13 19:08:25 -06:00
Yat Ho
8b8bfed2e8 chore: remove <charconv> workaround for older GCC (#8119) 2026-01-13 19:08:05 -06:00
Yat Ho
3df2b2fb14 refactor: implement tr_strv_sep() as a wrapper of find_first_of() (#8117)
* refactor: implement `tr_strv_sep()` as a wrapper of `find_first_of()`

* test: `tr_strv_sep` other overloads
2026-01-13 17:05:22 -06:00
Yat Ho
7a8d29b0a6 refactor: log blocklist line that failed to parse (#8118) 2026-01-13 15:03:04 -06:00
Yat Ho
4f7b932fee build: correctly set MSVC __cplusplus (#8120)
* build: correctly set MSVC `__cplusplus`

* refactor: let utf8cpp infer `UTF_CPP_CPLUSPLUS`
2026-01-13 15:02:50 -06:00
Charles Kerr
8dea0e863f fix: several CI errors (#8124)
* Revert "build(cmake): support building with (almost) all system 3rd-party libraries (#7554)"

This reverts commit a89ca4f2c9.

* fixup! refactor: use a map of getters, setters for `session_get` and `session_set` properties (#8024)

fix: capture-by-reference error in session_accessors()

* fix: 'Qt depends on a UTF-8 locale' CI warning

* fix: 'qt.qpa.xcb: could not connect to display' CI error
2026-01-13 13:16:40 -06:00
Charles Kerr
6f32b8d5dd refactor: move display types to UserMetaType.h (#8116) 2026-01-12 20:07:55 -06:00
Charles Kerr
4a05c06ce0 perf: add batch variant of tr_torrentStat() (#8100)
* refactor: add [Torrent updateTorrents]

refactor: use updateTorrents in Controller

* refactor: add a batch variant of tr_torrentStat()

* refactor: use batch variant of tr_torrentStat() in GTK details dialog

* refactor: use batch variant of tr_torrentStat() in gtr_confirm_remove()

* refactor: use batch variant of tr_torrentStat() in updateTorrents

* refactor: add Session::find_torrents()

* refactor: remove the raw ptr variant of updateTorrents()

* refactor: remove tr_sessionLock()

* fixup! refactor: add [Torrent updateTorrents]

remove duplicate method declaration

* fix: readability-avoid-const-params-in-decls

* fix: iwyu in transmission.h

* chore: remove an #include that was added in a draft that did not get used

* refactor: use nullptr instead of NULL
2026-01-12 16:23:06 -06:00
Yat Ho
a89ca4f2c9 build(cmake): support building with (almost) all system 3rd-party libraries (#7554)
* build: overhaul tr_add_external_auto_library

* build: use package-provided CMake config file libevent

* build: use package-provided CMake config file miniupnpc

* build: update libutp find module

* build: make LIBNAME an optional parameter

* build: use package-provided CMake config file libdeflate

* build: update libb64 find module

* build: update libnatpmp find module

* build: update libpsl find module

* build: support system fast_float library

* chore: reformat long brew commands

* build: support system fmt library

* build: support system rapidjson library

* build: support system small library

* build: support system library utf8cpp

* build: support system library WideInteger

* build: support system library gtest

* fix: incorrectly labeled test suites

* build: remove unused parameters from tr_add_external_auto_library

* build: update crc32c cmake script

* fix: dht system library

* fix: add libutp interface target

* code review: move TrGtest.cmake

* code review: move tr_get_fmt_version into Findfmt.cmake

* code review: use option() for gtest

* code review: move find_package(PkgConfig) out of loop

* build: delete FindCrc32c.cmake

Impossible to parse package version from distributed source files.

* code review: Finddht.cmake

* build: delete FindFastFloat.cmake

Impossible to parse package version from distributed source files.

* code review: Findfmt.cmake

* code review: Findlibb64.cmake

* code review: Findlibdeflate.cmake

* code review: Findlibevent.cmake

* code review: Findlibnatpmp.cmake

* code review: Findlibpsl.cmake

* code review: Findlibutp.cmake

* code review: Findlibminiupnpc.cmake

* code review: FindRapidJSON.cmake

* build: delete FindSmall.cmake

Impossible to parse package version from distributed source files.

* build: only accept cmake config package for utf8cpp

Impossible to parse package version from distributed source files.

* build: delete FindWideInteger.cmake

Impossible to parse package version from distributed source files.

* build: add `USE_SYSTEM_DEFAULT`

* ci: drop Fedora 40 and adopt Fedora 43

* ci: try to silence system header warnings

* ci: use `cmake --install`

* Revert "build: only accept cmake config package for utf8cpp"

This reverts commit 2158d631fd.

* build: harden utf8cpp find module

* chore: bump wide-integer

Pick up bf9398f9da and bcc726a30f

* refactor: gtest should be included with angled brackets

Now that gtest is built as a system library, it should be included with angled brackets instead of quotes.

* code review: fixup libutp variables before `find_package_handle_standard_args`

* code review: define `WIDE_INTEGER_HAS_LIMB_TYPE_UINT64` only for targets depending on WideInteger

* chore: bump wide-integer

Pickup 4b2258acac so that wide-integer tests won't run in Transmission project.
2026-01-12 09:04:47 -06:00
Charles Kerr
d177f9f903 test: add unit tests for Prefs (#8112)
* fix: hicpp-use-auto,modernize-use-auto

* refactor: make Prefs::getKey() a static method

refactor: make Prefs::isCore() a static method

refactor: make Prefs::type() a static method

* refactor: Application takes a Prefs& arg, not a std::unique_ptr<Prefs> arg

* fix: bugprone-exception-escape

save settings by calling prefs.save() from main()

* refactor: load settings by calling prefs.load() from main()

* refactor: use preferred declaration order in Prefs

* fixup! fix: bugprone-exception-escape

* refactor: add Prefs::current_values()

* refactor: clean up namespace use in Prefs.cc

* feat: add QString, QDateTime serializers

* test: add scaffolding for testing Qt code

test: add tests for Prefs

* refactor: remove unused #includes

* build: add clang-tidy rules to tests/qt/

* refactor: clean up the new test code a little

* chore: add missing copyright statement

* ci: ensure Qt6Test is installed

build: check for QTest when ENABLE_TESTS + ENABLE_QT are ON

* fixup! feat: add QString, QDateTime serializers

* fix: Wswitch warning

* build: do not disable tests in release/windows/build-qt5.psl, build-qt6.psl

* ci: set QT_QPA_PLATFORM for running new Qt tests

* test: build cleanly in Qt 5.15

* fixup! fixup! feat: add QString, QDateTime serializers

fix QDateTime serializer on macOS

* fixup! ci: set QT_QPA_PLATFORM for running new Qt tests

install xcb-util-cursor on alpine
2026-01-11 19:23:00 -06:00
Yat Ho
cf0a596a45 fix: url port parsing (#8109)
* fix: url port parsing

- `tr_urlParse()` should fail if cannot parse port
- Avoid parsing scheme ports to numbers
- Port should not be parsed to a negative number
- Port should not be parsed to `0`
- Directly parse number string to `uint16_t`

* test: invalid port
2026-01-11 11:43:12 -06:00
Charles Kerr
4c60472aae refactor: add helpers to avoid code duplication (#8101)
* refactor: add helpers to avoid code duplication

* refactor: remove unused default_value arg
2026-01-10 08:25:36 -06:00
Yat Ho
721a3dd0e3 fix: bufferevent_read never returns -1 (#8107) 2026-01-10 06:59:48 -06:00
Charles Kerr
781bb3f3d4 fix: 4.1.0-beta.5 regression using trqt as a remote (#8103) 2026-01-09 23:11:27 -06:00
Yat Ho
0de550663d fix: rebind udp sockets on bind-address change (#8096) 2026-01-09 16:16:36 -06:00
Yat Ho
f2d2edbdb9 refactor: use new tr_variant API in peer-msgs.cc (#8091)
* refactor: convert `tr_peerMsgsImpl::parse_ut_pex()`

* refactor: convert `tr_peerMsgsImpl::send_ltep_handshake()`

* refactor: convert `tr_peerMsgsImpl::parse_ltep_handshake()`

* refactor: convert `tr_peerMsgsImpl::parse_ut_metadata()`

* refactor: convert `tr_peerMsgsImpl::maybe_send_metadata_requests()`

* refactor: convert `tr_peerMsgsImpl::add_next_metadata_piece()`
2026-01-09 15:58:20 -06:00
Charles Kerr
47832db7b2 refactor: move tr_diffserv_t::Names into serializer (#8088)
* refactor: move tr_diffserv_t::Names into serializer

* Update libtransmission/serializer.cc
2026-01-09 14:39:54 -06:00
Yat Ho
cf3799fb42 build: change cppcoreguidelines-* to opt-out (#8097)
* build: change `cppcoreguidelines-*` to opt-out

* fix: `cppcoreguidelines-rvalue-reference-param-not-moved`

* chore: add todo for `cppcoreguidelines-pro-bounds-pointer-arithmetic`

* fix: `cppcoreguidelines-missing-std-forward`
2026-01-09 13:39:34 -06:00