diff options
Diffstat (limited to 'adb')
| -rw-r--r-- | adb/Android.bp | 9 | ||||
| -rw-r--r-- | adb/adb_utils.h | 2 | ||||
| -rw-r--r-- | adb/client/incremental.cpp | 6 | ||||
| -rw-r--r-- | adb/fdevent/fdevent_test.h | 4 | ||||
| -rw-r--r-- | adb/sockets.cpp | 2 |
5 files changed, 16 insertions, 7 deletions
diff --git a/adb/Android.bp b/adb/Android.bp index 2fc205faed..87ac54d06e 100644 --- a/adb/Android.bp +++ b/adb/Android.bp @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +tidy_errors = [ + "-*", + "bugprone-inaccurate-erase", +] + cc_defaults { name: "adb_defaults", @@ -73,6 +78,10 @@ cc_defaults { ], }, }, + + tidy: true, + tidy_checks: tidy_errors, + tidy_checks_as_errors: tidy_errors, } cc_defaults { diff --git a/adb/adb_utils.h b/adb/adb_utils.h index 66cba121b2..e72d8b6f87 100644 --- a/adb/adb_utils.h +++ b/adb/adb_utils.h @@ -55,7 +55,7 @@ std::string perror_str(const char* msg); bool set_file_block_mode(borrowed_fd fd, bool block); -// Given forward/reverse targets, returns true if they look sane. If an error is found, fills +// Given forward/reverse targets, returns true if they look valid. If an error is found, fills // |error| and returns false. // Currently this only checks "tcp:" targets. Additional checking could be added for other targets // if needed. diff --git a/adb/client/incremental.cpp b/adb/client/incremental.cpp index 3033059d01..60735f8c5e 100644 --- a/adb/client/incremental.cpp +++ b/adb/client/incremental.cpp @@ -55,9 +55,10 @@ static std::pair<unique_fd, std::vector<char>> read_signature(Size file_size, return {}; } - std::vector<char> invalid_signature; + auto [signature, tree_size] = read_id_sig_headers(fd); - if (st.st_size > kMaxSignatureSize) { + std::vector<char> invalid_signature; + if (signature.size() > kMaxSignatureSize) { if (!silent) { fprintf(stderr, "Signature is too long. Max allowed is %d. Abort.\n", kMaxSignatureSize); @@ -65,7 +66,6 @@ static std::pair<unique_fd, std::vector<char>> read_signature(Size file_size, return {std::move(fd), std::move(invalid_signature)}; } - auto [signature, tree_size] = read_id_sig_headers(fd); if (auto expected = verity_tree_size_for_file(file_size); tree_size != expected) { if (!silent) { fprintf(stderr, diff --git a/adb/fdevent/fdevent_test.h b/adb/fdevent/fdevent_test.h index ecda4da979..fcbf181dc0 100644 --- a/adb/fdevent/fdevent_test.h +++ b/adb/fdevent/fdevent_test.h @@ -65,7 +65,7 @@ class FdeventTest : public ::testing::Test { ASSERT_EQ(0u, fdevent_installed_count()); } - // Register a dummy socket used to wake up the fdevent loop to tell it to die. + // Register a placeholder socket used to wake up the fdevent loop to tell it to die. void PrepareThread() { int dummy_fds[2]; if (adb_socketpair(dummy_fds) != 0) { @@ -84,7 +84,7 @@ class FdeventTest : public ::testing::Test { } size_t GetAdditionalLocalSocketCount() { - // dummy socket installed in PrepareThread() + // placeholder socket installed in PrepareThread() return 1; } diff --git a/adb/sockets.cpp b/adb/sockets.cpp index 13a473776c..33b9524182 100644 --- a/adb/sockets.cpp +++ b/adb/sockets.cpp @@ -856,7 +856,7 @@ static int smart_socket_enqueue(asocket* s, apacket::payload_type data) { s->peer->shutdown = nullptr; s->peer->close = local_socket_close_notify; s->peer->peer = nullptr; - /* give him our transport and upref it */ + /* give them our transport and upref it */ s->peer->transport = s->transport; connect_to_remote(s->peer, std::string_view(s->smart_socket_data).substr(4)); |
