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

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

Issue 976903002: IPEndPoint::ToString should not crash when the IP address is empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « jingle/glue/proxy_resolving_client_socket.cc ('k') | no next file » | 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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const 46 bool ToSockAddr(struct sockaddr* address, socklen_t* address_length) const
47 WARN_UNUSED_RESULT; 47 WARN_UNUSED_RESULT;
48 48
49 // Convert from a sockaddr struct. 49 // Convert from a sockaddr struct.
50 // |address| is the address. 50 // |address| is the address.
51 // |address_length| is the length of |address|. 51 // |address_length| is the length of |address|.
52 // Returns true on success, false on failure. 52 // Returns true on success, false on failure.
53 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length) 53 bool FromSockAddr(const struct sockaddr* address, socklen_t address_length)
54 WARN_UNUSED_RESULT; 54 WARN_UNUSED_RESULT;
55 55
56 // Returns value as a string (e.g. "127.0.0.1:80"). Returns empty 56 // Returns value as a string (e.g. "127.0.0.1:80"). The IP address must be
57 // string if the address is invalid, and cannot not be converted to a 57 // valid.
58 // string.
59 std::string ToString() const; 58 std::string ToString() const;
60 59
61 // As above, but without port. 60 // As above, but without port.
62 std::string ToStringWithoutPort() const; 61 std::string ToStringWithoutPort() const;
63 62
64 bool operator<(const IPEndPoint& that) const; 63 bool operator<(const IPEndPoint& that) const;
65 bool operator==(const IPEndPoint& that) const; 64 bool operator==(const IPEndPoint& that) const;
66 65
67 private: 66 private:
68 IPAddressNumber address_; 67 IPAddressNumber address_;
69 uint16 port_; 68 uint16 port_;
70 }; 69 };
71 70
72 } // namespace net 71 } // namespace net
73 72
74 #endif // NET_BASE_IP_ENDPOINT_H_ 73 #endif // NET_BASE_IP_ENDPOINT_H_
OLDNEW
« no previous file with comments | « jingle/glue/proxy_resolving_client_socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698