From b4cff495a1f93b6c92f4327cbfb9e564b28913d8 Mon Sep 17 00:00:00 2001 From: Dan Austin Date: Mon, 28 Mar 2016 15:32:37 -0700 Subject: [PATCH] Address const issues in preparation for libcxx rebase. Change-Id: I4eccc1b5a70da9dd325e1a7e10ab0a3fe588c03f --- adb/socket.h | 2 +- adb/socket_test.cpp | 4 ++-- adb/sockets.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adb/socket.h b/adb/socket.h index 9eb1b19554ac..4acdf4a6d7ca 100644 --- a/adb/socket.h +++ b/adb/socket.h @@ -118,7 +118,7 @@ void connect_to_smartsocket(asocket *s); namespace internal { #if ADB_HOST -char* skip_host_serial(const char* service); +char* skip_host_serial(char* service); #endif } // namespace internal diff --git a/adb/socket_test.cpp b/adb/socket_test.cpp index 5cbef6dcf8e4..20a3bbbfc046 100644 --- a/adb/socket_test.cpp +++ b/adb/socket_test.cpp @@ -275,8 +275,8 @@ TEST_F(LocalSocketTest, close_socket_in_CLOSE_WAIT_state) { // Checks that skip_host_serial(serial) returns a pointer to the part of |serial| which matches // |expected|, otherwise logs the failure to gtest. -void VerifySkipHostSerial(const std::string& serial, const char* expected) { - const char* result = internal::skip_host_serial(serial.c_str()); +void VerifySkipHostSerial(std::string serial, const char* expected) { + char* result = internal::skip_host_serial(&serial[0]); if (expected == nullptr) { EXPECT_EQ(nullptr, result); } else { diff --git a/adb/sockets.cpp b/adb/sockets.cpp index c083ee144d4a..aecaba224167 100644 --- a/adb/sockets.cpp +++ b/adb/sockets.cpp @@ -634,7 +634,7 @@ namespace internal { // Where must be a base-10 number and may be any of {usb,product,model,device}. // // The returned pointer will point to the ':' just before , or nullptr if not found. -char* skip_host_serial(const char* service) { +char* skip_host_serial(char* service) { static const std::vector& prefixes = *(new std::vector{"usb:", "product:", "model:", "device:"});