From: Chris Manton Date: Sat, 22 Aug 2020 15:26:49 +0000 (-0700) Subject: Add const stack/l2cap/l2c_link::l2c_link_send_to_lower X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4edcd50c43;p=android-x86%2Fsystem-bt.git Add const stack/l2cap/l2c_link::l2c_link_send_to_lower Pull out fit-in-buffer conditions Towards proper interfaces Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: I861f7dc5eef2ee032a8e08c681ee5f18c7b5d277 --- diff --git a/stack/l2cap/l2c_link.cc b/stack/l2cap/l2c_link.cc index d4c5e9bf4..9d52a09de 100644 --- a/stack/l2cap/l2c_link.cc +++ b/stack/l2cap/l2c_link.cc @@ -1024,9 +1024,13 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf, const uint16_t link_xmit_quota = p_lcb->link_xmit_quota; const tBT_TRANSPORT transport = p_lcb->transport; - if (((transport == BT_TRANSPORT_BR_EDR) && - (p_buf->len <= acl_packet_size_classic)) || - ((transport == BT_TRANSPORT_LE) && (p_buf->len <= acl_packet_size_ble))) { + const bool is_bdr_and_fits_in_buffer = + (transport == BT_TRANSPORT_BR_EDR && + (p_buf->len <= acl_packet_size_classic)); + const bool is_ble_and_fits_in_buffer = + (transport == BT_TRANSPORT_LE && (p_buf->len <= acl_packet_size_ble)); + + if (is_bdr_and_fits_in_buffer || is_ble_and_fits_in_buffer) { if (link_xmit_quota == 0) { if (transport == BT_TRANSPORT_LE) l2cb.ble_round_robin_unacked++;