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