Commit Graph

34 Commits

Author SHA1 Message Date
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr 60ef1abadf
refactor: tr_torrents (#2722)
* refactor: add tr_torrents container
2022-03-01 15:06:29 -08:00
Charles Kerr ba14ffa74c
refactor: sonarcloud "use if init" statements (#2587) 2022-02-07 23:44:31 -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 e908193027
fix: some use-init-statement sonarcloud warnings (#2563) 2022-02-01 19:09:11 -06:00
Charles Kerr 878405f862
Revert "fix: sonarcloud (#2558)" (#2562)
This reverts commit 8b9483f7fb.
2022-02-01 11:30:51 -06:00
Charles Kerr 8b9483f7fb
fix: sonarcloud (#2558)
* fix: add const modifier for functions

* fix: many sonarcloud use-init-statement warnings
2022-01-31 22:46:27 -06:00
Charles Kerr 5db993d348
chore: iwyu (#2553) 2022-01-31 17:05:35 -06:00
Charles Kerr 26bb9f3440
fix: sonarcloud code smells (#2486) 2022-01-23 18:53:35 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 3036a76beb
fix: sonarcloud code smells (#2421) 2022-01-17 12:39:50 -06:00
Charles Kerr f3228e9670
refactor: further decouple tr_torrent and tr_info (#2336) 2021-12-24 15:12:33 -06:00
Charles Kerr bd68d3a2fd
refactor: use tr_sha1_digest_t everywhere (#2330) 2021-12-21 16:14:15 -06:00
Charles Kerr b9406dfebb
refactor: even more torrent housekeeping (#2323) 2021-12-16 22:51:53 -06:00
Charles Kerr e4a172d39c
fix: sonarcloud (#2322)
* fix: sonarcloud warning - redundant cast

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - move #include to top of file

* fix: sonarcloud warning - implicit conversion loses precision

* fix: sonarcloud warning - confirm safe use of strlen

* fix: sonarcloud warning - refactor code to not nest more than three deep

* iwyu: cstring

* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr d00be0dec7
refactor: tr_torrentIsSeed() -> tr_torrent::isDone() (#2313) 2021-12-15 01:04:26 -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 0b58e7afa7 fix: log the correct errno on libevent socket error 2021-11-18 16:07:00 -06:00
Charles Kerr 3a4dd6de95
refactor: add TR_PRIsv and TR_PRIsv_ARG (#2080)
* refactor: add TR_PRIsv, TR_PRIsv_ARG macros

Like PRId64 and similar macros, these new macros are printf() helpers.
They are for passing std::string_views to printf()-like functions.
2021-11-01 17:14:17 -05:00
Charles Kerr f270d6081c
refactor: cppcoreguidelines-init-variables pt. 15 (#2055)
* refactor: uninit vars in subprocess-posix

* refactor: uninit vars in handshake

* refactor: uninit vars in file-posix

* refactor: uninit vars in platform-quota
2021-10-29 17:43:25 -05: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 c472cbd88d
refactor: only use [[maybe_unused]] if arg might be used (#2033)
* refactor: [[maybe_unused]] iff arg _might_ be used

If the arg is never used, comment out its name.
If the arg is _sometimes_ used e.g. with ifdefs, use [[maybe_unused]].
2021-10-24 11:41:54 -05:00
Charles Kerr 94ee81f98d
fixup! refactor: add tr_peer_id_t (#2004) (#2016)
fix: array bounds read error introduced yesterday
2021-10-22 15:24:30 -05:00
Charles Kerr b491da0ce4
refactor: add tr_peer_id_t (#2004)
* refactor: move handshake_done args into a convenience struct

* refactor: move peer_id from peerIo to tr_handshake

tr_handshake is a short-term object and tr_peerIo is long-term, so this
effectively narrows the scope of this field.

* chore: remove unused field tr_peerIo.isEncrypted

* refactor: add tr_peer_id_t type to hold peer ids.

this is a 'using' alias to a std::array<> so that code passing peer-ids
around doesn't have to memcmp / memcpy PEER_ID_LEN anymore. Also removes
the now-unused PEER_ID_LEN macro.
2021-10-21 21:40:55 -05:00
Charles Kerr 850b3caa61
refactor: prefer constexpr over enum for non enumerated constants (#1996)
refactor: prefer constexpr over enum for non-enumerated constants
2021-10-20 19:39:05 -05:00
Charles Kerr 16e9a99fe9
refactor: clang-tidy --fix modernize-deprecated-headers (#1980) 2021-10-17 15:17:18 -05:00
Charles Kerr fd5804fbb7
refactor: add readability-else-after-return to clang-tidy (#1956)
* refactor: add readability-else-after-return to clang-tidy
2021-10-14 14:26:38 -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 1fb5a79813
refactor: use maybe unused attribute (#1918)
* refactor: replace TR_UNUSED with [[maybe_unused]]
2021-10-10 11:52:26 -05:00
Charles Kerr e9a264f29d
fix: minor dead store assignment warning in buildHandshakeMessage() (#1901) 2021-10-08 10:41:57 -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 19de6035a5
fix: dead store warning in handshake.cc (#1803) 2021-09-14 21:23:53 -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/handshake.c (Browse further)