Commit Graph

13706 Commits

Author SHA1 Message Date
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
Oleg Chashko 5947329a51
Fix: issue #1889, #1894, #1912, #1913 (#1923)
* Fix: issue #1889

* Fix: issue #1894

* Fix: issue #1912

* Fix: issue #1913
2021-10-13 11:04:10 -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 148de2da94
chore: allow vararg calls in qt/.clang-tidy (#1929)
let clang-tidy allow C-style vararg functions
2021-10-11 17:37:43 -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
Dinesh Manajipet ac41837ae9
Feature: Support Batch Adding Tracker Urls in Qt UI (#1161)
Adding tracker urls one at a time is very tedious.
This lEts you add multiple tracker urls at oNce, 1 trAcker url per line.
As a bonus, this also takes care of trailing spaces when pasting urls.

Fixes #1148
And this seems to be a requested feature:
https://forum.transmissionbt.com/viewtopic.php?t=18958

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-10-10 22:19:36 -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
shelvacu d2241cda67
Explain port-forwarding-enabled (#1900)
I'm basing this information on 454f55a9a2/gtk/tr-prefs.cc (L1185-L1186) which if I'm interpreting it right means that the same setting is labeled as "Use UPnP or NAT-PMP port forwarding from my router".
2021-10-08 09:10:34 -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 435f17641a
Don't set the path attribute when setting a cookie. (#1893)
Co-authored-by: Robert Crowston <crowston@protonmail.com>
2021-10-07 11:16:09 -05:00
Charles Kerr 959cbe2c64
web: fix sorting of renamed torrents by name (#1892)
Co-authored-by: Benedikt Morbach <benedikt.morbach@googlemail.com>
2021-10-07 09:44:28 -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
Mike Gelfand c8d0c8db2e Switch from zip to 7z for PDBs archive on AppVeyor
This reduces its size by more than 1.5 times.
2021-10-05 20:33:09 +03: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 916d418824
fix: some Coverity regressions reported on 2021-09-16 (#1870)
* fix: coverity regressions reported on 2021-10-01

leaks introduced by 3fd5c81a

* fix: resource leak in test utility filesAreIdentical()

* fix: use-after-free warning in test code for tr_urlParse()

* fix: false warning for unterminated c string

* fix: false unchecked return value in test code

cid 1491881

* fix: unterminated c string in test code

cid 1491890

* refactor: slightly better assertions in file-test
2021-10-01 15:28:01 -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
Charles Kerr c87d22d53f
fix: coverity regressions reported on 2021-10-01 (#1869)
leaks introduced by 3fd5c81a
2021-10-01 08:21:05 -05:00
Charles Kerr 392c375b17
refactor: use std::vector in tau_announce_request (#1868) 2021-10-01 07:18:49 -05:00
Charles Kerr d8af31a866
refactor: use std::string in tau_tracker (#1867) 2021-10-01 06:29:53 -05:00
Charles Kerr 3fd5c81a22
refactor: use std::string in tr_scrape_response (#1866) 2021-09-30 16:33:31 -05:00