diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-01-03 05:02:38 +0100 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-01-03 05:02:38 +0100 |
commit | ac309cf8c880809924bc07ef51300c616d4c0752 (patch) | |
tree | 24aa3d4dfd5180496259dd98fa66a37cf4066ccb | |
parent | Snap for 5198681 from 81d8e2e4ddeb4c8bf864442cad7b1e74f0d10c48 to qt-release (diff) | |
parent | Merge "minadbd: daemon_service_to_fd takes std::string_view." am: 72aa58dcf7 am: 29578b1117 (diff) | |
download | android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar.gz android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar.bz2 android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar.lz android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar.xz android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.tar.zst android_bootable_recovery-ac309cf8c880809924bc07ef51300c616d4c0752.zip |
-rw-r--r-- | minadbd/Android.bp | 2 | ||||
-rw-r--r-- | minadbd/minadbd_services.cpp | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/minadbd/Android.bp b/minadbd/Android.bp index 370232b3f..a95d979a5 100644 --- a/minadbd/Android.bp +++ b/minadbd/Android.bp @@ -21,6 +21,8 @@ cc_defaults { "-Werror", ], + cpp_std: "experimental", + include_dirs: [ "system/core/adb", ], diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp index e9c51da0a..9309ed749 100644 --- a/minadbd/minadbd_services.cpp +++ b/minadbd/minadbd_services.cpp @@ -23,6 +23,7 @@ #include <functional> #include <string> +#include <string_view> #include <thread> #include "adb.h" @@ -49,14 +50,13 @@ static void sideload_host_service(unique_fd sfd, const std::string& args) { exit(result == 0 ? 0 : 1); } -unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) { - if (!strncmp(name, "sideload:", 9)) { - // this exit status causes recovery to print a special error - // message saying to use a newer adb (that supports - // sideload-host). +unique_fd daemon_service_to_fd(std::string_view name, atransport* /* transport */) { + if (name.starts_with("sideload:")) { + // This exit status causes recovery to print a special error message saying to use a newer adb + // (that supports sideload-host). exit(3); - } else if (!strncmp(name, "sideload-host:", 14)) { - std::string arg(name + 14); + } else if (name.starts_with("sideload-host:")) { + std::string arg(name.substr(strlen("sideload-host:"))); return create_service_thread("sideload-host", std::bind(sideload_host_service, std::placeholders::_1, arg)); } |