Commit Graph

14015 Commits

Author SHA1 Message Date
FX Coudert d3c3058f16
Mac client uses freed memory (#2234)
* Update main.mm
2021-11-27 15:59:46 -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
Jonas Malaco 6cc9afe1c2
gtk: accept dropping URLs from browsers onto the main window (#2232)
Unlike files, which come as a URI list, links dragged from browsers have
textual selection types:

- Firefox: text/plain;charset=utf-8
- Chrome: UTF8_STRING

If the URI list for files is empty, try to pass the selection text to
add_from_url().
2021-11-26 09:59:10 -06:00
Charles Kerr 8d2ca760e6
fix: crash when renaming top-level folder in qt (#2230) 2021-11-25 19:14:14 -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 3811f66a5c
fix: honor dark mode in GTK client's message log (#2218) 2021-11-24 15:36:23 -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
evils 449b83e340
man pages: remove commas in option listings (#2204) 2021-11-23 23:12:15 -06:00
Dzmitry Neviadomski 1459220b5b
[macOS] Fix downloading compressed peer blocklists (#2191)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-21 11:36:06 -06:00
Mike Gelfand 90715c6fee
Use stock options and statistics icons in statusbar (GTK client) (#2200) 2021-11-21 14:36:52 +03:00
buckmelanoma 3183b43050
Set stock icon for speed, options and statistics buttons in qt (#2179)
* Set stock icon for options and statistics buttons
2021-11-21 01:05:25 -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 617df25ba1 fix: coverity regression reported on 2021-11-17
Xref: https://scan5.coverity.com/reports.htm\#v48014/p10174/fileInstanceId\=203957995\&defectInstanceId\=52250103\&mergedDefectId\=1494366
2021-11-17 18:28:16 -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 0fba476917
refactor: fix a -Wshadow warning for a variable named optarg (#2184) 2021-11-16 12:31:29 -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
Mike Gelfand e3538f9371
Fix tracker cells rendering in RTL mode (GTK client) (#2173)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-15 21:53:32 +03: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
Mike Gelfand 54cd1a2612
Fix torrent cells rendering in RTL mode (GTK client) (#2170) 2021-11-15 19:32:41 +03:00
Tomáš Kelemen d3231ccf7d
web: preferences: add option to alter the download queue (#2071)
This minor change adds an option to modify the download queue size and
enable/disable the download queue via web interface.

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-15 10:20:07 -06:00
Mike Gelfand cc8ab3f79f
Fix activity filter combo size (GTK client) (#2169)
For non-C locales, empty string is translated into a multi-line text
containing descriptive translation headers, which then affects cell size
(and in turn, combo widget size) even though that cell is considered a
separator.
2021-11-15 17:25:11 +03:00
Mike Gelfand a26400c3dc
Fix inconsistent message log action state (GTK client) (#2167) 2021-11-15 15:26:44 +03: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