1 From ea4e2d6657103a2c3d6f543a1a8619eb4d4472c8 Mon Sep 17 00:00:00 2001
2 From: dmiller <dmiller@e0a8ed71-7df4-0310-8962-fdc924857419>
3 Date: Mon, 30 Dec 2019 04:03:03 +0000
4 Subject: [PATCH] Avoid 'using namespace std' causing name conflicts. Fixes
9 nping/EchoServer.cc | 2 +-
10 nping/EchoServer.h | 4 +---
11 nping/NEPContext.h | 3 +--
12 nping/NpingTargets.h | 4 +---
13 nping/ProbeMode.h | 2 --
16 8 files changed, 8 insertions(+), 14 deletions(-)
18 diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
19 index ccdcf9c2d0..a824340cd2 100644
20 --- a/nping/EchoServer.cc
21 +++ b/nping/EchoServer.cc
22 @@ -199,7 +199,7 @@ NEPContext *EchoServer::getClientContext(nsock_iod iod){
23 * the context could not be found. */
24 int EchoServer::destroyClientContext(clientid_t clnt){
26 - vector<NEPContext>::iterator it;
27 + std::vector<NEPContext>::iterator it;
28 /* Iterate through the context array and delete the one that belongs to clnt */
29 for ( it=this->client_ctx.begin(); it<this->client_ctx.end(); it++){
30 if(it->getIdentifier()==clnt){
31 diff --git a/nping/EchoServer.h b/nping/EchoServer.h
32 index c3dece6341..c9fee6de9e 100644
33 --- a/nping/EchoServer.h
34 +++ b/nping/EchoServer.h
37 #include "NEPContext.h"
41 #define LISTEN_QUEUE_SIZE 10
47 - vector<NEPContext> client_ctx;
48 + std::vector<NEPContext> client_ctx;
49 clientid_t client_id_count;
52 diff --git a/nping/NEPContext.h b/nping/NEPContext.h
53 index 5e470d7551..32b8be48d6 100644
54 --- a/nping/NEPContext.h
55 +++ b/nping/NEPContext.h
58 #include "EchoHeader.h"
62 /* SERVER STATE MACHINE */
64 @@ -204,7 +203,7 @@ class NEPContext {
65 u8 client_nonce[NONCE_LEN];
66 bool server_nonce_set;
67 bool client_nonce_set;
68 - vector<fspec_t> fspecs;
69 + std::vector<fspec_t> fspecs;
70 struct sockaddr_storage clnt_addr;
72 u8 *generateKey(int key_type, size_t *final_len);
73 diff --git a/nping/NpingTargets.h b/nping/NpingTargets.h
74 index 61bb356f39..3a9a2145af 100644
75 --- a/nping/NpingTargets.h
76 +++ b/nping/NpingTargets.h
78 #include "NpingTarget.h"
83 #define MAX_NPING_HOSTNAME_LEN 512 /**< Max length for named hosts */
86 @@ -176,7 +174,7 @@ class NpingTargets {
88 /* TODO: Make private */
89 NpingTarget *currenths;
90 - vector<NpingTarget *> Targets;
91 + std::vector<NpingTarget *> Targets;
93 }; /* End of class NpingTargets */
95 diff --git a/nping/ProbeMode.h b/nping/ProbeMode.h
96 index aa86939e02..313776d862 100644
97 --- a/nping/ProbeMode.h
98 +++ b/nping/ProbeMode.h
104 #include "NpingTarget.h"
105 #include "utils_net.h"
107 -using namespace std;
109 #define PKT_TYPE_TCP_CONNECT 1
110 #define PKT_TYPE_UDP_NORMAL 2
111 diff --git a/nping/nping.cc b/nping/nping.cc
112 index 9de151a7be..40df912a88 100644
119 -using namespace std;
123 diff --git a/nping/utils.h b/nping/utils.h
124 index c3516cf29f..5de6b64b89 100644
130 #include "global_structures.h"
132 -using namespace std;
134 /* Function prototypes */
135 bool contains(const char *source, const char *substring);