Skip to content

Commit

Permalink
Fix code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Jun 22, 2021
1 parent 49fafcf commit 23263b0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
5 changes: 2 additions & 3 deletions libraries/chain/credit_offer_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ void_result credit_offer_update_evaluator::do_apply( const credit_offer_update_o
if( op.delta_amount.valid() )
d.adjust_balance( op.owner_account, -(*op.delta_amount) );

d.modify( *_offer, [&op,this]( credit_offer_object& coo ){
if( op.delta_amount.valid() )
{
d.modify( *_offer, [&op]( credit_offer_object& coo ){
if( op.delta_amount.valid() ) {
coo.total_balance += op.delta_amount->amount;
coo.current_balance += op.delta_amount->amount;
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/chain/db_notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,12 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
FC_ASSERT( aobj != nullptr );
accounts.insert( aobj->owner_account );
break;
} case credit_offer_object_type:{
} case credit_offer_object_type:{
const auto* aobj = dynamic_cast<const credit_offer_object*>( obj );
FC_ASSERT( aobj != nullptr );
accounts.insert( aobj->owner_account );
break;
} case credit_deal_object_type:{
} case credit_deal_object_type:{
const auto* aobj = dynamic_cast<const credit_deal_object*>( obj );
FC_ASSERT( aobj != nullptr );
accounts.insert( aobj->offer_owner );
Expand Down Expand Up @@ -575,7 +575,7 @@ void get_relevant_accounts( const object* obj, flat_set<account_id_type>& accoun
accounts.insert( aobj->bidder );
break;
} case impl_credit_deal_summary_object_type:{
const auto& aobj = dynamic_cast<const credit_deal_summary_object*>(obj);
const auto* aobj = dynamic_cast<const credit_deal_summary_object*>(obj);
FC_ASSERT( aobj != nullptr );
accounts.insert( aobj->offer_owner );
accounts.insert( aobj->borrower );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ namespace graphene { namespace protocol {
void validate()const override { FC_ASSERT( !"virtual operation" ); }

/// This is a virtual operation; there is no fee
share_type calculate_fee(const fee_parameters_type& k)const { return 0; }
share_type calculate_fee(const fee_parameters_type&)const { return 0; }
};

} } // graphene::protocol
Expand Down
10 changes: 5 additions & 5 deletions libraries/wallet/operation_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,28 +364,28 @@ std::string operation_result_printer::operator()(const void_result& x) const
return "";
}

std::string operation_result_printer::operator()(const object_id_type& oid)
std::string operation_result_printer::operator()(const object_id_type& oid) const
{
return std::string(oid);
}

std::string operation_result_printer::operator()(const asset& a)
std::string operation_result_printer::operator()(const asset& a) const
{
return _wallet.get_asset(a.asset_id).amount_to_pretty_string(a);
}

std::string operation_result_printer::operator()(const generic_operation_result& r)
std::string operation_result_printer::operator()(const generic_operation_result& r) const
{
return fc::json::to_string(r);
}

std::string operation_result_printer::operator()(const generic_exchange_operation_result& r)
std::string operation_result_printer::operator()(const generic_exchange_operation_result& r) const
{
// TODO show pretty amounts instead of raw json
return fc::json::to_string(r);
}

std::string operation_result_printer::operator()(const extendable_operation_result& r)
std::string operation_result_printer::operator()(const extendable_operation_result& r) const
{
// TODO show pretty amounts instead of raw json
return fc::json::to_string(r);
Expand Down
10 changes: 5 additions & 5 deletions libraries/wallet/operation_printer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ struct operation_result_printer
typedef std::string result_type;

std::string operator()(const graphene::protocol::void_result& x) const;
std::string operator()(const graphene::protocol::object_id_type& oid);
std::string operator()(const graphene::protocol::asset& a);
std::string operator()(const graphene::protocol::generic_operation_result& r);
std::string operator()(const graphene::protocol::generic_exchange_operation_result& r);
std::string operator()(const graphene::protocol::extendable_operation_result& r);
std::string operator()(const graphene::protocol::object_id_type& oid) const;
std::string operator()(const graphene::protocol::asset& a) const;
std::string operator()(const graphene::protocol::generic_operation_result& r) const;
std::string operator()(const graphene::protocol::generic_exchange_operation_result& r) const;
std::string operator()(const graphene::protocol::extendable_operation_result& r) const;
};

// BLOCK TRX OP VOP
Expand Down
2 changes: 1 addition & 1 deletion libraries/wallet/wallet_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace graphene { namespace wallet { namespace detail {
pcop.expiration_time = expiration;
signed_transaction& trx = _builder_transactions[handle];
std::transform(trx.operations.begin(), trx.operations.end(), std::back_inserter(pcop.proposed_ops),
[](const operation& op) -> op_wrapper { return op_wrapper(op); });
[](const operation& op) { return op_wrapper(op); });
if( review_period_seconds )
pcop.review_period_seconds = review_period_seconds;
trx.operations = {pcop};
Expand Down

0 comments on commit 23263b0

Please sign in to comment.