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.

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