Frank Aurich
319312596a
fix: integer overflow when calculating `sizeWhenDone` ( #2378 )
...
While the function correctly returns a `uint64_t`, internally a `size_t` variable is used to calculate the accumulated size.
On 32-bit systems (e.g. Raspbian) `size_t` is only 32-bit wide, causing overflow for torrents > 4GB.
2022-01-07 10:48:08 -06:00
Charles Kerr
a5c6168805
refactor: make tr_buildPath() private ( #2374 )
2022-01-02 11:51:59 -06:00
Charles Kerr
eafbf59832
refactor: avoid referencing tr_file struct directly ( #2373 )
2022-01-01 19:25:25 -06:00
Mike Gelfand
e56997185e
Fixup construction of temp dir path in `deleteLocalData` ( #2370 )
2022-01-01 11:27:03 +03: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
26110d5c8e
fix: out-of-bound memory acess sonarcloud warning ( #2364 )
2021-12-29 21:48:50 -06:00
Charles Kerr
23b7f02100
fix: clear verify_thread before releasing verify mutex lock ( #2360 )
...
* fix: clear verify_thread before releasing verify mutex lock
* refactor: increase the verify buffer size
* fix: uniqueness comparison for verify torrents
2021-12-29 13:20:09 -06:00
Charles Kerr
46f9582e36
refactor: prefer std::from_chars over strtoul ( #2359 )
2021-12-29 02:28:12 -06: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
88f9704eed
refactor: remove varargs code in tr_sys_file ( #2354 )
2021-12-28 09:08:04 -06:00
Charles Kerr
c832f3c18c
fix: sonarcloud warnings ( #2353 )
...
* fix: remove-redundant-cast sonarcloud warning
* fix: make type a pointer-to-const sonarcloud warning
* fix: use-init-statement sonarcloud warning
* fix: use-init-statement sonarcloud warning
* fix: extract-assignment-from-expression sonarcloud warning
* fix: remove-redundant-cast sonarcloud warning
* fix: extract-nested-block-into-method sonarcloud warning
2021-12-28 01:14:52 -06:00
Charles Kerr
02aa2f46d4
refactor: don't use varargs in tr_error ( #2352 )
2021-12-27 20:32:22 -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
0b095dc258
fix: sonarcloud warnings ( #2350 )
...
* fix: use-init-statement sonarcloud warning
* fix: use-init-statement sonarcloud warning
* fix: conversion-loses-precision sonarcloud warning
* fix: use std::string_view::npos sonarcoud warning
* fix: refactor code to not nest more than 3x sonarcloud warning
* fix: conversion-loses-precision sonarcloud warning
* fix: use init-statement sonarcloud warning
* fix: global variables should be const sonarcloud warning
* fix: conversion-loses-precision sonarcloud warning
* refactor: reduce complexity in doScrape()
2021-12-26 18:32:36 -06:00
Charles Kerr
6149870540
refactor: remove tr_file.priv ( #2349 )
2021-12-26 16:04:20 -06:00
Charles Kerr
fd96a9270b
refactor: remove tr_file.offset ( #2347 )
2021-12-26 12:43:27 -06:00
Charles Kerr
af183b1423
chore: remove tr_pieceOffset() ( #2346 )
2021-12-26 11:25:51 -06:00
Charles Kerr
a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor ( #2345 )
2021-12-26 10:25:07 -06:00
Charles Kerr
3f8cf63e59
refactor: use tr_torrent_metainfo in mac client ( #2343 )
2021-12-25 21:12:32 -06:00
Charles Kerr
bc4f513191
refactor: use tr_torrent_metainfo in transmission-show ( #2341 )
2021-12-25 16:41:18 -06:00
Charles Kerr
7c87cb36eb
refactor: tr_torrent_metainfo ( #2340 )
...
* refactor: add tr_torrent_metainfo class
Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00
Charles Kerr
0e321c2d21
fix: clang warnings ( #2339 )
...
* fix: comparison-is-always-false warning
* fix: C/C++ mixing (memset() to clear a C++ object)
2021-12-25 11:22:12 -06:00
Charles Kerr
b62b8f28bf
fix: exit time dtor warnings ( #2338 )
2021-12-24 20:07:33 -06:00
Charles Kerr
b058daff4b
refactor: change tr_torrentNew() args ( #2337 )
2021-12-24 16:05:17 -06:00
Charles Kerr
f3228e9670
refactor: further decouple tr_torrent and tr_info ( #2336 )
2021-12-24 15:12:33 -06:00
Charles Kerr
deee2b043e
refactor: take string_view in tr_loadFile(), tr_saveFile() ( #2335 )
2021-12-24 13:37:34 -06:00
Charles Kerr
33553c5331
refactor: move tr_ioFindFileLocation() to tr_file_piece_manager ( #2334 )
2021-12-24 00:39:55 -06:00
Charles Kerr
dd1379b0b6
refactor: add tr_interned_string ( #2332 )
2021-12-23 11:16:05 -06:00
Charles Kerr
bd68d3a2fd
refactor: use tr_sha1_digest_t everywhere ( #2330 )
2021-12-21 16:14:15 -06:00
Charles Kerr
37a8046ed5
fix: more sonarcloud warnings ( #2324 )
2021-12-16 23:47:51 -06:00
Charles Kerr
b9406dfebb
refactor: even more torrent housekeeping ( #2323 )
2021-12-16 22:51:53 -06:00
Charles Kerr
e4a172d39c
fix: sonarcloud ( #2322 )
...
* fix: sonarcloud warning - redundant cast
* fix: sonarcloud warning - init-statement
* fix: sonarcloud warning - init-statement
* fix: sonarcloud warning - move #include to top of file
* fix: sonarcloud warning - implicit conversion loses precision
* fix: sonarcloud warning - confirm safe use of strlen
* fix: sonarcloud warning - refactor code to not nest more than three deep
* iwyu: cstring
* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr
b93f3f0463
refactor: more tr_torrent housekeeping ( #2320 )
2021-12-16 03:43:51 -06:00
Charles Kerr
4ea2429217
refactor: tr_torrent housekeeping ( #2319 )
2021-12-16 02:49:04 -06:00
Charles Kerr
e65e0b3caa
refactor: prefer tr_strv*() even more ( #2318 )
2021-12-15 23:16:40 -06:00
Charles Kerr
2277fde4e0
refactor: prefer tr_strv*() funcs ( #2317 )
2021-12-15 20:09:46 -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
d00be0dec7
refactor: tr_torrentIsSeed() -> tr_torrent::isDone() ( #2313 )
2021-12-15 01:04:26 -06:00
Charles Kerr
68518bc307
refactor: make some tr_torrentFoo() methods member functions ( #2312 )
2021-12-14 23:48:56 -06:00
Charles Kerr
1e20d676c1
refactor: make tr_torrentInfo() private ( #2285 )
...
* refactor: make tr_torrentInfo() private
2021-12-14 15:59:44 -06:00
Charles Kerr
656df477f2
refactor: add tr_announce_list ( #2308 )
...
* refactor: add tr_announce_list (#2308 )
2021-12-14 14:59:40 -06:00
Mike Gelfand
3e072f9bd4
Fix most of critical issues reported by Sonar (GTK client) ( #2309 )
...
* (C++) Macros should not be used to define constants
* (C++) Memory should not be managed manually
* (C++) "void*" should not be used in typedefs, member variables, function parameters or return type
* (C++) When the "Rule-of-Zero" is not applicable, the "Rule-of-Five" should be followed
* (C++) "switch" statements should have "default" clauses
* (C++) "explicit" should be used on single-parameter constructors and conversiosn operators
* (C++) Non-const global variables should not be used
2021-12-14 11:43:27 +03:00
Charles Kerr
cec7685a64
refactor: remove unused tr_torrent.dnd_pieces_ ( #2296 )
2021-12-09 20:54:44 -06:00
Charles Kerr
0cedfec630
fixup! refactor: add tr_torrentTrackers() ( #2282 ) ( #2294 )
...
ensure announcer tracker count is correct
2021-12-09 20:03:26 -06:00
Charles Kerr
0f92232c65
fix: memleak regressions ( #2293 )
...
* fixup! refactor: add tr_saveFile() (#2267 )
fix: memleak regression
* fixup! fixup! refactor: make parts of tr file private (#2241 ) (#2281 )
fix: memory leak regression
* fixup! refactor: use C++ inheritance for tr_peer, tr_peerMsgs, and tr_webseed (#1877 )
fix: memory leak regression
2021-12-09 18:49:30 -06:00
Charles Kerr
f39a1e45a8
fix: crash in tr_file_priorities::filePriority() ( #2291 )
...
Fixes #2262 .
2021-12-09 15:38:18 -06:00
Charles Kerr
d5aead4b41
fix: non-portable strftime format string ( #2290 )
...
Xref: b61b1e2c16
2021-12-09 14:30:39 -06:00
Charles Kerr
b9de5bb9ca
fixup! fix: env var leak in tr_spawn_async() ( #2212 ) ( #2289 )
...
fix: fmr error with temporary strings
2021-12-09 12:39:06 -06:00
Charles Kerr
ab0c49859e
refactor: add tr_torrentTrackers() ( #2282 )
...
* refactor: add tr_torrentTrackers()
2021-12-08 10:55:52 -06:00
Charles Kerr
0a85c3aaa4
fixup! refactor: make parts of tr file private ( #2241 ) ( #2281 )
...
fix: crash regression in GTK client details dialog
2021-12-07 19:03:32 -06:00
Matt Joiner
76719bf34c
Reject cancels when fast extension enabled ( #2275 )
...
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-12-07 16:18:56 -06:00
Charles Kerr
c46ce2da06
refactor: add tr_torrentWebseed(), tr_torrentWebseedCount() ( #2277 )
...
* refactor: add tr_torrentWebseedCount()
2021-12-07 12:11:28 -06:00
Charles Kerr
bfbca961d4
refactor: remove assigned-but-unused tr_info.originalName ( #2276 )
2021-12-07 00:37:34 -06:00
Charles Kerr
5096bbae9b
refactor: add tr_torrent::file() ( #2274 )
...
* refactor: add tr_torrent::fileCount()
2021-12-06 22:18:17 -06:00
Mike Gelfand
41550bf17e
Avoid crash on null scrape url in rpcimpl.cc
2021-12-06 21:30:41 +00:00
Charles Kerr
867a131e1d
refactor: add tr_torrent::fileCount() ( #2273 )
...
Provide an accessor to get a torrent's file count.
This is an incremental step towards making tr_torrent's impl private.
2021-12-06 15:26:04 -06:00
Charles Kerr
e2be142ad6
fix: new warnings ( #2270 )
...
* fix: avoid potential resource leak in metainfo test
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205022335&defectInstanceId=52337396&mergedDefectId=1494638
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX2MsJ_lWODkx6cuASq6&open=AX2MsJ_lWODkx6cuASq6
* fix: omit-redundant-override-specifier warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX2MsJ5GWODkx6cuASq5&open=AX2MsJ5GWODkx6cuASq5
* fix: improper-use-of-negative-value warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020121&defectInstanceId=52337394&mergedDefectId=1494639
* fix: unchecked return value warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020168&defectInstanceId=52304887&mergedDefectId=1491438
* fix: potential-divide-by-zero warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020106&defectInstanceId=52337395&mergedDefectId=1494438
2021-12-05 21:12:21 -06:00
Mike Gelfand
ff7564dc23
Squash consecutive path separators on Windows ( #2268 )
...
This avoids ERROR_INVALID_NAME ("The filename, directory name, or volume
label syntax is incorrect") errors since such normalization doesn't
happen automatically for "\\?\"-prefixed paths.
Fixes : #1791
2021-12-05 16:32:39 +03: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
cc4cf1da5a
fixup! refactor: use cpputf for utf8 validation and conversion ( #2251 ) ( #2264 )
...
silence a nullptr-dereference warning
2021-12-03 18:07:17 -06:00
Charles Kerr
e5e11e3c83
fixup! fix: sonarcloud warnings ( #2260 ) ( #2263 )
...
the scope of the buf variable was narrowed too far
2021-12-03 17:20:39 -06:00
Charles Kerr
2977636d58
fix: sonarcloud warnings ( #2260 )
...
* fix: add-explicit-keyword-to-constructor warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuB-2farvsyMPiZl&open=AX1tyuB-2farvsyMPiZl
* fix: use a structured binding declaration
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuHH2farvsyMPiZm&open=AX1tyuHH2farvsyMPiZm
* Fix implicit-conversion-loses-precision warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuH22farvsyMPiZn&open=AX1tyuH22farvsyMPiZn
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuO42farvsyMPiZw&open=AX1tyuO42farvsyMPiZw
* fix implicit-conversion-loses-precision warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuO42farvsyMPiZs&open=AX1tyuO42farvsyMPiZs
* fix: implicit-conversion-loses-precision warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1tyuO42farvsyMPiZt&open=AX1tyuO42farvsyMPiZt
* fix handle-this-exceeption-or-do-not-catch-it warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1y7t12cIz3krp3mVpV&open=AX1y7t12cIz3krp3mVpV
* fix make-this-variable-a-reference-to-const warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1y7t12cIz3krp3mVpW&open=AX1y7t12cIz3krp3mVpW
* fix replace-redundant-type-with-auto warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1y7t12cIz3krp3mVpY&open=AX1y7t12cIz3krp3mVpY
* Fix use-try_emplace-instead-of-emplace warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0WPk3QwxvzFbF6whWN&open=AX0WPk3QwxvzFbF6whWN
* Fix: make-this-a-pointer-to-const warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0bZPUXjI_aUyxGBxB4&open=AX0bZPUXjI_aUyxGBxB4
* Fix use-std::make_unique warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0WPk0twxvzFbF6whWC&open=AX0WPk0twxvzFbF6whWC
* Fix: replace-push_back-with-emplace_back warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0BraL_0QLXO0pQ_Bfv&open=AX0BraL_0QLXO0pQ_Bfv
* Fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0bZPXajI_aUyxGBxB8&open=AX0bZPXajI_aUyxGBxB8
* Fix: replace-redundant-type-with-auto warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0bZPXajI_aUyxGBxB9&open=AX0bZPXajI_aUyxGBxB9
* Fix: replace-emplace-with-try_emplace warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0bZPXajI_aUyxGBxB_&open=AX0bZPXajI_aUyxGBxB_
* Fix: extract-assignment-from-operation warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0bZPXajI_aUyxGBxCA&open=AX0bZPXajI_aUyxGBxCA
* Fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX1op6_hUBCnp-Grmra8&open=AX1op6_hUBCnp-Grmra8
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0L8qgMUnpKTxYiu5CN&open=AX0L8qgMUnpKTxYiu5CN
* Revert "Fix use-std::make_unique warning"
This reverts commit 463a742f34
.
* fix: make-parameter-a-pointer-to-const warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX06St241usi2gyYkPTZ&open=AX06St241usi2gyYkPTZ
* fix: make-parameter-a-pointer-to-const warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX06St241usi2gyYkPTa&open=AX06St241usi2gyYkPTa
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX01Itn2f_SST5i7BN1o&open=AX01Itn2f_SST5i7BN1o
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AXziv55-MuQoG-Y-NgLX&open=AXziv55-MuQoG-Y-NgLX
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX0_a_JGNJn7rAzml_68&open=AX0_a_JGNJn7rAzml_68
* fix: replace-redundant-type-with-auto warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AXzyMRYbK9dvryvWm8XA&open=AXzyMRYbK9dvryvWm8XA
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AXziv52fMuQoG-Y-NgLW&open=AXziv52fMuQoG-Y-NgLW
2021-12-01 17:11:57 -06:00
Charles Kerr
933990fbfc
refactor: use utf8::unchecked::replace_invalid ( #2259 )
...
This works around a false Coverity uncaught-throw warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=204756586&defectInstanceId=52315575&mergedDefectId=1494566
2021-12-01 15:49:11 -06:00
Charles Kerr
ee83859bdc
refactor: getPeersToClose returns a vector ( #2253 )
2021-11-30 21:07:09 -06:00
Charles Kerr
bbe49639d6
refactor: use cpputf for utf8 validation and conversion ( #2251 )
...
* refactor: use cpputf for utf8 validation and conversion
2021-11-30 15:13:56 -06:00
Charles Kerr
9516e8a923
fixup! refactor: tr_completion ( #2220 )
...
fix: incorrect calculation in amountDone
2021-11-28 22:11:30 -06:00
Charles Kerr
35fe175f2a
refactor: add file-piece-map ( #2246 )
...
* refactor: add file-piece-map
* refactor: use tr_file_priorities
* refactor: use tr_files_wanted
2021-11-28 19:12:54 -06:00
Charles Kerr
ef154e48ae
fixup! refactor: tr_completion ( #2220 )
...
fix inverted logic regression
2021-11-28 15:55:29 -06:00
Charles Kerr
e2b1c71982
fix: unused variable warning when building in release mode
2021-11-28 08:05:44 -06:00
Charles Kerr
998d4c514b
fixup! refactor: make parts of tr file private ( #2241 )
2021-11-27 23:08:56 -06:00
Charles Kerr
34881f6295
refactor: make parts of tr file private ( #2241 )
...
* refactor: make parts of tr_file private
2021-11-27 21:17:47 -06:00
Charles Kerr
f6f0db75e1
fix: sonarcloud warnings / code smells ( #2242 )
...
* fix: use-init-statement
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6EvHJiycnfA7gfrG\&open\=AX1f6EvHJiycnfA7gfrG
* fix replace-use-of-new warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs41ZmlvCveKTzon\&open\=AX1ZNs41ZmlvCveKTzon
* fix has-virtual-functions-but-non-virtual-destructor warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs72ZmlvCveKTzo6\&open\=AX1ZNs72ZmlvCveKTzo6
* fix make-variable-const warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0_a_OVNJn7rAzml_7B\&open\=AX0_a_OVNJn7rAzml_7B
* fix remove-redundant-static-specifiers
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTb\&open\=AX06St-81usi2gyYkPTb
* fix function-should-be-declared-const
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTd\&open\=AX06St-81usi2gyYkPTd
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St-81usi2gyYkPTc\&open\=AX06St-81usi2gyYkPTc
* fix class-has-virtual-functions-but-non-virtual-destructor warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06Stz41usi2gyYkPTS\&open\=AX06Stz41usi2gyYkPTS
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTT\&open\=AX06St241usi2gyYkPTT
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTV\&open\=AX06St241usi2gyYkPTV
* fix has-virtual-functions-but-non-virtual-destructor warning
https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06St241usi2gyYkPTW\&open\=AX06St241usi2gyYkPTW
* fix remove-commented-out-code warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX06SuCA1usi2gyYkPTh\&open\=AX06SuCA1usi2gyYkPTh
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xF\&open\=AX0rAQvnfJ-O-YIDS9xF
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0rAQvnfJ-O-YIDS9xG\&open\=AX0rAQvnfJ-O-YIDS9xG
* fix remove-redundant-access-specifier warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1ZNs5tZmlvCveKTzor\&open\=AX1ZNs5tZmlvCveKTzor
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX01Itl7f_SST5i7BN1l\&open\=AX01Itl7f_SST5i7BN1l
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0wDijI2l89lDvp1C9P\&open\=AX0wDijI2l89lDvp1C9P
* fix use-automatically-managed-memory-instead-of-new warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX1f6E6HJiycnfA7gfrI\&open\=AX1f6E6HJiycnfA7gfrI
* fix use-init-statement warning
Xref: https://sonarcloud.io/project/issues\?id\=transmission_transmission\&issues\=AX0l8vknEafnvRiIHUEv\&open\=AX0l8vknEafnvRiIHUEv
* fixup! fix has-virtual-functions-but-non-virtual-destructor warning
2021-11-27 19:58:35 -06:00
Charles Kerr
742ae6fb00
refactor: minor naming change in block_info ( #2233 )
...
* refactor: rename method as block_info.pieceSize()
* refactor: rename method as block_info.blockSize()
2021-11-26 13:33:56 -06:00
Charles Kerr
dc36787378
fix: coverity warnings ( #2229 )
...
* fix: coverity uninitialized member warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-41
* fix: coverity uninitialized member warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371746\&defectInstanceId\=52288281\&mergedDefectId\=1494442\&eventId\=52288281-43
* fix: coverity unchecked return value
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204371760\&defectInstanceId\=52254984\&mergedDefectId\=1494150
* fix: coverity false nullptr dereference warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369613\&defectInstanceId\=52254971\&mergedDefectId\=1493396
* fix: coverity unchecked return value
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=204369625\&defectInstanceId\=52288288\&mergedDefectId\=1491891
2021-11-25 18:14:25 -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
72cae4996f
fixup! refactor: tr_completion ( #2220 ) ( #2228 )
...
fix off-by-one
2021-11-25 16:13:21 -06:00
Charles Kerr
3d2fa18c61
test: improve tr_bitfield and tr_block_info coverage ( #2226 )
...
* test: improve coverage in tr_bitfield::raw()
* test: improve coverage in tr_bitfield::count()
* test: improve coverage for edge cases in tr_bitfield::setSpan()
* test: confirm that excess bits in setRaw() are set to zero
* fix: edge case of tr_block_info::initBlocks() where piece_size is 0
this should not happen in production, but cover it anyway
2021-11-25 14:30:13 -06:00
Charles Kerr
de169c7ec3
refactor: tr_completion ( #2220 )
...
* refactor: refactor tr_completion + add test coverage for it
2021-11-25 12:26:51 -06:00
Charles Kerr
06090f113a
fix: crash on corrupt dht.dat file ( #2223 )
2021-11-25 02:59:44 -06:00
Charles Kerr
7b57cfcfa2
fixup! refactor: make tr_variantFromBuf() public ( #2187 ) ( #2216 )
2021-11-24 14:54:53 -06:00
Charles Kerr
68e3820ed1
fixup: crash after completing magnet link metainfo ( #2215 )
2021-11-24 14:12:32 -06:00
Charles Kerr
dbd9130d9d
fix: env var leak in tr_spawn_async() ( #2212 )
...
* fix: env var leak in tr_spawn_async()
2021-11-24 13:25:23 -06:00
Charles Kerr
d4e0f368c8
fixup! refactor: use std mutex/lock intead of bespoke ( #2194 ) ( #2211 )
2021-11-24 10:39:09 -06:00
Charles Kerr
843e486d2a
refactor: tr_block_info class ( #2210 )
...
* refactor: add tr_block_info with tests
2021-11-24 08:48:52 -06:00
Charles Kerr
da855a7257
refactor: use std mutex/lock intead of bespoke ( #2194 )
...
* refactor: use std mutex/lock intead of bespoke
2021-11-20 15:20:45 -06:00
Charles Kerr
ec457551ab
refactor: make Bandwidth.children a std::vector ( #2197 )
2021-11-20 10:58:47 -06:00
Charles Kerr
f7b729a350
refactor: add tr_buildTorrentFilename() ( #2196 )
...
a simpler API for building .torrent and .resume filenames
2021-11-19 18:36:25 -06:00
Charles Kerr
073c6af1d6
refactor: swarm ( #2103 )
...
* refactor: encapsulate request tracking in a class
Introduces a new class to peer-mgr, `ClientRequests`, which tracks what
active requests we've got pending: which blocks, when the requests were
sent, and who they were sent to.
This shouldn't change peer-mgr behavior. Its goal is to carve out some
of peer-mgr's data structures and encapsulte them behind an API that's
simpler to understand.
* refactor: move ActiveRequests to its own file
* perf: avoid duplicate call to tr_cpMissingBlocksInPiece
2021-11-19 12:37:38 -06:00
Charles Kerr
0b58e7afa7
fix: log the correct errno on libevent socket error
2021-11-18 16:07:00 -06:00
Charles Kerr
b3e4fc64c5
perf: faster shutdown ( #2193 )
...
* perf: don't update queue positions during shutdown
When a torrent is being removed, we try to update the queue positions of
the other torrents. But it's (slightly) expensive and is irrelevant when
the session is closing, so skip it in that case.
* perf: torrentLoadResume shouldn't touch tor->dirty
Loading torrent settings from disk does call a lot of tr_torrentSetFoo()
functions, but since these are the saved settings, they shouldnt' affect
the torrent's 'is dirty' flag.
2021-11-18 12:19:55 -06:00
Noobsai
0eca3b3c6c
Fix building for XFS ( #2192 )
2021-11-18 11:07:42 -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
36f5d56cfe
fixup! refactor: make piece checksums private ( #2130 ) ( #2190 )
2021-11-17 21:32:34 -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
ec94c90da9
fix: coverity warnings ( #2186 )
...
* fix: silence check_return warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245209\&mergedDefectId\=1494152
* fix: silence check_return warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924692\&defectInstanceId\=52245241\&mergedDefectId\=1493826
* fix: silence check_return warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924667\&defectInstanceId\=52245260\&mergedDefectId\=1493825
* fix: silence nullptr dereference warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924667\&defectInstanceId\=52245260\&mergedDefectId\=1493825
* fix: uninitialized variable in rpc-server z_stream
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245249\&mergedDefectId\=1494151
* fix: silence check_return warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924665\&defectInstanceId\=52245261\&mergedDefectId\=1492904
* fix: silence nullptr dereference warning
https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924689\&defectInstanceId\=52245236\&mergedDefectId\=1492890
* fix: silence unchecked return value warning
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203924666\&defectInstanceId\=52245259\&mergedDefectId\=1491888
2021-11-17 15:56:50 -06:00
Charles Kerr
1ba81938bf
refactor: use std::string_view in benc parser ( #2182 )
...
* refactor: use std::string_view to parse benc
* refactor: simplify private parsing API in variant.cc
* chore: remove unneeded includes
* refactor: merge tr_variantFromBenc and tr_variantFromBencFull
2021-11-16 21:29:30 -06:00
Charles Kerr
60b802a22b
refactor: fix some msvc compiler warnings ( #2185 )
...
* refactor: use if-constexpr to silence C4127 warning
* chore: fix C4706 assignment-within-conditional-expression warning
* chore: fix int-widened-to-uint64 warning in tests
2021-11-16 13:25:30 -06:00
Charles Kerr
7344b7e3cb
refactor: add a tr_loadFile() variant that takes a reusable buffer ( #2181 )
2021-11-16 00:15:13 -06:00
Charles Kerr
73edd7b642
refactor: remove tr_variantDictFindStr() ( #2180 )
...
* refactor: remove tr_variantDictFindStr
2021-11-15 23:20:06 -06:00
Charles Kerr
a21594b0ce
refactor: add tr_torrent::renamePath ( #2178 )
2021-11-15 22:10:36 -06:00
Charles Kerr
e7a229e6c3
refactor: tr_sys_path_dirname(), tr_sys_path_basename() now take std::string_view parameters ( #2177 )
...
* refactor tr_sys_path_dirname(), tr_sys_path_basename() now take std::string_views
2021-11-15 18:50:14 -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
505d2ae428
refactor: tr_torrent.setLocation ( #2175 )
...
member version of tr_torrentSetLocation
2021-11-15 14:53:53 -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
b1aeaa3dcc
refactor: remove tr_variantDictFindStr() from transmission-daemon ( #2165 )
...
* refactor: remove tr_variantDictFindStr from transmission-daemon
2021-11-14 22:49:56 -06:00
Charles Kerr
af8e9e66b9
fixup! refactor: rpc-server.cc ( #2152 ) ( #2164 )
...
fixup: rpc-server auth regression; fix tests
2021-11-14 21:54:48 -06:00
Charles Kerr
8980a33f4a
refactor: tr_webRun() now takes std::string_view args ( #2162 )
2021-11-14 19:17:03 -06:00
Charles Kerr
f46c4c4df9
refactor: remove tr_variantGetStr ( #2160 )
2021-11-14 17:28:37 -06:00
Charles Kerr
6dda4f2b5f
refactor: remove tr_variantDictFindStr() from rpc-server.cc ( #2159 )
...
* refactor: use FindStrview for rpc username
* refactor: use tr_variantDictFindStrView for rpc bind address
2021-11-14 16:06:32 -06:00
Charles Kerr
3bab6f02dc
refactor: rpc-server.cc ( #2152 )
...
* refactor: first baby steps towards C++ifying rpc_server
2021-11-14 15:14:37 -06:00
Charles Kerr
10d3cdb99a
fixup! feat: add tr_strvPath() ( #2134 ) ( #2156 )
...
fix: -Wshadow warning in tr_strvPath()
2021-11-14 13:53:58 -06:00
Charles Kerr
7b772e73e6
fixup! refactor: remove tr_piece struct ( #2059 ) ( #2153 )
...
fix: off-by-one when marking a range of pieces as untested
2021-11-14 10:12:02 -06:00
Charles Kerr
3d38e01a13
refactor: tr_session.congestion ( #2151 )
...
* refactor: tr_session.congestion
2021-11-14 00:41:44 -06:00
Charles Kerr
d55474161e
refactor: rpc whitelist ( #2150 )
...
* refactor: make rpc-whitelist string_view-friendly
2021-11-14 00:02:45 -06:00
Charles Kerr
861474e0ce
refactor: tr session.tos ( #2149 )
...
* refactor: make tr_session.tos string_view-friendly
2021-11-13 23:23:19 -06:00
Charles Kerr
99aeaa0eaf
refactor: tr_ssha1(), tr_ssha1_matches() ( #2148 )
...
* refactor: make tr_ssha1 and tr_ssha1_matches string_view-friendly
2021-11-13 20:03:01 -06:00
Charles Kerr
7ff6756ac5
refactor: tr session.blocklist ( #2147 )
...
* refactor: tr_session.blocklist
2021-11-13 19:09:33 -06:00
Charles Kerr
0be95b5074
refactor: tr_session.scripts ( #2146 )
...
* refactor: tr_session.scripts
2021-11-13 17:33:18 -06:00
Charles Kerr
903338af72
refactor: tr_session.incomplete_dir ( #2145 )
2021-11-13 14:49:10 -06:00
Charles Kerr
a8f640c559
refactor: tr_dirSpace() ( #2143 )
...
* refactor/tr_dirSpace
2021-11-13 12:09:14 -06:00
Charles Kerr
86f4e37571
refactor: tr_sys_path_is_relative() takes a string_view ( #2142 )
...
* refactor: tr_sys_path_is_relative() takes a string_view
2021-11-13 10:08:50 -06:00
Charles Kerr
254d837ddf
fixup! refactor: make piece checksums private ( #2130 ) ( #2136 )
2021-11-13 00:53:52 -06:00
Charles Kerr
6571be2b95
feat: add tr_strvPath() ( #2134 )
...
* feat: add tr_strvJoin
* feat: add tr_strvPath
2021-11-12 18:10:04 -06:00
Charles Kerr
d1f8c28fcd
refactor: make piece checksums private ( #2130 )
...
* refactor: remove tr_info.pieces
2021-11-12 10:42:51 -06:00
Dzmitry Neviadomski
319e1fc6bb
Replace C rand() with uniform_int_distribution and mt19937. ( #2089 )
...
Reuse random engine and distribution itself and change only
distribution bounds via lightweight param type.
2021-11-11 13:03:33 -06:00
Charles Kerr
7693ef69bf
refactor: magnet metainfo ( #2124 )
...
* refactor: magnet-metainfo
2021-11-09 20:42:18 -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
4ecf74081c
refactor: remove tr_ctorSetMetainfoFromHash() ( #2116 )
...
* refactor: remove tr_ctorSetMetainfoFromHash()
2021-11-07 20:04:07 -06:00
Charles Kerr
af4a953cd1
fixup! refactor: remove tr_piece struct ( #2059 ) ( #2115 )
...
yet another fixup of the tr_piece struct removal
2021-11-07 18:25:45 -06:00
Charles Kerr
2bd328c082
fixup! refactor: c++ify torrent ctor ( #2098 ) ( #2114 )
...
handle nullptrs in the accessor functions
2021-11-07 17:35:32 -06:00
Charles Kerr
bbdb488224
perf: recycle variant tree walking helpers ( #2100 )
...
* perf: recycle the helper classes that walk through variant trees
2021-11-05 09:54:44 -05:00
Charles Kerr
be22677f10
refactor: prefer string_view over raw char* ( #2097 )
2021-11-05 01:29:19 -05:00
Charles Kerr
087a804b49
fix: another piece priority fix ( #2099 )
...
move initialization to later in torrent construction so that we can correctly check whether the torrent is done or not
2021-11-05 00:06:19 -05:00
Charles Kerr
344ac056c8
refactor: c++ify torrent ctor ( #2098 )
...
* refactor: c++ify the torrent-ctor implementation
2021-11-04 22:08:38 -05:00
Charles Kerr
75ce9eae7b
perf: minor perf improvements ( #2096 )
...
* perf: use avoid unnecessary strlen when making log messages
* perf: avoid temporary string alloc/free in tr_metainfoAppendSanitizedPathComponent()
2021-11-03 20:36:32 -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
655050ce70
build: enable more .clang-tidy checks ( #2088 )
...
* build: add more clang-tidy warnings
2021-11-03 08:59:39 -05:00
Charles Kerr
fa2ef23bdc
refactor: fix uninit var warnings in blocklist.cc ( #2087 )
2021-11-02 22:55:43 -05:00
Charles Kerr
002b45a95c
fixup! refactor: remove tr_piece struct ( #2059 ) ( #2086 )
...
perf: discard piece priorities when done downloading
2021-11-02 21:55:33 -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
e5225ba8a2
refactor: tr_torrentFindFromHashString() takes a std::string_view ( #2082 )
...
* refactor: tr_torrentFindFromHashString() takes a string_view
2021-11-01 19:18:09 -05:00
Charles Kerr
5594b16358
refactor: tr_quark_lookup() takes a std::string_view ( #2081 )
...
* refactor: tr_quark_lookup takes a std::string_view
2021-11-01 18:29:13 -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
ba59060737
feat: new function tr_variantGetStrView() ( #2079 )
...
* feat: new method tr_variantGetStrView()
* test: add new variant tests
2021-11-01 16:30:18 -05:00
Charles Kerr
feaf12a205
refactor: tr_urlIsValid*() now takes a std::string_view ( #2078 )
...
* refactor: tr_urlIsValid*() now take a string_view arg
2021-11-01 15:36:14 -05:00
Charles Kerr
da51a17c30
refactor: add util tr_strvstrip() to strip string_views ( #2077 )
2021-11-01 13:50:53 -05:00
Charles Kerr
484e9ee64e
refactor: add a tr_urlParse() with no heap allocs ( #2070 )
2021-10-31 13:48:32 -05:00
Charles Kerr
cedec74d26
perf: add tr_buildBuf() ( #2068 )
...
* refactor: add tr_buildBuf() utility
2021-10-31 11:38:10 -05:00
depler
8cac7d6f94
Update file-win32.cc ( #2066 )
...
Fix pointer `return false` after refactoring
2021-10-31 02:15:07 -05:00
Charles Kerr
7c07f4acbb
perf: omit extra std::map in tr_torrentPrimaryMimeType() ( #2064 )
2021-10-30 11:49:47 -05:00
Charles Kerr
9200d972c3
refactor: use a std::vector for tr_session.removed_torrents ( #2062 )
2021-10-29 18:49:15 -05:00
Charles Kerr
f270d6081c
refactor: cppcoreguidelines-init-variables pt. 15 ( #2055 )
...
* refactor: uninit vars in subprocess-posix
* refactor: uninit vars in handshake
* refactor: uninit vars in file-posix
* refactor: uninit vars in platform-quota
2021-10-29 17:43:25 -05:00
Charles Kerr
d6032f829b
refactor: remove tr_piece struct ( #2059 )
...
* refactor: remove tr_piece struct
2021-10-29 13:24:30 -05:00
Frank Aurich
82d9232084
Fix RPC 'table' mode not being properly activated ( #2058 )
...
* Fix RPC 'table' mode not being properly activated.
2021-10-29 01:54:46 -05:00
Charles Kerr
1d0993c3a5
fix: fmr warning in removeAllPeers()
2021-10-27 21:43:12 -05:00
Charles Kerr
9be93a489e
refactor: simplify sorting peers by liveliness ( #2050 )
2021-10-27 21:05:00 -05:00
Charles Kerr
6bd229fcfd
fix: clang 13 nullptr warnings in libtransmission ( #2054 )
...
* fix: nullptr dereference warning in tr_peerMgrPeerStats
* fix: nullptr dereference warning in refillUpkeep()
* fix: nullptr dereference warning in tr_peerIsSeed()
* fix: nullptr dereference warning in rechokeUploads()
* fix: nullptr dereference warning in tr_variantDictAdd
* fix: nullptr dereference warning in tr_ioFindFileLocation()
* fix: nullptr dereference warning in tr_spawn_async_in_child()
* fix: nullptr dereference warning in calculatePiecePriority()
2021-10-27 20:16:24 -05:00
razaq
c3f1aafb96
add TR_TORRENT_TRACKERS env variable to script call ( #2053 )
...
* add TR_TORRENT_TRACKERS env variable to script call
2021-10-27 13:25:09 -05:00
Charles Kerr
ed801eab8f
feat: less prolix announce error logging ( #2052 )
2021-10-27 08:34:16 -05:00
Dan Walters
8234d064a8
fix: apply optional peer socket TOS to UDP sockets ( #1043 )
...
This effectively makes the TOS setting apply to uTP and DHT traffic.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-26 20:59:31 -05:00
Charles Kerr
2b65b985cf
refactor: cppcoreguidelines-init-variables pt. 14 ( #2049 )
...
* refactor: fix uninit var warnings in ptrarray
* refactor: fix uninit var warnings in bitfield
* refactor: fix uninit var warnings in handshake
* refactor: fix uninit var warnings in tr-dht
* refactor: fix uninit var warnings in natpmp
* refactor: fix uninit var warnings in tr-dht
* refactor: fix uninit var warnings in crypto-utils-openssl
* refactor: fix uninit var warnings in handshake
* refactor: fix uninit var warnings in crypto-utils
* refactor: fix uninit var warnings in crypto
* Revert "refactor: fix uninit var warnings in handshake"
This reverts commit 5aaa9cc30a
.
* refactor: fix uninit var warnings in crypto-utils-ccrypto
* refactor: fix uninit var warnings in crypto-utils-polarssl
* refactor: fix uninit var warnings in crypto-utils-cyassl
* fixup! refactor: fix uninit var warnings in crypto-utils-cyassl
* fixup! refactor: cppcoreguidelines-init-variables pt. 13 (#2043 )
2021-10-26 19:16:56 -05:00
Frank Aurich
d9277d4b93
transmission-remote: Fix size display for torrents > 4GB ( #2029 )
...
* As size_t is not 64-bit on all platforms, explicitly use uin64_t when dealing with byte sizes to support torrents > 4GB
2021-10-26 16:06:47 -05:00
Charles Kerr
b797b4c94f
refactor: cppcoreguidelines-init-variables pt. 13 ( #2043 )
...
* refactor: fix uninit var warnings in ptrarray
* refactor: fix uninit var warnings in bitfield
* refactor: fix uninit var warnings in handshake
* refactor: fix uninit var warnings in tr-dht
* refactor: fix uninit var warnings in natpmp
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-10-26 13:02:07 -05:00
Charles Kerr
a1c5a215bf
refactor: remove peer-mgr replication info ( #2021 )
...
* refactor: remove peer-mgr replication info
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-10-25 10:29:19 -05:00
Charles Kerr
775e30eefd
refactor: getPeerCandidates returns a std::vector ( #2042 )
...
Previously was a manually-malloced and freed array.
2021-10-25 00:15:04 -05:00
Charles Kerr
93d8a03d55
refactor: remove outvar args from tr_torGetFooBlockRange() functions ( #2041 )
2021-10-24 22:39:19 -05:00
Dzmitry Neviadomski
3a966a77d1
Remove C-style STD headers in watchdir-kqueue.cc ( #2037 )
...
`string.h` is unused, `cerrno` is needed for `errno` macro.
2021-10-24 17:30:31 -05:00
Charles Kerr
3008a992ca
fix: Bitfield.getRaw() regression ( #2023 )
...
* fix: Bitfield.getRaw() regression
2021-10-24 15:43:36 -05:00
Mike Gelfand
5edbcb3740
Add CommonCrypto-based crypto utils implementation ( #2032 )
...
* Add CommonCrypto-based crypto utils implementation
Ported and adapted from an old (circa 2014-2015) branch of mine.
DH helpers are based on CCBigNum since CCDH doesn't provide acceptable error
reporting, and SecDH interface is a bit weird and limiting. Given that all
mentioned APIs are private, it doesn't seem to matter which one we're using as
any of them could be changed/removed by Apple at any point.
* Switch Xcode project to CommonCrypto backend
2021-10-24 21:19:57 +03:00
Charles Kerr
3ec312dee8
refactor: cppcoreguidelines-init-variables pt. 12 ( #2022 )
...
* refactor: cppcoreguidelines-init-variables pt. 12 (#2022 )
2021-10-24 12:40:15 -05: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
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
91a447e3ea
fixup! refactor: use std::string in tau_tracker ( #1867 ) ( #2017 )
...
fix: memory leak regression
2021-10-22 17:01:55 -05:00
Charles Kerr
94ee81f98d
fixup! refactor: add tr_peer_id_t ( #2004 ) ( #2016 )
...
fix: array bounds read error introduced yesterday
2021-10-22 15:24:30 -05:00
Charles Kerr
9e716bb9dc
refactor: cppcoreguidelines-init-variables pt. 10 ( #2006 )
...
* refactor: uninit vars in peer-io.cc
* refactor: uninit vars in rpc-server.cc
* refactor: uninit vars in port-forwarding.cc
* refactor: uninit vars in torrent-ctor.cc
2021-10-22 08:51:36 -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
3b019ada3d
refactor: remove redundant assertions ( #2009 )
2021-10-21 19:02:38 -05:00
Charles Kerr
8cdc2c633e
refactor: replace tr_torrentFiles() with tr_torrentFileProgress() ( #1994 )
...
* refactor: s/tr_torrentFiles/tr_torrentFileProgress
Replace tr_torrentFiles() with a new function, tr_torrentFileProgress().
tr_torrentFiles() heap-allocated an array of progress structs. There is
nothing intrinsic in tr_torrent making batch computation more efficient,
so this PR replaces it with tr_torrentFileProgress(), a per-file variant
that doesn't use the heap.
2021-10-21 13:31:03 -05:00
Charles Kerr
b0fd4b474a
refactor: cppcoreguidelines-init-variables pt. 9 ( #1997 )
...
* refactor: fix uninit variable warnings in getopt, torrent-magnet
2021-10-21 12:40:36 -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
32395056e2
refactor: cppcoreguidelines-init-variables pt. 8 ( #1993 )
...
* refactor: fix uninit var warnings in rpcimpl
2021-10-20 11:31:20 -05:00
Charles Kerr
236a0965fa
refactor: tr_variant*Str() functions now take a std::string_view ( #1990 )
...
* refactor tr_variant*Str functions now take a std::string_view
* refactor: tr_torrentPrimaryMimeType returns a string-view
2021-10-19 21:30:50 -05:00
Charles Kerr
0b1e12ac5b
refactor: fix uninit var warnings in upnp, utils, verify, watchdir ( #1989 )
2021-10-19 11:09:38 -05:00
Charles Kerr
d7773c47b6
fix: crash on torrent with 65536 blocks per piece ( #1988 )
...
Fixes #1411 .
2021-10-18 19:25:00 -05:00
Daniel Kamil Kozar
77b11232f2
Add support for creating torrents with a source flag ( #443 )
...
* Add support for creating torrents with a source flag
* Add the source flag functionality for Mac OSX
* Source flag should be a part of the info dictionary
* Address review comments
* Rename "sourceFlag" to "source" since "Flag" is usually reserved for booleans.
* Free the "source" pointer in tr_metainfoFree.
* Add information about transmission-create argument to its manpage.
* Replace all occurences of "sourceFlag" with "source" and use "Source tag" in UI
* Settle on just "Source" in UI
* The last usage of "flag" hopefully bites the dust! ;-)
* Add a missing free for the source in tr_metainfoFree
* Add a "source" field to the torrent-get RPC method
* uncrustify
* Test for torrents having different infohashes due to different source flags.
This is the whole point of this feature, so it makes sense to test it.
* case is important
* try to incorporate the macosx xml changes
2021-10-18 18:05:39 -05:00
Mike Gelfand
bf41e1487a
Switch from gtk to gtkmm ( #1969 )
...
* Gtk to gtkmm: main.cc
* Gtk to gtkmm: details.cc
* Gtk to gtkmm: tr-window.cc
* Gtk to gtkmm: tr-prefs.cc
* Gtk to gtkmm: open-dialog.cc
* Gtk to gtkmm: file-list.cc
* Gtk to gtkmm: filter.cc
* Gtk to gtkmm: torrent-cell-renderer.cc
* Gtk to gtkmm: msgwin.cc
* Gtk to gtkmm: makemeta-ui.cc
* Gtk to gtkmm: relocate.cc
* Gtk to gtkmm: stats.cc
* Gtk to gtkmm: dialogs.cc
* Gtk to gtkmm: hig.cc
* Gtk to gtkmm: favicon.cc
* Gtk to gtkmm: icons.cc
* Gtk to gtkmm: tr-icon.cc
* Gtk to gtkmm: actions.cc
* Gtk to gtkmm: notify.cc
* Gtk to gtkmm: util.cc
* Gtk to gtkmm: tr-core.cc
* Gtk to gtkmm: conf.cc
* Glibmm <2.62 compatibility (missing Glib::ustring::sprintf)
* Glibmm <2.56 compatibility (missing Glib::RefPtr<>::get)
* Bump glibmm to 2.50.1+ (C++17 fix in Glib::Variant)
* Fix empty timestamps on message log export (broken by #1444 )
* Fix LGTM build issues
* Review fixes
2021-10-18 23:22:31 +03:00
Charles Kerr
462651bb8e
refactor: rpcimpl.cc getTorrents() returns a std::vector ( #1986 )
...
* refactor: rpcimpl.cc getTorrents() returns a std::vector
* refactor: tr_torrentQueueMove*() uses std::vector
2021-10-18 09:48:45 -05:00
Charles Kerr
2e50383760
refactor: cppcoreguidelines-init-variables pt. 6 ( #1979 )
...
* refactor: fix uninit var warnings in magnet.cc
* refactor: fix uninit var warnings in completion.cc
* refactor: fix uninit var warnings in session.cc
2021-10-18 07:51:02 -05:00
Charles Kerr
4739fd0959
fixup! Add total disk space to free-space RPC request ( #1682 ) ( #1984 )
...
fix: unused variable warning in free-space code
2021-10-17 22:04:20 -05:00
Charles Kerr
8be7f774db
fixup! tr_quark_new() now takes a std::string_view ( #1961 ) ( #1983 )
2021-10-17 20:59:08 -05:00
Charles Kerr
c6501c655c
refactor: add performance-* to libt .clang-tidy ( #1981 )
2021-10-17 16:09:58 -05:00
Charles Kerr
16e9a99fe9
refactor: clang-tidy --fix modernize-deprecated-headers ( #1980 )
2021-10-17 15:17:18 -05:00
Charles Kerr
2bc9959dc9
refactor: cppcoreguidelines-init-variables pt. 5 ( #1970 )
...
* fix: uninitialized variables in torrent.cc
2021-10-17 12:06:00 -05:00
Charles Kerr
4aba9b623f
fix: assertion failure in bitfield::bitfield(flags, n) ( #1976 )
...
* fix: bitfield construct-from-bool-array regression
2021-10-17 10:34:36 -05:00
Charles Kerr
290f7fc71a
fix: cppcoreguidelines-init-variables pt. 4 ( #1965 )
...
* fix: uninitialized variables in resume
2021-10-16 11:17:34 -05:00
Dmytro Lytovchenko
953f07375a
Modernize bitfield.cc: Storage changes and refactor ( #1927 )
...
* Modernize bitfield.cc: Storage changed to vector of bytes, return vector from getRaw, new Span readonly memory view
Modernize bitfield.cc: Code style/review notes
Modernize bitfield.cc: Code format
* Modernize bitfield.cc: Swap end and begin in bit counting code assertion
* Modernize bitfield.cc: Rewrite states and simplify code
* Modernize bitfield.cc: Fixing the code and tests
* Modernize bitfield.cc: Fixing tests
* Modernize bitfield.cc: Formatting; +std::size, +const
2021-10-16 09:04:19 -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
7b423b7e0d
refactor: tr_utf8clean now takes a std::string_view ( #1967 )
2021-10-15 20:02:40 -05:00
Charles Kerr
7e5e1f3812
refactor: tr_rpc_parse_list_str() takes a std::string_view ( #1966 )
2021-10-15 18:34:22 -05:00
Charles Kerr
3e7b8eb7bb
refactor: tr_parseNumberRange() takes a std::string_view ( #1962 )
...
* tr_parseNumberRange() now takes a std::string_view
2021-10-15 17:15:33 -05:00
Sander van Kasteel
d11ccf113c
Added primitive CORS header support ( #1885 )
...
* Copied over patch from github user fecristovao
* Added nullptr check
2021-10-15 15:10:09 -05:00
Charles Kerr
fb39c4663c
Fix/benc zero length dict key ( #1964 )
...
* fix: benc decoding bug that failed to parse hybrid torrents
2021-10-15 13:13:33 -05:00
Charles Kerr
23d85458f8
fix: cppcoreguidelines-init-variables pt. 3 ( #1954 )
...
* refactor: fix uninitialized variable warnings in variant code
* refactor: fix uninitialized variable warnings in web, webseed
2021-10-15 12:27:12 -05:00
Charles Kerr
567f1e48c8
tr_quark_new() now takes a std::string_view ( #1961 )
2021-10-15 08:28:47 -05:00
Charles Kerr
c98b4d33c3
refactor: use C++'s [[noreturn]] atrribute ( #1960 )
2021-10-14 22:16:52 -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
Johan
04f8b82308
Add total disk space to free-space RPC request ( #1682 )
...
* Add total space to free-space endpoint
* Update docs
2021-10-14 12:07:16 -05:00
Charles Kerr
ab82e155be
build: add clang tidy modernize loop convert ( #1949 )
...
* build: add clang-tidy check modernize-pass-by-value
* build: add clang-tidy check modernize-loop-convert
* refactor: constexpr
* refactor: make preallocGuess a std::array
2021-10-14 10:36:49 -05:00
Charles Kerr
5df6e4f88f
fix: uninitialized variables in announcer ( #1936 )
2021-10-14 09:22:28 -05:00
Rosen Penev
1f48884726
fix runtime with wolfSSL and fastmath ( #1950 )
...
wolfSSL's fastmath support requires options.h to be included before
anything else. Otherwise bad codepaths get taken and a crash occurs
during DH initialization.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-10-13 22:48:04 -05:00
Charles Kerr
af2af2a57e
build: add clang-tidy check modernize-pass-by-value ( #1946 )
2021-10-13 19:14:27 -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
306f0c4b80
fix: uninitialized variables pt 1: peer-mgr.cc ( #1932 )
...
* fix: uninitialized variables in peer-mgr.cc
2021-10-13 10:08:37 -05:00
Charles Kerr
98e16a178f
refactor: add an enumeration of the script types ( #1934 )
...
* refactor: add an enumeration of the script types
This simplifies the API by having a single set of functions that can be
used for getting/setting all the script types.
2021-10-12 22:46:12 -05:00
Charles Kerr
16dcc224ec
feat: add rpc-version-semver to RPC's session-get ( #1935 )
...
* feat: add rpc-version-semver to RPC's session-get
2021-10-12 22:03:28 -05:00
Charles Kerr
ba6513ed4a
feat: add an option to run a script when a torrent is added ( #1896 )
...
Co-authored-by: cfpp2p <cfpp2p>
2021-10-12 16:32:32 -05:00
Kirill Ovchinnikov
4daaea9ff1
Replace NULL back with nullptr (mistake after auto-rebase) ( #1933 )
2021-10-12 14:45:18 -05:00
Kirill Ovchinnikov
53e5200968
Slashes fixes ( #857 )
...
* Fix 409/404 error when request URI is exactly equal with server URL
* Fix 409/404 error when user requests "/web" path without trailing slash
* Fix errors when "rpc_url" setting has no trailing slash
* Code style fixes
* rpc-server.c: code refactoring and minor fixes
* Minor code style fix
* rpc-server.c: handle_request refactoring
Co-Authored-By: uprt <15909793+uprt@users.noreply.github.com>
* rpc-server.c: minor refactoring
Co-Authored-By: uprt <15909793+uprt@users.noreply.github.com>
* Fix clang-format warning
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-12 09:28:46 -05:00
Charles Kerr
62372602b4
refactor: run clang-tidy on bandwidth.h, .cc ( #1930 )
...
* chore: allow vararg calls in qt/.clang-tidy
An awkward PR since this isn't intended for the qt/ codebase at all, but
rather for use with libtransmission instead. But libtransmission is *so*
noncompilant at this point that this config can't be promoted higher up
the tree yet. Instead, it needs to be callable on-request by devs.
* refactor: make clang-tidy happy with bandwidth.h, .cc
* refactor: use getFooSpeedBytesPerSecond()
2021-10-12 01:04:22 -05:00
Charles Kerr
02b9e17207
refactor: make tr_peerIo a class ( #1928 )
...
* refactor: make tr_peerIo a class
No behavioral changes.
Use `new` and `delete` and change `struct` references to `class`.
* refactor: make some tr_peerIo fields const
* refactor: reorganize tr_peerIo fields to remove padding holes
* refactor: remove redundant field tr_peerIo.isIncoming
* refactor: make tr_peerIo.inbuf, .outbuf fields const*
2021-10-11 16:54:16 -05:00
Charles Kerr
8f8d6e5db2
refactor: remove padding holes from Bandwidth ( #1926 )
...
Another pahole patch. No functional changes; just rearranging fields.
old sizeof(Bandwidth): 848
new sizeof(Bandwidth): 816
2021-10-11 13:11:24 -05:00
Dmytro Lytovchenko
39376f2105
Modernize/bitfield.cc: Make into C++ ( #1917 )
...
* Modernize bitfield.cc: Grouped member functions into the struct; C++ construction
* Modernize bitfield.cc: Naming style similar to qt/ C++ source
* Modernize bitfield.cc: Bitfield test updated to new API
* Modernize bitfield.cc: Renames for private functions
* Modernize bitfield.cc: Formatting
* Modernize bitfield.cc: Remove struct in 'struct Bitfield' and update commented code too
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-11 12:29:14 -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
Dmytro Lytovchenko
a4d7e11a14
Bandwidth.cc bring naming closer to C++ style of code in qt/ ( #1914 )
...
* Modernize bitfield.cc: Rename tr_bandwidth to Bandwidth; Move dependent structs and consts into it
* Modernize bitfield.cc: Rename internal fields to lower_snake_case_ with suffix underscore
* Modernize bitfield.cc: Remove struct in 'struct Bandwidth' type usages
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-09 20:12:03 -05:00
Charles Kerr
0783e9691d
refactor: make tr_swarm a class ( #1915 )
2021-10-09 19:13:40 -05:00
Dmytro Lytovchenko
c287b82c00
Modernize bandwidth.cc: Moved functions inside struct ( #1895 )
...
* Modernize bandwidth.cc: Move functions inside struct
* Modernize bandwidth.cc: Review notes - remove extraneous checks, move small functions into .H file, etc
* Modernize bandwidth.cc: Construction and destruction is now via C++ new/delete
* Modernize bandwidth.cc: Rename used() to notifyBandwidthConsumed()
* Modernize bandwidth.cc: Children is now unordered_set
* Modernize bandwidth.cc: Allocation functions for peer bandwidth are now using std::vector instead of ptrArrays
* Modernize bandwidth.cc: Code formatting
* Modernize bandwidth.cc: Private fields after public; Minor review notes
* Modernize bandwidth.cc: Ungroup enums into constants; Docs minor update
* Modernize bitfield.cc: Docs comments changes; Using constexpr instead of const
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-09 07:52:09 -05:00
Charles Kerr
1ba64684f9
refactor: C++ify clients.cc ( #1907 )
...
* refactor: use C++17 for clients.cc
2021-10-08 21:46:10 -05:00
Charles Kerr
e9a264f29d
fix: minor dead store assignment warning in buildHandshakeMessage() ( #1901 )
2021-10-08 10:41:57 -05:00
Charles Kerr
454f55a9a2
fixup! refactor: prefer constexpr functions over static inline ones ( #1887 ) ( #1899 )
...
do not declare tr_peerMsgs as both a struct and a class
2021-10-07 20:12:53 -05:00
Charles Kerr
93f5ad8767
fix: dead store warning in torrent.cc when building without assertions ( #1898 )
2021-10-07 18:44:43 -05:00
Dmytro Lytovchenko
2312965285
Suggested modernization steps for each *.CC module ( #1801 )
...
* Suggested modernization steps
2021-10-07 12:18:44 -05:00
Charles Kerr
3b72a1feea
refactor: use C++ inheritance for tr_peer, tr_peerMsgs, and tr_webseed ( #1877 )
...
* refactor: use C++ inheritance for tr_peer, tr_peerMsgs, and tr_webseed
2021-10-07 08:33:55 -05:00
Charles Kerr
83f21b8e0e
refactor: prefer constexpr functions over static inline ones ( #1887 )
...
* refactor: prefer constexpr functions over static inline ones
2021-10-06 17:24:04 -05:00
Charles Kerr
f876a100a0
refactor: add [[fallthrough]] annotation ( #1886 )
2021-10-06 12:24:02 -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
cc204e0b2c
refactor: prefer "using" over "typedef" ( #1883 )
...
* refactor: prefer "using" over "typedef"
2021-10-06 09:26:07 -05:00
Charles Kerr
035ca23226
fix: sonarcloud false error from O_SEQUENTIAL use. ( #1882 )
...
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AXvcFXmBqMngl89XhIRU&open=AXvcFXmBqMngl89XhIRU
2021-10-06 08:09:16 -05:00
Charles Kerr
396afd8a42
refactor: remove unused tr_variant_string.session ( #1881 )
...
This was assigned but never used. Shrinks sizeof(tr_bandwidth) by 8 bytes.
2021-10-05 19:06:18 -05:00
Charles Kerr
3b49fa993c
refactor: remove unused tr_variant_string.quark ( #1880 )
...
This was assigned but never used. Shrinks sizeof(tr_variant) by 8 bytes.
2021-10-05 14:33:02 -05:00
Charles Kerr
8983af7e46
refactor: make some tr_session methods private ( #1879 )
...
These public methods weren't used anywhere except in tr_session, so make
them private.
tr_sessionGetAltSpeed_Bps()
tr_sessionGetPieceSpeed_Bps()
tr_sessionGetRawSpeed_Bps()
tr_sessionSetAltSpeed_Bps()
tr_sessionSetSpeedLimit_Bps()
2021-10-05 13:54:02 -05:00
Charles Kerr
6b7f2f9e53
refactor: make tr_info.errorString a const char*. ( #1878 )
...
this field now points to tr_torrent.errorString instead of copying into
a standalone char array.
old: sizeof(tr_torrent) 2640
new: sizeof(tr_torrent) 2136
2021-10-05 12:23:07 -05:00
Charles Kerr
976fec6e94
refactor: make mime-type array inline constexpr ( #1872 )
...
* refactor: make mime-type array inline constexpr
* fix: iwyu <iterator> for std::back_inserter
* fix: remove newly-unused variable in mime-types.js
2021-10-01 17:55:19 -05:00
Charles Kerr
6b71050000
fix: recent regressions ( #1873 )
...
* fixup! refactor: use std::set in tr_webseed (#1847 )
fix: use placement new to instantiate tr_webseeds.tasks
* fixup! refactor: use std::string in tr_scrape_response (#1866 )
fix: avoid assigning a nullptr to std::string
* fixup! refactor: use std::string in tr_scrape_response (#1866 )
fix: avoid assigning a nullptr to std::string
2021-10-01 16:57:30 -05:00
Charles Kerr
b546fd423f
fix: sonarcloud getopt warnings ( #1871 )
...
* fix: sonarcloud out-of-bound memory access warning
* fix: sonarcloud out-of-bound memory access warning
* fix: sonarcloud 64-to-32 narrowing warning
2021-10-01 12:47:23 -05:00