Skip to content

Commit

Permalink
style: clang-tidy auto fixes (#1730)
Browse files Browse the repository at this point in the history
Fixes #1729. Please review and commit clang-tidy fixes.

Co-authored-by: kuznetsss <[email protected]>
  • Loading branch information
github-actions[bot] and kuznetsss authored Nov 12, 2024
1 parent 6b61984 commit 0e25c0c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/data/CassandraBackend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class BasicCassandraBackend : public BackendInterface {

auto mptObjects = doFetchLedgerObjects(mptKeys, ledgerSequence, yield);

auto it = std::remove_if(mptObjects.begin(), mptObjects.end(), [](Blob const& mpt) { return mpt.size() == 0; });
auto it = std::remove_if(mptObjects.begin(), mptObjects.end(), [](Blob const& mpt) { return mpt.empty(); });

mptObjects.erase(it, mptObjects.end());

Expand Down Expand Up @@ -948,7 +948,8 @@ class BasicCassandraBackend : public BackendInterface {
writeMPTHolders(std::vector<MPTHolderData> const& data) override
{
std::vector<Statement> statements;
for (auto [mptId, holder] : data)
statements.reserve(data.size());
for (auto [mptId, holder] : data)
statements.push_back(schema_->insertMPTHolder.bind(std::move(mptId), std::move(holder)));

executor_.write(std::move(statements));
Expand Down
13 changes: 9 additions & 4 deletions src/etl/MPTHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@
*/
//==============================================================================

#include "data/BackendInterface.hpp"
#include "data/DBHelpers.hpp"
#include "data/Types.hpp"

#include <fmt/core.h>
#include <ripple/protocol/STBase.h>
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/TxMeta.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxFormats.h>

#include <vector>
#include <optional>
#include <string>

namespace etl {

Expand Down
1 change: 1 addition & 0 deletions src/rpc/RPCHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@

#include <algorithm>
#include <array>
#include <cassert>
#include <chrono>
#include <cstddef>
#include <cstdint>
Expand Down
7 changes: 4 additions & 3 deletions src/rpc/handlers/MPTHolders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@
#include "rpc/RPCHelpers.hpp"
#include "rpc/common/Types.hpp"

#include <boost/json/array.hpp>
#include <boost/json/conversion.hpp>
#include <boost/json/object.hpp>
#include <boost/json/value.hpp>
#include <ripple/basics/base_uint.h>
#include <ripple/basics/strHex.h>
#include <ripple/protocol/AccountID.h>
#include <ripple/protocol/ErrorCodes.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/LedgerHeader.h>
#include <ripple/protocol/jss.h>
#include <ripple/protocol/nft.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STLedgerEntry.h>

#include <optional>
#include <string>
Expand Down Expand Up @@ -73,7 +74,7 @@ MPTHoldersHandler::process(MPTHoldersHandler::Input input, Context const& ctx) c
output.limit = limit;
output.ledgerIndex = lgrInfo.seq;

boost::json::array mpts;
boost::json::array const mpts;
for (auto const& mpt : dbResponse.mptokens) {
ripple::STLedgerEntry const sle{ripple::SerialIter{mpt.data(), mpt.size()}, keylet::mptIssuance(mptID).key};
boost::json::object mptJson;
Expand Down
2 changes: 1 addition & 1 deletion tests/common/util/TestObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ CreateMPTokenObject(std::string_view accountId, ripple::uint192 issuanceID, std:
mptoken.setFieldH256(ripple::sfPreviousTxnID, ripple::uint256{});
mptoken.setFieldU32(ripple::sfPreviousTxnLgrSeq, 0);

if (mptAmount)
if (mptAmount != 0u)
mptoken.setFieldU64(ripple::sfMPTAmount, mptAmount);

return mptoken;
Expand Down
1 change: 1 addition & 0 deletions tests/unit/rpc/handlers/LedgerDataTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <gtest/gtest.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Indexes.h>

#include <cstdint>
#include <optional>
Expand Down
1 change: 1 addition & 0 deletions tests/unit/rpc/handlers/MPTHoldersTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <ripple/basics/base_uint.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/LedgerHeader.h>
#include <xrpl/basics/strHex.h>

#include <functional>
#include <optional>
Expand Down

0 comments on commit 0e25c0c

Please sign in to comment.