mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
tests: Avoid using C-style NUL-terminated strings as arguments
Cherry-picked from: 7a046cdc
This commit is contained in:
parent
14c9288af7
commit
8bbda1d2be
@ -49,29 +49,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static CNetAddr ResolveIP(const char* ip)
|
||||
static CNetAddr ResolveIP(const std::string& ip)
|
||||
{
|
||||
CNetAddr addr;
|
||||
BOOST_CHECK_MESSAGE(LookupHost(ip, addr, false), strprintf("failed to resolve: %s", ip));
|
||||
return addr;
|
||||
}
|
||||
|
||||
static CNetAddr ResolveIP(std::string ip)
|
||||
{
|
||||
return ResolveIP(ip.c_str());
|
||||
}
|
||||
|
||||
static CService ResolveService(const char* ip, int port = 0)
|
||||
static CService ResolveService(const std::string& ip, const int port = 0)
|
||||
{
|
||||
CService serv;
|
||||
BOOST_CHECK_MESSAGE(Lookup(ip, serv, port, false), strprintf("failed to resolve: %s:%i", ip, port));
|
||||
return serv;
|
||||
}
|
||||
|
||||
static CService ResolveService(std::string ip, int port = 0)
|
||||
{
|
||||
return ResolveService(ip.c_str(), port);
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(addrman_tests, BasicTestingSetup)
|
||||
|
||||
|
||||
@ -13,14 +13,14 @@
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(netbase_tests, BasicTestingSetup)
|
||||
|
||||
static CNetAddr ResolveIP(const char* ip)
|
||||
static CNetAddr ResolveIP(const std::string& ip)
|
||||
{
|
||||
CNetAddr addr;
|
||||
LookupHost(ip, addr, false);
|
||||
return addr;
|
||||
}
|
||||
|
||||
static CSubNet ResolveSubNet(const char* subnet)
|
||||
static CSubNet ResolveSubNet(const std::string& subnet)
|
||||
{
|
||||
CSubNet ret;
|
||||
LookupSubNet(subnet, ret);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user