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

Commit 54ca64be authored by Marie Janssen's avatar Marie Janssen Committed by android-build-merger
Browse files

readability fix: No assigns in if conditionals

am: 6b659db2

Change-Id: I11c5af715b2ad86f33491fae7a5bd530f07a2e96
parents 822c73bd 6b659db2
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -668,7 +668,8 @@ static void bta_ag_api_register(tBTA_AG_DATA* p_data) {
  tBTA_AG_REGISTER reg;

  /* allocate an scb */
  if ((p_scb = bta_ag_scb_alloc()) != NULL) {
  p_scb = bta_ag_scb_alloc();
  if (p_scb != NULL) {
    APPL_TRACE_DEBUG("bta_ag_api_register: p_scb 0x%08x ", p_scb);
    bta_ag_sm_execute(p_scb, p_data->hdr.event, p_data);
  } else {
@@ -692,7 +693,8 @@ static void bta_ag_api_result(tBTA_AG_DATA* p_data) {
  int i;

  if (p_data->hdr.layer_specific != BTA_AG_HANDLE_ALL) {
    if ((p_scb = bta_ag_scb_by_idx(p_data->hdr.layer_specific)) != NULL) {
    p_scb = bta_ag_scb_by_idx(p_data->hdr.layer_specific);
    if (p_scb != NULL) {
      APPL_TRACE_DEBUG("bta_ag_api_result: p_scb 0x%08x ", p_scb);
      bta_ag_sm_execute(p_scb, BTA_AG_API_RESULT_EVT, p_data);
    }
@@ -753,7 +755,8 @@ void bta_ag_sm_execute(tBTA_AG_SCB* p_scb, uint16_t event,

  /* execute action functions */
  for (i = 0; i < BTA_AG_ACTIONS; i++) {
    if ((action = state_table[event][i]) != BTA_AG_IGNORE) {
    action = state_table[event][i];
    if (action != BTA_AG_IGNORE) {
      (*bta_ag_action[action])(p_scb, p_data);
    } else {
      break;
@@ -805,7 +808,8 @@ bool bta_ag_hdl_event(BT_HDR* p_msg) {

    /* all others reference scb by handle */
    default:
      if ((p_scb = bta_ag_scb_by_idx(p_msg->layer_specific)) != NULL) {
      p_scb = bta_ag_scb_by_idx(p_msg->layer_specific);
      if (p_scb != NULL) {
        APPL_TRACE_DEBUG("bta_ag_hdl_event: p_scb 0x%08x ", p_scb);
        bta_ag_sm_execute(p_scb, p_msg->event, (tBTA_AG_DATA*)p_msg);
      }
+4 −2
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ static void bta_ag_port_cback(UNUSED_ATTR uint32_t code, uint16_t port_handle,
                              uint16_t handle) {
  tBTA_AG_SCB* p_scb;

  if ((p_scb = bta_ag_scb_by_idx(handle)) != NULL) {
  p_scb = bta_ag_scb_by_idx(handle);
  if (p_scb != NULL) {
    /* ignore port events for port handles other than connected handle */
    if (port_handle != p_scb->conn_handle) {
      APPL_TRACE_DEBUG(
@@ -115,7 +116,8 @@ static void bta_ag_mgmt_cback(uint32_t code, uint16_t port_handle,
  APPL_TRACE_DEBUG("ag_mgmt_cback : code = %d, port_handle = %d, handle = %d",
                   code, port_handle, handle);

  if ((p_scb = bta_ag_scb_by_idx(handle)) != NULL) {
  p_scb = bta_ag_scb_by_idx(handle);
  if (p_scb != NULL) {
    /* ignore close event for port handles other than connected handle */
    if ((code != PORT_SUCCESS) && (port_handle != p_scb->conn_handle)) {
      APPL_TRACE_DEBUG("ag_mgmt_cback ignoring handle:%d", port_handle);
+11 −8
Original line number Diff line number Diff line
@@ -72,7 +72,8 @@ static void bta_ag_sdp_cback(uint16_t status, uint8_t idx) {

  APPL_TRACE_DEBUG("%s status:0x%x", __func__, status);

  if ((p_scb = bta_ag_scb_by_idx(idx)) != NULL) {
  p_scb = bta_ag_scb_by_idx(idx);
  if (p_scb != NULL) {
    /* set event according to int/acp */
    if (p_scb->role == BTA_AG_ACP) {
      event = BTA_AG_DISC_ACP_RES_EVT;
@@ -303,12 +304,13 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {
  /* loop through all records we found */
  while (true) {
    /* get next record; if none found, we're done */
    if ((p_rec = SDP_FindServiceInDb(p_scb->p_disc_db, uuid, p_rec)) == NULL) {
    p_rec = SDP_FindServiceInDb(p_scb->p_disc_db, uuid, p_rec);
    if (p_rec == NULL) {
      if (uuid == UUID_SERVCLASS_HEADSET_HS) {
        /* Search again in case the peer device is HSP v1.0 */
        uuid = UUID_SERVCLASS_HEADSET;
        if ((p_rec = SDP_FindServiceInDb(p_scb->p_disc_db, uuid, p_rec)) ==
            NULL) {
        p_rec = SDP_FindServiceInDb(p_scb->p_disc_db, uuid, p_rec);
        if (p_rec == NULL) {
          break;
        }
      } else
@@ -329,8 +331,8 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {

    /* get features if HFP */
    if (service & BTA_HFP_SERVICE_MASK) {
      if ((p_attr = SDP_FindAttributeInRec(
               p_rec, ATTR_ID_SUPPORTED_FEATURES)) != NULL) {
      p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FEATURES);
      if (p_attr != NULL) {
        /* Found attribute. Get value. */
        /* There might be race condition between SDP and BRSF.  */
        /* Do not update if we already received BRSF.           */
@@ -339,8 +341,9 @@ bool bta_ag_sdp_find_attr(tBTA_AG_SCB* p_scb, tBTA_SERVICE_MASK service) {
      }
    } else /* HSP */
    {
      if ((p_attr = SDP_FindAttributeInRec(
               p_rec, ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL)) != NULL) {
      p_attr =
          SDP_FindAttributeInRec(p_rec, ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL);
      if (p_attr != NULL) {
        /* Remote volume control of HSP */
        if (p_attr->attr_value.v.u8)
          p_scb->peer_features |= BTA_AG_PEER_FEAT_VOL;
+8 −7
Original line number Diff line number Diff line
@@ -316,7 +316,8 @@ uint8_t bta_av_rc_create(tBTA_AV_CB* p_cb, uint8_t role, uint8_t shdl,
    bda = p_scb->peer_addr;
    status = BTA_AV_RC_ROLE_INT;
  } else {
    if ((p_rcb = bta_av_get_rcb_by_shdl(shdl)) != NULL) {
    p_rcb = bta_av_get_rcb_by_shdl(shdl);
    if (p_rcb != NULL) {
      APPL_TRACE_ERROR("bta_av_rc_create ACP handle exist for shdl:%d", shdl);
      return p_rcb->handle;
    }
@@ -1603,8 +1604,8 @@ tBTA_AV_FEAT bta_av_check_peer_features(uint16_t service_uuid) {
  /* loop through all records we found */
  while (true) {
    /* get next record; if none found, we're done */
    if ((p_rec = SDP_FindServiceInDb(p_cb->p_disc_db, service_uuid, p_rec)) ==
        NULL) {
    p_rec = SDP_FindServiceInDb(p_cb->p_disc_db, service_uuid, p_rec);
    if (p_rec == NULL) {
      break;
    }

@@ -1633,8 +1634,8 @@ tBTA_AV_FEAT bta_av_check_peer_features(uint16_t service_uuid) {
      if (peer_rc_version >= AVRC_REV_1_4) {
        peer_features |= (BTA_AV_FEAT_ADV_CTRL);
        /* get supported categories */
        if ((p_attr = SDP_FindAttributeInRec(
                 p_rec, ATTR_ID_SUPPORTED_FEATURES)) != NULL) {
        p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FEATURES);
        if (p_attr != NULL) {
          categories = p_attr->attr_value.v.u16;
          if (categories & AVRC_SUPF_CT_BROWSE)
            peer_features |= (BTA_AV_FEAT_BROWSE);
+2 −1
Original line number Diff line number Diff line
@@ -1120,7 +1120,8 @@ void bta_av_sm_execute(tBTA_AV_CB* p_cb, uint16_t event, tBTA_AV_DATA* p_data) {
  APPL_TRACE_EVENT("next state=%d event offset:%d", p_cb->state, event);

  /* execute action functions */
  if ((action = state_table[event][BTA_AV_ACTION_COL]) != BTA_AV_IGNORE) {
  action = state_table[event][BTA_AV_ACTION_COL];
  if (action != BTA_AV_IGNORE) {
    APPL_TRACE_EVENT("%s action executed %d", __func__, action);
    (*bta_av_action[action])(p_cb, p_data);
  }
Loading