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

Unified Diff: net/base/net_util.cc

Issue 718273002: Use uint16 for port numbers, net/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 years, 1 month 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/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index b9cf59f1789a910bed6242794417f5592f0694f1..d8ef1bedd96b9654c5f6fba668df8c0d48946c86 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -301,7 +301,7 @@ bool IsPortAllowedByDefault(int port) {
return false;
}
}
- return true;
+ return port >= 0 && port <= 65535;
mmenke 2014/11/18 21:06:39 return IsPortValid(port); (New function, inspire
Peter Kasting 2014/11/18 23:38:42 Done.
}
bool IsPortAllowedByFtp(int port) {
@@ -568,7 +568,7 @@ bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr,
*address = reinterpret_cast<const uint8*>(&addr->btAddr);
*address_len = kBluetoothAddressSize;
if (port)
- *port = addr->port;
+ *port = static_cast<uint16>(addr->port);
return true;
}
#endif

Powered by Google App Engine
This is Rietveld 408576698