Charles Kerr
cee339e10d
refactor: remove tr_removeElementFromArray() ( #3731 )
2022-08-28 21:51:26 -05:00
Charles Kerr
072bb0322c
refactor: remove tr_quark_get_string() ( #3728 )
2022-08-28 16:17:07 -05:00
Charles Kerr
bfec98c323
refactor: avoid tr_new() in transmission-remote ( #3665 )
2022-08-17 20:25:42 -05:00
Charles Kerr
7fe2cf68b9
refactor: avoid tr_new(), tr_free() in tr_variant ( #3663 )
...
* refactor: remove unused tr_renew()
* refactor: remove unused tr_realloc()
* refactor: avoid tr_strvDup() in tr-quark
2022-08-17 14:44:18 -05:00
Charles Kerr
29f57bc296
chore: iwyu headers ( #3661 )
2022-08-17 11:08:36 -05:00
Charles Kerr
868fc1ab78
Refactor/tr variant from buf ( #3592 )
...
* refactor: use std::string in tr_watchdir_inotify_on_event()
* refactor: add template tr_variantFromBuf() variant
if it has .data() and .size() it is good
2022-08-05 16:12:45 -05:00
Charles Kerr
dab81c1af6
fix: readability-inconsistent-declaration-parameter-name warnings in libtransmission ( #3572 )
2022-08-03 01:15:37 -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
2293f4336a
perf: use fast_float to parse floating-point numbers ( #3092 )
2022-05-16 00:06:17 -05:00
Charles Kerr
ed897f93f2
refactor: remove evbuffer_free_to_str() ( #2967 )
2022-04-22 13:05:49 -05:00
Charles Kerr
f79a75cb21
test: fuzz test tr_variantFromBuf() ( #2892 )
...
* test: fuzz test tr_torrent_metainfo.parseBenc()
* fix: better error-checking in benc string parsing
* fix: return benc failure if the parse stack is unbalanced
* fix: stack range error when logging json parse errors
* test: fuzz test tr_variantFromBuf()
2022-04-06 16:39:39 -05:00
Charles Kerr
4c2cb23c24
refactor: tr_variantToFile() takes a string_view filename ( #2824 )
...
* chore: fix shadowed variable warning
"byte" is declared by a third-party UTP header
* refactor: tr_variantFromFile, tr_variantToFile take a string_view filename
2022-03-25 22:39:08 -05:00
Charles Kerr
977b2a1bab
refactor: tr_loadFile() tr_saveFile() take a std::string_view filename arg ( #2822 )
...
* refactor: tr_saveFile takes a string_view
* refactor: tr_saveFile, tr_loadFile take string_view filename
2022-03-25 19:31:27 -05:00
Charles Kerr
0be920156b
refactor: fmt part 3 ( #2773 )
2022-03-15 19:51:36 -05:00
Charles Kerr
a942c67199
refactor: use fmt ( #2758 )
...
* deps: use fmt (8.1.1 tag) to build log strings
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-13 23:43:35 -05: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
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