Fix warnings - virtual destructors
- added virtual destructors to classes w/virtual methods - added qualification to std::abs to get the generic func
This commit is contained in:
parent
92169180fd
commit
7d90548bbb
10 changed files with 85 additions and 3 deletions
|
@ -2711,7 +2711,7 @@ TEST (rpc, account_info)
|
|||
std::string balance (response.json.get<std::string> ("balance"));
|
||||
ASSERT_EQ ("100", balance);
|
||||
std::string modified_timestamp (response.json.get<std::string> ("modified_timestamp"));
|
||||
ASSERT_TRUE (abs (time - stol (modified_timestamp)) < 5);
|
||||
ASSERT_TRUE (std::abs (time - stol (modified_timestamp)) < 5);
|
||||
std::string block_count (response.json.get<std::string> ("block_count"));
|
||||
ASSERT_EQ ("2", block_count);
|
||||
}
|
||||
|
@ -3087,4 +3087,4 @@ TEST (rpc, wallet_create_fail)
|
|||
system.poll ();
|
||||
}
|
||||
ASSERT_EQ ("Failed to create wallet. Increase lmdb_max_dbs in node config.", response.json.get<std::string> ("error"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ bool rai::from_string_hex (std::string const & value_a, uint64_t & target_a)
|
|||
return result;
|
||||
}
|
||||
|
||||
rai::block::~block ()
|
||||
{
|
||||
}
|
||||
|
||||
std::string rai::block::to_json ()
|
||||
{
|
||||
std::string result;
|
||||
|
@ -1112,3 +1116,23 @@ void rai::receive_hashables::hash (blake2b_state & hash_a) const
|
|||
blake2b_update (&hash_a, previous.bytes.data (), sizeof (previous.bytes));
|
||||
blake2b_update (&hash_a, source.bytes.data (), sizeof (source.bytes));
|
||||
}
|
||||
|
||||
rai::block_visitor::~block_visitor ()
|
||||
{
|
||||
}
|
||||
|
||||
rai::open_block::~open_block ()
|
||||
{
|
||||
}
|
||||
|
||||
rai::change_block::~change_block ()
|
||||
{
|
||||
}
|
||||
|
||||
rai::send_block::~send_block ()
|
||||
{
|
||||
}
|
||||
|
||||
rai::receive_block::~receive_block ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
virtual bool operator== (rai::block const &) const = 0;
|
||||
virtual rai::block_type type () const = 0;
|
||||
virtual void signature_set (rai::uint512_union const &) = 0;
|
||||
virtual ~block ();
|
||||
};
|
||||
class send_hashables
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ public:
|
|||
send_block (rai::block_hash const &, rai::account const &, rai::amount const &, rai::raw_key const &, rai::public_key const &, uint64_t);
|
||||
send_block (bool &, rai::stream &);
|
||||
send_block (bool &, boost::property_tree::ptree const &);
|
||||
virtual ~send_block ();
|
||||
using rai::block::hash;
|
||||
void hash (blake2b_state &) const override;
|
||||
uint64_t block_work () const override;
|
||||
|
@ -116,6 +118,7 @@ public:
|
|||
receive_block (rai::block_hash const &, rai::block_hash const &, rai::raw_key const &, rai::public_key const &, uint64_t);
|
||||
receive_block (bool &, rai::stream &);
|
||||
receive_block (bool &, boost::property_tree::ptree const &);
|
||||
virtual ~receive_block ();
|
||||
using rai::block::hash;
|
||||
void hash (blake2b_state &) const override;
|
||||
uint64_t block_work () const override;
|
||||
|
@ -156,6 +159,7 @@ public:
|
|||
open_block (rai::block_hash const &, rai::account const &, rai::account const &, std::nullptr_t);
|
||||
open_block (bool &, rai::stream &);
|
||||
open_block (bool &, boost::property_tree::ptree const &);
|
||||
virtual ~open_block ();
|
||||
using rai::block::hash;
|
||||
void hash (blake2b_state &) const override;
|
||||
uint64_t block_work () const override;
|
||||
|
@ -194,6 +198,7 @@ public:
|
|||
change_block (rai::block_hash const &, rai::account const &, rai::raw_key const &, rai::public_key const &, uint64_t);
|
||||
change_block (bool &, rai::stream &);
|
||||
change_block (bool &, boost::property_tree::ptree const &);
|
||||
virtual ~change_block ();
|
||||
using rai::block::hash;
|
||||
void hash (blake2b_state &) const override;
|
||||
uint64_t block_work () const override;
|
||||
|
@ -223,6 +228,7 @@ public:
|
|||
virtual void receive_block (rai::receive_block const &) = 0;
|
||||
virtual void open_block (rai::open_block const &) = 0;
|
||||
virtual void change_block (rai::change_block const &) = 0;
|
||||
virtual ~block_visitor ();
|
||||
};
|
||||
std::unique_ptr<rai::block> deserialize_block (rai::stream &);
|
||||
std::unique_ptr<rai::block> deserialize_block (rai::stream &, rai::block_type);
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
complete (true)
|
||||
{
|
||||
}
|
||||
virtual ~add_dependency_visitor ()
|
||||
{
|
||||
}
|
||||
void send_block (rai::send_block const & block_a) override
|
||||
{
|
||||
add_dependency (block_a.hashables.previous);
|
||||
|
@ -127,6 +130,10 @@ node (node_a)
|
|||
{
|
||||
}
|
||||
|
||||
rai::push_synchronization::~push_synchronization ()
|
||||
{
|
||||
}
|
||||
|
||||
bool rai::push_synchronization::synchronized (MDB_txn * transaction_a, rai::block_hash const & hash_a)
|
||||
{
|
||||
auto result (!node.store.unsynced_exists (transaction_a, hash_a));
|
||||
|
@ -1368,6 +1375,9 @@ public:
|
|||
connection (connection_a)
|
||||
{
|
||||
}
|
||||
virtual ~request_response_visitor ()
|
||||
{
|
||||
}
|
||||
void keepalive (rai::keepalive const &) override
|
||||
{
|
||||
assert (false);
|
||||
|
|
|
@ -25,7 +25,7 @@ class block_synchronization
|
|||
{
|
||||
public:
|
||||
block_synchronization (boost::log::sources::logger_mt &);
|
||||
~block_synchronization ();
|
||||
virtual ~block_synchronization ();
|
||||
// Return true if target already has block
|
||||
virtual bool synchronized (MDB_txn *, rai::block_hash const &) = 0;
|
||||
virtual std::unique_ptr<rai::block> retrieve (MDB_txn *, rai::block_hash const &) = 0;
|
||||
|
@ -42,6 +42,7 @@ class push_synchronization : public rai::block_synchronization
|
|||
{
|
||||
public:
|
||||
push_synchronization (rai::node &, std::function<rai::sync_result (MDB_txn *, rai::block const &)> const &);
|
||||
virtual ~push_synchronization ();
|
||||
bool synchronized (MDB_txn *, rai::block_hash const &) override;
|
||||
std::unique_ptr<rai::block> retrieve (MDB_txn *, rai::block_hash const &) override;
|
||||
rai::sync_result target (MDB_txn *, rai::block const &) override;
|
||||
|
|
|
@ -518,3 +518,7 @@ void rai::bulk_push::visit (rai::message_visitor & visitor_a) const
|
|||
{
|
||||
visitor_a.bulk_push (*this);
|
||||
}
|
||||
|
||||
rai::message_visitor::~message_visitor ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -219,5 +219,6 @@ public:
|
|||
virtual void bulk_pull (rai::bulk_pull const &) = 0;
|
||||
virtual void bulk_push (rai::bulk_push const &) = 0;
|
||||
virtual void frontier_req (rai::frontier_req const &) = 0;
|
||||
virtual ~message_visitor ();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -332,6 +332,9 @@ public:
|
|||
sender (sender_a)
|
||||
{
|
||||
}
|
||||
virtual ~network_message_visitor ()
|
||||
{
|
||||
}
|
||||
void keepalive (rai::keepalive const & message_a) override
|
||||
{
|
||||
if (node.config.logging.network_keepalive_logging ())
|
||||
|
@ -2226,6 +2229,9 @@ public:
|
|||
block (block_a)
|
||||
{
|
||||
}
|
||||
virtual ~confirmed_visitor ()
|
||||
{
|
||||
}
|
||||
void send_block (rai::send_block const & block_a) override
|
||||
{
|
||||
for (auto i (node.wallets.items.begin ()), n (node.wallets.items.end ()); i != n; ++i)
|
||||
|
|
|
@ -1546,6 +1546,9 @@ public:
|
|||
hash (hash_a)
|
||||
{
|
||||
}
|
||||
virtual ~history_visitor ()
|
||||
{
|
||||
}
|
||||
void send_block (rai::send_block const & block_a)
|
||||
{
|
||||
tree.put ("type", "send");
|
||||
|
|
|
@ -593,6 +593,9 @@ public:
|
|||
result (0)
|
||||
{
|
||||
}
|
||||
virtual ~representative_visitor ()
|
||||
{
|
||||
}
|
||||
void compute (rai::block_hash const & hash_a)
|
||||
{
|
||||
current = hash_a;
|
||||
|
@ -798,6 +801,9 @@ public:
|
|||
store (store_a)
|
||||
{
|
||||
}
|
||||
virtual ~set_predecessor ()
|
||||
{
|
||||
}
|
||||
void fill_value (rai::block const & block_a)
|
||||
{
|
||||
auto hash (block_a.hash ());
|
||||
|
@ -1724,6 +1730,9 @@ public:
|
|||
store (store_a)
|
||||
{
|
||||
}
|
||||
virtual ~root_visitor ()
|
||||
{
|
||||
}
|
||||
void send_block (rai::send_block const & block_a) override
|
||||
{
|
||||
result = block_a.previous ();
|
||||
|
@ -1788,6 +1797,7 @@ class ledger_processor : public rai::block_visitor
|
|||
{
|
||||
public:
|
||||
ledger_processor (rai::ledger &, MDB_txn *);
|
||||
virtual ~ledger_processor ();
|
||||
void send_block (rai::send_block const &) override;
|
||||
void receive_block (rai::receive_block const &) override;
|
||||
void open_block (rai::open_block const &) override;
|
||||
|
@ -1802,6 +1812,7 @@ class amount_visitor : public rai::block_visitor
|
|||
{
|
||||
public:
|
||||
amount_visitor (MDB_txn *, rai::block_store &);
|
||||
virtual ~amount_visitor ();
|
||||
void compute (rai::block_hash const &);
|
||||
void send_block (rai::send_block const &) override;
|
||||
void receive_block (rai::receive_block const &) override;
|
||||
|
@ -1818,6 +1829,7 @@ class balance_visitor : public rai::block_visitor
|
|||
{
|
||||
public:
|
||||
balance_visitor (MDB_txn *, rai::block_store &);
|
||||
virtual ~balance_visitor ();
|
||||
void compute (rai::block_hash const &);
|
||||
void send_block (rai::send_block const &) override;
|
||||
void receive_block (rai::receive_block const &) override;
|
||||
|
@ -1835,6 +1847,10 @@ store (store_a)
|
|||
{
|
||||
}
|
||||
|
||||
amount_visitor::~amount_visitor ()
|
||||
{
|
||||
}
|
||||
|
||||
void amount_visitor::send_block (rai::send_block const & block_a)
|
||||
{
|
||||
balance_visitor prev (transaction, store);
|
||||
|
@ -1879,6 +1895,10 @@ result (0)
|
|||
{
|
||||
}
|
||||
|
||||
balance_visitor::~balance_visitor ()
|
||||
{
|
||||
}
|
||||
|
||||
void balance_visitor::send_block (rai::send_block const & block_a)
|
||||
{
|
||||
result += block_a.hashables.balance.number ();
|
||||
|
@ -1933,6 +1953,9 @@ public:
|
|||
ledger (ledger_a)
|
||||
{
|
||||
}
|
||||
virtual ~rollback_visitor ()
|
||||
{
|
||||
}
|
||||
void send_block (rai::send_block const & block_a) override
|
||||
{
|
||||
auto hash (block_a.hash ());
|
||||
|
@ -2520,6 +2543,10 @@ transaction (transaction_a)
|
|||
{
|
||||
}
|
||||
|
||||
ledger_processor::~ledger_processor ()
|
||||
{
|
||||
}
|
||||
|
||||
rai::vote::vote (rai::vote const & other_a) :
|
||||
sequence (other_a.sequence),
|
||||
block (other_a.block),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue