Commit Graph

4754 Commits

Author SHA1 Message Date
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
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
Charles Kerr 14fc626943
refactor: use std::vector for tau_scrape_request.payload (#1865) 2021-09-30 14:00:02 -05:00
Charles Kerr a76cf22211
refactor: use std::map for tr_announcer.scrape_info (#1864)
* refactor: use std::map for tr_announcer.scrape_info
2021-09-30 13:18:46 -05:00
Charles Kerr 7c4f66c44e
refactor: use a std:: container in getBlockRequestPeers() (#1863)
* refactor: use std::vector in getBlockRequestPeers()
2021-09-30 10:08:34 -05:00
Charles Kerr 766d95b352
refactor: use std::vector in rechokeUploads() (#1862) 2021-09-30 09:20:55 -05:00
Charles Kerr 5395e2e545
refactor: use std::vector and std::array in quark.cc (#1861)
* refactor: use std::vector and std::array in quark.cc
2021-09-30 07:01:04 -05:00
Charles Kerr e47762c7ca
refactor: use std::vector in extract_parts_from_multipart() (#1860)
* refactor: use std::vector in extract_parts_from_multipart()
2021-09-29 21:14:31 -05:00
Charles Kerr 78e571d6f2
refactor: use std::set in tr_announcer.stops (#1859)
* refactor: use std::set for tr_announcer.stops
2021-09-29 18:42:50 -05:00
Charles Kerr 20b5a8c62b
refactor: use std::vector in tr_sessionGetNextQueuedTorrents (#1858) 2021-09-29 17:21:04 -05:00
Charles Kerr 27068cb4a6
refactor: use std::unordered_set in loadBlocklists (#1857)
* refactor: use std::unordered_set in loadBlocklists
2021-09-29 16:23:34 -05:00
Charles Kerr baafb68bfd
refactor: use std::unordered_set for tr_torrent.labels (#1856) 2021-09-29 14:52:19 -05:00
Charles Kerr e03bc8e5bc
refactor: replace tr_ptrArray with std::unordered_set in tr_watchdir_scan() (#1854)
* replace tr_ptrArray with std:: in tr_watchdir_scan
2021-09-29 12:25:52 -05:00
Charles Kerr 055a8ecb4d
refactor: use std::set in deleteLocalData() (#1853) 2021-09-29 10:22:04 -05:00
Charles Kerr b413e934ba
in variant-benc, use std::deque not tr_ptrArray (#1851) 2021-09-28 19:09:01 -05:00
Charles Kerr e2f0432146
in variant-json, use std::deque not tr_ptrArray (#1850) 2021-09-28 08:56:46 -05:00
Charles Kerr 7d2f65455c
refactor: remove unused tr_list code (#1849) 2021-09-27 17:57:20 -05:00
Charles Kerr 16a70e57d2
refactor: use std::set in verify.cc's verifyList (#1848)
* refactor: use std::set in verify.cc
2021-09-27 17:07:58 -05:00
Charles Kerr 2554adba9c
refactor: use std::set in tr_webseed (#1847) 2021-09-27 14:28:11 -05:00
Charles Kerr 12f052621d
refactor: replace tr_list with std::list in tr_session.blocklists (#1846) 2021-09-27 13:28:41 -05:00
Charles Kerr c42a6c785d
refactor: replace tr_list with std::set in web.cc (#1845) 2021-09-27 11:27:02 -05:00
Charles Kerr 3504933fba
refactor: replace tr_list with std::list in rpc-server whitelists (#1844) 2021-09-27 10:03:54 -05:00
Charles Kerr 96d3559a18
refactor: replace tr_list with std::list in tr_getWebClientDir() (#1843) 2021-09-27 08:45:21 -05:00
Charles Kerr 643074e7bb
refactor: use std::list in variant-json.cc (#1842)
* refactor: replace tr_list with std::deque in variant-json.cc struct ParentState
2021-09-27 07:46:38 -05:00
Charles Kerr 78d2074335
refactor: replace tr_list with std::list in sessionLoadTorrents() (#1841) 2021-09-26 17:23:11 -05:00
Charles Kerr 7f2578008d
refactor: tr_parseNumberRange returns std::vector. (#1838)
* refactor: tr_parseNumberRange returns std::vector.
2021-09-25 14:37:28 -05:00
Charles Kerr 17ee032dd8
refactor: remove TR_BEGIN_DECLS, TR_END_DECLS (#1837)
* refactor: remove TR_BEGIN_DECLS, TR_END_DECLS
2021-09-25 11:07:22 -05:00
Mike Gelfand c646a26c43
Reimplement quarks order check as a static assert (#1836) 2021-09-25 08:56:34 -05:00
Charles Kerr b92c609ed9
refactor: use std container for session torrents (#1832)
* refactor: use std container for session's torrents
2021-09-24 18:31:02 -05:00
Charles Kerr f3a97b13ef
build: use CXX_WARNING_FLAGS in libtransmission (#1824) 2021-09-21 08:56:34 -05:00
Dmytro Lytovchenko 312d18281d
C++ modernize: Replace MIN/MAX with type safe std::min/std::max (#1806)
* C++ modernize: Replace MIN/MAX with type safe std::min/std::max

* Template std::min/max invocations now explicitly use largest integer type

* torrent.cc did not have <algorithm> included

* MIN/MAX Changes for subprocess-win32.cc

* Using type{} style cast instead of template parameter in std::min/max

* 32-bit type cast errors with uint64_t versus size_t

* 32-bit type cast errors inout.cc and file.cc

* Missing include in windows code; Type cast error fixed

* Missing macro in win32 daemon; Replaced MIN in commented code with std::min

* Update libtransmission/tr-getopt.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/file-posix.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update tests/libtransmission/copy-test.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Update libtransmission/peer-mgr.cc

Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>

* Strlen returns size_t, remove cast

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
2021-09-19 15:41:35 -05:00
Charles Kerr 7e06c6401f
fix: clang warnings (#1814)
* fix: clang nullptr dereference warning in peer-io

* fix: shared variable name clang warning in peer-io

* fix: clang nullptr dereference warning in bitfield

* fix: shadowed variable in session.cc's parse_tos()

* fix: shadowed variable warning in sessionSetImpl()

* fix: tr_stringEndsWith() shadowed variable warning

* fix: a tr_peerMgrGetNextRequests() nullptr warning
2021-09-16 23:21:50 -05:00
Charles Kerr 25c4015d4a
fix: 'enumerated and non-enumerated type' warnings (#1810)
Simple change to silence warnings, changes the offending enums to be
constexprs. There is still more cleanup work to update other enums;
this just addresses the ones causing compiler warnings
2021-09-16 11:22:33 -05:00
Charles Kerr c80fb5f6e0
refactor: variant fixups (#1811)
* cleanups to the previous variant commit
2021-09-15 17:11:00 -05:00
Charles Kerr de4634f0a5
fix: clang++ nullptr dereference warning in tr_variantWalk() (#1800)
* fix: clang++ nullptr dereference warning in variant.cc
2021-09-15 13:51:19 -05:00
Charles Kerr e19353bf60
fix: dead-store asssignment warning in file-posix. (#1809)
* fix: dead-store asssignment warning in file-posix.

This also extracts the different per-platform preallocation methods into
their own standalone functions for readability and clarity.
2021-09-15 11:55:46 -05:00
Charles Kerr fc0ba38bc9
refactor: tr_quickfindFirstK --> std::partial_sort (#1794)
* refactor: tr_quickfindFirstK --> std::partial_sort

Remove `tr_quickfindFirstK()` and use `std::partial_sort()` instead.

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-15 09:32:07 -05:00
Charles Kerr abdfcb9681
fix: dead store warning in peer-msgs.cc (#1804) 2021-09-14 22:49:04 -05:00
Charles Kerr 19de6035a5
fix: dead store warning in handshake.cc (#1803) 2021-09-14 21:23:53 -05:00