Skip to content

Commit

Permalink
More warning cleanup #605
Browse files Browse the repository at this point in the history
  • Loading branch information
theoreticalbts committed Nov 23, 2016
1 parent 1639130 commit 632b187
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 58 deletions.
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
2 changes: 1 addition & 1 deletion libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,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
8 changes: 4 additions & 4 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 @@ -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 @@ -3973,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
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 @@ -296,7 +296,6 @@ uint32_t debug_node_plugin::debug_generate_blocks(
uint32_t new_slot = miss_blocks+1;
std::string scheduled_witness_name = db.get_scheduled_witness( slot );
fc::time_point_sec scheduled_time = db.get_slot_time( slot );
const chain::witness_object& scheduled_witness = db.get_witness( scheduled_witness_name );
steemit::chain::public_key_type scheduled_key = scheduled_witness.signing_key;
if( debug_key != "" )
{
Expand Down
1 change: 0 additions & 1 deletion libraries/plugins/follow/follow_evaluators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 632b187

Please sign in to comment.