mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
fixup: new coverity warnings (#3864)
* fixup: memcmp length argument regression * perf: fix big parameter passed by value * chore: silence unchecked curl_easy_setopt return value warning
This commit is contained in:
parent
3bb8f3c03f
commit
fed6d180fe
4 changed files with 8 additions and 8 deletions
|
@ -581,10 +581,9 @@ void BlocklistFile::assertValidRules(std::vector<AddressRange> const& ranges)
|
||||||
|
|
||||||
for (size_t i = 1; i < std::size(ranges_ipv6); ++i)
|
for (size_t i = 1; i < std::size(ranges_ipv6); ++i)
|
||||||
{
|
{
|
||||||
auto last_end_address = ranges_ipv6[i - 1].end6_.s6_addr;
|
auto const& last_end_address = ranges_ipv6[i - 1].end6_;
|
||||||
auto start_address = ranges_ipv6[i].begin6_.s6_addr;
|
auto const& start_address = ranges_ipv6[i].begin6_;
|
||||||
|
TR_ASSERT(memcmp(&last_end_address, &start_address, sizeof(start_address)) > 0);
|
||||||
TR_ASSERT(memcmp(last_end_address, start_address, sizeof(&start_address)) > 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <cstddef> // for size_t
|
#include <cstddef> // for size_t
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
[[nodiscard]] virtual tr_sha1_digest_t finish() = 0;
|
[[nodiscard]] virtual tr_sha1_digest_t finish() = 0;
|
||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
[[nodiscard]] static tr_sha1_digest_t digest(T... args)
|
[[nodiscard]] static tr_sha1_digest_t digest(T const&... args)
|
||||||
{
|
{
|
||||||
auto context = tr_sha1::create();
|
auto context = tr_sha1::create();
|
||||||
(context->add(std::data(args), std::size(args)), ...);
|
(context->add(std::data(args), std::size(args)), ...);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
[[nodiscard]] virtual tr_sha256_digest_t finish() = 0;
|
[[nodiscard]] virtual tr_sha256_digest_t finish() = 0;
|
||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
[[nodiscard]] static tr_sha256_digest_t digest(T... args)
|
[[nodiscard]] static tr_sha256_digest_t digest(T const&... args)
|
||||||
{
|
{
|
||||||
auto context = tr_sha256::create();
|
auto context = tr_sha256::create();
|
||||||
(context->add(std::data(args), std::size(args)), ...);
|
(context->add(std::data(args), std::size(args)), ...);
|
||||||
|
|
|
@ -345,8 +345,8 @@ void doScrape(tr_torrent_metainfo const& metainfo)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
// execute the http scrape
|
// execute the http scrape
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, scrape_url.c_str());
|
(void)curl_easy_setopt(curl, CURLOPT_URL, scrape_url.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, TimeoutSecs);
|
(void)curl_easy_setopt(curl, CURLOPT_TIMEOUT, TimeoutSecs);
|
||||||
if (auto const res = curl_easy_perform(curl); res != CURLE_OK)
|
if (auto const res = curl_easy_perform(curl); res != CURLE_OK)
|
||||||
{
|
{
|
||||||
fmt::print("error: {:s}\n", curl_easy_strerror(res));
|
fmt::print("error: {:s}\n", curl_easy_strerror(res));
|
||||||
|
|
Loading…
Reference in a new issue