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: tools/android/forwarder2/host_forwarder_main.cc

Issue 1549203002: Switch to standard integer types in tools/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « tools/android/forwarder2/host_controller.cc ('k') | tools/android/forwarder2/pipe_notifier.h » ('j') | 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 #include <errno.h> 5 #include <errno.h>
6 #include <signal.h> 6 #include <signal.h>
7 #include <stddef.h>
8 #include <stdint.h>
7 #include <sys/types.h> 9 #include <sys/types.h>
8 #include <sys/wait.h> 10 #include <sys/wait.h>
9 #include <unistd.h> 11 #include <unistd.h>
10 12
11 #include <cstdio> 13 #include <cstdio>
12 #include <iostream> 14 #include <iostream>
13 #include <limits> 15 #include <limits>
14 #include <string> 16 #include <string>
15 #include <utility> 17 #include <utility>
16 #include <vector> 18 #include <vector>
17 19
18 #include "base/at_exit.h" 20 #include "base/at_exit.h"
19 #include "base/basictypes.h"
20 #include "base/bind.h" 21 #include "base/bind.h"
21 #include "base/command_line.h" 22 #include "base/command_line.h"
22 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
23 #include "base/containers/hash_tables.h" 24 #include "base/containers/hash_tables.h"
24 #include "base/files/file_path.h" 25 #include "base/files/file_path.h"
25 #include "base/files/file_util.h" 26 #include "base/files/file_util.h"
26 #include "base/logging.h" 27 #include "base/logging.h"
28 #include "base/macros.h"
27 #include "base/memory/linked_ptr.h" 29 #include "base/memory/linked_ptr.h"
28 #include "base/memory/weak_ptr.h" 30 #include "base/memory/weak_ptr.h"
29 #include "base/pickle.h" 31 #include "base/pickle.h"
30 #include "base/strings/string_number_conversions.h" 32 #include "base/strings/string_number_conversions.h"
31 #include "base/strings/string_piece.h" 33 #include "base/strings/string_piece.h"
32 #include "base/strings/string_split.h" 34 #include "base/strings/string_split.h"
33 #include "base/strings/string_util.h" 35 #include "base/strings/string_util.h"
34 #include "base/strings/stringprintf.h" 36 #include "base/strings/stringprintf.h"
35 #include "base/task_runner.h" 37 #include "base/task_runner.h"
36 #include "base/threading/thread.h" 38 #include "base/threading/thread.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 " --unmap DEVICE_PORT\n" 409 " --unmap DEVICE_PORT\n"
408 " --adb PATH_TO_ADB\n" 410 " --adb PATH_TO_ADB\n"
409 " --kill-server\n"; 411 " --kill-server\n";
410 exit(1); 412 exit(1);
411 } 413 }
412 414
413 int PortToInt(const std::string& s) { 415 int PortToInt(const std::string& s) {
414 int value; 416 int value;
415 // Note that 0 is a valid port (used for dynamic port allocation). 417 // Note that 0 is a valid port (used for dynamic port allocation).
416 if (!base::StringToInt(s, &value) || value < 0 || 418 if (!base::StringToInt(s, &value) || value < 0 ||
417 value > std::numeric_limits<uint16>::max()) { 419 value > std::numeric_limits<uint16_t>::max()) {
418 LOG(ERROR) << "Could not convert string " << s << " to port"; 420 LOG(ERROR) << "Could not convert string " << s << " to port";
419 ExitWithUsage(); 421 ExitWithUsage();
420 } 422 }
421 return value; 423 return value;
422 } 424 }
423 425
424 int RunHostForwarder(int argc, char** argv) { 426 int RunHostForwarder(int argc, char** argv) {
425 base::CommandLine::Init(argc, argv); 427 base::CommandLine::Init(argc, argv);
426 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); 428 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
427 std::string adb_path = "adb"; 429 std::string adb_path = "adb";
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 471
470 return client_delegate.has_failed() || daemon_delegate.has_failed(); 472 return client_delegate.has_failed() || daemon_delegate.has_failed();
471 } 473 }
472 474
473 } // namespace 475 } // namespace
474 } // namespace forwarder2 476 } // namespace forwarder2
475 477
476 int main(int argc, char** argv) { 478 int main(int argc, char** argv) {
477 return forwarder2::RunHostForwarder(argc, argv); 479 return forwarder2::RunHostForwarder(argc, argv);
478 } 480 }
OLDNEW
« no previous file with comments | « tools/android/forwarder2/host_controller.cc ('k') | tools/android/forwarder2/pipe_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698