Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d597ba8 authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Fix clang-tidy warnings

Fix warnings for readability-*

Test: ALLOW_LOCAL_TIDY_TRUE=1 m root-canal
Change-Id: I5975ac2ee127252b5ec1a368bff8243c5256aef0
parent b91254ac
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -18,13 +18,18 @@ cc_defaults {
    tidy: true,
    tidy_checks: [
        "-*",
        "readability-inconsistent-declaration-parameter-name",
        "readability-*",
	"-readability-function-size",
        "-readability-identifier-length",
        "-readability-implicit-bool-conversion",
        "-readability-magic-numbers",
        "-readability-use-anyofallof",
    ],
    tidy_checks_as_errors: [
        "readability-inconsistent-declaration-parameter-name",
        "readability-*",
    ],
    tidy_flags: [
        "--header-filter=^((?!BluetoothGeneratedPackets_h|RootCanalGeneratedPackets_h|RootCanalBrEdrBBGeneratedPackets_h).)*$",
        "--header-filter=^.*tools\\/rootcanal\\/(model|include|net|desktop)\\/(.(?!\\.pb\\.h))*$",
    ],
    defaults: [
        "fluoride_common_options",
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ int main(int argc, char** argv) {
  for (int arg = 0; arg < argc; arg++) {
    int port = (int)strtol(argv[arg], nullptr, 0);
    LOG_INFO("%d: %s (%d)", arg, argv[arg], port);
    if (port < 0 || port > 0xffff) {
    if (port < 0 || port > UINT16_MAX) {
      LOG_WARN("%s out of range", argv[arg]);
    } else {
      switch (arg) {
+7 −5
Original line number Diff line number Diff line
@@ -145,7 +145,9 @@ void TestEnvironment::SetUpLinkLayerServer() {
std::shared_ptr<Device> TestEnvironment::ConnectToRemoteServer(
    const std::string& server, int port, Phy::Type phy_type) {
  auto socket = connector_->ConnectToRemoteServer(server, port);
  if (!socket->Connected()) return nullptr;
  if (!socket->Connected()) {
    return nullptr;
  }
  return LinkLayerSocketDevice::Create(socket, phy_type);
}

@@ -157,14 +159,14 @@ void TestEnvironment::SetUpTestChannel() {
        server->StartListening();
        if (test_channel_open_) {
          LOG_WARN("Only one connection at a time is supported");
          test_channel_transport_.SendResponse(conn_fd,
                                               "The connection is broken");
          rootcanal::TestChannelTransport::SendResponse(
              conn_fd, "The connection is broken");
          return false;
        }
        test_channel_open_ = true;
        test_channel_.RegisterSendResponse(
            [this, conn_fd](const std::string& response) {
              test_channel_transport_.SendResponse(conn_fd, response);
            [conn_fd](const std::string& response) {
              rootcanal::TestChannelTransport::SendResponse(conn_fd, response);
            });

        conn_fd->WatchForNonBlockingRead([this](AsyncDataChannel* conn_fd) {
+3 −1
Original line number Diff line number Diff line
@@ -51,7 +51,9 @@ class AddressWithType final {
  /* Is this an Resolvable Private Address, that was generated from given irk ?
   */
  bool IsRpaThatMatchesIrk(const rootcanal::crypto::Octet16& irk) const {
    if (!IsRpa()) return false;
    if (!IsRpa()) {
      return false;
    }

    /* use the 3 MSB of bd address as prand */
    uint8_t prand[3];
+4 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#pragma once

#include <algorithm>
#include <cstdint>

#include "hci/hci_packets.h"
@@ -43,12 +44,9 @@ class ConnectedIsochronousGroup {
  virtual ~ConnectedIsochronousGroup() = default;

  bool HasConnectedStream() const {
    for (auto& stream : streams_) {
      if (stream.IsConnected()) {
        return true;
      }
    }
    return false;
    return std::any_of(
        streams_.begin(), streams_.end(),
        [&](const ConnectedIsochronousStream& s) { return s.IsConnected(); });
  }

  bool StreamIsConnected(uint16_t handle) const {
Loading