Loading adb/adb_listeners.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "socket_spec.h" #include "sysdeps.h" #include "sysdeps/memory.h" #include "transport.h" // A listener is an entity which binds to a local port and, upon receiving a connection on that Loading Loading @@ -203,7 +204,7 @@ InstallStatus install_listener(const std::string& local_name, const char* connec } } std::unique_ptr<alistener> listener(new alistener(local_name, connect_to)); auto listener = std::make_unique<alistener>(local_name, connect_to); int resolved = 0; listener->fd = socket_spec_listen(listener->local_name, error, &resolved); Loading adb/client/commandline.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ #include "services.h" #include "shell_service.h" #include "sysdeps/chrono.h" #include "sysdeps/memory.h" static int install_app(int argc, const char** argv); static int install_multiple_app(int argc, const char** argv); Loading Loading @@ -263,7 +264,7 @@ int read_and_dump(int fd, bool use_shell_protocol = false, char raw_buffer[BUFSIZ]; char* buffer_ptr = raw_buffer; if (use_shell_protocol) { protocol.reset(new ShellProtocol(fd)); protocol = std::make_unique<ShellProtocol>(fd); if (!protocol) { LOG(ERROR) << "failed to allocate memory for ShellProtocol object"; return 1; Loading Loading @@ -630,7 +631,7 @@ static int RemoteShell(bool use_shell_protocol, const std::string& type_arg, args->raw_stdin = raw_stdin; args->escape_char = escape_char; if (use_shell_protocol) { args->protocol.reset(new ShellProtocol(args->write_fd)); args->protocol = std::make_unique<ShellProtocol>(args->write_fd); } if (raw_stdin) stdin_raw_init(); Loading adb/daemon/shell_service.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ bool Subprocess::ForkAndExec(std::string* error) { } D("protocol FD = %d", protocol_sfd_.get()); input_.reset(new ShellProtocol(protocol_sfd_)); output_.reset(new ShellProtocol(protocol_sfd_)); input_ = std::make_unique<ShellProtocol>(protocol_sfd_); output_ = std::make_unique<ShellProtocol>(protocol_sfd_); if (!input_ || !output_) { *error = "failed to allocate shell protocol objects"; kill(pid_, SIGKILL); Loading adb/fdevent.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "fdevent.h" #include <fcntl.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> Loading @@ -36,6 +37,7 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> #include <android-base/thread_annotations.h> #include <android-base/threads.h> #include "adb_io.h" #include "adb_trace.h" Loading Loading @@ -78,7 +80,7 @@ static auto& g_poll_node_map = *new std::unordered_map<int, PollNode>(); static auto& g_pending_list = *new std::list<fdevent*>(); static std::atomic<bool> terminate_loop(false); static bool main_thread_valid; static unsigned long main_thread_id; static uint64_t main_thread_id; static auto& run_queue_notify_fd = *new unique_fd(); static auto& run_queue_mutex = *new std::mutex(); Loading @@ -86,13 +88,13 @@ static auto& run_queue GUARDED_BY(run_queue_mutex) = *new std::deque<std::functi void check_main_thread() { if (main_thread_valid) { CHECK_EQ(main_thread_id, adb_thread_id()); CHECK_EQ(main_thread_id, android::base::GetThreadId()); } } void set_main_thread() { main_thread_valid = true; main_thread_id = adb_thread_id(); main_thread_id = android::base::GetThreadId(); } static std::string dump_fde(const fdevent* fde) { Loading adb/fdevent_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ static void FdEventThreadFunc(ThreadArg* arg) { std::vector<std::unique_ptr<FdHandler>> fd_handlers; for (size_t i = 0; i < read_fds.size(); ++i) { fd_handlers.push_back(std::unique_ptr<FdHandler>(new FdHandler(read_fds[i], write_fds[i]))); fd_handlers.push_back(std::make_unique<FdHandler>(read_fds[i], write_fds[i])); } fdevent_loop(); Loading Loading
adb/adb_listeners.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "socket_spec.h" #include "sysdeps.h" #include "sysdeps/memory.h" #include "transport.h" // A listener is an entity which binds to a local port and, upon receiving a connection on that Loading Loading @@ -203,7 +204,7 @@ InstallStatus install_listener(const std::string& local_name, const char* connec } } std::unique_ptr<alistener> listener(new alistener(local_name, connect_to)); auto listener = std::make_unique<alistener>(local_name, connect_to); int resolved = 0; listener->fd = socket_spec_listen(listener->local_name, error, &resolved); Loading
adb/client/commandline.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ #include "services.h" #include "shell_service.h" #include "sysdeps/chrono.h" #include "sysdeps/memory.h" static int install_app(int argc, const char** argv); static int install_multiple_app(int argc, const char** argv); Loading Loading @@ -263,7 +264,7 @@ int read_and_dump(int fd, bool use_shell_protocol = false, char raw_buffer[BUFSIZ]; char* buffer_ptr = raw_buffer; if (use_shell_protocol) { protocol.reset(new ShellProtocol(fd)); protocol = std::make_unique<ShellProtocol>(fd); if (!protocol) { LOG(ERROR) << "failed to allocate memory for ShellProtocol object"; return 1; Loading Loading @@ -630,7 +631,7 @@ static int RemoteShell(bool use_shell_protocol, const std::string& type_arg, args->raw_stdin = raw_stdin; args->escape_char = escape_char; if (use_shell_protocol) { args->protocol.reset(new ShellProtocol(args->write_fd)); args->protocol = std::make_unique<ShellProtocol>(args->write_fd); } if (raw_stdin) stdin_raw_init(); Loading
adb/daemon/shell_service.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -372,8 +372,8 @@ bool Subprocess::ForkAndExec(std::string* error) { } D("protocol FD = %d", protocol_sfd_.get()); input_.reset(new ShellProtocol(protocol_sfd_)); output_.reset(new ShellProtocol(protocol_sfd_)); input_ = std::make_unique<ShellProtocol>(protocol_sfd_); output_ = std::make_unique<ShellProtocol>(protocol_sfd_); if (!input_ || !output_) { *error = "failed to allocate shell protocol objects"; kill(pid_, SIGKILL); Loading
adb/fdevent.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "fdevent.h" #include <fcntl.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <unistd.h> Loading @@ -36,6 +37,7 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> #include <android-base/thread_annotations.h> #include <android-base/threads.h> #include "adb_io.h" #include "adb_trace.h" Loading Loading @@ -78,7 +80,7 @@ static auto& g_poll_node_map = *new std::unordered_map<int, PollNode>(); static auto& g_pending_list = *new std::list<fdevent*>(); static std::atomic<bool> terminate_loop(false); static bool main_thread_valid; static unsigned long main_thread_id; static uint64_t main_thread_id; static auto& run_queue_notify_fd = *new unique_fd(); static auto& run_queue_mutex = *new std::mutex(); Loading @@ -86,13 +88,13 @@ static auto& run_queue GUARDED_BY(run_queue_mutex) = *new std::deque<std::functi void check_main_thread() { if (main_thread_valid) { CHECK_EQ(main_thread_id, adb_thread_id()); CHECK_EQ(main_thread_id, android::base::GetThreadId()); } } void set_main_thread() { main_thread_valid = true; main_thread_id = adb_thread_id(); main_thread_id = android::base::GetThreadId(); } static std::string dump_fde(const fdevent* fde) { Loading
adb/fdevent_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ static void FdEventThreadFunc(ThreadArg* arg) { std::vector<std::unique_ptr<FdHandler>> fd_handlers; for (size_t i = 0; i < read_fds.size(); ++i) { fd_handlers.push_back(std::unique_ptr<FdHandler>(new FdHandler(read_fds[i], write_fds[i]))); fd_handlers.push_back(std::make_unique<FdHandler>(read_fds[i], write_fds[i])); } fdevent_loop(); Loading