Always use std::min, std::max.
This commit is contained in:
@@ -682,11 +682,11 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
|
|||||||
int timeout = INT_MAX;
|
int timeout = INT_MAX;
|
||||||
uint64_t now = Network::timestamp();
|
uint64_t now = Network::timestamp();
|
||||||
|
|
||||||
timeout = min( timeout, network.wait_time() );
|
timeout = std::min( timeout, network.wait_time() );
|
||||||
timeout = min( timeout, terminal.wait_time( now ) );
|
timeout = std::min( timeout, terminal.wait_time( now ) );
|
||||||
if ( (!network.get_remote_state_num())
|
if ( (!network.get_remote_state_num())
|
||||||
|| network.shutdown_in_progress() ) {
|
|| network.shutdown_in_progress() ) {
|
||||||
timeout = min( timeout, 5000 );
|
timeout = std::min( timeout, 5000 );
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* The server goes completely asleep if it has no remote peer.
|
* The server goes completely asleep if it has no remote peer.
|
||||||
@@ -701,7 +701,7 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
|
|||||||
/* 24 days might be too soon. That's OK. */
|
/* 24 days might be too soon. That's OK. */
|
||||||
network_sleep = INT_MAX;
|
network_sleep = INT_MAX;
|
||||||
}
|
}
|
||||||
timeout = min( timeout, static_cast<int>(network_sleep) );
|
timeout = std::min( timeout, static_cast<int>(network_sleep) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* poll for events */
|
/* poll for events */
|
||||||
|
|||||||
@@ -439,11 +439,11 @@ bool STMClient::main( void )
|
|||||||
try {
|
try {
|
||||||
output_new_frame();
|
output_new_frame();
|
||||||
|
|
||||||
int wait_time = min( network->wait_time(), overlays.wait_time() );
|
int wait_time = std::min( network->wait_time(), overlays.wait_time() );
|
||||||
|
|
||||||
/* Handle startup "Connecting..." message */
|
/* Handle startup "Connecting..." message */
|
||||||
if ( still_connecting() ) {
|
if ( still_connecting() ) {
|
||||||
wait_time = min( 250, wait_time );
|
wait_time = std::min( 250, wait_time );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* poll for events */
|
/* poll for events */
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
#include "terminaloverlay.h"
|
#include "terminaloverlay.h"
|
||||||
|
|
||||||
using namespace Overlay;
|
using namespace Overlay;
|
||||||
using std::max;
|
|
||||||
|
|
||||||
void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, int row, bool flag ) const
|
void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, int row, bool flag ) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -104,13 +104,13 @@ void TransportSender<MyState>::calculate_timers( void )
|
|||||||
mindelay_clock = now;
|
mindelay_clock = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_send_time = max( mindelay_clock + SEND_MINDELAY,
|
next_send_time = std::max( mindelay_clock + SEND_MINDELAY,
|
||||||
sent_states.back().timestamp + send_interval() );
|
sent_states.back().timestamp + send_interval() );
|
||||||
} else if ( !(current_state == assumed_receiver_state->state)
|
} else if ( !(current_state == assumed_receiver_state->state)
|
||||||
&& (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
|
&& (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
|
||||||
next_send_time = sent_states.back().timestamp + send_interval();
|
next_send_time = sent_states.back().timestamp + send_interval();
|
||||||
if ( mindelay_clock != uint64_t( -1 ) ) {
|
if ( mindelay_clock != uint64_t( -1 ) ) {
|
||||||
next_send_time = max( next_send_time, mindelay_clock + SEND_MINDELAY );
|
next_send_time = std::max( next_send_time, mindelay_clock + SEND_MINDELAY );
|
||||||
}
|
}
|
||||||
} else if ( !(current_state == sent_states.front().state )
|
} else if ( !(current_state == sent_states.front().state )
|
||||||
&& (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
|
&& (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) {
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ void Dispatcher::OSC_dispatch( const Parser::OSC_End *act __attribute((unused)),
|
|||||||
bool set_title = cmd_num == 0 || cmd_num == 2;
|
bool set_title = cmd_num == 0 || cmd_num == 2;
|
||||||
if ( set_icon || set_title ) {
|
if ( set_icon || set_title ) {
|
||||||
fb->set_title_initialized();
|
fb->set_title_initialized();
|
||||||
int title_length = min(OSC_string.size(), (size_t)256);
|
int title_length = std::min(OSC_string.size(), (size_t)256);
|
||||||
Terminal::Framebuffer::title_type newtitle( OSC_string.begin() + offset, OSC_string.begin() + title_length );
|
Terminal::Framebuffer::title_type newtitle( OSC_string.begin() + offset, OSC_string.begin() + title_length );
|
||||||
if ( set_icon ) { fb->set_icon_name( newtitle ); }
|
if ( set_icon ) { fb->set_icon_name( newtitle ); }
|
||||||
if ( set_title ) { fb->set_window_title( newtitle ); }
|
if ( set_title ) { fb->set_window_title( newtitle ); }
|
||||||
|
|||||||
Reference in New Issue
Block a user