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

Unified Diff: net/base/host_port_pair.cc

Issue 1829873002: Add base/parse_number.h to generalize number parsing done in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/host_port_pair_unittest.cc » ('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 a0dd2d507520df724bad704b35e81fdc11360d4b..441a35965d8f4fa7e93a8b323d1a4ffca19d1d20 100644
--- a/net/base/host_port_pair.cc
+++ b/net/base/host_port_pair.cc
@@ -10,6 +10,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/base/ip_endpoint.h"
+#include "net/base/parse_number.h"
#include "net/base/port_util.h"
#include "url/gurl.h"
@@ -37,7 +38,7 @@ HostPortPair HostPortPair::FromString(const std::string& str) {
if (key_port.size() != 2)
return HostPortPair();
int port;
- if (!base::StringToInt(key_port[1], &port))
+ if (!ParseNonNegativeDecimalInt(key_port[1], &port))
return HostPortPair();
if (!IsPortValid(port))
return HostPortPair();
« no previous file with comments | « no previous file | net/base/host_port_pair_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698