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

Unified Diff: net/base/host_port_pair.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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
« no previous file with comments | « net/base/host_mapping_rules.cc ('k') | net/base/ip_address_number.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_port_pair.cc
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc
index 816bbac9b1f875ed83a19d783dbf6efba74b2ecc..cd56089ec20903e72a58b634807a7e812b693dbd 100644
--- a/net/base/host_port_pair.cc
+++ b/net/base/host_port_pair.cc
@@ -32,8 +32,8 @@ HostPortPair HostPortPair::FromIPEndPoint(const IPEndPoint& ipe) {
}
HostPortPair HostPortPair::FromString(const std::string& str) {
- std::vector<std::string> key_port;
- base::SplitString(str, ':', &key_port);
+ std::vector<base::StringPiece> key_port = base::SplitStringPiece(
+ str, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (key_port.size() != 2)
return HostPortPair();
int port;
@@ -42,7 +42,7 @@ HostPortPair HostPortPair::FromString(const std::string& str) {
if (!IsPortValid(port))
return HostPortPair();
HostPortPair host_port_pair;
- host_port_pair.set_host(key_port[0]);
+ host_port_pair.set_host(key_port[0].as_string());
host_port_pair.set_port(static_cast<uint16_t>(port));
return host_port_pair;
}
« no previous file with comments | « net/base/host_mapping_rules.cc ('k') | net/base/ip_address_number.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698