Merge pull request #7688

451b5a5 clang: fix -Wrange-loop-analysis warnings (selsta)
This commit is contained in:
luigi1111 2021-05-12 16:57:32 -05:00
commit c1a1f2a6ea
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 4 additions and 4 deletions

View file

@ -151,7 +151,7 @@ namespace epee
: byte_slice() : byte_slice()
{ {
std::size_t space_needed = 0; std::size_t space_needed = 0;
for (const auto source : sources) for (const auto& source : sources)
space_needed += source.size(); space_needed += source.size();
if (space_needed) if (space_needed)
@ -160,7 +160,7 @@ namespace epee
span<std::uint8_t> out{reinterpret_cast<std::uint8_t*>(storage.get() + 1), space_needed}; span<std::uint8_t> out{reinterpret_cast<std::uint8_t*>(storage.get() + 1), space_needed};
portion_ = {out.data(), out.size()}; portion_ = {out.data(), out.size()};
for (const auto source : sources) for (const auto& source : sources)
{ {
std::memcpy(out.data(), source.data(), source.size()); std::memcpy(out.data(), source.data(), source.size());
if (out.remove_prefix(source.size()) < source.size()) if (out.remove_prefix(source.size()) < source.size())

View file

@ -365,7 +365,7 @@ inline typename std::enable_if<sfinae::is_vector_like<Vec>::value, void>::type t
static_assert(!std::is_same<value_type, unsigned char>::value, "encoding an array of unsigned char is faster as hex"); static_assert(!std::is_same<value_type, unsigned char>::value, "encoding an array of unsigned char is faster as hex");
dest.StartArray(); dest.StartArray();
for (const auto& t : vec) for (auto t : vec)
toJsonValue(dest, t); toJsonValue(dest, t);
dest.EndArray(); dest.EndArray();
} }

View file

@ -51,7 +51,7 @@ namespace test
if (!cryptonote::find_tx_extra_field_by_type(extra_fields, key_field)) if (!cryptonote::find_tx_extra_field_by_type(extra_fields, key_field))
throw std::runtime_error{"invalid transaction"}; throw std::runtime_error{"invalid transaction"};
for (auto const& input : boost::adaptors::index(source.vout)) for (auto const input : boost::adaptors::index(source.vout))
{ {
source_amount += input.value().amount; source_amount += input.value().amount;
auto const& key = boost::get<cryptonote::txout_to_key>(input.value().target); auto const& key = boost::get<cryptonote::txout_to_key>(input.value().target);