You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.8 KiB

  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
  5. #1363, fixes #1867
  6. ---
  7. CHANGELOG | 4 ++++
  8. nping/EchoServer.cc | 2 +-
  9. nping/EchoServer.h | 4 +---
  10. nping/NEPContext.h | 3 +--
  11. nping/NpingTargets.h | 4 +---
  12. nping/ProbeMode.h | 2 --
  13. nping/nping.cc | 1 -
  14. nping/utils.h | 2 --
  15. 8 files changed, 8 insertions(+), 14 deletions(-)
  16. diff --git a/nping/EchoServer.cc b/nping/EchoServer.cc
  17. index ccdcf9c2d0..a824340cd2 100644
  18. --- a/nping/EchoServer.cc
  19. +++ b/nping/EchoServer.cc
  20. @@ -199,7 +199,7 @@ NEPContext *EchoServer::getClientContext(nsock_iod iod){
  21. * the context could not be found. */
  22. int EchoServer::destroyClientContext(clientid_t clnt){
  23. bool deleted=false;
  24. - vector<NEPContext>::iterator it;
  25. + std::vector<NEPContext>::iterator it;
  26. /* Iterate through the context array and delete the one that belongs to clnt */
  27. for ( it=this->client_ctx.begin(); it<this->client_ctx.end(); it++){
  28. if(it->getIdentifier()==clnt){
  29. diff --git a/nping/EchoServer.h b/nping/EchoServer.h
  30. index c3dece6341..c9fee6de9e 100644
  31. --- a/nping/EchoServer.h
  32. +++ b/nping/EchoServer.h
  33. @@ -136,15 +136,13 @@
  34. #include <vector>
  35. #include "NEPContext.h"
  36. -using namespace std;
  37. -
  38. #define LISTEN_QUEUE_SIZE 10
  39. class EchoServer {
  40. private:
  41. /* Attributes */
  42. - vector<NEPContext> client_ctx;
  43. + std::vector<NEPContext> client_ctx;
  44. clientid_t client_id_count;
  45. /* Methods */
  46. diff --git a/nping/NEPContext.h b/nping/NEPContext.h
  47. index 5e470d7551..32b8be48d6 100644
  48. --- a/nping/NEPContext.h
  49. +++ b/nping/NEPContext.h
  50. @@ -135,7 +135,6 @@
  51. #include "nsock.h"
  52. #include "EchoHeader.h"
  53. #include <vector>
  54. -using namespace std;
  55. /* SERVER STATE MACHINE */
  56. /* _ */
  57. @@ -204,7 +203,7 @@ class NEPContext {
  58. u8 client_nonce[NONCE_LEN];
  59. bool server_nonce_set;
  60. bool client_nonce_set;
  61. - vector<fspec_t> fspecs;
  62. + std::vector<fspec_t> fspecs;
  63. struct sockaddr_storage clnt_addr;
  64. u8 *generateKey(int key_type, size_t *final_len);
  65. diff --git a/nping/NpingTargets.h b/nping/NpingTargets.h
  66. index 61bb356f39..3a9a2145af 100644
  67. --- a/nping/NpingTargets.h
  68. +++ b/nping/NpingTargets.h
  69. @@ -137,8 +137,6 @@
  70. #include "NpingTarget.h"
  71. #include <vector>
  72. -using namespace std;
  73. -
  74. #define MAX_NPING_HOSTNAME_LEN 512 /**< Max length for named hosts */
  75. class NpingTargets {
  76. @@ -176,7 +174,7 @@ class NpingTargets {
  77. /* TODO: Make private */
  78. NpingTarget *currenths;
  79. - vector<NpingTarget *> Targets;
  80. + std::vector<NpingTarget *> Targets;
  81. }; /* End of class NpingTargets */
  82. diff --git a/nping/ProbeMode.h b/nping/ProbeMode.h
  83. index aa86939e02..313776d862 100644
  84. --- a/nping/ProbeMode.h
  85. +++ b/nping/ProbeMode.h
  86. @@ -135,11 +135,9 @@
  87. #include "nping.h"
  88. #include "nsock.h"
  89. -#include <vector>
  90. #include "NpingTarget.h"
  91. #include "utils_net.h"
  92. #include "utils.h"
  93. -using namespace std;
  94. #define PKT_TYPE_TCP_CONNECT 1
  95. #define PKT_TYPE_UDP_NORMAL 2
  96. diff --git a/nping/nping.cc b/nping/nping.cc
  97. index 9de151a7be..40df912a88 100644
  98. --- a/nping/nping.cc
  99. +++ b/nping/nping.cc
  100. @@ -150,7 +150,6 @@
  101. #include <signal.h>
  102. #include <time.h>
  103. -using namespace std;
  104. NpingOps o;
  105. EchoClient ec;
  106. EchoServer es;
  107. diff --git a/nping/utils.h b/nping/utils.h
  108. index c3516cf29f..5de6b64b89 100644
  109. --- a/nping/utils.h
  110. +++ b/nping/utils.h
  111. @@ -143,8 +143,6 @@
  112. #endif
  113. #include "global_structures.h"
  114. -#include <vector>
  115. -using namespace std;
  116. /* Function prototypes */
  117. bool contains(const char *source, const char *substring);