mirror of
https://github.com/transmission/transmission
synced 2024-12-27 01:57:52 +00:00
fix: sonarcloud use-init-statement warnings in new code (#2536)
This commit is contained in:
parent
52f6e80a61
commit
314aa6925d
1 changed files with 3 additions and 8 deletions
|
@ -211,9 +211,7 @@ void tr_announcerParseHttpAnnounceResponse(tr_announce_response& response, std::
|
||||||
|
|
||||||
bool Int64(int64_t value, Context const& context) override
|
bool Int64(int64_t value, Context const& context) override
|
||||||
{
|
{
|
||||||
auto const key = currentKey();
|
if (auto const key = currentKey(); key == "interval")
|
||||||
|
|
||||||
if (key == "interval")
|
|
||||||
{
|
{
|
||||||
response_.interval = value;
|
response_.interval = value;
|
||||||
}
|
}
|
||||||
|
@ -248,9 +246,7 @@ void tr_announcerParseHttpAnnounceResponse(tr_announce_response& response, std::
|
||||||
|
|
||||||
bool String(std::string_view value, Context const& context) override
|
bool String(std::string_view value, Context const& context) override
|
||||||
{
|
{
|
||||||
auto const key = currentKey();
|
if (auto const key = currentKey(); key == "failure reason"sv)
|
||||||
|
|
||||||
if (key == "failure reason"sv)
|
|
||||||
{
|
{
|
||||||
response_.errmsg = value;
|
response_.errmsg = value;
|
||||||
}
|
}
|
||||||
|
@ -399,8 +395,7 @@ void tr_announcerParseHttpScrapeResponse(tr_scrape_response& response, std::stri
|
||||||
{
|
{
|
||||||
BasicHandler::Key(value, context);
|
BasicHandler::Key(value, context);
|
||||||
|
|
||||||
auto needle = tr_sha1_digest_t{};
|
if (auto needle = tr_sha1_digest_t{}; depth() == 2 && key(1) == "files"sv && std::size(value) == std::size(needle))
|
||||||
if (depth() == 2 && key(1) == "files"sv && std::size(value) == std::size(needle))
|
|
||||||
{
|
{
|
||||||
std::copy_n(reinterpret_cast<std::byte const*>(std::data(value)), std::size(value), std::data(needle));
|
std::copy_n(reinterpret_cast<std::byte const*>(std::data(value)), std::size(value), std::data(needle));
|
||||||
auto const it = std::find_if(
|
auto const it = std::find_if(
|
||||||
|
|
Loading…
Reference in a new issue