Loading adb/adb.cpp +1 −34 Original line number Diff line number Diff line Loading @@ -73,39 +73,6 @@ std::string adb_version() { android::base::GetExecutablePath().c_str()); } void fatal(const char *fmt, ...) { va_list ap; va_start(ap, fmt); char buf[1024]; vsnprintf(buf, sizeof(buf), fmt, ap); #if ADB_HOST fprintf(stderr, "error: %s\n", buf); #else LOG(ERROR) << "error: " << buf; #endif va_end(ap); abort(); } void fatal_errno(const char* fmt, ...) { int err = errno; va_list ap; va_start(ap, fmt); char buf[1024]; vsnprintf(buf, sizeof(buf), fmt, ap); #if ADB_HOST fprintf(stderr, "error: %s: %s\n", buf, strerror(err)); #else LOG(ERROR) << "error: " << buf << ": " << strerror(err); #endif va_end(ap); abort(); } uint32_t calculate_apacket_checksum(const apacket* p) { uint32_t sum = 0; for (size_t i = 0; i < p->msg.data_length; ++i) { Loading @@ -118,7 +85,7 @@ apacket* get_apacket(void) { apacket* p = new apacket(); if (p == nullptr) { fatal("failed to allocate an apacket"); LOG(FATAL) << "failed to allocate an apacket"; } memset(&p->msg, 0, sizeof(p->msg)); Loading adb/adb.h +0 −3 Original line number Diff line number Diff line Loading @@ -124,9 +124,6 @@ inline bool ConnectionStateIsOnline(ConnectionState state) { void print_packet(const char* label, apacket* p); void fatal(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2))); void fatal_errno(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2))); void handle_packet(apacket* p, atransport* t); int launch_server(const std::string& socket_spec); Loading adb/adb_utils.cpp +5 −17 Original line number Diff line number Diff line Loading @@ -57,11 +57,11 @@ static constexpr char kNullFileName[] = "/dev/null"; void close_stdin() { int fd = unix_open(kNullFileName, O_RDONLY); if (fd == -1) { fatal_errno("failed to open %s", kNullFileName); PLOG(FATAL) << "failed to open " << kNullFileName; } if (TEMP_FAILURE_RETRY(dup2(fd, STDIN_FILENO)) == -1) { fatal_errno("failed to redirect stdin to %s", kNullFileName); PLOG(FATAL) << "failed to redirect stdin to " << kNullFileName; } unix_close(fd); } Loading Loading @@ -316,18 +316,6 @@ std::string adb_get_android_dir_path() { return android_dir; } int syntax_error(const char* fmt, ...) { fprintf(stderr, "adb: usage: "); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); return 1; } std::string GetLogFilePath() { #if defined(_WIN32) const char log_name[] = "adb.log"; Loading @@ -337,13 +325,13 @@ std::string GetLogFilePath() { DWORD nchars = GetTempPathW(arraysize(temp_path), temp_path); if (nchars >= arraysize(temp_path) || nchars == 0) { // If string truncation or some other error. fatal("cannot retrieve temporary file path: %s\n", android::base::SystemErrorCodeToString(GetLastError()).c_str()); LOG(FATAL) << "cannot retrieve temporary file path: " << android::base::SystemErrorCodeToString(GetLastError()); } std::string temp_path_utf8; if (!android::base::WideToUTF8(temp_path, &temp_path_utf8)) { fatal_errno("cannot convert temporary file path from UTF-16 to UTF-8"); PLOG(FATAL) << "cannot convert temporary file path from UTF-16 to UTF-8"; } return temp_path_utf8 + log_name; Loading adb/adb_utils.h +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ #include "adb.h" int syntax_error(const char*, ...) __attribute__((__format__(__printf__, 1, 2))); void close_stdin(); bool getcwd(std::string* cwd); Loading adb/client/adb_install.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ static int install_app_streamed(int argc, const char** argv, bool use_fastdeploy // The last argument must be the APK file const char* file = argv[argc - 1]; if (!android::base::EndsWithIgnoreCase(file, ".apk")) { return syntax_error("filename doesn't end .apk: %s", file); error(1, 0, "filename doesn't end .apk: %s", file); } if (use_fastdeploy == true) { Loading Loading @@ -224,7 +224,7 @@ static int install_app_legacy(int argc, const char** argv, bool use_fastdeploy, } } if (last_apk == -1) return syntax_error("need APK file on command line"); if (last_apk == -1) error(1, 0, "need APK file on command line"); int result = -1; std::vector<const char*> apk_file = {argv[last_apk]}; Loading Loading @@ -311,7 +311,7 @@ int install_app(int argc, const char** argv) { } if (installMode == INSTALL_STREAM && _use_legacy_install() == true) { return syntax_error("Attempting to use streaming install on unsupported deivce."); error(1, 0, "Attempting to use streaming install on unsupported device"); } if (use_fastdeploy == true && is_reinstall == false) { Loading Loading @@ -370,7 +370,7 @@ int install_multiple_app(int argc, const char** argv) { } } if (first_apk == -1) return syntax_error("need APK file on command line"); if (first_apk == -1) error(1, 0, "need APK file on command line"); std::string install_cmd; if (_use_legacy_install()) { Loading Loading
adb/adb.cpp +1 −34 Original line number Diff line number Diff line Loading @@ -73,39 +73,6 @@ std::string adb_version() { android::base::GetExecutablePath().c_str()); } void fatal(const char *fmt, ...) { va_list ap; va_start(ap, fmt); char buf[1024]; vsnprintf(buf, sizeof(buf), fmt, ap); #if ADB_HOST fprintf(stderr, "error: %s\n", buf); #else LOG(ERROR) << "error: " << buf; #endif va_end(ap); abort(); } void fatal_errno(const char* fmt, ...) { int err = errno; va_list ap; va_start(ap, fmt); char buf[1024]; vsnprintf(buf, sizeof(buf), fmt, ap); #if ADB_HOST fprintf(stderr, "error: %s: %s\n", buf, strerror(err)); #else LOG(ERROR) << "error: " << buf << ": " << strerror(err); #endif va_end(ap); abort(); } uint32_t calculate_apacket_checksum(const apacket* p) { uint32_t sum = 0; for (size_t i = 0; i < p->msg.data_length; ++i) { Loading @@ -118,7 +85,7 @@ apacket* get_apacket(void) { apacket* p = new apacket(); if (p == nullptr) { fatal("failed to allocate an apacket"); LOG(FATAL) << "failed to allocate an apacket"; } memset(&p->msg, 0, sizeof(p->msg)); Loading
adb/adb.h +0 −3 Original line number Diff line number Diff line Loading @@ -124,9 +124,6 @@ inline bool ConnectionStateIsOnline(ConnectionState state) { void print_packet(const char* label, apacket* p); void fatal(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2))); void fatal_errno(const char* fmt, ...) __attribute__((noreturn, format(__printf__, 1, 2))); void handle_packet(apacket* p, atransport* t); int launch_server(const std::string& socket_spec); Loading
adb/adb_utils.cpp +5 −17 Original line number Diff line number Diff line Loading @@ -57,11 +57,11 @@ static constexpr char kNullFileName[] = "/dev/null"; void close_stdin() { int fd = unix_open(kNullFileName, O_RDONLY); if (fd == -1) { fatal_errno("failed to open %s", kNullFileName); PLOG(FATAL) << "failed to open " << kNullFileName; } if (TEMP_FAILURE_RETRY(dup2(fd, STDIN_FILENO)) == -1) { fatal_errno("failed to redirect stdin to %s", kNullFileName); PLOG(FATAL) << "failed to redirect stdin to " << kNullFileName; } unix_close(fd); } Loading Loading @@ -316,18 +316,6 @@ std::string adb_get_android_dir_path() { return android_dir; } int syntax_error(const char* fmt, ...) { fprintf(stderr, "adb: usage: "); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "\n"); return 1; } std::string GetLogFilePath() { #if defined(_WIN32) const char log_name[] = "adb.log"; Loading @@ -337,13 +325,13 @@ std::string GetLogFilePath() { DWORD nchars = GetTempPathW(arraysize(temp_path), temp_path); if (nchars >= arraysize(temp_path) || nchars == 0) { // If string truncation or some other error. fatal("cannot retrieve temporary file path: %s\n", android::base::SystemErrorCodeToString(GetLastError()).c_str()); LOG(FATAL) << "cannot retrieve temporary file path: " << android::base::SystemErrorCodeToString(GetLastError()); } std::string temp_path_utf8; if (!android::base::WideToUTF8(temp_path, &temp_path_utf8)) { fatal_errno("cannot convert temporary file path from UTF-16 to UTF-8"); PLOG(FATAL) << "cannot convert temporary file path from UTF-16 to UTF-8"; } return temp_path_utf8 + log_name; Loading
adb/adb_utils.h +0 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,6 @@ #include "adb.h" int syntax_error(const char*, ...) __attribute__((__format__(__printf__, 1, 2))); void close_stdin(); bool getcwd(std::string* cwd); Loading
adb/client/adb_install.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ static int install_app_streamed(int argc, const char** argv, bool use_fastdeploy // The last argument must be the APK file const char* file = argv[argc - 1]; if (!android::base::EndsWithIgnoreCase(file, ".apk")) { return syntax_error("filename doesn't end .apk: %s", file); error(1, 0, "filename doesn't end .apk: %s", file); } if (use_fastdeploy == true) { Loading Loading @@ -224,7 +224,7 @@ static int install_app_legacy(int argc, const char** argv, bool use_fastdeploy, } } if (last_apk == -1) return syntax_error("need APK file on command line"); if (last_apk == -1) error(1, 0, "need APK file on command line"); int result = -1; std::vector<const char*> apk_file = {argv[last_apk]}; Loading Loading @@ -311,7 +311,7 @@ int install_app(int argc, const char** argv) { } if (installMode == INSTALL_STREAM && _use_legacy_install() == true) { return syntax_error("Attempting to use streaming install on unsupported deivce."); error(1, 0, "Attempting to use streaming install on unsupported device"); } if (use_fastdeploy == true && is_reinstall == false) { Loading Loading @@ -370,7 +370,7 @@ int install_multiple_app(int argc, const char** argv) { } } if (first_apk == -1) return syntax_error("need APK file on command line"); if (first_apk == -1) error(1, 0, "need APK file on command line"); std::string install_cmd; if (_use_legacy_install()) { Loading