Sfoglia il codice sorgente

HPCC-20871 Avoid automatic type conversion via IpAddress ctor

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 6 anni fa
parent
commit
d1aa7208c7

+ 1 - 1
esp/services/ws_machine/ws_machineService.cpp

@@ -1183,7 +1183,7 @@ int Cws_machineEx::runCommand(IEspContext& context, const char* sAddress, const
         IFRunSSH * connection = createFRunSSH();
         connection->init(command.str(),NULL,NULL,NULL,m_SSHConnectTimeoutSeconds,0);
         // executed as single connection
-        connection->exec(sAddress,NULL,true);
+        connection->exec(IpAddress(sAddress),NULL,true);
         response.append(connection->getReplyText()[0]);
         exitCode = connection->getReply()[0];
         int len = response.length();

+ 1 - 1
esp/services/ws_machine/ws_machineServiceRexec.cpp

@@ -125,7 +125,7 @@ public:
             {
                 IFRunSSH * connection = createFRunSSH();
                 connection->init(m_sCommand.str(),NULL,NULL,NULL,5,0);
-                connection->exec(m_sAddress.str(),NULL,true);
+                connection->exec(IpAddress(m_sAddress.str()),NULL,true);
             }
         }
         // CFRunSSH uses a MakeStringExceptionDirect throw to pass code and result string to caller

+ 2 - 1
roxie/udplib/uttest.cpp

@@ -60,7 +60,8 @@ void usage()
     exit(1);
 }
 
-const char *multicastIP = "239.1.1.1";
+const char *multicastIPStr = "239.1.1.1";
+IpAddress multicastIP(multicastIPStr);
 unsigned udpNumQs = 1;
 unsigned numNodes;
 unsigned myIndex;

+ 1 - 1
system/jlib/jsocket.hpp

@@ -80,7 +80,7 @@ class jlib_decl IpAddress
 public:
     IpAddress()                                         { ipset(NULL); }
     IpAddress(const IpAddress& other)                   { ipset(other); }
-    IpAddress(const char *text)                         { ipset(text); }
+    explicit IpAddress(const char *text)                { ipset(text); }
     
     bool ipset(const char *text);                       // sets to NULL if fails or text=NULL   
     void ipset(const IpAddress& other)                  { memcpy(&netaddr,&other.netaddr,sizeof(netaddr)); }

+ 1 - 1
system/xmllibtest/xmllibtest.cpp

@@ -317,7 +317,7 @@ void doTransform()
             {
                 if (gStreamingBySocket)
                 {
-                    SocketEndpoint ep(gPort,gHost);
+                    SocketEndpoint ep(gHost, gPort);
                     ISocket* s = ISocket::connect(ep);
                     transform->transform(s);
                 }