diff options
Diffstat (limited to 'net/base/host_port_pair.cc')
-rw-r--r-- | net/base/host_port_pair.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc index d4e7d4e..645d958 100644 --- a/net/base/host_port_pair.cc +++ b/net/base/host_port_pair.cc @@ -7,15 +7,17 @@ namespace net { -HostPortPair::HostPortPair() : port(0) {} +HostPortPair::HostPortPair() : port_(0) {} HostPortPair::HostPortPair(const std::string& in_host, uint16 in_port) - : host(in_host), port(in_port) {} + : host_(in_host), port_(in_port) {} std::string HostPortPair::ToString() const { // Check to see if the host is an IPv6 address. If so, added brackets. - if (host.find(':') != std::string::npos) - return StringPrintf("[%s]:%u", host.c_str(), port); - return StringPrintf("%s:%u", host.c_str(), port); + if (host_.find(':') != std::string::npos) { + DCHECK_NE(host_[0], '['); + return StringPrintf("[%s]:%u", host_.c_str(), port_); + } + return StringPrintf("%s:%u", host_.c_str(), port_); } } // namespace net |