From ccc584523ac8f2d39ab73084026416edff96ad2e Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 25 Feb 2019 13:02:43 -0800 Subject: [PATCH] adbd: switch abb to ConsumePrefix. Test: mma Change-Id: I57d1a30a526c97c5b5a2718740b76220da6eea39 --- adb/daemon/abb.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/adb/daemon/abb.cpp b/adb/daemon/abb.cpp index 4ffa6bb85..eeac41a93 100644 --- a/adb/daemon/abb.cpp +++ b/adb/daemon/abb.cpp @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "adb.h" -#include "adb_io.h" -#include "shell_service.h" - -#include "cmd.h" - #include #include +#include + +#include "adb.h" +#include "adb_io.h" +#include "adb_utils.h" +#include "shell_service.h" namespace { @@ -87,11 +87,9 @@ int main(int argc, char* const argv[]) { std::string_view name = data; auto protocol = SubprocessProtocol::kShell; - if (name.starts_with("abb:")) { - name.remove_prefix(strlen("abb:")); + if (ConsumePrefix(&name, "abb:")) { protocol = SubprocessProtocol::kShell; - } else if (name.starts_with("abb_exec:")) { - name.remove_prefix(strlen("abb_exec:")); + } else if (ConsumePrefix(&name, "abb_exec:")) { protocol = SubprocessProtocol::kNone; } else { LOG(FATAL) << "Unknown command prefix for abb: " << data;