Replace C++0x auto with Boost Typeof library
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <boost/lambda/lambda.hpp>
|
#include <boost/lambda/lambda.hpp>
|
||||||
#include <boost/lambda/bind.hpp>
|
#include <boost/lambda/bind.hpp>
|
||||||
|
#include <boost/typeof/typeof.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
@@ -100,9 +101,9 @@ Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row,
|
|||||||
|| ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) {
|
|| ( (sent_frame <= early_ack) && (expiration_time <= now) ) ) {
|
||||||
if ( (current.contents == replacement.contents)
|
if ( (current.contents == replacement.contents)
|
||||||
|| (current.is_blank() && replacement.is_blank()) ) {
|
|| (current.is_blank() && replacement.is_blank()) ) {
|
||||||
auto it = find_if( original_contents.begin(), original_contents.end(),
|
BOOST_AUTO( it, find_if( original_contents.begin(), original_contents.end(),
|
||||||
(replacement.is_blank() && bind( &Cell::is_blank, _1 ))
|
(replacement.is_blank() && bind( &Cell::is_blank, _1 ))
|
||||||
|| replacement.contents == (&_1)->*&Cell::contents );
|
|| replacement.contents == (&_1)->*&Cell::contents ) );
|
||||||
if ( it == original_contents.end() ) {
|
if ( it == original_contents.end() ) {
|
||||||
return Correct;
|
return Correct;
|
||||||
} else {
|
} else {
|
||||||
@@ -340,8 +341,8 @@ void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb )
|
|||||||
prediction_epoch ) );
|
prediction_epoch ) );
|
||||||
cursor().active = true;
|
cursor().active = true;
|
||||||
|
|
||||||
for ( auto i = overlays.begin(); i != overlays.end(); i++ ) {
|
for ( BOOST_AUTO( i, overlays.begin() ); i != overlays.end(); i++ ) {
|
||||||
for ( auto j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) {
|
for ( BOOST_AUTO( j, i->overlay_cells.begin() ); j != i->overlay_cells.end(); j++ ) {
|
||||||
if ( j->tentative( epoch - 1 ) ) {
|
if ( j->tentative( epoch - 1 ) ) {
|
||||||
j->reset();
|
j->reset();
|
||||||
}
|
}
|
||||||
@@ -405,9 +406,9 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
|||||||
|
|
||||||
/* go through cell predictions */
|
/* go through cell predictions */
|
||||||
|
|
||||||
auto i = overlays.begin();
|
BOOST_AUTO( i, overlays.begin() );
|
||||||
while ( i != overlays.end() ) {
|
while ( i != overlays.end() ) {
|
||||||
auto inext = i;
|
BOOST_AUTO( inext, i );
|
||||||
inext++;
|
inext++;
|
||||||
if ( (i->row_num < 0) || (i->row_num >= fb.ds.get_height()) ) {
|
if ( (i->row_num < 0) || (i->row_num >= fb.ds.get_height()) ) {
|
||||||
overlays.erase( i );
|
overlays.erase( i );
|
||||||
@@ -415,7 +416,7 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) {
|
for ( BOOST_AUTO( j, i->overlay_cells.begin() ); j != i->overlay_cells.end(); j++ ) {
|
||||||
if ( j->start_clock( local_frame_acked, now, send_interval ) ) {
|
if ( j->start_clock( local_frame_acked, now, send_interval ) ) {
|
||||||
last_scheduled_timeout = max( last_scheduled_timeout, j->expiration_time );
|
last_scheduled_timeout = max( last_scheduled_timeout, j->expiration_time );
|
||||||
}
|
}
|
||||||
@@ -505,7 +506,7 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* go through cursor predictions */
|
/* go through cursor predictions */
|
||||||
for ( auto it = cursors.begin(); it != cursors.end(); it++ ) {
|
for ( BOOST_AUTO( it, cursors.begin() ); it != cursors.end(); it++ ) {
|
||||||
if ( it->start_clock( local_frame_acked, now, send_interval ) ) {
|
if ( it->start_clock( local_frame_acked, now, send_interval ) ) {
|
||||||
last_scheduled_timeout = max( last_scheduled_timeout, it->expiration_time );
|
last_scheduled_timeout = max( last_scheduled_timeout, it->expiration_time );
|
||||||
}
|
}
|
||||||
@@ -536,8 +537,8 @@ void PredictionEngine::cull( const Framebuffer &fb )
|
|||||||
|
|
||||||
ConditionalOverlayRow & PredictionEngine::get_or_make_row( int row_num, int num_cols )
|
ConditionalOverlayRow & PredictionEngine::get_or_make_row( int row_num, int num_cols )
|
||||||
{
|
{
|
||||||
auto it = find_if( overlays.begin(), overlays.end(),
|
BOOST_AUTO( it, find_if( overlays.begin(), overlays.end(),
|
||||||
(&_1)->*&ConditionalOverlayRow::row_num == row_num );
|
(&_1)->*&ConditionalOverlayRow::row_num == row_num ) );
|
||||||
|
|
||||||
if ( it != overlays.end() ) {
|
if ( it != overlays.end() ) {
|
||||||
return *it;
|
return *it;
|
||||||
@@ -573,7 +574,7 @@ void PredictionEngine::new_user_byte( char the_byte, const Framebuffer &fb )
|
|||||||
|
|
||||||
list<Parser::Action *> actions( parser.input( the_byte ) );
|
list<Parser::Action *> actions( parser.input( the_byte ) );
|
||||||
|
|
||||||
for ( auto it = actions.begin(); it != actions.end(); it++ ) {
|
for ( BOOST_AUTO( it, actions.begin() ); it != actions.end(); it++ ) {
|
||||||
Parser::Action *act = *it;
|
Parser::Action *act = *it;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -743,9 +744,9 @@ void PredictionEngine::newline_carriage_return( const Framebuffer &fb )
|
|||||||
init_cursor( fb );
|
init_cursor( fb );
|
||||||
cursor().col = 0;
|
cursor().col = 0;
|
||||||
if ( cursor().row == fb.ds.get_height() - 1 ) {
|
if ( cursor().row == fb.ds.get_height() - 1 ) {
|
||||||
for ( auto i = overlays.begin(); i != overlays.end(); i++ ) {
|
for ( BOOST_AUTO( i, overlays.begin() ); i != overlays.end(); i++ ) {
|
||||||
i->row_num--;
|
i->row_num--;
|
||||||
for ( auto j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) {
|
for ( BOOST_AUTO( j, i->overlay_cells.begin() ); j != i->overlay_cells.end(); j++ ) {
|
||||||
if ( j->active ) {
|
if ( j->active ) {
|
||||||
j->expire( local_frame_sent + 1, now );
|
j->expire( local_frame_sent + 1, now );
|
||||||
}
|
}
|
||||||
@@ -754,7 +755,7 @@ void PredictionEngine::newline_carriage_return( const Framebuffer &fb )
|
|||||||
|
|
||||||
/* make blank prediction for last row */
|
/* make blank prediction for last row */
|
||||||
ConditionalOverlayRow &the_row = get_or_make_row( cursor().row, fb.ds.get_width() );
|
ConditionalOverlayRow &the_row = get_or_make_row( cursor().row, fb.ds.get_width() );
|
||||||
for ( auto j = the_row.overlay_cells.begin(); j != the_row.overlay_cells.end(); j++ ) {
|
for ( BOOST_AUTO( j, the_row.overlay_cells.begin() ); j != the_row.overlay_cells.end(); j++ ) {
|
||||||
j->active = true;
|
j->active = true;
|
||||||
j->tentative_until_epoch = prediction_epoch;
|
j->tentative_until_epoch = prediction_epoch;
|
||||||
j->expire( local_frame_sent + 1, now );
|
j->expire( local_frame_sent + 1, now );
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <boost/lambda/lambda.hpp>
|
#include <boost/lambda/lambda.hpp>
|
||||||
|
#include <boost/typeof/typeof.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -162,7 +163,7 @@ void TransportSender<MyState>::add_sent_state( uint64_t the_timestamp, uint64_t
|
|||||||
{
|
{
|
||||||
sent_states.push_back( TimestampedState<MyState>( the_timestamp, num, state ) );
|
sent_states.push_back( TimestampedState<MyState>( the_timestamp, num, state ) );
|
||||||
if ( sent_states.size() > 32 ) { /* limit on state queue */
|
if ( sent_states.size() > 32 ) { /* limit on state queue */
|
||||||
auto last = sent_states.end();
|
BOOST_AUTO( last, sent_states.end() );
|
||||||
for ( int i = 0; i < 16; i++ ) { last--; }
|
for ( int i = 0; i < 16; i++ ) { last--; }
|
||||||
sent_states.erase( last ); /* erase state from middle of queue */
|
sent_states.erase( last ); /* erase state from middle of queue */
|
||||||
}
|
}
|
||||||
@@ -259,7 +260,7 @@ void TransportSender<MyState>::send_in_fragments( string diff, uint64_t new_num
|
|||||||
|
|
||||||
vector<Fragment> fragments = fragmenter.make_fragments( inst, connection->get_MTU() );
|
vector<Fragment> fragments = fragmenter.make_fragments( inst, connection->get_MTU() );
|
||||||
|
|
||||||
for ( auto i = fragments.begin(); i != fragments.end(); i++ ) {
|
for ( BOOST_AUTO( i, fragments.begin() ); i != fragments.end(); i++ ) {
|
||||||
connection->send( i->tostring() );
|
connection->send( i->tostring() );
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
@@ -311,7 +312,7 @@ uint64_t TransportSender<MyState>::get_late_ack( uint64_t now )
|
|||||||
{
|
{
|
||||||
uint64_t newest_echo_ack = 0;
|
uint64_t newest_echo_ack = 0;
|
||||||
|
|
||||||
for ( auto i = ack_history.begin(); i != ack_history.end(); i++ ) {
|
for ( BOOST_AUTO( i, ack_history.begin() ); i != ack_history.end(); i++ ) {
|
||||||
if ( i->second < now - ECHO_TIMEOUT ) {
|
if ( i->second < now - ECHO_TIMEOUT ) {
|
||||||
newest_echo_ack = i->first;
|
newest_echo_ack = i->first;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/typeof/typeof.hpp>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const
|
|||||||
/* set window title */
|
/* set window title */
|
||||||
frame.append( "\033]0;" );
|
frame.append( "\033]0;" );
|
||||||
const std::deque<wchar_t> &window_title( f.get_window_title() );
|
const std::deque<wchar_t> &window_title( f.get_window_title() );
|
||||||
for ( auto i = window_title.begin();
|
for ( BOOST_AUTO( i, window_title.begin() );
|
||||||
i != window_title.end();
|
i != window_title.end();
|
||||||
i++ ) {
|
i++ ) {
|
||||||
snprintf( tmp, 64, "%lc", *i );
|
snprintf( tmp, 64, "%lc", *i );
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <boost/typeof/typeof.hpp>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -429,7 +430,7 @@ void Row::reset( int background_color )
|
|||||||
|
|
||||||
void Framebuffer::prefix_window_title( const std::deque<wchar_t> &s )
|
void Framebuffer::prefix_window_title( const std::deque<wchar_t> &s )
|
||||||
{
|
{
|
||||||
for ( auto i = s.rbegin(); i != s.rend(); i++ ) {
|
for ( BOOST_AUTO( i, s.rbegin() ); i != s.rend(); i++ ) {
|
||||||
window_title.push_front( *i );
|
window_title.push_front( *i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user