|
|
- From ea4e2d6657103a2c3d6f543a1a8619eb4d4472c8 Mon Sep 17 00:00:00 2001
- From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
- Date: Mon, 30 Dec 2019 04:03:03 +0000
- Subject: [PATCH] Avoid 'using namespace std' causing name conflicts. Fixes
- #1363, fixes #1867
-
- ---
- CHANGELOG | 4 ++++
- nping/EchoServer.cc | 2 +-
- nping/EchoServer.h | 4 +---
- nping/NEPContext.h | 3 +--
- nping/NpingTargets.h | 4 +---
- nping/ProbeMode.h | 2 --
- nping/nping.cc | 1 -
- nping/utils.h | 2 --
- 8 files changed, 8 insertions(+), 14 deletions(-)
-
- diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
- index ccdcf9c2d0..a824340cd2 100644
- --- a/nping/EchoServer.cc
- +++ b/nping/EchoServer.cc
- @@ -199,7 +199,7 @@ NEPContext *EchoServer::getClientContext(nsock_iod iod){
- * the context could not be found. */
- int EchoServer::destroyClientContext(clientid_t clnt){
- bool deleted=false;
- - vector<NEPContext>::iterator it;
- + std::vector<NEPContext>::iterator it;
- /* Iterate through the context array and delete the one that belongs to clnt */
- for ( it=this->client_ctx.begin(); it<this->client_ctx.end(); it++){
- if(it->getIdentifier()==clnt){
- diff --git a/nping/EchoServer.h b/nping/EchoServer.h
- index c3dece6341..c9fee6de9e 100644
- --- a/nping/EchoServer.h
- +++ b/nping/EchoServer.h
- @@ -136,15 +136,13 @@
- #include <vector>
- #include "NEPContext.h"
-
- -using namespace std;
- -
- #define LISTEN_QUEUE_SIZE 10
-
- class EchoServer {
-
- private:
- /* Attributes */
- - vector<NEPContext> client_ctx;
- + std::vector<NEPContext> client_ctx;
- clientid_t client_id_count;
-
- /* Methods */
- diff --git a/nping/NEPContext.h b/nping/NEPContext.h
- index 5e470d7551..32b8be48d6 100644
- --- a/nping/NEPContext.h
- +++ b/nping/NEPContext.h
- @@ -135,7 +135,6 @@
- #include "nsock.h"
- #include "EchoHeader.h"
- #include <vector>
- -using namespace std;
-
- /* SERVER STATE MACHINE */
- /* _ */
- @@ -204,7 +203,7 @@ class NEPContext {
- u8 client_nonce[NONCE_LEN];
- bool server_nonce_set;
- bool client_nonce_set;
- - vector<fspec_t> fspecs;
- + std::vector<fspec_t> fspecs;
- struct sockaddr_storage clnt_addr;
-
- u8 *generateKey(int key_type, size_t *final_len);
- diff --git a/nping/NpingTargets.h b/nping/NpingTargets.h
- index 61bb356f39..3a9a2145af 100644
- --- a/nping/NpingTargets.h
- +++ b/nping/NpingTargets.h
- @@ -137,8 +137,6 @@
- #include "NpingTarget.h"
- #include <vector>
-
- -using namespace std;
- -
- #define MAX_NPING_HOSTNAME_LEN 512 /**< Max length for named hosts */
-
- class NpingTargets {
- @@ -176,7 +174,7 @@ class NpingTargets {
-
- /* TODO: Make private */
- NpingTarget *currenths;
- - vector<NpingTarget *> Targets;
- + std::vector<NpingTarget *> Targets;
-
- }; /* End of class NpingTargets */
-
- diff --git a/nping/ProbeMode.h b/nping/ProbeMode.h
- index aa86939e02..313776d862 100644
- --- a/nping/ProbeMode.h
- +++ b/nping/ProbeMode.h
- @@ -135,11 +135,9 @@
-
- #include "nping.h"
- #include "nsock.h"
- -#include <vector>
- #include "NpingTarget.h"
- #include "utils_net.h"
- #include "utils.h"
- -using namespace std;
-
- #define PKT_TYPE_TCP_CONNECT 1
- #define PKT_TYPE_UDP_NORMAL 2
- diff --git a/nping/nping.cc b/nping/nping.cc
- index 9de151a7be..40df912a88 100644
- --- a/nping/nping.cc
- +++ b/nping/nping.cc
- @@ -150,7 +150,6 @@
- #include <signal.h>
- #include <time.h>
-
- -using namespace std;
- NpingOps o;
- EchoClient ec;
- EchoServer es;
- diff --git a/nping/utils.h b/nping/utils.h
- index c3516cf29f..5de6b64b89 100644
- --- a/nping/utils.h
- +++ b/nping/utils.h
- @@ -143,8 +143,6 @@
- #endif
-
- #include "global_structures.h"
- -#include <vector>
- -using namespace std;
-
- /* Function prototypes */
- bool contains(const char *source, const char *substring);
|