Fix various new compiler warnings.

terminalfunctions.cc: set_if_available() was undeclared.
Fix printf() wint_t/wchar_t warnings.
mosh-server.cc: Fix warning for side effects inside typeid().

Signed-off-by: John Hood <cgull@glup.org>
This commit is contained in:
John Hood
2015-06-05 23:35:18 -04:00
parent b604a7d7c2
commit 543f346ac7
6 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -206,7 +206,7 @@ static int vt_parser( int fd, Parser::UTF8Parser *parser )
if ( act->char_present ) { if ( act->char_present ) {
if ( iswprint( act->ch ) ) { if ( iswprint( act->ch ) ) {
printf( "%s(0x%02x=%lc) ", act->name().c_str(), (unsigned int)act->ch, act->ch ); printf( "%s(0x%02x=%lc) ", act->name().c_str(), (unsigned int)act->ch, (wint_t)act->ch );
} else { } else {
printf( "%s(0x%02x) ", act->name().c_str(), (unsigned int)act->ch ); printf( "%s(0x%02x) ", act->name().c_str(), (unsigned int)act->ch );
} }
+3 -2
View File
@@ -585,8 +585,9 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
us.apply_string( network.get_remote_diff() ); us.apply_string( network.get_remote_diff() );
/* apply userstream to terminal */ /* apply userstream to terminal */
for ( size_t i = 0; i < us.size(); i++ ) { for ( size_t i = 0; i < us.size(); i++ ) {
terminal_to_host += terminal.act( us.get_action( i ) ); const Parser::Action *action = us.get_action( i );
if ( typeid( *us.get_action( i ) ) == typeid( Parser::Resize ) ) { terminal_to_host += terminal.act( action );
if ( typeid( action ) == typeid( Parser::Resize ) ) {
/* tell child process of resize */ /* tell child process of resize */
const Parser::Resize *res = static_cast<const Parser::Resize *>( us.get_action( i ) ); const Parser::Resize *res = static_cast<const Parser::Resize *>( us.get_action( i ) );
struct winsize window_size; struct winsize window_size;
+1 -1
View File
@@ -43,7 +43,7 @@ std::string Action::str( void )
char thechar[ 10 ] = { 0 }; char thechar[ 10 ] = { 0 };
if ( char_present ) { if ( char_present ) {
if ( iswprint( ch ) ) if ( iswprint( ch ) )
snprintf( thechar, 10, "(%lc)", ch ); snprintf( thechar, 10, "(%lc)", (wint_t)ch );
else else
snprintf( thechar, 10, "(0x%x)", (unsigned int)ch ); snprintf( thechar, 10, "(0x%x)", (unsigned int)ch );
} }
+4 -4
View File
@@ -81,7 +81,7 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const
for ( std::deque<wchar_t>::const_iterator i = window_title.begin(); for ( std::deque<wchar_t>::const_iterator i = window_title.begin();
i != window_title.end(); i != window_title.end();
i++ ) { i++ ) {
snprintf( tmp, 64, "%lc", *i ); snprintf( tmp, 64, "%lc", (wint_t)*i );
frame.append( tmp ); frame.append( tmp );
} }
frame.append( "\007" ); frame.append( "\007" );
@@ -93,7 +93,7 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const
for ( std::deque<wchar_t>::const_iterator i = icon_name.begin(); for ( std::deque<wchar_t>::const_iterator i = icon_name.begin();
i != icon_name.end(); i != icon_name.end();
i++ ) { i++ ) {
snprintf( tmp, 64, "%lc", *i ); snprintf( tmp, 64, "%lc", (wint_t)*i );
frame.append( tmp ); frame.append( tmp );
} }
frame.append( "\007" ); frame.append( "\007" );
@@ -103,7 +103,7 @@ std::string Display::new_frame( bool initialized, const Framebuffer &last, const
for ( std::deque<wchar_t>::const_iterator i = window_title.begin(); for ( std::deque<wchar_t>::const_iterator i = window_title.begin();
i != window_title.end(); i != window_title.end();
i++ ) { i++ ) {
snprintf( tmp, 64, "%lc", *i ); snprintf( tmp, 64, "%lc", (wint_t)*i );
frame.append( tmp ); frame.append( tmp );
} }
frame.append( "\007" ); frame.append( "\007" );
@@ -421,7 +421,7 @@ void Display::put_cell( bool initialized, FrameState &frame, const Framebuffer &
for ( std::vector<wchar_t>::const_iterator i = cell->contents.begin(); for ( std::vector<wchar_t>::const_iterator i = cell->contents.begin();
i != cell->contents.end(); i != cell->contents.end();
i++ ) { i++ ) {
snprintf( tmp, 64, "%lc", *i ); snprintf( tmp, 64, "%lc", (wint_t)*i );
frame.append( tmp ); frame.append( tmp );
} }
+1 -1
View File
@@ -589,7 +589,7 @@ bool Cell::compare( const Cell &other ) const
if ( !contents_match( other ) ) { if ( !contents_match( other ) ) {
ret = true; ret = true;
fprintf( stderr, "Contents: %lc vs. %lc\n", fprintf( stderr, "Contents: %lc vs. %lc\n",
debug_contents(), other.debug_contents() ); (wint_t)debug_contents(), (wint_t)other.debug_contents() );
} }
if ( fallback != other.fallback ) { if ( fallback != other.fallback ) {
+1 -1
View File
@@ -279,7 +279,7 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) {
} }
/* helper for CSI_DECSM and CSI_DECRM */ /* helper for CSI_DECSM and CSI_DECRM */
void set_if_available( bool *mode, bool value ) static void set_if_available( bool *mode, bool value )
{ {
if ( mode ) { *mode = value; } if ( mode ) { *mode = value; }
} }