diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp index ffac315b3730a26672d2e014caec89f470a74467..35017f0e31d49fa1d2582265a0e0617d2e8f8b72 100644 --- a/adb/adb_utils.cpp +++ b/adb/adb_utils.cpp @@ -49,9 +49,9 @@ #if defined(_WIN32) -constexpr char kNullFileName[] = "NUL"; +static constexpr char kNullFileName[] = "NUL"; #else -constexpr char kNullFileName[] = "/dev/null"; +static constexpr char kNullFileName[] = "/dev/null"; #endif void close_stdin() { diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp index 451422fb050fe8818bdb1f5a9ffcbf1c43854430..a5cfd7f1ca244734d8af1db1bce4f746c04075ee 100644 --- a/adb/client/commandline.cpp +++ b/adb/client/commandline.cpp @@ -354,8 +354,7 @@ static void stdinout_raw_epilogue(int inFd, int outFd, int old_stdin_mode, int o } void copy_to_file(int inFd, int outFd) { - constexpr size_t BUFSIZE = 32 * 1024; - std::vector<char> buf(BUFSIZE); + std::vector<char> buf(32 * 1024); int len; long total = 0; int old_stdin_mode = -1; @@ -367,9 +366,9 @@ void copy_to_file(int inFd, int outFd) { while (true) { if (inFd == STDIN_FILENO) { - len = unix_read(inFd, buf.data(), BUFSIZE); + len = unix_read(inFd, buf.data(), buf.size()); } else { - len = adb_read(inFd, buf.data(), BUFSIZE); + len = adb_read(inFd, buf.data(), buf.size()); } if (len == 0) { D("copy_to_file() : read 0 bytes; exiting"); diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp index fda388962e6ff0e2d0425d9454b07661cf2380f5..3b05661020d976f0a3ae60a50b016f9374862012 100644 --- a/adb/client/fastdeploy.cpp +++ b/adb/client/fastdeploy.cpp @@ -25,9 +25,9 @@ #include "fastdeploycallbacks.h" #include "utils/String16.h" -const long kRequiredAgentVersion = 0x00000001; +static constexpr long kRequiredAgentVersion = 0x00000001; -const char* kDeviceAgentPath = "/data/local/tmp/"; +static constexpr const char* kDeviceAgentPath = "/data/local/tmp/"; long get_agent_version() { std::vector<char> versionOutputBuffer; diff --git a/adb/transport.cpp b/adb/transport.cpp index 239403a83f19ac40a7b270babfc19b92479eb919..95df49006d9d03aa4aff500068493210b8f9610f 100644 --- a/adb/transport.cpp +++ b/adb/transport.cpp @@ -1040,12 +1040,6 @@ size_t atransport::get_max_payload() const { return max_payload; } -namespace { - -constexpr char kFeatureStringDelimiter = ','; - -} // namespace - const FeatureSet& supported_features() { // Local static allocation to avoid global non-POD variables. static const FeatureSet* features = new FeatureSet{ @@ -1059,7 +1053,7 @@ const FeatureSet& supported_features() { } std::string FeatureSetToString(const FeatureSet& features) { - return android::base::Join(features, kFeatureStringDelimiter); + return android::base::Join(features, ','); } FeatureSet StringToFeatureSet(const std::string& features_string) { @@ -1067,7 +1061,7 @@ FeatureSet StringToFeatureSet(const std::string& features_string) { return FeatureSet(); } - auto names = android::base::Split(features_string, {kFeatureStringDelimiter}); + auto names = android::base::Split(features_string, ","); return FeatureSet(names.begin(), names.end()); } diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp index 4fd483b574977ba68611570e7e7d1bb957cbb4e8..8353d89f2975d5fe38574fd28ee749b8be0e6bd1 100644 --- a/adb/transport_local.cpp +++ b/adb/transport_local.cpp @@ -187,8 +187,8 @@ static void PollAllLocalPortsForEmulator() { } // Retry the disconnected local port for 60 times, and sleep 1 second between two retries. -constexpr uint32_t LOCAL_PORT_RETRY_COUNT = 60; -constexpr auto LOCAL_PORT_RETRY_INTERVAL = 1s; +static constexpr uint32_t LOCAL_PORT_RETRY_COUNT = 60; +static constexpr auto LOCAL_PORT_RETRY_INTERVAL = 1s; struct RetryPort { int port;