Remove various assert(constant) calls

These cause warnings from static checkers, and seem to lead to spurious
GCC7 -Wmaybe-uninitialized.
This commit is contained in:
John Hood
2017-08-07 05:03:18 +02:00
parent 93daa5ac3b
commit a40b67691a
7 changed files with 4 additions and 14 deletions
+1 -3
View File
@@ -126,7 +126,6 @@ Validity ConditionalCursorMove::get_validity( const Framebuffer &fb,
if ( (row >= fb.ds.get_height()) if ( (row >= fb.ds.get_height())
|| (col >= fb.ds.get_width()) ) { || (col >= fb.ds.get_width()) ) {
// assert( false );
// fprintf( stderr, "Crazy cursor (%d,%d)!\n", row, col ); // fprintf( stderr, "Crazy cursor (%d,%d)!\n", row, col );
return IncorrectOrExpired; return IncorrectOrExpired;
} }
@@ -299,9 +298,8 @@ void NotificationEngine::apply( Framebuffer &fb ) const
} }
break; break;
case -1: /* unprintable character */ case -1: /* unprintable character */
default: /* Bogus width, ignore. */
break; break;
default:
assert( false );
} }
} }
} }
-3
View File
@@ -286,7 +286,6 @@ Connection::Connection( const char *desired_ip, const char *desired_port ) /* se
throw; /* this time it's fatal */ throw; /* this time it's fatal */
} }
assert( false );
throw NetworkException( "Could not bind", errno ); throw NetworkException( "Could not bind", errno );
} }
@@ -352,7 +351,6 @@ bool Connection::try_bind( const char *addr, int port_low, int port_high )
} }
} }
assert( false );
return false; return false;
} }
@@ -458,7 +456,6 @@ string Connection::recv( void )
prune_sockets(); prune_sockets();
return payload; return payload;
} }
assert( false );
return ""; return "";
} }
-2
View File
@@ -95,7 +95,6 @@ string UserStream::diff_from( const UserStream &existing ) const
} }
break; break;
default: default:
assert( false );
break; break;
} }
@@ -131,7 +130,6 @@ const Parser::Action &UserStream::get_action( unsigned int i ) const
case ResizeType: case ResizeType:
return actions[ i ].resize; return actions[ i ].resize;
default: default:
assert( false );
static const Parser::Ignore nothing = Parser::Ignore(); static const Parser::Ignore nothing = Parser::Ignore();
return nothing; return nothing;
} }
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Network {
/* interface for Network::Transport */ /* interface for Network::Transport */
void subtract( const UserStream *prefix ); void subtract( const UserStream *prefix );
string diff_from( const UserStream &existing ) const; string diff_from( const UserStream &existing ) const;
string init_diff( void ) const { assert( false ); return string(); }; string init_diff( void ) const { return string(); };
void apply_string( const string &diff ); void apply_string( const string &diff );
bool operator==( const UserStream &x ) const { return actions == x.actions; } bool operator==( const UserStream &x ) const { return actions == x.actions; }
+1 -3
View File
@@ -140,9 +140,7 @@ void Emulator::print( const Parser::Print *act )
} }
break; break;
case -1: /* unprintable character */ case -1: /* unprintable character */
break; default: /* bogus width, ignore */
default:
assert( false );
break; break;
} }
} }
-1
View File
@@ -76,7 +76,6 @@ string UserInput::input( const Parser::UserByte *act,
default: default:
/* This doesn't handle the 8-bit SS3 C1 control, which would be /* This doesn't handle the 8-bit SS3 C1 control, which would be
two octets in UTF-8. Fortunately nobody seems to send this. */ two octets in UTF-8. Fortunately nobody seems to send this. */
assert( false );
return string(); return string();
} }
} }
+1 -1
View File
@@ -144,7 +144,7 @@ int main( int argc, char *argv[] ) {
} catch ( const CryptoException &e ) { } catch ( const CryptoException &e ) {
fprintf( stderr, "Crypto exception: %s\r\n", fprintf( stderr, "Crypto exception: %s\r\n",
e.what() ); e.what() );
fatal_assert( false ); return 1;
} }
} }