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

Commit 3f8f9b88 authored by Nick Desaulniers's avatar Nick Desaulniers
Browse files

[system][bt][gd] fix -Wreorder-init-list



C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Change-Id: I4ed1a2c2865cfa26b45db970202340ae582ba78d
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
parent dacad0cd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -26,7 +26,9 @@ namespace classic {
bool FixedChannelManager::ConnectServices(hci::Address device, OnConnectionFailureCallback on_fail_callback,
                                          os::Handler* handler) {
  internal::LinkManager::PendingFixedChannelConnection pending_fixed_channel_connection{
      .on_fail_callback_ = std::move(on_fail_callback), .handler_ = handler};
      .handler_ = handler,
      .on_fail_callback_ = std::move(on_fail_callback),
  };
  l2cap_layer_handler_->Post(common::BindOnce(&internal::LinkManager::ConnectFixedChannelServices,
                                              common::Unretained(link_manager_), device,
                                              std::move(pending_fixed_channel_connection)));
+3 −1
Original line number Diff line number Diff line
@@ -26,7 +26,9 @@ namespace le {
bool FixedChannelManager::ConnectServices(hci::Address device, hci::AddressType address_type,
                                          OnConnectionFailureCallback on_fail_callback, os::Handler* handler) {
  internal::LinkManager::PendingFixedChannelConnection pending_fixed_channel_connection{
      .on_fail_callback_ = std::move(on_fail_callback), .handler_ = handler};
      .handler_ = handler,
      .on_fail_callback_ = std::move(on_fail_callback),
  };
  l2cap_layer_handler_->Post(common::BindOnce(&internal::LinkManager::ConnectFixedChannelServices,
                                              common::Unretained(link_manager_), device, address_type,
                                              std::move(pending_fixed_channel_connection)));
+3 −3
Original line number Diff line number Diff line
@@ -54,10 +54,10 @@ struct elliptic_curve_t {

// P-256 elliptic curve, as per BT Spec 5.1 Vol 2, Part H 7.6
static constexpr elliptic_curve_t curve_p256{
    .p = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0, 0x0, 0x00000001, 0xFFFFFFFF},
    .omega = {0},
    .a = {0},
    .b = {0x27d2604b, 0x3bce3c3e, 0xcc53b0f6, 0x651d06b0, 0x769886bc, 0xb3ebbd55, 0xaa3a93e7, 0x5ac635d8},
    .p = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0, 0x0, 0x00000001, 0xFFFFFFFF},
    .omega = {0},

    .G = {.x = {0xd898c296, 0xf4a13945, 0x2deb33a0, 0x77037d81, 0x63a440f2, 0xf8bce6e5, 0xe12c4247, 0x6b17d1f2},
          .y = {0x37bf51f5, 0xcbb64068, 0x6b315ece, 0x2bce3357, 0x7c0f9e16, 0x8ee7eb4a, 0xfe1a7f9b, 0x4fe342e2}},
+7 −10
Original line number Diff line number Diff line
@@ -130,12 +130,11 @@ InitialInformations initial_informations{
                              .initiator_key_distribution = 0x03,
                              .responder_key_distribution = 0x03},

    .le_security_interface = &leSecurityMock,
    .ui_handler = &uiMock,

    .remotely_initiated = false,
    .remote_connection_address = {},
    .remote_connection_address_type = 0x01,
    .ui_handler = &uiMock,
    .le_security_interface = &leSecurityMock,
    .OnPairingFinished = OnPairingFinished,
};

@@ -263,10 +262,9 @@ InitialInformations initial_informations_trsi{
                              .initiator_key_distribution = 0x03,
                              .responder_key_distribution = 0x03},

    .le_security_interface = &leSecurityMock,
    .ui_handler = &uiMock,

    .remotely_initiated = true,
    .ui_handler = &uiMock,
    .le_security_interface = &leSecurityMock,
    .OnPairingFinished = OnPairingFinished,
};

@@ -299,13 +297,12 @@ InitialInformations initial_informations_trmi{
                              .initiator_key_distribution = 0x03,
                              .responder_key_distribution = 0x03},

    .le_security_interface = &leSecurityMock,
    .ui_handler = &uiMock,

    .remotely_initiated = true,
    .pairing_request = PairingRequestView::Create(BuilderToView(
        PairingRequestBuilder::Create(IoCapability::NO_INPUT_NO_OUTPUT, OobDataFlag::NOT_PRESENT,
                                      AuthReqMaskBondingFlag | AuthReqMaskMitm | AuthReqMaskSc, 16, 0x03, 0x03))),
    .ui_handler = &uiMock,
    .le_security_interface = &leSecurityMock,

    .OnPairingFinished = OnPairingFinished,
};
+17 −26
Original line number Diff line number Diff line
@@ -174,15 +174,14 @@ class PairingHandlerPairTest : public testing::Test {
                                  .initiator_key_distribution = KeyMaskId | KeyMaskSign,
                                  .responder_key_distribution = KeyMaskId | KeyMaskSign},

        .remotely_initiated = false,
        .connection_handle = CONN_HANDLE_MASTER,
        .remote_connection_address = ADDRESS_SLAVE,
        .remote_connection_address_type = ADDRESS_TYPE_SLAVE,
        .ui_handler = &master_ui_handler,
        .le_security_interface = &master_le_security_mock,
        .proper_l2cap_interface = up_buffer_a_.get(),
        .l2cap_handler = handler_,

        .connection_handle = CONN_HANDLE_MASTER,
        .remotely_initiated = false,
        .remote_connection_address = ADDRESS_SLAVE,
        .remote_connection_address_type = ADDRESS_TYPE_SLAVE,
        .OnPairingFinished = OnPairingFinishedMaster,
    };

@@ -197,16 +196,14 @@ class PairingHandlerPairTest : public testing::Test {
                                  .maximum_encryption_key_size = 16,
                                  .initiator_key_distribution = KeyMaskId | KeyMaskSign,
                                  .responder_key_distribution = KeyMaskId | KeyMaskSign},

        .remotely_initiated = true,
        .connection_handle = CONN_HANDLE_SLAVE,
        .remote_connection_address = ADDRESS_MASTER,
        .remote_connection_address_type = ADDRESS_TYPE_MASTER,
        .ui_handler = &slave_ui_handler,
        .le_security_interface = &slave_le_security_mock,
        .proper_l2cap_interface = up_buffer_b_.get(),
        .l2cap_handler = handler_,

        .connection_handle = CONN_HANDLE_SLAVE,
        .remotely_initiated = true,
        .remote_connection_address = ADDRESS_MASTER,
        .remote_connection_address_type = ADDRESS_TYPE_MASTER,
        .OnPairingFinished = OnPairingFinishedSlave,
    };

@@ -342,29 +339,25 @@ TEST_F(PairingHandlerPairTest, test_secure_connections_just_works_slave_initiate
      .my_role = hci::Role::MASTER,
      .my_connection_address = ADDRESS_MASTER,
      .my_connection_address_type = ADDRESS_TYPE_MASTER,

      .myPairingCapabilities = {.io_capability = IoCapability::NO_INPUT_NO_OUTPUT,
                                .oob_data_flag = OobDataFlag::NOT_PRESENT,
                                .auth_req = AuthReqMaskBondingFlag | AuthReqMaskMitm | AuthReqMaskSc,
                                .maximum_encryption_key_size = 16,
                                .initiator_key_distribution = KeyMaskId | KeyMaskSign,
                                .responder_key_distribution = KeyMaskId | KeyMaskSign},

      .remotely_initiated = true,
      .connection_handle = CONN_HANDLE_MASTER,
      .remote_connection_address = ADDRESS_SLAVE,
      .remote_connection_address_type = ADDRESS_TYPE_SLAVE,
      .ui_handler = &master_ui_handler,
      .le_security_interface = &master_le_security_mock,
      .proper_l2cap_interface = up_buffer_a_.get(),
      .l2cap_handler = handler_,

      .connection_handle = CONN_HANDLE_MASTER,
      .remotely_initiated = true,
      .remote_connection_address = ADDRESS_SLAVE,
      .remote_connection_address_type = ADDRESS_TYPE_SLAVE,
      .OnPairingFinished = OnPairingFinishedMaster,
  };

  slave_setup = {
      .my_role = hci::Role::SLAVE,

      .my_connection_address = ADDRESS_SLAVE,
      .my_connection_address_type = ADDRESS_TYPE_SLAVE,
      .myPairingCapabilities = {.io_capability = IoCapability::NO_INPUT_NO_OUTPUT,
@@ -373,16 +366,14 @@ TEST_F(PairingHandlerPairTest, test_secure_connections_just_works_slave_initiate
                                .maximum_encryption_key_size = 16,
                                .initiator_key_distribution = KeyMaskId | KeyMaskSign,
                                .responder_key_distribution = KeyMaskId | KeyMaskSign},

      .remotely_initiated = false,
      .connection_handle = CONN_HANDLE_SLAVE,
      .remote_connection_address = ADDRESS_MASTER,
      .remote_connection_address_type = ADDRESS_TYPE_MASTER,
      .ui_handler = &slave_ui_handler,
      .le_security_interface = &slave_le_security_mock,
      .proper_l2cap_interface = up_buffer_b_.get(),
      .l2cap_handler = handler_,

      .connection_handle = CONN_HANDLE_SLAVE,
      .remotely_initiated = false,
      .remote_connection_address = ADDRESS_MASTER,
      .remote_connection_address_type = ADDRESS_TYPE_MASTER,
      .OnPairingFinished = OnPairingFinishedSlave,
  };