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
ecef0feb0c
refactor: clang-tidy in libtransmission ( #2578 )
...
* chore: enable cppcoreguidelines-slicing warning
* chore: enable readability-named-parameter warning
* chore: enable bugprone-reserved-identifier check
* chore: enable bugprone-not-null-terminated-result check
* chore: enable bugprone-sizeof-expression check
* chore: enable bugprone-incorrect-roundings check
* chore: enable misc-misplaced-const check
* chore: enable bugprone-suspicious-include check
* chore: enable bugprone-signed-char-misuse check
* chore: enable modernize-raw-string-literal check
* chore: enable readability-static-accessed-through-instance check
* chore: enable readability-implicit-bool-conversion check
* fixup! Merge branch 'main' into refactor/clang-tidy
2022-02-06 22:28:36 -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
5efec26a3b
refactor: SAX-like benc parser pt. 1 ( #2490 )
...
* refactor: add SAX-like benc parser
This is the first part of a series of PRs whose end goal is to avoid
the overhead of tr_variant when parsing bencoded data, e.g. when
parsing .torrent files on startup or when parsing announce/scrape
tracker responses.
This PR introduces a SAX-like benc parser, reimplements variant-benc
to use the SAX benc parser (so that we don't have two benc parsers),
and updates the benc + variant tests.
2022-01-24 00:30:00 -06:00
Charles Kerr
26bb9f3440
fix: sonarcloud code smells ( #2486 )
2022-01-23 18:53:35 -06:00
Charles Kerr
e51527203e
refactor: re-enable clang-tidy warnings ( #2485 )
2022-01-23 16:47:41 -06:00
Charles Kerr
df1cca9b57
chore: update copyright years, make notices consistent ( #2463 )
2022-01-20 12:27:56 -06:00
Charles Kerr
db23ca4c6b
refactor: replace tr_info with tr_torrent_metainfo ( #2397 )
...
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Charles Kerr
b0ee4007ff
refactor: include cleanups ( #2392 )
...
* refactor: include <memory> when using shared_ptr or unique_ptr
* refactor: include <cstdio> iff we use it
* refactor: include <cstring> iff we use it
* refactor: include <cstdlib> iff we use it
* refactor: include <string_view> or <string> iff we use it
* refactor: include <array> iff we use it
* refactor: include <ctime> iff we use it
* refactor: include <cctype> iff we use it
* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr
02aa2f46d4
refactor: don't use varargs in tr_error ( #2352 )
2021-12-27 20:32:22 -06:00
Charles Kerr
fa35b8ad39
refactor: use std::string in tr_variantToStr() ( #2351 )
...
* refactor: use std::string in tr_variantToStr()
2021-12-27 16:47:25 -06:00
Charles Kerr
deee2b043e
refactor: take string_view in tr_loadFile(), tr_saveFile() ( #2335 )
2021-12-24 13:37:34 -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
0f92232c65
fix: memleak regressions ( #2293 )
...
* fixup! refactor: add tr_saveFile() (#2267 )
fix: memleak regression
* fixup! fixup! refactor: make parts of tr file private (#2241 ) (#2281 )
fix: memory leak regression
* fixup! refactor: use C++ inheritance for tr_peer, tr_peerMsgs, and tr_webseed (#1877 )
fix: memory leak regression
2021-12-09 18:49:30 -06:00
Charles Kerr
e2be142ad6
fix: new warnings ( #2270 )
...
* fix: avoid potential resource leak in metainfo test
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205022335&defectInstanceId=52337396&mergedDefectId=1494638
* fix: use-init-statement warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX2MsJ_lWODkx6cuASq6&open=AX2MsJ_lWODkx6cuASq6
* fix: omit-redundant-override-specifier warning
Xref: https://sonarcloud.io/project/issues?id=transmission_transmission&issues=AX2MsJ5GWODkx6cuASq5&open=AX2MsJ5GWODkx6cuASq5
* fix: improper-use-of-negative-value warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020121&defectInstanceId=52337394&mergedDefectId=1494639
* fix: unchecked return value warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020168&defectInstanceId=52304887&mergedDefectId=1491438
* fix: potential-divide-by-zero warning
Xref: https://scan5.coverity.com/reports.htm#v48014/p10174/fileInstanceId=205020106&defectInstanceId=52337395&mergedDefectId=1494438
2021-12-05 21:12:21 -06:00
Charles Kerr
c656bee061
refactor: add tr_saveFile() ( #2267 )
...
* refactor: add tr_saveFile()
* refactor: add tr_ctorSaveContents()
2021-12-04 19:32:35 -06:00
Charles Kerr
a79a868257
refactor: make tr_variantFromBuf() public ( #2187 )
...
* refactor: add tr_variantFromBuf() and support inplace json/benc parsing
2021-11-17 23:37:35 -06:00
Charles Kerr
1ba81938bf
refactor: use std::string_view in benc parser ( #2182 )
...
* refactor: use std::string_view to parse benc
* refactor: simplify private parsing API in variant.cc
* chore: remove unneeded includes
* refactor: merge tr_variantFromBenc and tr_variantFromBencFull
2021-11-16 21:29:30 -06:00
Charles Kerr
73edd7b642
refactor: remove tr_variantDictFindStr() ( #2180 )
...
* refactor: remove tr_variantDictFindStr
2021-11-15 23:20:06 -06:00
Charles Kerr
250a2e3cc5
refactor: remove unused pieces of str to variant ( #2166 )
...
* feat: add tr_variantInitStrView()
* refactor: remove unused function tr_variantFromJsonFull
* refactor: tr_variantFromJson() now takes a string_view
* refactor: tr_variantFromBenc() now takes a string_view
* refactor: remove unused source arg from tr_variantFromBencFull()
* refactor: make tr_variantFromBuf() private
2021-11-15 01:21:57 -06:00
Charles Kerr
f46c4c4df9
refactor: remove tr_variantGetStr ( #2160 )
2021-11-14 17:28:37 -06:00
Charles Kerr
6571be2b95
feat: add tr_strvPath() ( #2134 )
...
* feat: add tr_strvJoin
* feat: add tr_strvPath
2021-11-12 18:10:04 -06:00
Charles Kerr
bbdb488224
perf: recycle variant tree walking helpers ( #2100 )
...
* perf: recycle the helper classes that walk through variant trees
2021-11-05 09:54:44 -05:00
Charles Kerr
790b0bb2b5
feat: add tr_quark_get_string_view() ( #2083 )
2021-11-01 20:01:27 -05:00
Charles Kerr
ba59060737
feat: new function tr_variantGetStrView() ( #2079 )
...
* feat: new method tr_variantGetStrView()
* test: add new variant tests
2021-11-01 16:30:18 -05:00
Charles Kerr
6bd229fcfd
fix: clang 13 nullptr warnings in libtransmission ( #2054 )
...
* fix: nullptr dereference warning in tr_peerMgrPeerStats
* fix: nullptr dereference warning in refillUpkeep()
* fix: nullptr dereference warning in tr_peerIsSeed()
* fix: nullptr dereference warning in rechokeUploads()
* fix: nullptr dereference warning in tr_variantDictAdd
* fix: nullptr dereference warning in tr_ioFindFileLocation()
* fix: nullptr dereference warning in tr_spawn_async_in_child()
* fix: nullptr dereference warning in calculatePiecePriority()
2021-10-27 20:16:24 -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
236a0965fa
refactor: tr_variant*Str() functions now take a std::string_view ( #1990 )
...
* refactor tr_variant*Str functions now take a std::string_view
* refactor: tr_torrentPrimaryMimeType returns a string-view
2021-10-19 21:30:50 -05:00
Charles Kerr
16e9a99fe9
refactor: clang-tidy --fix modernize-deprecated-headers ( #1980 )
2021-10-17 15:17:18 -05:00
Charles Kerr
23d85458f8
fix: cppcoreguidelines-init-variables pt. 3 ( #1954 )
...
* refactor: fix uninitialized variable warnings in variant code
* refactor: fix uninitialized variable warnings in web, webseed
2021-10-15 12:27:12 -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
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
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
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
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
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