Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: net/base/ip_endpoint.h

Issue 1692353002: Make IP Address related functions return the empty string when used on an invalid address. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/ip_endpoint.h
diff --git a/net/base/ip_endpoint.h b/net/base/ip_endpoint.h
index 34b378bdda365d1b16c9ba08743d36ae908f8f07..a1c12296b3dca8b9b91913f1722e1187ebd8468e 100644
--- a/net/base/ip_endpoint.h
+++ b/net/base/ip_endpoint.h
@@ -57,11 +57,12 @@ class NET_EXPORT IPEndPoint {
bool FromSockAddr(const struct sockaddr* address, socklen_t address_length)
WARN_UNUSED_RESULT;
- // Returns value as a string (e.g. "127.0.0.1:80"). The IP address must be
- // valid.
+ // Returns value as a string (e.g. "127.0.0.1:80"). Returns the empty string
+ // when |address_| is invalid (the port will be ignored).
std::string ToString() const;
- // As above, but without port.
+ // As above, but without port. Returns the empty string when address_ is
+ // invalid.
std::string ToStringWithoutPort() const;
bool operator<(const IPEndPoint& that) const;

Powered by Google App Engine
This is Rietveld 408576698