Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

605 clean warnings #609

Merged
merged 3 commits into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 2 additions & 43 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ namespace steemit { namespace app {
int32_t block_num = int32_t(b.block_num());
if( _callbacks.size() )
{
for( int32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num )
for( size_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num )
{
const auto& trx = b.transactions[trx_num];
auto id = trx.id();
auto itr = _callbacks.find(id);
if( itr == _callbacks.end() ) continue;
confirmation_callback callback = itr->second;
itr->second = [](variant){};
callback( fc::variant(transaction_confirmation( id, block_num, trx_num, false )) );
callback( fc::variant(transaction_confirmation( id, block_num, int32_t(trx_num), false )) );
}
}

Expand All @@ -193,53 +193,12 @@ namespace steemit { namespace app {
transaction_id_type txid_byval = txid; // can't pass in by reference as it's going to be deleted
callback( fc::variant(transaction_confirmation{ txid_byval, block_num, -1, true}) );

//fc::async( [capture_this,block_num,txid_byval,callback](){
_callbacks.erase( cb_it );
}
_callbacks_expirations.erase( exp_it );
}
}); /// fc::async

/*
if( _callbacks.size() )
{
for( int32_t trx_num = 0; trx_num < b.transactions.size(); ++trx_num )
{
const auto& trx = b.transactions[trx_num];
auto id = trx.id();
auto itr = _callbacks.find(id);
if( itr != _callbacks.end() )
{
confirmation_callback callback = itr->second;
fc::async( [capture_this,id,block_num,trx_num,callback](){ callback( fc::variant(transaction_confirmation( id, block_num, trx_num, false )) ); } );
_callbacks.erase( itr );
}
}
}
/// clear all expirations
while( true )
{
auto exp_it = _callbacks_expirations.begin();
if( exp_it == _callbacks_expirations.end() )
break;
if( exp_it->first >= b.timestamp )
break;
for( const transaction_id_type& txid : exp_it->second )
{
auto cb_it = _callbacks.find( txid );
// If it's empty, that means the transaction has been confirmed and has been deleted by the above check.
if( cb_it == _callbacks.end() )
continue;
std::shared_ptr< network_broadcast_api > capture_this = shared_from_this();
confirmation_callback callback = cb_it->second;
transaction_id_type txid_byval = txid; // can't pass in by reference as it's going to be deleted
fc::async( [capture_this,block_num,txid_byval,callback](){ callback( fc::variant(transaction_confirmation{ txid_byval, block_num, -1, true}) ); } );
_callbacks.erase( cb_it );
}
_callbacks_expirations.erase( exp_it );
}
*/

}

void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
Expand Down
4 changes: 1 addition & 3 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1380,8 +1380,6 @@ vector<discussion> database_api::get_discussions_by_comments( const discussion_q
auto start_author = *( query.start_author );
auto start_permlink = query.start_permlink ? *( query.start_permlink ) : "";

const auto& account = my->_db.get_account( start_author );

const auto& c_idx = my->_db.get_index< comment_index >().indices().get< by_permlink >();
const auto& t_idx = my->_db.get_index< comment_index >().indices().get< by_author_last_update >();
auto comment_itr = t_idx.lower_bound( start_author );
Expand Down Expand Up @@ -1511,7 +1509,7 @@ vector<discussion> database_api::get_discussions_by_author_before_date(
#ifndef IS_LOW_MEM
FC_ASSERT( limit <= 100 );
result.reserve( limit );
int count = 0;
uint32_t count = 0;
const auto& didx = my->_db.get_index<comment_index>().indices().get<by_author_last_update>();

if( before_date == time_point_sec() )
Expand Down
24 changes: 14 additions & 10 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,12 +1269,12 @@ void database::update_witness_schedule4()
modify( wso, [&]( witness_schedule_object& _wso )
{
// active witnesses has exactly STEEMIT_MAX_WITNESSES elements, asserted above
for( int i = 0; i < active_witnesses.size(); i++ )
for( size_t i = 0; i < active_witnesses.size(); i++ )
{
_wso.current_shuffled_witnesses[i] = active_witnesses[i];
}

for( int i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ )
for( size_t i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ )
{
_wso.current_shuffled_witnesses[i] = account_name_type();
}
Expand Down Expand Up @@ -1425,12 +1425,12 @@ void database::update_witness_schedule()
_wso.current_shuffled_witnesses.push_back( w );
*/
// active witnesses has exactly STEEMIT_MAX_WITNESSES elements, asserted above
for( int i = 0; i < active_witnesses.size(); i++ )
for( size_t i = 0; i < active_witnesses.size(); i++ )
{
_wso.current_shuffled_witnesses[i] = active_witnesses[i];
}

for( int i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ )
for( size_t i = active_witnesses.size(); i < STEEMIT_MAX_WITNESSES; i++ )
{
_wso.current_shuffled_witnesses[i] = account_name_type();
}
Expand Down Expand Up @@ -2790,7 +2790,7 @@ void database::init_genesis( uint64_t init_supply )
} );
}

const auto& gpo = create< dynamic_global_property_object >( [&]( dynamic_global_property_object& p )
create< dynamic_global_property_object >( [&]( dynamic_global_property_object& p )
{
p.current_witness = STEEMIT_INIT_MINER_NAME;
p.time = STEEMIT_GENESIS_TIME;
Expand Down Expand Up @@ -3126,7 +3126,7 @@ try {
modify( get_feed_history(), [&]( feed_history_object& fho )
{
fho.price_history.push_back( median_feed );
int steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW_PRE_HF_16;
size_t steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW_PRE_HF_16;
if( has_hardfork( STEEMIT_HARDFORK_0_16__551) )
steemit_feed_history_window = STEEMIT_FEED_HISTORY_WINDOW;

Expand Down Expand Up @@ -3499,10 +3499,14 @@ void database::update_last_irreversible_block()
if( tmp_head )
log_head_num = tmp_head->block_num();

while( log_head_num < dpo.last_irreversible_block_num )
if( log_head_num < dpo.last_irreversible_block_num )
{
_block_log.append( *fetch_block_by_number( log_head_num + 1 ) );
log_head_num++;
while( log_head_num < dpo.last_irreversible_block_num )
{
_block_log.append( *fetch_block_by_number( log_head_num + 1 ) );
log_head_num++;
}
_block_log.flush();
}
}
}
Expand Down Expand Up @@ -3969,7 +3973,7 @@ void database::set_hardfork( uint32_t hardfork, bool apply_now )
{
auto const& hardforks = get_hardfork_property_object();

for( int i = hardforks.last_hardfork + 1; i <= hardfork && i <= STEEMIT_NUM_HARDFORKS; i++ )
for( uint32_t i = hardforks.last_hardfork + 1; i <= hardfork && i <= STEEMIT_NUM_HARDFORKS; i++ )
{
if( i <= STEEMIT_HARDFORK_0_5__54 )
_hardfork_times[i] = head_block_time();
Expand Down
3 changes: 1 addition & 2 deletions libraries/net/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,6 @@ namespace graphene { namespace net { namespace detail {
{
VERIFY_CORRECT_THREAD();
item_hash_t reference_point = peer->last_block_delegate_has_seen;
uint32_t reference_point_block_num = _delegate->get_block_number(peer->last_block_delegate_has_seen);

// when we call _delegate->get_blockchain_synopsis(), we may yield and there's a
// chance this peer's state will change before we get control back. Save off
Expand Down Expand Up @@ -3366,7 +3365,7 @@ namespace graphene { namespace net { namespace detail {
bool new_transaction_discovered = false;
for (const item_hash_t& transaction_message_hash : contained_transaction_message_ids)
{
size_t items_erased = _items_to_fetch.get<item_id_index>().erase(item_id(trx_message_type, transaction_message_hash));
_items_to_fetch.get<item_id_index>().erase(item_id(trx_message_type, transaction_message_hash));
// there are two ways we could behave here: we could either act as if we received
// the transaction outside the block and offer it to our peers, or we could just
// forget about it (we would still advertise this block to our peers so they should
Expand Down
2 changes: 0 additions & 2 deletions libraries/plugins/account_by_key/account_by_key_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ void account_by_key_plugin_impl::update_key_lookup( const account_authority_obje
for( const auto& item : a.posting.key_auths )
new_keys.insert( item.first );

const auto& lookup_idx = db.get_index< key_lookup_index >().indices().get< by_key >();

// For each key that needs a lookup
for( const auto& key : new_keys )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ void account_history_plugin_impl::on_operation( const operation_notification& no
flat_set<account_name_type> impacted;
steemit::chain::database& db = database();

const auto& hist_idx = db.get_index<account_history_index>().indices().get<by_account>();
const operation_object* new_obj = nullptr;
app::operation_get_impacted_accounts( note.op, impacted );

Expand Down
2 changes: 0 additions & 2 deletions libraries/plugins/auth_util/auth_util_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ void auth_util_plugin::plugin_initialize( const boost::program_options::variable

void auth_util_plugin::plugin_startup()
{
chain::database& db = database();

app().register_api_factory< auth_util_api >( "auth_util_api" );
}

Expand Down
1 change: 0 additions & 1 deletion libraries/plugins/debug_node/debug_node_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ uint32_t debug_node_plugin::debug_generate_blocks(
if( logging ) wlog( "Modified key for witness ${w}", ("w", scheduled_witness_name) );
debug_update( [=]( chain::database& db )
{
const auto& scheduled_witness = db.get_witness( scheduled_witness_name );
db.modify( db.get_witness( scheduled_witness_name ), [&]( chain::witness_object& w )
{
w.signing_key = debug_public_key;
Expand Down
4 changes: 2 additions & 2 deletions libraries/plugins/follow/follow_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ vector< comment_feed_entry > follow_api_impl::get_feed( string account, uint32_t
results.reserve( limit );

const auto& db = *app.chain_database();
const auto& feed_idx = app.chain_database()->get_index< feed_index >().indices().get< by_feed >();
const auto& feed_idx = db.get_index< feed_index >().indices().get< by_feed >();
auto itr = feed_idx.lower_bound( boost::make_tuple( account, entry_id ) );

while( itr != feed_idx.end() && itr->account == account && results.size() < limit )
{
const auto& comment = itr->comment( *app.chain_database() );
const auto& comment = itr->comment( db );
comment_feed_entry entry;
entry.comment = comment;
entry.entry_id = itr->account_feed_id;
Expand Down
3 changes: 1 addition & 2 deletions libraries/plugins/follow/follow_evaluators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void reblog_evaluator::do_apply( const reblog_operation& o )

if( feed_itr == comment_idx.end() )
{
auto& fd = db.create< feed_object >( [&]( feed_object& f )
db.create< feed_object >( [&]( feed_object& f )
{
f.account = itr->follower;
f.first_reblogged_by = o.account;
Expand All @@ -125,7 +125,6 @@ void reblog_evaluator::do_apply( const reblog_operation& o )
f.reblogs = 1;
f.account_feed_id = next_id;
});

}
else
{
Expand Down
11 changes: 5 additions & 6 deletions libraries/plugins/market_history/market_history_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,19 @@ market_volume market_history_api_impl::get_volume() const
auto db = app.chain_database();
const auto& bucket_idx = db->get_index< bucket_index >().indices().get< by_bucket >();
auto itr = bucket_idx.lower_bound( boost::make_tuple( 0, db->head_block_time() - 86400 ) );
uint32_t bucket_size;

market_volume result;

if( itr != bucket_idx.end() )
bucket_size = itr->seconds;
if( itr == bucket_idx.end() )
return result;

while( itr != bucket_idx.end() && itr->seconds == bucket_size )
uint32_t bucket_size = itr->seconds;
do
{
result.steem_volume.amount += itr->steem_volume;
result.sbd_volume.amount += itr->sbd_volume;

++itr;
}
} while( itr != bucket_idx.end() && itr->seconds == bucket_size );

return result;
}
Expand Down
2 changes: 0 additions & 2 deletions libraries/plugins/market_history/market_history_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ void market_history_plugin_impl::update_market_histories( const operation_notifi
auto& db = _self.database();
const auto& bucket_idx = db.get_index< bucket_index >().indices().get< by_bucket >();

uint64_t history_seq = std::numeric_limits< uint64_t >::min();

db.create< order_history_object >( [&]( order_history_object& ho )
{
ho.time = db.head_block_time();
Expand Down
1 change: 1 addition & 0 deletions libraries/plugins/raw_block/raw_block_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ get_raw_block_result raw_block_api::get_raw_block( get_raw_block_args args )
result.block_id = block->id();
result.previous = block->previous;
result.timestamp = block->timestamp;
return result;
}

void raw_block_api::push_raw_block( std::string block_b64 )
Expand Down
2 changes: 0 additions & 2 deletions libraries/plugins/raw_block/raw_block_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ void raw_block_plugin::plugin_initialize( const boost::program_options::variable

void raw_block_plugin::plugin_startup()
{
chain::database& db = database();

app().register_api_factory< raw_block_api >( "raw_block_api" );
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/wallet/include/steemit/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ FC_REFLECT( steemit::wallet::wallet_data,
(ws_password)
)

FC_REFLECT( steemit::wallet::brain_key_info, (brain_priv_key)(wif_priv_key) (pub_key));
FC_REFLECT( steemit::wallet::brain_key_info, (brain_priv_key)(wif_priv_key) (pub_key))

FC_REFLECT_DERIVED( steemit::wallet::signed_block_with_info, (steemit::chain::signed_block),
(block_id)(signing_key)(transaction_ids) )
Expand Down Expand Up @@ -1021,4 +1021,4 @@ FC_API( steemit::wallet::wallet_api,
(get_transaction)
)

FC_REFLECT( steemit::wallet::memo_data, (from)(to)(nonce)(check)(encrypted) );
FC_REFLECT( steemit::wallet::memo_data, (from)(to)(nonce)(check)(encrypted) )
2 changes: 1 addition & 1 deletion libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ class wallet_api_impl
<< "\n====================================================================================================="
<< "|=====================================================================================================\n";

for( int i = 0; i < orders.bids.size() || i < orders.asks.size(); i++ )
for( size_t i = 0; i < orders.bids.size() || i < orders.asks.size(); i++ )
{
if ( i < orders.bids.size() )
{
Expand Down
2 changes: 1 addition & 1 deletion tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void database_fixture::vest( const string& account, const asset& amount )
gpo.current_supply += amount;
});

auto new_vesting = db.create_vesting( db.get_account( account ), amount );
db.create_vesting( db.get_account( account ), amount );

db.update_virtual_supply();
}, default_skip );
Expand Down
Loading