Remove "using namespace std;".

This commit is contained in:
John Hood
2018-08-15 01:56:53 -04:00
parent fb23168ed9
commit 756f4f8e98
13 changed files with 16 additions and 24 deletions
-1
View File
@@ -44,7 +44,6 @@
#include "fatal_assert.h" #include "fatal_assert.h"
#include "prng.h" #include "prng.h"
using namespace std;
using namespace Crypto; using namespace Crypto;
long int myatoi( const char *str ) long int myatoi( const char *str )
+4 -5
View File
@@ -37,7 +37,6 @@
#include "crypto.h" #include "crypto.h"
using namespace Crypto; using namespace Crypto;
using namespace std;
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
@@ -51,8 +50,8 @@ int main( int argc, char *argv[] )
Session session( key ); Session session( key );
/* Read input */ /* Read input */
ostringstream input; std::ostringstream input;
input << cin.rdbuf(); input << std::cin.rdbuf();
/* Decrypt message */ /* Decrypt message */
@@ -60,9 +59,9 @@ int main( int argc, char *argv[] )
fprintf( stderr, "Nonce = %ld\n", fprintf( stderr, "Nonce = %ld\n",
(long)message.nonce.val() ); (long)message.nonce.val() );
cout << message.text; std::cout << message.text;
} catch ( const CryptoException &e ) { } catch ( const CryptoException &e ) {
cerr << e.what() << endl; std::cerr << e.what() << std::endl;
exit( 1 ); exit( 1 );
} }
+5 -6
View File
@@ -37,7 +37,6 @@
#include "crypto.h" #include "crypto.h"
using namespace Crypto; using namespace Crypto;
using namespace std;
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
@@ -52,18 +51,18 @@ int main( int argc, char *argv[] )
Nonce nonce( myatoi( argv[ 1 ] ) ); Nonce nonce( myatoi( argv[ 1 ] ) );
/* Read input */ /* Read input */
ostringstream input; std::ostringstream input;
input << cin.rdbuf(); input << std::cin.rdbuf();
/* Encrypt message */ /* Encrypt message */
string ciphertext = session.encrypt( Message( nonce, input.str() ) ); string ciphertext = session.encrypt( Message( nonce, input.str() ) );
cerr << "Key: " << key.printable_key() << endl; std::cerr << "Key: " << key.printable_key() << std::endl;
cout << ciphertext; std::cout << ciphertext;
} catch ( const CryptoException &e ) { } catch ( const CryptoException &e ) {
cerr << e.what() << endl; std::cerr << e.what() << std::endl;
exit( 1 ); exit( 1 );
} }
+1 -2
View File
@@ -107,7 +107,6 @@ static int run_server( const char *desired_ip, const char *desired_port,
const string &command_path, char *command_argv[], const string &command_path, char *command_argv[],
const int colors, unsigned int verbose, bool with_motd ); const int colors, unsigned int verbose, bool with_motd );
using namespace std;
static void print_version( FILE *file ) static void print_version( FILE *file )
{ {
@@ -150,7 +149,7 @@ static string get_SSH_IP( void )
fputs( "Warning: SSH_CONNECTION not found; binding to any interface.\n", stderr ); fputs( "Warning: SSH_CONNECTION not found; binding to any interface.\n", stderr );
return string( "" ); return string( "" );
} }
istringstream ss( SSH_CONNECTION ); std::istringstream ss( SSH_CONNECTION );
string dummy, local_interface_IP; string dummy, local_interface_IP;
ss >> dummy >> dummy >> local_interface_IP; ss >> dummy >> dummy >> local_interface_IP;
if ( !ss ) { if ( !ss ) {
+2
View File
@@ -63,6 +63,8 @@
#include "networktransport-impl.h" #include "networktransport-impl.h"
using std::wstring;
void STMClient::resume( void ) void STMClient::resume( void )
{ {
/* Restore termios state */ /* Restore termios state */
-1
View File
@@ -36,7 +36,6 @@
#include "dos_assert.h" #include "dos_assert.h"
using namespace Network; using namespace Network;
using namespace std;
string Compressor::compress_str( const string &input ) string Compressor::compress_str( const string &input )
{ {
-1
View File
@@ -60,7 +60,6 @@
#define AI_NUMERICSERV 0 #define AI_NUMERICSERV 0
#endif #endif
using namespace std;
using namespace Network; using namespace Network;
using namespace Crypto; using namespace Crypto;
-1
View File
@@ -38,7 +38,6 @@
#include "transportsender-impl.h" #include "transportsender-impl.h"
using namespace Network; using namespace Network;
using namespace std;
template <class MyState, class RemoteState> template <class MyState, class RemoteState>
Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote, Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState &initial_remote,
-1
View File
@@ -45,7 +45,6 @@
#include <limits.h> #include <limits.h>
using namespace Network; using namespace Network;
using namespace std;
template <class MyState> template <class MyState>
TransportSender<MyState>::TransportSender( Connection *s_connection, MyState &initial_state ) TransportSender<MyState>::TransportSender( Connection *s_connection, MyState &initial_state )
+1 -1
View File
@@ -161,7 +161,7 @@ bool Complete::set_echo_ack( uint64_t now )
void Complete::register_input_frame( uint64_t n, uint64_t now ) void Complete::register_input_frame( uint64_t n, uint64_t now )
{ {
input_history.push_back( make_pair( n, now ) ); input_history.push_back( std::make_pair( n, now ) );
} }
int Complete::wait_time( uint64_t now ) const int Complete::wait_time( uint64_t now ) const
-1
View File
@@ -40,7 +40,6 @@
#include "parseraction.h" #include "parseraction.h"
using namespace Terminal; using namespace Terminal;
using namespace std;
/* Terminal functions -- routines activated by CSI, escape or a control char */ /* Terminal functions -- routines activated by CSI, escape or a control char */
+1 -1
View File
@@ -34,7 +34,7 @@
#include "terminaluserinput.h" #include "terminaluserinput.h"
using namespace Terminal; using namespace Terminal;
using namespace std; using std::string;
string UserInput::input( const Parser::UserByte *act, string UserInput::input( const Parser::UserByte *act,
bool application_mode_cursor_keys ) bool application_mode_cursor_keys )
+2 -3
View File
@@ -45,12 +45,11 @@
#include "locale_utils.h" #include "locale_utils.h"
using namespace std;
const string LocaleVar::str( void ) const const std::string LocaleVar::str( void ) const
{ {
if ( name.empty() ) { if ( name.empty() ) {
return string( "[no charset variables]" ); return std::string( "[no charset variables]" );
} }
return name + "=" + value; return name + "=" + value;
} }