Commit Graph

49 Commits

Author SHA1 Message Date
Charles Kerr 64d9d57363
chore: fix minor clang-tidy warnings (#6275) 2023-11-21 09:02:03 -06:00
Julien 8ac323d5d6
chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
tearfur 2ec19e694d
chore: minor code cleanup (#5760) 2023-07-13 09:10:43 -05:00
tearfur 5ec4ca550e
chore: iwyu (#5746) 2023-07-08 10:24:03 -05:00
Charles Kerr c364abcb6f
chore: misc-include-cleaner (partial) (#5738) 2023-07-06 10:00:07 -05:00
Charles Kerr ce66e5c442
iwyu: remove, add std headers where used (#5694)
* chore: remove unused #include <array>

* chore: remove unused #include <chrono>

* chore: remove unused #include <set>

* chore: remove unused #include <algorithm>

* chore: remove unused #include "interned-string.h"

* chore: remove unused #include <list>

* chore: remove unused #include <optional>

* chore: iwyu <cstddef>

* chore: iwyu <ctime>

* chore: remove unused #include <cerrno>

* chore: remove unused #include <deque>

* chore: remove unused #include <vector>

* chore: remove unused #include <memory>

* chore: remove unused #include <unordered_set>

* chore: remove unused #include <array>

* chore: remove unused #include <mutex>

* chore: remove unused #include <functional>

* chore: remove unused #include <cmath>
2023-06-29 23:51:55 -05:00
Gary Elshaw 2f1d5a225c
fix: comment typos in libtransmission (#5473) 2023-04-30 13:29:29 -05:00
Charles Kerr 9d2507c7e3
refactor: snake_case in libtransmission class methods (#5428) 2023-04-22 20:25:55 -05:00
Charles Kerr 9158ae7126
feat: add tr_bitfield::intersects() (#5155) 2023-04-14 18:45:46 -05:00
Charles Kerr d72cb67cfb
chore: include directory name in libtransmission #includes (#5308) 2023-04-14 14:33:23 -05:00
Julien 4b8cfa2e57
chore: update copyrights to 2023 (#4834) 2023-02-11 14:49:42 -06:00
Charles Kerr c75f9a4a7a
refactor: tidy libtransmission symbol visibility (#4680) 2023-01-27 14:25:08 -06:00
Charles Kerr 7367d465b5
style: use the new paragraph comment style everywhere (#4634) 2023-01-22 13:21:30 -06:00
Cœur 7814e0736e
Fixed tr_bitfield::operator|= range (#4351) 2022-12-12 02:23:59 +00:00
Charles Kerr 5bd4f007ac
fix: remove invalid assertion from bitfield code (#4346) 2022-12-10 14:54:22 -06:00
Charles Kerr a8f2b840f7
perf: improve tr_peerMgrGetDesiredAvailable() (#4226) 2022-11-22 23:26:10 -06:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
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)