Charles Kerr
b889f0c395
chore: iwyu cstring, cstdlib, optional, unordered_set ( #3532 )
2022-07-27 16:53:39 -05:00
Charles Kerr
445aad56a0
test: add platform tests ( #3514 )
...
* test: add tr_getDefaultDownloadDir() tests
this also indirectly tests xdg and homedir
* test: add PlatformTest.defaultConfigDirEnv
* test: add PlatformTest.defaultConfigDirXdgConfig
test: add PlatformTest.defaultConfigDirXdgConfigHome
* test: add PlatformTest.webClientDirEnvClutch
test: add PlatformTest.webClientDirEnvTr
test: add PlatformTest.webClientDirXdgDataHome
* fixup! test: add PlatformTest.webClientDirEnvClutch
fix: win32 breakage
2022-07-22 20:10:02 -05:00
Charles Kerr
c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs ( #3118 )
...
* refactor: add sv-friendly tr_sys_dir_create() variant
* refactor: add sv-friendly tr_sys_path_get_info() variant
* refactor: add sv-friendly tr_sys_path_exists() variant
* refactor: add sv-friendly tr_sys_path_remove() variant
* refactor: add sv-friendly tr_sys_path_rename() variant
* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
Charles Kerr
392e511f7e
refactor: remove tr_snprintf() pt 1 ( #2867 )
...
* refactor use fmt instead of tr_snprintf in remote.cc
* refactor use fmt instead of tr_snprintf in daemon.cc
* refactor use fmt instead of tr_snprintf in cli.cc
2022-04-02 14:34:29 -05:00
Charles Kerr
a250690f30
fix: sonarcloud ( #2860 )
...
* fix: break will never be executed
* fix: rewrite rimraf() to be non-throwing
* fix: conditional operation returns same value whether condition is true or false
* fix: use std::array instead of a C-style array
* fix: remove redundant access specifier
* fix: replace switch with if for readability
* fix: convert integer literal to a bool literal
* fix: replace const std::string reference to std::string_view
* fix: remove redundant access specifier
* fix: replace const std::string reference to std::string_view
* fix: remove unused parameter
* fix: remove redundant access specifier
* fix: use std::array instead of C-style array
* fix: remove redundant access specifier
* fix: replace const std::string reference with std::string_view
* fix: remove redundant access specifier
* fix: use std::array instead of C-style array
* fix: remove redundant access specifier
* fix: replace const std::string reference to std::string_view
* fix: remove redundant access specifier
* fix: merge if statement with enclosing one
* chore: clang-format
* chore: clang-format
* Revert "fix: remove redundant access specifier"
This reverts commit 054e4e7eec
.
* Revert "fix: remove redundant access specifier"
This reverts commit 2c92f227e8
.
* Revert "fix: remove redundant access specifier"
This reverts commit a0710202a8
.
* Revert "fix: remove redundant access specifier"
This reverts commit 54da1d9397
.
* Revert "fix: remove redundant access specifier"
This reverts commit f7b1777578
.
* Revert "fix: remove redundant access specifier"
This reverts commit ad8e3dfff4
.
* chore: revert access specifier change
2022-04-01 14:16:33 -05:00
Charles Kerr
71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs ( #2827 )
2022-03-27 12:37:29 -05:00
Charles Kerr
29af76d977
refactor: tr_web ( #2640 )
...
* fixup! refactor: tr_web (#2633 )
fix: race condition in web threadfunc during bootstrap
fixes #2639
2022-02-17 17:35:57 -06:00
Charles Kerr
f1a53840f9
refactor: tr_web ( #2633 )
...
* refactor: fix tr_web rate limiting and dns caching
2022-02-16 12:33:50 -06:00
Charles Kerr
a822a46e47
refactor: add fetch options object to tr_webRun() ( #2620 )
...
* refactor: add fetch options object to tr_webRun()
Fold `tr_webRun()`, `tr_webRunWithCookies()`, and `tr_webRunWebseed()`
into a single API that takes an options argument that callers can
customize to their needs.
Also does a surface cleanup pass to the tr_webseed and tr_web internal
structures, e.g. making fields const where possible, not using raw
pointers, and making some fields private.
This revision is still full of code smells. Refactoring the entire
system is overwhelming, so instead I'm doing it in incremental steps.
2022-02-13 20:09:56 -06:00
Charles Kerr
96178b1a9f
feat: add support for adding torrents by raw hash values ( #2608 )
...
* Add support for adding torrents by raw hash values
Co-authored-by: vjunk <vjunk@mail.ru>
2022-02-12 22:16:55 -06:00
Charles Kerr
6383e2ff5f
feat: support dscp classes in socket iptos ( #2594 )
...
* refactor: Replace ToS with DSCP
IP TOS was superseded by DSCP in RFC 2474.
Co-authored-by: dgcampea <dgcampea@outlook.com>
2022-02-10 15:35:28 -06:00
Charles Kerr
7bdb6f777b
refactor: remove callback from tr_torrentVerify() public API ( #2592 )
2022-02-09 12:02:59 -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
Mike Gelfand
d8d361e491
Make some utility functions return std::string to simplify code ( #2368 )
...
* tr_formatter_speed_KBps returns std::string
* tr_formatter_mem_B returns std::string
* tr_formatter_size_B returns std::string
* tr_strpercent/tr_strratio returns std::string
2021-12-31 03:30:21 +03:00
Charles Kerr
884135d853
fix: sonarcloud ( #2356 )
...
* refactor: replace #define with constexpr in some utils
* fix: use-std-string-instead-of-c-array sonarcloud warning
* fix: use init-statement sonarcloud warning
* fix: explain-empty-function sonarcloud warning
* fix: move #include directive to top sonarcloud warning
* fix: replace-void-ptr-arg-with-more-meaningful-type sonarcloud warning
* fix: replace-redundant-type-with-auto warning
* fix: use-init-statement sonarcloud warning
* fix: make type a pointer-to-const sonarcloud warning
* fix: cli tyop
* fix: replace-redundant-type-with-auto warning
* fix: use-init-statement sonarcloud warning
* fix: replace-redundant-type-with-auto warning
* fix: use-init-statement sonarcloud warning
* fix: replace-redundant-type-with-auto warning
* fix: make type a pointer-to-const sonarcloud warning
* fix: make type a pointer-to-const sonarcloud warning
* fix: replace-redundant-type-with-auto warning
* refactor: replace #define with constexpr in rpcimpl
2021-12-28 11:23:47 -06:00
Charles Kerr
a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor ( #2345 )
2021-12-26 10:25:07 -06:00
Charles Kerr
b058daff4b
refactor: change tr_torrentNew() args ( #2337 )
2021-12-24 16:05:17 -06:00
Charles Kerr
7ca0b4cc25
fix: sonarcloud ( #2327 )
2021-12-17 14:48:02 -06:00
Charles Kerr
c656bee061
refactor: add tr_saveFile() ( #2267 )
...
* refactor: add tr_saveFile()
* refactor: add tr_ctorSaveContents()
2021-12-04 19:32:35 -06:00
Charles Kerr
f14e741052
fix: some sonarcloud warnings ( #2189 )
...
* fix: pass-large-object-by-reference-to-const warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0Gz8ze7dx8i2lkKEvq\&open\=AX0Gz8ze7dx8i2lkKEvq
* fix: use-std-array-instead-of-C-array warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5B-\&open\=AX0L8qcgUnpKTxYiu5B-
* fix: extract-assignment-from-expression
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CH\&open\=AX0L8qcgUnpKTxYiu5CH
* fix: move-include-directives-to-top
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qlYUnpKTxYiu5CQ\&open\=AX0L8qlYUnpKTxYiu5CQ
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0L8qcgUnpKTxYiu5CK\&open\=AX0L8qcgUnpKTxYiu5CK
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh
* fix: ensure-move-constructor-is-noexcept
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlWzwxvzFbF6whWU\&open\=AX0WPlWzwxvzFbF6whWU
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP20jI_aUyxGBxCD\&open\=AX0bZP20jI_aUyxGBxCD
* fix: replace-redundant-type-with-auto
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP0rjI_aUyxGBxCB\&open\=AX0bZP0rjI_aUyxGBxCB
* fix: make-parameter-const
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQqqPDVGqE4PY-io\&open\=AX0gkQqqPDVGqE4PY-io
* fix: use-init-statement
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rARJbfJ-O-YIDS9xM\&open\=AX0rARJbfJ-O-YIDS9xM
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0WPlmBwxvzFbF6whWh\&open\=AX0WPlmBwxvzFbF6whWh
* fix: explicitly-delete-copy-ctor
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0gkQr6PDVGqE4PY-i4\&open\=AX0gkQr6PDVGqE4PY-i4
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0bZP9wjI_aUyxGBxCF\&open\=AX0bZP9wjI_aUyxGBxCF
2021-11-17 18:17:09 -06:00
Charles Kerr
0fba476917
refactor: fix a -Wshadow warning for a variable named optarg ( #2184 )
2021-11-16 12:31:29 -06:00
Charles Kerr
73edd7b642
refactor: remove tr_variantDictFindStr() ( #2180 )
...
* refactor: remove tr_variantDictFindStr
2021-11-15 23:20:06 -06:00
Charles Kerr
cef3f43088
refactor: tr_web's callback now uses std::string_view ( #2172 )
...
* refactor: tr_web tasks now use a std::string_view argument
2021-11-15 12:10:18 -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
1fb5a79813
refactor: use maybe unused attribute ( #1918 )
...
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr
003685b40a
refactor: use nullptr instead of NULL ( #1884 )
...
* refactor: use nullptr instead of NULL.
No functional changes; just more C++ification
2021-10-06 11:32:17 -05:00
Charles Kerr
6c77fa92ce
Port transmission-cli to C++ ( #1831 )
...
* move transmission-cli to C++
2021-09-24 09:38:09 -05:00