Charles Kerr
e4461c48d7
refactor: prefer FMT_STRING ( #2845 )
...
* use FMT_STRING in libtr client on non-i18n strings
This gives compile-time safety checks.
2022-03-30 14:59:13 -05:00
Charles Kerr
2996e223dd
refactor: strbuf for metainfo files ( #2833 )
...
* refactor: tr_ctorSaveContents takes a string_view filename
* refactor: remove tr_ctorSaveMagnetContents
* refactor: announce_list::save takes a std::string_view
* refactor: magnet() takes an OutputIt arg
Generate the magnet link URL into an output iterator
* refactor: remove deprecated calls to tr_http_escape
* refactor: tr_torrent.torrentFile takes an OutputIterator
* refactor: tr_torrent.torrentFile returns a tr_pathbuf
* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf
* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr
6cb0498486
fix: log unexpected announce/scrape keys ( #2778 )
...
Fixes #2765 .
2022-03-17 19:31:24 -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
a942c67199
refactor: use fmt ( #2758 )
...
* deps: use fmt (8.1.1 tag) to build log strings
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05:00
Charles Kerr
d2f8e1d4e0
refactor: set logging levels ( #2755 )
2022-03-11 15:09:22 -06:00
Charles Kerr
af339a15ed
refactor: remove deep logging ( #2749 )
...
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr
cdd819772d
feat: tr_runInEventThread() now takes std::function, typesafe args ( #2739 )
2022-03-04 20:26:03 -08:00
Charles Kerr
9c3acc7e8a
fixup: handle unhandled scrape/announce responses ( #2701 )
...
followup to the #2531 benc refactor
2022-02-24 07:59:58 -06: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
ebb2ab6aee
chore: update license spdx abbreviations ( #2582 )
...
Use SPDX license list 3.0 terminology: replace deprecated identifiers
GPL-2.0" and "GPL-3.0" with "GPL-3.0-only" and "GPL-3.0-only".
2022-02-07 10:25:02 -06: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
e908193027
fix: some use-init-statement sonarcloud warnings ( #2563 )
2022-02-01 19:09:11 -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
314aa6925d
fix: sonarcloud use-init-statement warnings in new code ( #2536 )
2022-01-29 16:26:09 -06:00
Charles Kerr
9e264250d1
refactor: add benc::Handler::Context ( #2531 )
...
Prerequisite for using the new benc parser in tr_torrent_metainfo:
That code needs to know the span of the bencoded info dict.
2022-01-28 16:46:14 -06:00
Charles Kerr
7f60738cce
refactor: use the new benc parser in announcer-http ( #2529 )
2022-01-28 12:39:45 -06:00
Charles Kerr
3c5442dd7b
test: add tests for parsing http tracker scrape responses ( #2527 )
2022-01-27 17:18:50 -06:00
Charles Kerr
064ad6a436
refactor: saxlike benc pt. 2: add announce response parsing tests ( #2505 )
2022-01-24 22:25:55 -06:00
Charles Kerr
26bb9f3440
fix: sonarcloud code smells ( #2486 )
2022-01-23 18:53:35 -06:00
Charles Kerr
b45c831bcb
refactor: use C++ objects in announcer ( #2474 )
2022-01-22 23:41:01 -06:00
vuori
a89b98f9e5
Fixed wrong ipv6 addr used in announces. ( #265 )
2022-01-20 15:28:04 -06:00
Charles Kerr
df1cca9b57
chore: update copyright years, make notices consistent ( #2463 )
2022-01-20 12:27:56 -06:00
Charles Kerr
3036a76beb
fix: sonarcloud code smells ( #2421 )
2022-01-17 12:39:50 -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
88f9704eed
refactor: remove varargs code in tr_sys_file ( #2354 )
2021-12-28 09:08:04 -06:00
Charles Kerr
fa35b8ad39
refactor: use std::string in tr_variantToStr() ( #2351 )
...
* refactor: use std::string in tr_variantToStr()
2021-12-27 16:47:25 -06:00
Charles Kerr
dd1379b0b6
refactor: add tr_interned_string ( #2332 )
2021-12-23 11:16:05 -06:00
Charles Kerr
42b1362760
refactor: tidy libtransmission includes ( #2316 )
2021-12-15 15:25:42 -06:00
Charles Kerr
74f367c150
fix: sonarcloud ( #2227 )
...
* fix: sonarcloud useless-sequence-of-pointer-operators warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRYbK9dvryvWm8XC\&open\=AXzyMRYbK9dvryvWm8XC
* fix: sonarcloud unused-function warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTE\&open\=AX06Stxd1usi2gyYkPTE
* fix: sonarcloud init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzyMRABK9dvryvWm8Wv\&open\=AXzyMRABK9dvryvWm8Wv
* fix: sonarcloud assignment-in-expression warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXztC8rqIH_lVCrUGWcX\&open\=AXztC8rqIH_lVCrUGWcX
* fix: sonarcloud use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKY\&open\=AXy-sssdW63O2GMuTBKY
* fix: replace-redundant-type-with-auto warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXy-sssdW63O2GMuTBKZ\&open\=AXy-sssdW63O2GMuTBKZ
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AXzOK_MX7S1ht0f4sjIh\&open\=AXzOK_MX7S1ht0f4sjIh
* fix: use-structured-binding-declaration warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTK\&open\=AX06Stxd1usi2gyYkPTK
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTL\&open\=AX06Stxd1usi2gyYkPTL
* fix: use-structured-binding-declaration warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stxd1usi2gyYkPTP\&open\=AX06Stxd1usi2gyYkPTP
* fixup! fix: use-structured-binding-declaration warning
* Revert "fix: sonarcloud useless-sequence-of-pointer-operators warning"
This reverts commit 26c99e75c6
.
cannot convert from 'const _InIt' to 'const rpc_method *'
2021-11-25 16:39:19 -06:00
Charles Kerr
a79a868257
refactor: make tr_variantFromBuf() public ( #2187 )
...
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr
da142f400e
refactor: tr_address_from_string is now std::string_view-friendly ( #2176 )
2021-11-15 17:03:55 -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
250a2e3cc5
refactor: remove unused pieces of str to variant ( #2166 )
...
* feat: add tr_variantInitStrView()
* refactor: remove unused function tr_variantFromJsonFull
* refactor: tr_variantFromJson() now takes a string_view
* refactor: tr_variantFromBenc() now takes a string_view
* refactor: remove unused source arg from tr_variantFromBencFull()
* refactor: make tr_variantFromBuf() private
2021-11-15 01:21:57 -06:00
Charles Kerr
bdf1bb6d17
refactor: tr_strv*() util functions ( #2123 )
...
* feat: add tr_strv utils
2021-11-09 18:13:47 -06:00
Charles Kerr
d8b57fe4dc
refactor: web_utils ( #2121 )
...
* chore: move web utils from web, utils to web-utils
2021-11-08 21:30:03 -06:00
Charles Kerr
be22677f10
refactor: prefer string_view over raw char* ( #2097 )
2021-11-05 01:29:19 -05:00
Charles Kerr
7724111a8b
refactor: increase use of tr sha1 digest t ( #2091 )
...
* refactor: make tr_sha1_digest_t an array of std::byte
* refactor: increase use of tr_sha1_digest_t
2021-11-03 19:55:04 -05:00
Charles Kerr
9dca5f2086
perf: intern the announcer module's URL strings ( #2085 )
...
* perf: intern the announcer module's internal URLs
2021-11-02 18:00:01 -05:00
Charles Kerr
790b0bb2b5
feat: add tr_quark_get_string_view() ( #2083 )
2021-11-01 20:01:27 -05:00
Charles Kerr
3a4dd6de95
refactor: add TR_PRIsv and TR_PRIsv_ARG ( #2080 )
...
* refactor: add TR_PRIsv, TR_PRIsv_ARG macros
Like PRId64 and similar macros, these new macros are printf() helpers.
They are for passing std::string_views to printf()-like functions.
2021-11-01 17:14:17 -05:00
Charles Kerr
b9e8a11793
fixup! refactor: use std::string in tr_scrape_response ( #1866 ) ( #2018 )
...
fix leaked errmsg introduced in 3fd5c81
(#1866 )
2021-10-22 18:14:46 -05:00
Charles Kerr
b491da0ce4
refactor: add tr_peer_id_t ( #2004 )
...
* refactor: move handshake_done args into a convenience struct
* refactor: move peer_id from peerIo to tr_handshake
tr_handshake is a short-term object and tr_peerIo is long-term, so this
effectively narrows the scope of this field.
* chore: remove unused field tr_peerIo.isEncrypted
* refactor: add tr_peer_id_t type to hold peer ids.
this is a 'using' alias to a std::array<> so that code passing peer-ids
around doesn't have to memcmp / memcpy PEER_ID_LEN anymore. Also removes
the now-unused PEER_ID_LEN macro.
2021-10-21 21:40:55 -05:00
Charles Kerr
16e9a99fe9
refactor: clang-tidy --fix modernize-deprecated-headers ( #1980 )
2021-10-17 15:17:18 -05:00
Charles Kerr
43ad1346eb
refactor: tr_torrentInfoGetMagnetLink now takes a std::string_view ( #1968 )
...
* refactor: tr_torrentInfoGetMagnetLink now takes a std::string_view
2021-10-16 08:20:04 -05:00
Charles Kerr
5df6e4f88f
fix: uninitialized variables in announcer ( #1936 )
2021-10-14 09:22:28 -05:00