fix: sonarcloud (#2865)

* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
This commit is contained in:
Charles Kerr
2022-04-02 09:06:02 -05:00
committed by GitHub
parent 46cc95f72e
commit 1cc9da26ba
42 changed files with 520 additions and 494 deletions

View File

@@ -1444,8 +1444,7 @@ static void onBlocklistFetched(tr_web::FetchResponse const& web_response)
// tr_blocklistSetContent needs a source file,
// so save content into a tmpfile
auto const filename = tr_pathbuf{ session->config_dir, "/blocklist.tmp"sv };
tr_error* error = nullptr;
if (!tr_saveFile(filename, content, &error))
if (tr_error* error = nullptr; !tr_saveFile(filename, content, &error))
{
fmt::format_to_n(
result,
@@ -1460,9 +1459,9 @@ static void onBlocklistFetched(tr_web::FetchResponse const& web_response)
}
// feed it to the session and give the client a response
int const rule_count = tr_blocklistSetContent(session, filename.c_str());
int const rule_count = tr_blocklistSetContent(session, filename);
tr_variantDictAddInt(data->args_out, TR_KEY_blocklist_size, rule_count);
tr_sys_path_remove(filename.c_str());
tr_sys_path_remove(filename);
tr_idle_function_done(data, "success");
}