aboutsummaryrefslogtreecommitdiff
path: root/src/netaddress.h
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-08-01 12:22:41 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-08-16 16:33:25 +0200
commit64fb0ac016c7fd01c60c39af60f6431bac57f9ee (patch)
tree8d8523dd68167f9a6299dd92cc9dd5e0fd162b23 /src/netaddress.h
parent22e301a3d56dc9e6878380ee92c7d19ca43119d2 (diff)
downloadbitcoin-64fb0ac016c7fd01c60c39af60f6431bac57f9ee.tar.xz
Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
Diffstat (limited to 'src/netaddress.h')
-rw-r--r--src/netaddress.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/netaddress.h b/src/netaddress.h
index 57ce897db5..6ca99b36b5 100644
--- a/src/netaddress.h
+++ b/src/netaddress.h
@@ -36,7 +36,7 @@ class CNetAddr
public:
CNetAddr();
- CNetAddr(const struct in_addr& ipv4Addr);
+ explicit CNetAddr(const struct in_addr& ipv4Addr);
void Init();
void SetIP(const CNetAddr& ip);
@@ -82,7 +82,7 @@ class CNetAddr
std::vector<unsigned char> GetGroup() const;
int GetReachabilityFrom(const CNetAddr *paddrPartner = nullptr) const;
- CNetAddr(const struct in6_addr& pipv6Addr, const uint32_t scope = 0);
+ explicit CNetAddr(const struct in6_addr& pipv6Addr, const uint32_t scope = 0);
bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
friend bool operator==(const CNetAddr& a, const CNetAddr& b);
@@ -146,7 +146,7 @@ class CService : public CNetAddr
CService();
CService(const CNetAddr& ip, unsigned short port);
CService(const struct in_addr& ipv4Addr, unsigned short port);
- CService(const struct sockaddr_in& addr);
+ explicit CService(const struct sockaddr_in& addr);
void Init();
unsigned short GetPort() const;
bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const;
@@ -160,7 +160,7 @@ class CService : public CNetAddr
std::string ToStringIPPort() const;
CService(const struct in6_addr& ipv6Addr, unsigned short port);
- CService(const struct sockaddr_in6& addr);
+ explicit CService(const struct sockaddr_in6& addr);
ADD_SERIALIZE_METHODS;