diff --git a/src/crypto/ae.h b/src/crypto/ae.h index a0d803449..63bb5d601 100644 --- a/src/crypto/ae.h +++ b/src/crypto/ae.h @@ -58,7 +58,7 @@ typedef struct _ae_ctx ae_ctx; ae_ctx* ae_allocate( void* misc ); /* Allocate ae_ctx, set optional ptr */ void ae_free( ae_ctx* ctx ); /* Deallocate ae_ctx struct */ int ae_clear( ae_ctx* ctx ); /* Undo initialization */ -int ae_ctx_sizeof( void ); /* Return sizeof(ae_ctx) */ +int ae_ctx_sizeof(); /* Return sizeof(ae_ctx) */ /* ae_allocate() allocates an ae_ctx structure, but does not initialize it. * ae_free() deallocates an ae_ctx structure, but does not zeroize it. * ae_clear() zeroes sensitive values associated with an ae_ctx structure diff --git a/src/crypto/crypto.cc b/src/crypto/crypto.cc index 7a79d7e7a..825c973cc 100644 --- a/src/crypto/crypto.cc +++ b/src/crypto/crypto.cc @@ -61,7 +61,7 @@ long int myatoi( const char* str ) return ret; } -uint64_t Crypto::unique( void ) +uint64_t Crypto::unique() { static uint64_t counter = 0; uint64_t rv = counter++; @@ -138,7 +138,7 @@ Base64Key::Base64Key( PRNG& prng ) prng.fill( key, sizeof( key ) ); } -std::string Base64Key::printable_key( void ) const +std::string Base64Key::printable_key() const { char base64[24]; @@ -174,7 +174,7 @@ Nonce::Nonce( uint64_t val ) memcpy( bytes + 4, &val_net, 8 ); } -uint64_t Nonce::val( void ) const +uint64_t Nonce::val() const { uint64_t ret; memcpy( &ret, bytes + 4, 8 ); @@ -285,7 +285,7 @@ static rlim_t saved_core_rlimit; /* Disable dumping core, as a precaution to avoid saving sensitive data to disk. */ -void Crypto::disable_dumping_core( void ) +void Crypto::disable_dumping_core() { struct rlimit limit; if ( 0 != getrlimit( RLIMIT_CORE, &limit ) ) { @@ -303,7 +303,7 @@ void Crypto::disable_dumping_core( void ) } } -void Crypto::reenable_dumping_core( void ) +void Crypto::reenable_dumping_core() { /* Silent failure is safe. */ struct rlimit limit; diff --git a/src/crypto/crypto.h b/src/crypto/crypto.h index f329d4a03..fc2b7ca46 100644 --- a/src/crypto/crypto.h +++ b/src/crypto/crypto.h @@ -61,7 +61,7 @@ class CryptoException : public std::exception * numbers that never repeats its output. Enforce that with this * function. */ -uint64_t unique( void ); +uint64_t unique(); /* 16-byte-aligned buffer, with length. */ class AlignedBuffer @@ -76,8 +76,8 @@ class AlignedBuffer ~AlignedBuffer() { free( m_allocated ); } - char* data( void ) const { return m_data; } - size_t len( void ) const { return m_len; } + char* data() const { return m_data; } + size_t len() const { return m_len; } private: /* Not implemented */ @@ -94,8 +94,8 @@ class Base64Key Base64Key(); /* random key */ Base64Key( PRNG& prng ); Base64Key( std::string printable_key ); - std::string printable_key( void ) const; - unsigned char* data( void ) { return key; } + std::string printable_key() const; + unsigned char* data() { return key; } }; class Nonce @@ -110,9 +110,9 @@ class Nonce Nonce( uint64_t val ); Nonce( const char* s_bytes, size_t len ); - std::string cc_str( void ) const { return std::string( bytes + 4, 8 ); } - const char* data( void ) const { return bytes; } - uint64_t val( void ) const; + std::string cc_str() const { return std::string( bytes + 4, 8 ); } + const char* data() const { return bytes; } + uint64_t val() const; }; class Message @@ -156,8 +156,8 @@ class Session Session& operator=( const Session& ); }; -void disable_dumping_core( void ); -void reenable_dumping_core( void ); +void disable_dumping_core(); +void reenable_dumping_core(); } #endif diff --git a/src/frontend/mosh-client.cc b/src/frontend/mosh-client.cc index d61717973..6c27aa01c 100644 --- a/src/frontend/mosh-client.cc +++ b/src/frontend/mosh-client.cc @@ -91,7 +91,7 @@ static void print_usage( FILE* file, const char* argv0 ) argv0 ); } -static void print_colorcount( void ) +static void print_colorcount() { /* check colors */ setupterm( (char*)0, 1, (int*)0 ); diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 5d22553d6..0d42877db 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -130,12 +130,12 @@ static void print_usage( FILE* stream, const char* argv0 ) } static bool print_motd( const char* filename ); -static void chdir_homedir( void ); -static bool motd_hushed( void ); +static void chdir_homedir(); +static bool motd_hushed(); static void warn_unattached( const std::string& ignore_entry ); /* Simple spinloop */ -static void spin( void ) +static void spin() { static unsigned int spincount = 0; spincount++; @@ -149,7 +149,7 @@ static void spin( void ) } } -static std::string get_SSH_IP( void ) +static std::string get_SSH_IP() { const char* SSH_CONNECTION = getenv( "SSH_CONNECTION" ); if ( !SSH_CONNECTION ) { /* Older sshds don't set this */ @@ -990,7 +990,7 @@ static bool print_motd( const char* filename ) return true; } -static void chdir_homedir( void ) +static void chdir_homedir() { const char* home = getenv( "HOME" ); if ( home == NULL ) { @@ -1011,7 +1011,7 @@ static void chdir_homedir( void ) } } -static bool motd_hushed( void ) +static bool motd_hushed() { /* must be in home directory already */ struct stat buf; diff --git a/src/frontend/stmclient.cc b/src/frontend/stmclient.cc index bccab7d94..8fa0044bf 100644 --- a/src/frontend/stmclient.cc +++ b/src/frontend/stmclient.cc @@ -64,7 +64,7 @@ #include "src/network/networktransport-impl.h" -void STMClient::resume( void ) +void STMClient::resume() { /* Restore termios state */ if ( tcsetattr( STDIN_FILENO, TCSANOW, &raw_termios ) < 0 ) { @@ -79,7 +79,7 @@ void STMClient::resume( void ) repaint_requested = true; } -void STMClient::init( void ) +void STMClient::init() { if ( !is_utf8_locale() ) { LocaleVar native_ctype = get_ctype(); @@ -201,7 +201,7 @@ void STMClient::init( void ) connecting_notification = std::wstring( tmp ); } -void STMClient::shutdown( void ) +void STMClient::shutdown() { /* Restore screen state */ overlays.get_notification_engine().set_notification_string( std::wstring( L"" ) ); @@ -233,7 +233,7 @@ void STMClient::shutdown( void ) } } -void STMClient::main_init( void ) +void STMClient::main_init() { Select& sel = Select::get_instance(); sel.add_signal( SIGWINCH ); @@ -272,7 +272,7 @@ void STMClient::main_init( void ) Select::set_verbose( verbose ); } -void STMClient::output_new_frame( void ) +void STMClient::output_new_frame() { if ( !network ) { /* clean shutdown even when not initialized */ return; @@ -293,7 +293,7 @@ void STMClient::output_new_frame( void ) local_framebuffer = new_state; } -void STMClient::process_network_input( void ) +void STMClient::process_network_input() { network->recv(); @@ -407,7 +407,7 @@ bool STMClient::process_user_input( int fd ) return true; } -bool STMClient::process_resize( void ) +bool STMClient::process_resize() { /* get new size */ if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { @@ -430,7 +430,7 @@ bool STMClient::process_resize( void ) return true; } -bool STMClient::main( void ) +bool STMClient::main() { /* initialize signal handling and structures */ main_init(); diff --git a/src/frontend/stmclient.h b/src/frontend/stmclient.h index 4d19225f3..77ac35822 100644 --- a/src/frontend/stmclient.h +++ b/src/frontend/stmclient.h @@ -73,20 +73,20 @@ class STMClient bool clean_shutdown; unsigned int verbose; - void main_init( void ); - void process_network_input( void ); + void main_init(); + void process_network_input(); bool process_user_input( int fd ); - bool process_resize( void ); + bool process_resize(); - void output_new_frame( void ); + void output_new_frame(); - bool still_connecting( void ) const + bool still_connecting() const { /* Initially, network == NULL */ return network && ( network->get_remote_state_num() == 0 ); } - void resume( void ); /* restore state after SIGCONT */ + void resume(); /* restore state after SIGCONT */ public: STMClient( const char* s_ip, @@ -121,9 +121,9 @@ class STMClient } } - void init( void ); - void shutdown( void ); - bool main( void ); + void init(); + void shutdown(); + bool main(); /* unused */ STMClient( const STMClient& ); diff --git a/src/frontend/terminaloverlay.cc b/src/frontend/terminaloverlay.cc index 38f71b2e7..91e3bfc5d 100644 --- a/src/frontend/terminaloverlay.cc +++ b/src/frontend/terminaloverlay.cc @@ -298,14 +298,14 @@ void NotificationEngine::apply( Framebuffer& fb ) const } } -void NotificationEngine::adjust_message( void ) +void NotificationEngine::adjust_message() { if ( timestamp() >= message_expiration ) { message.clear(); } } -int NotificationEngine::wait_time( void ) const +int NotificationEngine::wait_time() const { uint64_t next_expiry = INT_MAX; @@ -390,7 +390,7 @@ void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer& fb ) become_tentative(); } -void PredictionEngine::reset( void ) +void PredictionEngine::reset() { cursors.clear(); overlays.clear(); @@ -862,7 +862,7 @@ void PredictionEngine::newline_carriage_return( const Framebuffer& fb ) } } -void PredictionEngine::become_tentative( void ) +void PredictionEngine::become_tentative() { if ( display_preference != Experimental ) { prediction_epoch++; @@ -874,7 +874,7 @@ void PredictionEngine::become_tentative( void ) */ } -bool PredictionEngine::active( void ) const +bool PredictionEngine::active() const { if ( !cursors.empty() ) { return true; diff --git a/src/frontend/terminaloverlay.h b/src/frontend/terminaloverlay.h index 01dfe2b0a..b835913c6 100644 --- a/src/frontend/terminaloverlay.h +++ b/src/frontend/terminaloverlay.h @@ -71,7 +71,7 @@ class ConditionalOverlay virtual ~ConditionalOverlay() {} bool tentative( uint64_t confirmed_epoch ) const { return tentative_until_epoch > confirmed_epoch; } - void reset( void ) + void reset() { expiration_frame = tentative_until_epoch = -1; active = false; @@ -113,13 +113,13 @@ class ConditionalOverlayCell : public ConditionalOverlay : ConditionalOverlay( s_exp, s_col, s_tentative ), replacement( 0 ), unknown( false ), original_contents() {} - void reset( void ) + void reset() { unknown = false; original_contents.clear(); ConditionalOverlay::reset(); } - void reset_with_orig( void ) + void reset_with_orig() { if ( ( !active ) || unknown ) { reset(); @@ -161,12 +161,12 @@ class NotificationEngine bool need_countup( uint64_t ts ) const { return server_late( ts ) || reply_late( ts ); } public: - void adjust_message( void ); + void adjust_message(); void apply( Framebuffer& fb ) const; - const std::wstring& get_notification_string( void ) const { return message; } + const std::wstring& get_notification_string() const { return message; } void server_heard( uint64_t s_last_word ) { last_word_from_server = s_last_word; } void server_acked( uint64_t s_last_acked ) { last_acked_state = s_last_acked; } - int wait_time( void ) const; + int wait_time() const; void set_notification_string( const std::wstring& s_message, bool permanent = false, @@ -242,7 +242,7 @@ class PredictionEngine uint64_t prediction_epoch; uint64_t confirmed_epoch; - void become_tentative( void ); + void become_tentative(); void newline_carriage_return( const Framebuffer& fb ); @@ -251,7 +251,7 @@ class PredictionEngine unsigned int glitch_trigger; /* show predictions temporarily because of long-pending prediction */ uint64_t last_quick_confirmation; - ConditionalCursorMove& cursor( void ) + ConditionalCursorMove& cursor() { assert( !cursors.empty() ); return cursors.back(); @@ -278,9 +278,9 @@ class PredictionEngine DisplayPreference display_preference; bool predict_overwrite; - bool active( void ) const; + bool active() const; - bool timing_tests_necessary( void ) const + bool timing_tests_necessary() const { /* Are there any timing-based triggers that haven't fired yet? */ return !( glitch_trigger && flagging ); @@ -294,7 +294,7 @@ class PredictionEngine void new_user_byte( char the_byte, const Framebuffer& fb ); void cull( const Framebuffer& fb ); - void reset( void ); + void reset(); void set_local_frame_sent( uint64_t x ) { local_frame_sent = x; } void set_local_frame_acked( uint64_t x ) { local_frame_acked = x; } @@ -302,9 +302,9 @@ class PredictionEngine void set_send_interval( unsigned int x ) { send_interval = x; } - int wait_time( void ) const { return ( timing_tests_necessary() && active() ) ? 50 : INT_MAX; } + int wait_time() const { return ( timing_tests_necessary() && active() ) ? 50 : INT_MAX; } - PredictionEngine( void ) + PredictionEngine() : last_byte( 0 ), parser(), overlays(), cursors(), local_frame_sent( 0 ), local_frame_acked( 0 ), local_frame_late_acked( 0 ), prediction_epoch( 1 ), confirmed_epoch( 0 ), flagging( false ), srtt_trigger( false ), glitch_trigger( 0 ), last_quick_confirmation( 0 ), send_interval( 250 ), @@ -334,14 +334,14 @@ class OverlayManager public: void apply( Framebuffer& fb ); - NotificationEngine& get_notification_engine( void ) { return notifications; } - PredictionEngine& get_prediction_engine( void ) { return predictions; } + NotificationEngine& get_notification_engine() { return notifications; } + PredictionEngine& get_prediction_engine() { return predictions; } void set_title_prefix( const std::wstring& s ) { title.set_prefix( s ); } OverlayManager() : notifications(), predictions(), title() {} - int wait_time( void ) const { return std::min( notifications.wait_time(), predictions.wait_time() ); } + int wait_time() const { return std::min( notifications.wait_time(), predictions.wait_time() ); } }; } diff --git a/src/network/compressor.cc b/src/network/compressor.cc index cd3e6a5d0..f708ef582 100644 --- a/src/network/compressor.cc +++ b/src/network/compressor.cc @@ -54,7 +54,7 @@ std::string Compressor::uncompress_str( const std::string& input ) } /* construct on first use */ -Compressor& Network::get_compressor( void ) +Compressor& Network::get_compressor() { static Compressor the_compressor; return the_compressor; diff --git a/src/network/compressor.h b/src/network/compressor.h index 9c290bc96..9c4fbfff4 100644 --- a/src/network/compressor.h +++ b/src/network/compressor.h @@ -55,7 +55,7 @@ class Compressor Compressor& operator=( const Compressor& ); }; -Compressor& get_compressor( void ); +Compressor& get_compressor(); } #endif diff --git a/src/network/network.cc b/src/network/network.cc index 8a6118eae..4be48ca83 100644 --- a/src/network/network.cc +++ b/src/network/network.cc @@ -83,7 +83,7 @@ Packet::Packet( const Message& message ) } /* Output from packet */ -Message Packet::toMessage( void ) +Message Packet::toMessage() { uint64_t direction_seq = ( uint64_t( direction == TO_CLIENT ) << 63 ) | ( seq & SEQUENCE_MASK ); @@ -113,7 +113,7 @@ Packet Connection::new_packet( const std::string& s_payload ) return p; } -void Connection::hop_port( void ) +void Connection::hop_port() { assert( !server ); @@ -124,7 +124,7 @@ void Connection::hop_port( void ) prune_sockets(); } -void Connection::prune_sockets( void ) +void Connection::prune_sockets() { /* don't keep old sockets if the new socket has been working for long enough */ if ( socks.size() > 1 ) { @@ -177,12 +177,12 @@ Connection::Socket::Socket( int family ) : _fd( socket( family, SOCK_DGRAM, 0 ) #endif } -void Connection::setup( void ) +void Connection::setup() { last_port_choice = timestamp(); } -const std::vector Connection::fds( void ) const +const std::vector Connection::fds() const { std::vector ret; @@ -399,7 +399,7 @@ void Connection::send( const std::string& s ) } } -std::string Connection::recv( void ) +std::string Connection::recv() { assert( !socks.empty() ); for ( std::deque::const_iterator it = socks.begin(); it != socks.end(); it++ ) { @@ -544,7 +544,7 @@ std::string Connection::recv_one( int sock_to_recv ) return p.payload; } -std::string Connection::port( void ) const +std::string Connection::port() const { Addr local_addr; socklen_t addrlen = sizeof( local_addr ); @@ -562,12 +562,12 @@ std::string Connection::port( void ) const return std::string( serv ); } -uint64_t Network::timestamp( void ) +uint64_t Network::timestamp() { return frozen_timestamp(); } -uint16_t Network::timestamp16( void ) +uint16_t Network::timestamp16() { uint16_t ts = timestamp() % 65536; if ( ts == uint16_t( -1 ) ) { @@ -589,7 +589,7 @@ uint16_t Network::timestamp_diff( uint16_t tsnew, uint16_t tsold ) return diff; } -uint64_t Connection::timeout( void ) const +uint64_t Connection::timeout() const { uint64_t RTO = lrint( ceil( SRTT + 4 * RTTVAR ) ); if ( RTO < MIN_RTO ) { diff --git a/src/network/network.h b/src/network/network.h index 00125f57e..917bab5d5 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -52,8 +52,8 @@ using namespace Crypto; namespace Network { static const unsigned int MOSH_PROTOCOL_VERSION = 2; /* bumped for echo-ack */ -uint64_t timestamp( void ); -uint16_t timestamp16( void ); +uint64_t timestamp(); +uint16_t timestamp16(); uint16_t timestamp_diff( uint16_t tsnew, uint16_t tsold ); class NetworkException : public std::exception @@ -94,7 +94,7 @@ class Packet Packet( const Message& message ); - Message toMessage( void ); + Message toMessage(); }; union Addr { @@ -158,7 +158,7 @@ class Connection int _fd; public: - int fd( void ) const { return _fd; } + int fd() const { return _fd; } Socket( int family ); ~Socket(); @@ -178,7 +178,7 @@ class Connection Base64Key key; Session session; - void setup( void ); + void setup(); Direction direction; uint16_t saved_timestamp; @@ -198,15 +198,15 @@ class Connection Packet new_packet( const std::string& s_payload ); - void hop_port( void ); + void hop_port(); - int sock( void ) const + int sock() const { assert( !socks.empty() ); return socks.back().fd(); } - void prune_sockets( void ); + void prune_sockets(); std::string recv_one( int sock_to_recv ); @@ -220,21 +220,21 @@ class Connection Connection( const char* key_str, const char* ip, const char* port ); /* client */ void send( const std::string& s ); - std::string recv( void ); - const std::vector fds( void ) const; - int get_MTU( void ) const { return MTU; } + std::string recv(); + const std::vector fds() const; + int get_MTU() const { return MTU; } - std::string port( void ) const; - std::string get_key( void ) const { return key.printable_key(); } - bool get_has_remote_addr( void ) const { return has_remote_addr; } + std::string port() const; + std::string get_key() const { return key.printable_key(); } + bool get_has_remote_addr() const { return has_remote_addr; } - uint64_t timeout( void ) const; - double get_SRTT( void ) const { return SRTT; } + uint64_t timeout() const; + double get_SRTT() const { return SRTT; } - const Addr& get_remote_addr( void ) const { return remote_addr; } - socklen_t get_remote_addr_len( void ) const { return remote_addr_len; } + const Addr& get_remote_addr() const { return remote_addr; } + socklen_t get_remote_addr_len() const { return remote_addr_len; } - std::string& get_send_error( void ) { return send_error; } + std::string& get_send_error() { return send_error; } void set_last_roundtrip_success( uint64_t s_success ) { last_roundtrip_success = s_success; } diff --git a/src/network/networktransport-impl.h b/src/network/networktransport-impl.h index 2a088bc4c..2fbecb44c 100644 --- a/src/network/networktransport-impl.h +++ b/src/network/networktransport-impl.h @@ -65,7 +65,7 @@ Transport::Transport( MyState& initial_state, } template -void Transport::recv( void ) +void Transport::recv() { std::string s( connection.recv() ); Fragment frag( s ); @@ -192,7 +192,7 @@ void Transport::process_throwaway_until( uint64_t throwawa } template -std::string Transport::get_remote_diff( void ) +std::string Transport::get_remote_diff() { /* find diff between last receiver state and current remote state, then rationalize states */ diff --git a/src/network/networktransport.h b/src/network/networktransport.h index 1b09a6300..735157337 100644 --- a/src/network/networktransport.h +++ b/src/network/networktransport.h @@ -76,39 +76,39 @@ class Transport const char* port ); /* Send data or an ack if necessary. */ - void tick( void ) { sender.tick(); } + void tick() { sender.tick(); } /* Returns the number of ms to wait until next possible event. */ - int wait_time( void ) { return sender.wait_time(); } + int wait_time() { return sender.wait_time(); } /* Blocks waiting for a packet. */ - void recv( void ); + void recv(); /* Find diff between last receiver state and current remote state, then rationalize states. */ - std::string get_remote_diff( void ); + std::string get_remote_diff(); /* Shut down other side of connection. */ /* Illegal to change current_state after this. */ - void start_shutdown( void ) { sender.start_shutdown(); } - bool shutdown_in_progress( void ) const { return sender.get_shutdown_in_progress(); } - bool shutdown_acknowledged( void ) const { return sender.get_shutdown_acknowledged(); } - bool shutdown_ack_timed_out( void ) const { return sender.shutdown_ack_timed_out(); } - bool has_remote_addr( void ) const { return connection.get_has_remote_addr(); } + void start_shutdown() { sender.start_shutdown(); } + bool shutdown_in_progress() const { return sender.get_shutdown_in_progress(); } + bool shutdown_acknowledged() const { return sender.get_shutdown_acknowledged(); } + bool shutdown_ack_timed_out() const { return sender.shutdown_ack_timed_out(); } + bool has_remote_addr() const { return connection.get_has_remote_addr(); } /* Other side has requested shutdown and we have sent one ACK */ - bool counterparty_shutdown_ack_sent( void ) const { return sender.get_counterparty_shutdown_acknowledged(); } + bool counterparty_shutdown_ack_sent() const { return sender.get_counterparty_shutdown_acknowledged(); } - std::string port( void ) const { return connection.port(); } - std::string get_key( void ) const { return connection.get_key(); } + std::string port() const { return connection.port(); } + std::string get_key() const { return connection.get_key(); } - MyState& get_current_state( void ) { return sender.get_current_state(); } + MyState& get_current_state() { return sender.get_current_state(); } void set_current_state( const MyState& x ) { sender.set_current_state( x ); } - uint64_t get_remote_state_num( void ) const { return received_states.back().num; } + uint64_t get_remote_state_num() const { return received_states.back().num; } - const TimestampedState& get_latest_remote_state( void ) const { return received_states.back(); } + const TimestampedState& get_latest_remote_state() const { return received_states.back(); } - const std::vector fds( void ) const { return connection.fds(); } + const std::vector fds() const { return connection.fds(); } void set_verbose( unsigned int s_verbose ) { @@ -118,16 +118,16 @@ class Transport void set_send_delay( int new_delay ) { sender.set_send_delay( new_delay ); } - uint64_t get_sent_state_acked_timestamp( void ) const { return sender.get_sent_state_acked_timestamp(); } - uint64_t get_sent_state_acked( void ) const { return sender.get_sent_state_acked(); } - uint64_t get_sent_state_last( void ) const { return sender.get_sent_state_last(); } + uint64_t get_sent_state_acked_timestamp() const { return sender.get_sent_state_acked_timestamp(); } + uint64_t get_sent_state_acked() const { return sender.get_sent_state_acked(); } + uint64_t get_sent_state_last() const { return sender.get_sent_state_last(); } - unsigned int send_interval( void ) const { return sender.send_interval(); } + unsigned int send_interval() const { return sender.send_interval(); } - const Addr& get_remote_addr( void ) const { return connection.get_remote_addr(); } - socklen_t get_remote_addr_len( void ) const { return connection.get_remote_addr_len(); } + const Addr& get_remote_addr() const { return connection.get_remote_addr(); } + socklen_t get_remote_addr_len() const { return connection.get_remote_addr_len(); } - std::string& get_send_error( void ) { return connection.get_send_error(); } + std::string& get_send_error() { return connection.get_send_error(); } }; } diff --git a/src/network/transportfragment.cc b/src/network/transportfragment.cc index 427f2c271..a66d618d6 100644 --- a/src/network/transportfragment.cc +++ b/src/network/transportfragment.cc @@ -53,7 +53,7 @@ static std::string network_order_string( uint64_t host_order ) return std::string( (char*)&net_int, sizeof( net_int ) ); } -std::string Fragment::tostring( void ) +std::string Fragment::tostring() { assert( initialized ); @@ -126,7 +126,7 @@ bool FragmentAssembly::add_fragment( Fragment& frag ) return fragments_arrived == fragments_total; } -Instruction FragmentAssembly::get_assembly( void ) +Instruction FragmentAssembly::get_assembly() { assert( fragments_arrived == fragments_total ); diff --git a/src/network/transportfragment.h b/src/network/transportfragment.h index 8a3a23d57..28ed5002f 100644 --- a/src/network/transportfragment.h +++ b/src/network/transportfragment.h @@ -63,7 +63,7 @@ class Fragment Fragment( const std::string& x ); - std::string tostring( void ); + std::string tostring(); bool operator==( const Fragment& x ) const; }; @@ -78,7 +78,7 @@ class FragmentAssembly public: FragmentAssembly() : fragments(), current_id( -1 ), fragments_arrived( 0 ), fragments_total( -1 ) {} bool add_fragment( Fragment& inst ); - Instruction get_assembly( void ); + Instruction get_assembly(); }; class Fragmenter @@ -95,7 +95,7 @@ class Fragmenter last_instruction.set_new_num( -1 ); } std::vector make_fragments( const Instruction& inst, size_t MTU ); - uint64_t last_ack_sent( void ) const { return last_instruction.ack_num(); } + uint64_t last_ack_sent() const { return last_instruction.ack_num(); } }; } diff --git a/src/network/transportsender-impl.h b/src/network/transportsender-impl.h index 69921d30a..7ea17c201 100644 --- a/src/network/transportsender-impl.h +++ b/src/network/transportsender-impl.h @@ -58,7 +58,7 @@ TransportSender::TransportSender( Connection* s_connection, MyState& in /* Try to send roughly two frames per RTT, bounded by limits on frame rate */ template -unsigned int TransportSender::send_interval( void ) const +unsigned int TransportSender::send_interval() const { int SEND_INTERVAL = lrint( ceil( connection->get_SRTT() / 2.0 ) ); if ( SEND_INTERVAL < SEND_INTERVAL_MIN ) { @@ -72,7 +72,7 @@ unsigned int TransportSender::send_interval( void ) const /* Housekeeping routine to calculate next send and ack times */ template -void TransportSender::calculate_timers( void ) +void TransportSender::calculate_timers() { uint64_t now = timestamp(); @@ -111,7 +111,7 @@ void TransportSender::calculate_timers( void ) /* How many ms to wait until next event */ template -int TransportSender::wait_time( void ) +int TransportSender::wait_time() { calculate_timers(); @@ -135,7 +135,7 @@ int TransportSender::wait_time( void ) /* Send data or an empty ack if necessary */ template -void TransportSender::tick( void ) +void TransportSender::tick() { calculate_timers(); /* updates assumed receiver state and rationalizes */ @@ -187,7 +187,7 @@ void TransportSender::tick( void ) } template -void TransportSender::send_empty_ack( void ) +void TransportSender::send_empty_ack() { uint64_t now = timestamp(); @@ -253,7 +253,7 @@ void TransportSender::send_to_receiver( const std::string& diff ) } template -void TransportSender::update_assumed_receiver_state( void ) +void TransportSender::update_assumed_receiver_state() { uint64_t now = timestamp(); @@ -278,7 +278,7 @@ void TransportSender::update_assumed_receiver_state( void ) } template -void TransportSender::rationalize_states( void ) +void TransportSender::rationalize_states() { const MyState* known_receiver_state = &sent_states.front().state; @@ -292,7 +292,7 @@ void TransportSender::rationalize_states( void ) } template -const std::string TransportSender::make_chaff( void ) +const std::string TransportSender::make_chaff() { const size_t CHAFF_MAX = 16; const size_t chaff_len = prng.uint8() % ( CHAFF_MAX + 1 ); @@ -372,7 +372,7 @@ void TransportSender::process_acknowledgment_through( uint64_t ack_num /* give up on getting acknowledgement for shutdown */ template -bool TransportSender::shutdown_ack_timed_out( void ) const +bool TransportSender::shutdown_ack_timed_out() const { if ( shutdown_in_progress ) { if ( shutdown_tries >= SHUTDOWN_RETRIES ) { diff --git a/src/network/transportsender.h b/src/network/transportsender.h index c0f48cc8b..d6be32f0e 100644 --- a/src/network/transportsender.h +++ b/src/network/transportsender.h @@ -58,11 +58,11 @@ class TransportSender { private: /* helper methods for tick() */ - void update_assumed_receiver_state( void ); + void update_assumed_receiver_state(); void attempt_prospective_resend_optimization( std::string& proposed_diff ); - void rationalize_states( void ); + void rationalize_states(); void send_to_receiver( const std::string& diff ); - void send_empty_ack( void ); + void send_empty_ack(); void send_in_fragments( const std::string& diff, uint64_t new_num ); void add_sent_state( uint64_t the_timestamp, uint64_t num, MyState& state ); @@ -86,7 +86,7 @@ class TransportSender uint64_t next_ack_time; uint64_t next_send_time; - void calculate_timers( void ); + void calculate_timers(); unsigned int verbose; bool shutdown_in_progress; @@ -103,7 +103,7 @@ class TransportSender /* chaff to disguise instruction length */ PRNG prng; - const std::string make_chaff( void ); + const std::string make_chaff(); uint64_t mindelay_clock; /* time of first pending change to current state */ @@ -112,10 +112,10 @@ class TransportSender TransportSender( Connection* s_connection, MyState& initial_state ); /* Send data or an ack if necessary */ - void tick( void ); + void tick(); /* Returns the number of ms to wait until next possible event. */ - int wait_time( void ); + int wait_time(); /* Executed upon receipt of ack */ void process_acknowledgment_through( uint64_t ack_num ); @@ -124,13 +124,13 @@ class TransportSender void set_ack_num( uint64_t s_ack_num ); /* Accelerate reply ack */ - void set_data_ack( void ) { pending_data_ack = true; } + void set_data_ack() { pending_data_ack = true; } /* Received something */ void remote_heard( uint64_t ts ) { last_heard = ts; } /* Starts shutdown sequence */ - void start_shutdown( void ) + void start_shutdown() { if ( !shutdown_in_progress ) { shutdown_start = timestamp(); @@ -140,7 +140,7 @@ class TransportSender /* Misc. getters and setters */ /* Cannot modify current_state while shutdown in progress */ - MyState& get_current_state( void ) + MyState& get_current_state() { assert( !shutdown_in_progress ); return current_state; @@ -153,18 +153,18 @@ class TransportSender } void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; } - bool get_shutdown_in_progress( void ) const { return shutdown_in_progress; } - bool get_shutdown_acknowledged( void ) const { return sent_states.front().num == uint64_t( -1 ); } - bool get_counterparty_shutdown_acknowledged( void ) const { return fragmenter.last_ack_sent() == uint64_t( -1 ); } - uint64_t get_sent_state_acked_timestamp( void ) const { return sent_states.front().timestamp; } - uint64_t get_sent_state_acked( void ) const { return sent_states.front().num; } - uint64_t get_sent_state_last( void ) const { return sent_states.back().num; } + bool get_shutdown_in_progress() const { return shutdown_in_progress; } + bool get_shutdown_acknowledged() const { return sent_states.front().num == uint64_t( -1 ); } + bool get_counterparty_shutdown_acknowledged() const { return fragmenter.last_ack_sent() == uint64_t( -1 ); } + uint64_t get_sent_state_acked_timestamp() const { return sent_states.front().timestamp; } + uint64_t get_sent_state_acked() const { return sent_states.front().num; } + uint64_t get_sent_state_last() const { return sent_states.back().num; } - bool shutdown_ack_timed_out( void ) const; + bool shutdown_ack_timed_out() const; void set_send_delay( int new_delay ) { SEND_MINDELAY = new_delay; } - unsigned int send_interval( void ) const; + unsigned int send_interval() const; /* nonexistent methods to satisfy -Weffc++ */ TransportSender( const TransportSender& x ); diff --git a/src/statesync/completeterminal.cc b/src/statesync/completeterminal.cc index d0493b2d9..ef193105d 100644 --- a/src/statesync/completeterminal.cc +++ b/src/statesync/completeterminal.cc @@ -93,7 +93,7 @@ string Complete::diff_from( const Complete& existing ) const return output.SerializeAsString(); } -string Complete::init_diff( void ) const +string Complete::init_diff() const { return diff_from( Complete( get_fb().ds.get_width(), get_fb().ds.get_height() ) ); } diff --git a/src/statesync/completeterminal.h b/src/statesync/completeterminal.h index 799c7d5f3..226d2f6a2 100644 --- a/src/statesync/completeterminal.h +++ b/src/statesync/completeterminal.h @@ -68,9 +68,9 @@ class Complete std::string act( const std::string& str ); std::string act( const Parser::Action& act ); - const Framebuffer& get_fb( void ) const { return terminal.get_fb(); } - void reset_input( void ) { parser.reset_input(); } - uint64_t get_echo_ack( void ) const { return echo_ack; } + const Framebuffer& get_fb() const { return terminal.get_fb(); } + void reset_input() { parser.reset_input(); } + uint64_t get_echo_ack() const { return echo_ack; } bool set_echo_ack( uint64_t now ); void register_input_frame( uint64_t n, uint64_t now ); int wait_time( uint64_t now ) const; @@ -78,7 +78,7 @@ class Complete /* interface for Network::Transport */ void subtract( const Complete* ) const {} std::string diff_from( const Complete& existing ) const; - std::string init_diff( void ) const; + std::string init_diff() const; void apply_string( const std::string& diff ); bool operator==( const Complete& x ) const; diff --git a/src/statesync/user.h b/src/statesync/user.h index 09f49f32b..10df952ec 100644 --- a/src/statesync/user.h +++ b/src/statesync/user.h @@ -79,14 +79,14 @@ class UserStream void push_back( const Parser::UserByte& s_userbyte ) { actions.push_back( UserEvent( s_userbyte ) ); } void push_back( const Parser::Resize& s_resize ) { actions.push_back( UserEvent( s_resize ) ); } - bool empty( void ) const { return actions.empty(); } - size_t size( void ) const { return actions.size(); } + bool empty() const { return actions.empty(); } + size_t size() const { return actions.size(); } const Parser::Action& get_action( unsigned int i ) const; /* interface for Network::Transport */ void subtract( const UserStream* prefix ); std::string diff_from( const UserStream& existing ) const; - std::string init_diff( void ) const { return diff_from( UserStream() ); }; + std::string init_diff() const { return diff_from( UserStream() ); }; void apply_string( const std::string& diff ); bool operator==( const UserStream& x ) const { return actions == x.actions; } diff --git a/src/terminal/parser.h b/src/terminal/parser.h index ecff70111..8cbff6cff 100644 --- a/src/terminal/parser.h +++ b/src/terminal/parser.h @@ -61,7 +61,7 @@ class Parser void input( wchar_t ch, Actions& actions ); - void reset_input( void ) { state = &family.s_Ground; } + void reset_input() { state = &family.s_Ground; } }; static const size_t BUF_SIZE = 8; @@ -79,7 +79,7 @@ class UTF8Parser void input( char c, Actions& actions ); - void reset_input( void ) + void reset_input() { parser.reset_input(); buf[0] = '\0'; diff --git a/src/terminal/parseraction.h b/src/terminal/parseraction.h index a24e88116..6af300ca9 100644 --- a/src/terminal/parseraction.h +++ b/src/terminal/parseraction.h @@ -48,7 +48,7 @@ class Action wchar_t ch; bool char_present; - virtual std::string name( void ) = 0; + virtual std::string name() = 0; virtual void act_on_terminal( Terminal::Emulator* ) const {}; @@ -64,82 +64,82 @@ using Actions = std::vector; class Ignore : public Action { public: - std::string name( void ) { return std::string( "Ignore" ); } + std::string name() { return std::string( "Ignore" ); } bool ignore() const { return true; } }; class Print : public Action { public: - std::string name( void ) { return std::string( "Print" ); } + std::string name() { return std::string( "Print" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Execute : public Action { public: - std::string name( void ) { return std::string( "Execute" ); } + std::string name() { return std::string( "Execute" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Clear : public Action { public: - std::string name( void ) { return std::string( "Clear" ); } + std::string name() { return std::string( "Clear" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Collect : public Action { public: - std::string name( void ) { return std::string( "Collect" ); } + std::string name() { return std::string( "Collect" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Param : public Action { public: - std::string name( void ) { return std::string( "Param" ); } + std::string name() { return std::string( "Param" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Esc_Dispatch : public Action { public: - std::string name( void ) { return std::string( "Esc_Dispatch" ); } + std::string name() { return std::string( "Esc_Dispatch" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class CSI_Dispatch : public Action { public: - std::string name( void ) { return std::string( "CSI_Dispatch" ); } + std::string name() { return std::string( "CSI_Dispatch" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class Hook : public Action { public: - std::string name( void ) { return std::string( "Hook" ); } + std::string name() { return std::string( "Hook" ); } }; class Put : public Action { public: - std::string name( void ) { return std::string( "Put" ); } + std::string name() { return std::string( "Put" ); } }; class Unhook : public Action { public: - std::string name( void ) { return std::string( "Unhook" ); } + std::string name() { return std::string( "Unhook" ); } }; class OSC_Start : public Action { public: - std::string name( void ) { return std::string( "OSC_Start" ); } + std::string name() { return std::string( "OSC_Start" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class OSC_Put : public Action { public: - std::string name( void ) { return std::string( "OSC_Put" ); } + std::string name() { return std::string( "OSC_Put" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; class OSC_End : public Action { public: - std::string name( void ) { return std::string( "OSC_End" ); } + std::string name() { return std::string( "OSC_End" ); } void act_on_terminal( Terminal::Emulator* emu ) const; }; @@ -149,7 +149,7 @@ class UserByte : public Action public: char c; /* The user-source byte. We don't try to interpret the charset */ - std::string name( void ) { return std::string( "UserByte" ); } + std::string name() { return std::string( "UserByte" ); } void act_on_terminal( Terminal::Emulator* emu ) const; UserByte( int s_c ) : c( s_c ) {} @@ -163,7 +163,7 @@ class Resize : public Action public: size_t width, height; - std::string name( void ) { return std::string( "Resize" ); } + std::string name() { return std::string( "Resize" ); } void act_on_terminal( Terminal::Emulator* emu ) const; Resize( size_t s_width, size_t s_height ) : width( s_width ), height( s_height ) {} diff --git a/src/terminal/parserstate.cc b/src/terminal/parserstate.cc index 747b7c666..6f54e87b8 100644 --- a/src/terminal/parserstate.cc +++ b/src/terminal/parserstate.cc @@ -100,7 +100,7 @@ Transition Ground::input_state_rule( wchar_t ch ) const return Transition(); } -ActionPointer Escape::enter( void ) const +ActionPointer Escape::enter() const { return std::make_shared(); } @@ -156,7 +156,7 @@ Transition Escape_Intermediate::input_state_rule( wchar_t ch ) const return Transition(); } -ActionPointer CSI_Entry::enter( void ) const +ActionPointer CSI_Entry::enter() const { return std::make_shared(); } @@ -249,7 +249,7 @@ Transition CSI_Ignore::input_state_rule( wchar_t ch ) const return Transition(); } -ActionPointer DCS_Entry::enter( void ) const +ActionPointer DCS_Entry::enter() const { return std::make_shared(); } @@ -317,12 +317,12 @@ Transition DCS_Intermediate::input_state_rule( wchar_t ch ) const return Transition(); } -ActionPointer DCS_Passthrough::enter( void ) const +ActionPointer DCS_Passthrough::enter() const { return std::make_shared(); } -ActionPointer DCS_Passthrough::exit( void ) const +ActionPointer DCS_Passthrough::exit() const { return std::make_shared(); } @@ -349,12 +349,12 @@ Transition DCS_Ignore::input_state_rule( wchar_t ch ) const return Transition(); } -ActionPointer OSC_String::enter( void ) const +ActionPointer OSC_String::enter() const { return std::make_shared(); } -ActionPointer OSC_String::exit( void ) const +ActionPointer OSC_String::exit() const { return std::make_shared(); } diff --git a/src/terminal/parserstate.h b/src/terminal/parserstate.h index bb7e26bc8..e252031c2 100644 --- a/src/terminal/parserstate.h +++ b/src/terminal/parserstate.h @@ -50,8 +50,8 @@ class State public: void setfamily( StateFamily* s_family ) { family = s_family; } Transition input( wchar_t ch ) const; - virtual ActionPointer enter( void ) const { return std::make_shared(); } - virtual ActionPointer exit( void ) const { return std::make_shared(); } + virtual ActionPointer enter() const { return std::make_shared(); } + virtual ActionPointer exit() const { return std::make_shared(); } State() : family( NULL ) {}; virtual ~State() {}; @@ -67,7 +67,7 @@ class Ground : public State class Escape : public State { - ActionPointer enter( void ) const; + ActionPointer enter() const; Transition input_state_rule( wchar_t ch ) const; }; @@ -78,7 +78,7 @@ class Escape_Intermediate : public State class CSI_Entry : public State { - ActionPointer enter( void ) const; + ActionPointer enter() const; Transition input_state_rule( wchar_t ch ) const; }; class CSI_Param : public State @@ -96,7 +96,7 @@ class CSI_Ignore : public State class DCS_Entry : public State { - ActionPointer enter( void ) const; + ActionPointer enter() const; Transition input_state_rule( wchar_t ch ) const; }; class DCS_Param : public State @@ -109,9 +109,9 @@ class DCS_Intermediate : public State }; class DCS_Passthrough : public State { - ActionPointer enter( void ) const; + ActionPointer enter() const; Transition input_state_rule( wchar_t ch ) const; - ActionPointer exit( void ) const; + ActionPointer exit() const; }; class DCS_Ignore : public State { @@ -120,9 +120,9 @@ class DCS_Ignore : public State class OSC_String : public State { - ActionPointer enter( void ) const; + ActionPointer enter() const; Transition input_state_rule( wchar_t ch ) const; - ActionPointer exit( void ) const; + ActionPointer exit() const; }; class SOS_PM_APC_String : public State { diff --git a/src/terminal/terminal.cc b/src/terminal/terminal.cc index d9ebb4c88..5797e9d86 100644 --- a/src/terminal/terminal.cc +++ b/src/terminal/terminal.cc @@ -43,7 +43,7 @@ using namespace Terminal; Emulator::Emulator( size_t s_width, size_t s_height ) : fb( s_width, s_height ), dispatch(), user() {} -std::string Emulator::read_octets_to_host( void ) +std::string Emulator::read_octets_to_host() { std::string ret = dispatch.terminal_to_host; dispatch.terminal_to_host.clear(); diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index d06e9ffd8..4593b3929 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -77,9 +77,9 @@ class Emulator public: Emulator( size_t s_width, size_t s_height ); - std::string read_octets_to_host( void ); + std::string read_octets_to_host(); - const Framebuffer& get_fb( void ) const { return fb; } + const Framebuffer& get_fb() const { return fb; } bool operator==( Emulator const& x ) const; }; diff --git a/src/terminal/terminaldispatcher.cc b/src/terminal/terminaldispatcher.cc index 7515ca703..ea98a5418 100644 --- a/src/terminal/terminaldispatcher.cc +++ b/src/terminal/terminaldispatcher.cc @@ -75,7 +75,7 @@ void Dispatcher::clear( const Parser::Clear* act __attribute( ( unused ) ) ) parsed = false; } -void Dispatcher::parse_params( void ) +void Dispatcher::parse_params() { if ( parsed ) { return; @@ -147,7 +147,7 @@ int Dispatcher::getparam( size_t N, int defaultval ) return ret; } -int Dispatcher::param_count( void ) +int Dispatcher::param_count() { if ( !parsed ) { parse_params(); @@ -156,7 +156,7 @@ int Dispatcher::param_count( void ) return parsed_params.size(); } -std::string Dispatcher::str( void ) +std::string Dispatcher::str() { char assum[64]; snprintf( assum, 64, "[dispatch=\"%s\" params=\"%s\"]", dispatch_chars.c_str(), params.c_str() ); @@ -164,7 +164,7 @@ std::string Dispatcher::str( void ) } /* construct on first use to avoid static initialization order crash */ -DispatchRegistry& Terminal::get_global_dispatch_registry( void ) +DispatchRegistry& Terminal::get_global_dispatch_registry() { static DispatchRegistry global_dispatch_registry; return global_dispatch_registry; diff --git a/src/terminal/terminaldispatcher.h b/src/terminal/terminaldispatcher.h index 1b8c3fb7c..009ea191d 100644 --- a/src/terminal/terminaldispatcher.h +++ b/src/terminal/terminaldispatcher.h @@ -85,7 +85,7 @@ class DispatchRegistry DispatchRegistry() : escape(), CSI(), control() {} }; -DispatchRegistry& get_global_dispatch_registry( void ); +DispatchRegistry& get_global_dispatch_registry(); class Dispatcher { @@ -97,7 +97,7 @@ class Dispatcher std::string dispatch_chars; std::vector OSC_string; - void parse_params( void ); + void parse_params(); public: static const int PARAM_MAX = 65535; @@ -107,17 +107,17 @@ class Dispatcher Dispatcher(); int getparam( size_t N, int defaultval ); - int param_count( void ); + int param_count(); void newparamchar( const Parser::Param* act ); void collect( const Parser::Collect* act ); void clear( const Parser::Clear* act ); - std::string str( void ); + std::string str(); void dispatch( Function_Type type, const Parser::Action* act, Framebuffer* fb ); - std::string get_dispatch_chars( void ) const { return dispatch_chars; } - std::vector get_OSC_string( void ) const { return OSC_string; } + std::string get_dispatch_chars() const { return dispatch_chars; } + std::vector get_OSC_string() const { return OSC_string; } void OSC_put( const Parser::OSC_Put* act ); void OSC_start( const Parser::OSC_Start* act ); diff --git a/src/terminal/terminaldisplay.cc b/src/terminal/terminaldisplay.cc index ca2ae8655..9486189e1 100644 --- a/src/terminal/terminaldisplay.cc +++ b/src/terminal/terminaldisplay.cc @@ -39,7 +39,7 @@ using namespace Terminal; /* Print a new "frame" to the terminal, using ANSI/ECMA-48 escape codes. */ -static const Renditions& initial_rendition( void ) +static const Renditions& initial_rendition() { const static Renditions blank = Renditions( 0 ); return blank; diff --git a/src/terminal/terminalframebuffer.cc b/src/terminal/terminalframebuffer.cc index ae6b83268..a04b2d64b 100644 --- a/src/terminal/terminalframebuffer.cc +++ b/src/terminal/terminalframebuffer.cc @@ -112,13 +112,13 @@ void Framebuffer::scroll( int N ) } } -void DrawState::new_grapheme( void ) +void DrawState::new_grapheme() { combining_char_col = cursor_col; combining_char_row = cursor_row; } -void DrawState::snap_cursor_to_border( void ) +void DrawState::snap_cursor_to_border() { if ( cursor_row < limit_top() ) cursor_row = limit_top(); @@ -188,7 +188,7 @@ void Framebuffer::move_rows_autoscroll( int rows ) ds.move_row( rows, true ); } -Cell* Framebuffer::get_combining_cell( void ) +Cell* Framebuffer::get_combining_cell() { if ( ( ds.get_combining_char_col() < 0 ) || ( ds.get_combining_char_row() < 0 ) || ( ds.get_combining_char_col() >= ds.get_width() ) @@ -199,7 +199,7 @@ Cell* Framebuffer::get_combining_cell( void ) return get_mutable_cell( ds.get_combining_char_row(), ds.get_combining_char_col() ); } -void DrawState::set_tab( void ) +void DrawState::set_tab() { tabs[cursor_col] = true; } @@ -251,12 +251,12 @@ void DrawState::set_scrolling_region( int top, int bottom ) } } -int DrawState::limit_top( void ) const +int DrawState::limit_top() const { return origin_mode ? scrolling_region_top_row : 0; } -int DrawState::limit_bottom( void ) const +int DrawState::limit_bottom() const { return origin_mode ? scrolling_region_bottom_row : height - 1; } @@ -281,7 +281,7 @@ SavedCursor::SavedCursor() : cursor_col( 0 ), cursor_row( 0 ), renditions( 0 ), auto_wrap_mode( true ), origin_mode( false ) {} -void DrawState::save_cursor( void ) +void DrawState::save_cursor() { save.cursor_col = cursor_col; save.cursor_row = cursor_row; @@ -290,7 +290,7 @@ void DrawState::save_cursor( void ) save.origin_mode = origin_mode; } -void DrawState::restore_cursor( void ) +void DrawState::restore_cursor() { cursor_col = save.cursor_col; cursor_row = save.cursor_row; @@ -381,7 +381,7 @@ void Framebuffer::delete_cell( int row, int col ) get_mutable_row( row )->delete_cell( col, ds.get_background_rendition() ); } -void Framebuffer::reset( void ) +void Framebuffer::reset() { int width = ds.get_width(), height = ds.get_height(); ds = DrawState( width, height ); @@ -391,7 +391,7 @@ void Framebuffer::reset( void ) /* do not reset bell_count */ } -void Framebuffer::soft_reset( void ) +void Framebuffer::soft_reset() { ds.insert_mode = false; ds.origin_mode = false; @@ -538,7 +538,7 @@ void Renditions::set_background_color( int num ) } } -std::string Renditions::sgr( void ) const +std::string Renditions::sgr() const { std::string ret; char col[64]; @@ -649,7 +649,7 @@ void Framebuffer::prefix_window_title( const title_type& s ) window_title.insert( window_title.begin(), s.begin(), s.end() ); } -std::string Cell::debug_contents( void ) const +std::string Cell::debug_contents() const { if ( contents.empty() ) { return "'_' ()"; diff --git a/src/terminal/terminalframebuffer.h b/src/terminal/terminalframebuffer.h index ef87ea84b..3a564d3ad 100644 --- a/src/terminal/terminalframebuffer.h +++ b/src/terminal/terminalframebuffer.h @@ -74,7 +74,7 @@ class Renditions void set_foreground_color( int num ); void set_background_color( int num ); void set_rendition( color_type num ); - std::string sgr( void ) const; + std::string sgr() const; static unsigned int make_true_color( unsigned int r, unsigned int g, unsigned int b ) { @@ -153,14 +153,14 @@ class Cell bool operator!=( const Cell& x ) const { return !operator==( x ); } /* Accessors for contents field */ - std::string debug_contents( void ) const; + std::string debug_contents() const; - bool empty( void ) const { return contents.empty(); } + bool empty() const { return contents.empty(); } /* 32 seems like a reasonable limit on combining characters */ - bool full( void ) const { return contents.size() >= 32; } - void clear( void ) { contents.clear(); } + bool full() const { return contents.size() >= 32; } + void clear() { contents.clear(); } - bool is_blank( void ) const + bool is_blank() const { // XXX fix. return ( contents.empty() || contents == " " || contents == "\xC2\xA0" ); @@ -228,15 +228,15 @@ class Cell /* Other accessors */ const Hyperlink& get_hyperlink() const { return hyperlink; } void set_hyperlink( Hyperlink l ) { hyperlink = std::move( l ); } - const Renditions& get_renditions( void ) const { return renditions; } - Renditions& get_renditions( void ) { return renditions; } + const Renditions& get_renditions() const { return renditions; } + Renditions& get_renditions() { return renditions; } void set_renditions( const Renditions& r ) { renditions = r; } - bool get_wide( void ) const { return wide; } + bool get_wide() const { return wide; } void set_wide( bool w ) { wide = w; } - unsigned int get_width( void ) const { return wide + 1; } - bool get_fallback( void ) const { return fallback; } + unsigned int get_width() const { return wide + 1; } + bool get_fallback() const { return fallback; } void set_fallback( bool f ) { fallback = f; } - bool get_wrap( void ) const { return wrap; } + bool get_wrap() const { return wrap; } void set_wrap( bool f ) { wrap = f; } }; @@ -263,7 +263,7 @@ class Row bool operator==( const Row& x ) const { return ( gen == x.gen && cells == x.cells ); } - bool get_wrap( void ) const { return cells.back().get_wrap(); } + bool get_wrap() const { return cells.back().get_wrap(); } void set_wrap( bool w ) { cells.back().set_wrap( w ); } uint64_t get_gen() const; @@ -287,8 +287,8 @@ class DrawState private: int width, height; - void new_grapheme( void ); - void snap_cursor_to_border( void ); + void new_grapheme(); + void snap_cursor_to_border(); int cursor_col, cursor_row; int combining_char_col, combining_char_row; @@ -342,26 +342,26 @@ class DrawState void move_row( int N, bool relative = false ); void move_col( int N, bool relative = false, bool implicit = false ); - int get_cursor_col( void ) const { return cursor_col; } - int get_cursor_row( void ) const { return cursor_row; } - int get_combining_char_col( void ) const { return combining_char_col; } - int get_combining_char_row( void ) const { return combining_char_row; } - int get_width( void ) const { return width; } - int get_height( void ) const { return height; } + int get_cursor_col() const { return cursor_col; } + int get_cursor_row() const { return cursor_row; } + int get_combining_char_col() const { return combining_char_col; } + int get_combining_char_row() const { return combining_char_row; } + int get_width() const { return width; } + int get_height() const { return height; } - void set_tab( void ); + void set_tab(); void clear_tab( int col ); - void clear_default_tabs( void ) { default_tabs = false; } + void clear_default_tabs() { default_tabs = false; } /* Default tabs can't be restored without resetting the draw state. */ int get_next_tab( int count ) const; void set_scrolling_region( int top, int bottom ); - int get_scrolling_region_top_row( void ) const { return scrolling_region_top_row; } - int get_scrolling_region_bottom_row( void ) const { return scrolling_region_bottom_row; } + int get_scrolling_region_top_row() const { return scrolling_region_top_row; } + int get_scrolling_region_bottom_row() const { return scrolling_region_bottom_row; } - int limit_top( void ) const; - int limit_bottom( void ) const; + int limit_top() const; + int limit_bottom() const; const Hyperlink& get_hyperlink() const { return hyperlink; } void set_hyperlink( Hyperlink x ) { hyperlink = std::move( x ); } @@ -369,13 +369,13 @@ class DrawState void set_foreground_color( int x ) { renditions.set_foreground_color( x ); } void set_background_color( int x ) { renditions.set_background_color( x ); } void add_rendition( color_type x ) { renditions.set_rendition( x ); } - const Renditions& get_renditions( void ) const { return renditions; } - Renditions& get_renditions( void ) { return renditions; } - int get_background_rendition( void ) const { return renditions.get_background_rendition(); } + const Renditions& get_renditions() const { return renditions; } + Renditions& get_renditions() { return renditions; } + int get_background_rendition() const { return renditions.get_background_rendition(); } - void save_cursor( void ); - void restore_cursor( void ); - void clear_saved_cursor( void ) { save = SavedCursor(); } + void save_cursor(); + void restore_cursor(); + void clear_saved_cursor() { save = SavedCursor(); } void resize( int s_width, int s_height ); @@ -420,7 +420,7 @@ class Framebuffer unsigned int bell_count; bool title_initialized; /* true if the window title has been set via an OSC */ - row_pointer newrow( void ) + row_pointer newrow() { const size_t w = ds.get_width(); const color_type c = ds.get_background_rendition(); @@ -479,7 +479,7 @@ class Framebuffer return &get_mutable_row( row )->cells.at( col ); } - Cell* get_combining_cell( void ); + Cell* get_combining_cell(); void apply_renditions_to_cell( Cell* cell ); void apply_hyperlink_to_cell( Cell* cell ); @@ -490,17 +490,17 @@ class Framebuffer void insert_cell( int row, int col ); void delete_cell( int row, int col ); - void reset( void ); - void soft_reset( void ); + void reset(); + void soft_reset(); - void set_title_initialized( void ) { title_initialized = true; } - bool is_title_initialized( void ) const { return title_initialized; } + void set_title_initialized() { title_initialized = true; } + bool is_title_initialized() const { return title_initialized; } void set_icon_name( const title_type& s ) { icon_name = s; } void set_window_title( const title_type& s ) { window_title = s; } void set_clipboard( const title_type& s ) { clipboard = s; } - const title_type& get_icon_name( void ) const { return icon_name; } - const title_type& get_window_title( void ) const { return window_title; } - const title_type& get_clipboard( void ) const { return clipboard; } + const title_type& get_icon_name() const { return icon_name; } + const title_type& get_window_title() const { return window_title; } + const title_type& get_clipboard() const { return clipboard; } void prefix_window_title( const title_type& s ); @@ -509,8 +509,8 @@ class Framebuffer void reset_cell( Cell* c ) { c->reset( ds.get_background_rendition() ); } void reset_row( Row* r ) { r->reset( ds.get_background_rendition() ); } - void ring_bell( void ) { bell_count++; } - unsigned int get_bell_count( void ) const { return bell_count; } + void ring_bell() { bell_count++; } + unsigned int get_bell_count() const { return bell_count; } bool operator==( const Framebuffer& x ) const { diff --git a/src/tests/base64.cc b/src/tests/base64.cc index 72579eedd..6408a5826 100644 --- a/src/tests/base64.cc +++ b/src/tests/base64.cc @@ -54,7 +54,7 @@ bool verbose = false; -static void test_base64( void ) +static void test_base64() { /* run through a test vector */ char encoded[25]; diff --git a/src/tests/encrypt-decrypt.cc b/src/tests/encrypt-decrypt.cc index c7468d5fa..6888579c4 100644 --- a/src/tests/encrypt-decrypt.cc +++ b/src/tests/encrypt-decrypt.cc @@ -56,7 +56,7 @@ bool verbose = false; #define NONCE_FMT "%016" PRIx64 -static std::string random_payload( void ) +static std::string random_payload() { const size_t len = prng.uint32() % MESSAGE_SIZE_MAX; char buf[MESSAGE_SIZE_MAX]; @@ -88,7 +88,7 @@ static void test_bad_decrypt( Session& decryption_session ) } /* Generate a single key and initial nonce, then perform some encryptions. */ -static void test_one_session( void ) +static void test_one_session() { Base64Key key; Session encryption_session( key ); diff --git a/src/tests/ocb-aes.cc b/src/tests/ocb-aes.cc index 847674194..a671e38e6 100644 --- a/src/tests/ocb-aes.cc +++ b/src/tests/ocb-aes.cc @@ -191,7 +191,7 @@ static void test_vector( const char* key_p, #define TEST_VECTOR( _key, _nonce, _assoc, _pt, _ct ) \ test_vector( _key, _nonce, sizeof( _assoc ) - 1, _assoc, sizeof( _pt ) - 1, _pt, sizeof( _ct ) - 1, _ct ) -static void test_all_vectors( void ) +static void test_all_vectors() { /* Test vectors from http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A */ @@ -501,7 +501,7 @@ static void test_all_vectors( void ) /* http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A also specifies an iterative test algorithm, which we implement here. */ -static void test_iterative( void ) +static void test_iterative() { /* Key is always all zeros */ AlignedBuffer key( KEY_LEN ); diff --git a/src/util/locale_utils.cc b/src/util/locale_utils.cc index 45b408abd..ef2ba603f 100644 --- a/src/util/locale_utils.cc +++ b/src/util/locale_utils.cc @@ -45,7 +45,7 @@ #include "src/util/locale_utils.h" -const std::string LocaleVar::str( void ) const +const std::string LocaleVar::str() const { if ( name.empty() ) { return std::string( "[no charset variables]" ); @@ -53,7 +53,7 @@ const std::string LocaleVar::str( void ) const return name + "=" + value; } -const LocaleVar get_ctype( void ) +const LocaleVar get_ctype() { /* Reimplement the search logic, just for diagnostics */ if ( const char* all = getenv( "LC_ALL" ) ) { @@ -66,7 +66,7 @@ const LocaleVar get_ctype( void ) return LocaleVar( "", "" ); } -const char* locale_charset( void ) +const char* locale_charset() { static const char ASCII_name[] = "US-ASCII"; @@ -80,7 +80,7 @@ const char* locale_charset( void ) return ret; } -bool is_utf8_locale( void ) +bool is_utf8_locale() { /* Verify locale calls for UTF-8 */ if ( strcmp( locale_charset(), "UTF-8" ) != 0 && strcmp( locale_charset(), "utf-8" ) != 0 ) { @@ -89,7 +89,7 @@ bool is_utf8_locale( void ) return true; } -void set_native_locale( void ) +void set_native_locale() { /* Adopt native locale */ if ( NULL == setlocale( LC_ALL, "" ) ) { @@ -107,7 +107,7 @@ void set_native_locale( void ) } } -void clear_locale_variables( void ) +void clear_locale_variables() { unsetenv( "LANG" ); unsetenv( "LANGUAGE" ); diff --git a/src/util/locale_utils.h b/src/util/locale_utils.h index dec3df0d8..4acbe6f63 100644 --- a/src/util/locale_utils.h +++ b/src/util/locale_utils.h @@ -40,13 +40,13 @@ class LocaleVar public: const std::string name, value; LocaleVar( const char* s_name, const char* s_value ) : name( s_name ), value( s_value ) {} - const std::string str( void ) const; + const std::string str() const; }; -const LocaleVar get_ctype( void ); -const char* locale_charset( void ); -bool is_utf8_locale( void ); -void set_native_locale( void ); -void clear_locale_variables( void ); +const LocaleVar get_ctype(); +const char* locale_charset(); +bool is_utf8_locale(); +void set_native_locale(); +void clear_locale_variables(); #endif diff --git a/src/util/select.h b/src/util/select.h index 39a4d724b..52c79214a 100644 --- a/src/util/select.h +++ b/src/util/select.h @@ -51,7 +51,7 @@ class Select { public: - static Select& get_instance( void ) + static Select& get_instance() { /* COFU may or may not be thread-safe, depending on compiler */ static Select instance; @@ -71,7 +71,7 @@ class Select fatal_assert( 0 == sigemptyset( &empty_sigset ) ); } - void clear_got_signal( void ) + void clear_got_signal() { for ( volatile sig_atomic_t* p = got_signal; p < got_signal + sizeof( got_signal ) / sizeof( *got_signal ); p++ ) { @@ -92,7 +92,7 @@ class Select FD_SET( fd, &all_fds ); } - void clear_fds( void ) { FD_ZERO( &all_fds ); } + void clear_fds() { FD_ZERO( &all_fds ); } static void add_signal( int signum ) { @@ -205,7 +205,7 @@ class Select } /* This method does not consume signal notifications. */ - bool any_signal( void ) const + bool any_signal() const { bool rv = false; for ( int i = 0; i < MAX_SIGNAL_NUMBER; i++ ) { @@ -214,10 +214,7 @@ class Select return rv; } - static void set_verbose( unsigned int s_verbose ) - { - verbose = s_verbose; - } + static void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; } private: static const int MAX_SIGNAL_NUMBER = 64; diff --git a/src/util/timestamp.cc b/src/util/timestamp.cc index 569ae6fc1..2b4043ea4 100644 --- a/src/util/timestamp.cc +++ b/src/util/timestamp.cc @@ -60,7 +60,7 @@ static uint64_t millis_cache = -1; -uint64_t frozen_timestamp( void ) +uint64_t frozen_timestamp() { if ( millis_cache == uint64_t( -1 ) ) { freeze_timestamp(); @@ -69,7 +69,7 @@ uint64_t frozen_timestamp( void ) return millis_cache; } -void freeze_timestamp( void ) +void freeze_timestamp() { // Try all our clock sources till we get something. This could // break if a source only sometimes works in a given process. diff --git a/src/util/timestamp.h b/src/util/timestamp.h index 07cf5b434..10fa05f1d 100644 --- a/src/util/timestamp.h +++ b/src/util/timestamp.h @@ -35,7 +35,7 @@ #include -void freeze_timestamp( void ); -uint64_t frozen_timestamp( void ); +void freeze_timestamp(); +uint64_t frozen_timestamp(); #endif