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

Side by Side Diff: net/base/ip_endpoint.h

Issue 1708483002: Revert of 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: 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 unified diff | Download patch
« no previous file with comments | « net/base/ip_address_unittest.cc ('k') | net/base/ip_endpoint_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_IP_ENDPOINT_H_ 5 #ifndef NET_BASE_IP_ENDPOINT_H_
6 #define NET_BASE_IP_ENDPOINT_H_ 6 #define NET_BASE_IP_ENDPOINT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const 50 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const
51 WARN_UNUSED_RESULT; 51 WARN_UNUSED_RESULT;
52 52
53 // Convert from a sockaddr struct. 53 // Convert from a sockaddr struct.
54 // |address| is the address. 54 // |address| is the address.
55 // |address_length| is the length of |address|. 55 // |address_length| is the length of |address|.
56 // Returns true on success, false on failure. 56 // Returns true on success, false on failure.
57 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length) 57 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length)
58 WARN_UNUSED_RESULT; 58 WARN_UNUSED_RESULT;
59 59
60 // Returns value as a string (e.g. "127.0.0.1:80"). Returns the empty string 60 // Returns value as a string (e.g. "127.0.0.1:80"). The IP address must be
61 // when |address_| is invalid (the port will be ignored). 61 // valid.
62 std::string ToString() const; 62 std::string ToString() const;
63 63
64 // As above, but without port. Returns the empty string when address_ is 64 // As above, but without port.
65 // invalid.
66 std::string ToStringWithoutPort() const; 65 std::string ToStringWithoutPort() const;
67 66
68 bool operator<(const IPEndPoint& that) const; 67 bool operator<(const IPEndPoint& that) const;
69 bool operator==(const IPEndPoint& that) const; 68 bool operator==(const IPEndPoint& that) const;
70 69
71 private: 70 private:
72 IPAddress address_; 71 IPAddress address_;
73 uint16_t port_; 72 uint16_t port_;
74 }; 73 };
75 74
76 } // namespace net 75 } // namespace net
77 76
78 #endif // NET_BASE_IP_ENDPOINT_H_ 77 #endif // NET_BASE_IP_ENDPOINT_H_
OLDNEW
« no previous file with comments | « net/base/ip_address_unittest.cc ('k') | net/base/ip_endpoint_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698