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

Unified Diff: media/cast/test/sender.cc

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change 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
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/utility/udp_proxy_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/test/sender.cc
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc
index 38aef308fe2faa30f430ba59fd2ef902bf445c37..96ca5d7ff6c8ac104ec948af7d7898fb6e1cbb91 100644
--- a/media/cast/test/sender.cc
+++ b/media/cast/test/sender.cc
@@ -155,7 +155,7 @@ void InitializationResult(media::cast::CastInitializationStatus result) {
CHECK(end_result) << "Cast sender uninitialized";
}
-net::IPEndPoint CreateUDPAddress(std::string ip_str, int port) {
+net::IPEndPoint CreateUDPAddress(std::string ip_str, uint16 port) {
net::IPAddressNumber ip_number;
CHECK(net::ParseIPLiteralToNumber(ip_str, &ip_number));
return net::IPEndPoint(ip_number, port);
@@ -275,8 +275,8 @@ int main(int argc, char** argv) {
if (remote_ip_address.empty())
remote_ip_address = "127.0.0.1";
int remote_port = 0;
- if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchPort),
- &remote_port)) {
+ if (!base::StringToInt(cmd->GetSwitchValueASCII(kSwitchPort), &remote_port) ||
+ remote_port < 0 || remote_port > 65535) {
remote_port = 2344;
}
LOG(INFO) << "Sending to " << remote_ip_address << ":" << remote_port
@@ -288,7 +288,7 @@ int main(int argc, char** argv) {
// Running transport on the main thread.
// Setting up transport config.
net::IPEndPoint remote_endpoint =
- CreateUDPAddress(remote_ip_address, remote_port);
+ CreateUDPAddress(remote_ip_address, static_cast<uint16>(remote_port));
// Enable raw event and stats logging.
// Running transport on the main thread.
« no previous file with comments | « media/cast/test/receiver.cc ('k') | media/cast/test/utility/udp_proxy_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698