Commit Graph

32 Commits

Author SHA1 Message Date
luzpaz f8203148f0
fix: fix various user facing and non-user facing typos (#3743)
* fix: fix various user facing and non-user facing typos

Found via `odespell -q 3 -S ./third-party,*.po,*.ts -L filetest,inout`
2022-08-31 11:28:54 -05:00
Charles Kerr f39826cc59
fix: clang-tidy-15 warnings (#3570)
* fix: bugprone-assignment-in-if-condition warning in tr_bitfield::countFlags()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_generic_new()

* fix: bugprone-assignment-in-if-condition warning in torrentRenamePath()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_inotify_on_event()

* fix: bugprone-assignment-in-if-condition warning in tr_variantWalk()

* fix: misc-const-correctness warning in TrackerDelegate::getText()

* fix: bugprone-assignment-in-if-condition warning in Session::updateStats()

* fix: performance-unnecessary-value-param warning in discoverThreadfunc()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_completion::setHasAll()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_torrentFileCompleted()

* fix: silence clang-analyzer-cplusplus.NewDelete warning when using QPointer

This appears to be a false positive; added NOLINT
2022-08-02 18:34:53 -05:00
Charles Kerr b889f0c395
chore: iwyu cstring, cstdlib, optional, unordered_set (#3532) 2022-07-27 16:53:39 -05:00
Charles Kerr ec79a2a888
fix: clang-tidy misc-const-correctness warnings (#3529) 2022-07-27 09:03:13 -05:00
Charles Kerr 67a078402d
fix: compiler warnings (#3123)
* fix: unused function warning tr_rpc_address_is_valid

* fix: unused variable warning old_byte_pop

* fix: method-can-be-made-static warning assertValidRules

* fix: signed-unsigned comparison warning

* fix: invalid case style warning for KBps

* chore: disable warning for static class member varaible
2022-05-22 21:22:34 -05:00
Charles Kerr a818ac9b13
perf: limit the scope of bitfield assertions (#2994)
Fixes #2830.
2022-04-26 19:51:24 -05:00
Charles Kerr 3643a8aee5
refactor: prefer std::vector as the default container (#2964) 2022-04-22 08:08:02 -05:00
goldsteinn f823df364e
Refactor: use popcnt in bitfield and cleanup warnings (#2950)
Co-authored-by: Noah Goldstein <goldstein.w.n@gmail.com>
2022-04-22 06:54:35 -05:00
Antoine Cœur bdac708762
docs: fix various typos and misspellings (#2955) 2022-04-21 09:28:38 -05:00
goldsteinn 9c84e85432
Refactor: Cleanup misc inefficiencies throughout the file (#2933)
Co-authored-by: Noah Goldstein <goldstein.w.n@gmail.com>
2022-04-17 10:54:38 -05:00
Charles Kerr ca5799a4a8
refactor: annotate nodiscard, constexpr, noexcept methods (#2862) 2022-04-01 19:48:09 -05:00
Charles Kerr 33cbe33229
refactor: remove varargs from TR_ASSERT_MSG() (#2861) 2022-04-01 18:00:51 -05:00
Charles Kerr f19c09ad9b
fix: bugprone-narrowing-conversions warnings in bitfield.cc (#2806) 2022-03-24 08:31:00 -05:00
David Beinder 53dc3a41b4
fix: return correct bitfield when fully downloaded (#2799)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-03-22 14:01:07 -05:00
Charles Kerr 1bafbd18ac
chore: add more descriptive assertion in bitfield (#2748)
Related to #2727
2022-03-09 17:43:42 -06:00
Charles Kerr ebb2ab6aee
chore: update license spdx abbreviations (#2582)
Use SPDX license list 3.0 terminology: replace deprecated identifiers
GPL-2.0" and "GPL-3.0" with "GPL-3.0-only" and "GPL-3.0-only".
2022-02-07 10:25:02 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 37a8046ed5
fix: more sonarcloud warnings (#2324) 2021-12-16 23:47:51 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -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 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 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 3008a992ca
fix: Bitfield.getRaw() regression (#2023)
* fix: Bitfield.getRaw() regression
2021-10-24 15:43:36 -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
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
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 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
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
Dmytro Lytovchenko 43d1ece562
C++ modernization: Replace NULLs with typesafe nullptrs (#1799)
Fixing CI errors and build errors
Reverted changes: NULL in EV_SET macro; Clang-formatting
Reverted changes: MacosX *.m files reverted from master
2021-09-14 19:18:09 -05:00
Charles Kerr 4c1b627647
refactor: port libtransmission to C++ (#1787)
Port libtransmission to C++. This PR doesn't refactor everything to c++.
Its code changes are only what was necessary to compile and link as c++.
See libtransmission/README.md for details on how to submit modernization 
patches!

Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2021-09-12 12:41:49 -05:00
Renamed from libtransmission/bitfield.c (Browse further)