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

Commit 98f51566 authored by Michael Sun's avatar Michael Sun
Browse files

btif: fix btif_dm lint error

Fix btif_dm lint error

Bug: 353527430
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, lint fix only
Change-Id: I91f023a19fcedcff9a5eca44d3f90aa8ca9eaaa8
parent d41a2fac
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@
#include "btif_api.h"
#include "btif_bqr.h"
#include "btif_config.h"
#include "btif_dm.h"
#include "btif_metrics_logging.h"
#include "btif_sdp.h"
#include "btif_storage.h"
@@ -462,7 +461,7 @@ static bool check_eir_appearance(tBTA_DM_SEARCH* p_search_data, uint16_t* p_appe
 *                  Populate p_remote_name, if provided and remote name found
 *
 ******************************************************************************/
static bool get_cached_remote_name(const RawAddress& bd_addr, uint8_t* p_remote_name,
static bool get_cached_remote_name(const RawAddress& bd_addr, bt_bdname_t* p_remote_name,
                                   uint8_t* p_remote_name_len) {
  bt_bdname_t bdname;
  bt_property_t prop_name;
@@ -472,7 +471,7 @@ static bool get_cached_remote_name(const RawAddress& bd_addr, uint8_t* p_remote_
  BTIF_STORAGE_FILL_PROPERTY(&prop_name, BT_PROPERTY_BDNAME, sizeof(bt_bdname_t), &bdname);
  if (btif_storage_get_remote_device_property(&bd_addr, &prop_name) == BT_STATUS_SUCCESS) {
    if (p_remote_name && p_remote_name_len) {
      strcpy((char*)p_remote_name, (char*)bdname.name);
      snprintf((char*)p_remote_name->name, sizeof(p_remote_name->name), "%s", (char*)bdname.name);
      *p_remote_name_len = strlen((char*)p_remote_name);
    }
    return true;
@@ -1335,7 +1334,7 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH*
      bdname.name[0] = 0;

      if (!check_eir_remote_name(p_search_data, bdname.name, &remote_name_len)) {
        get_cached_remote_name(p_search_data->inq_res.bd_addr, bdname.name, &remote_name_len);
        get_cached_remote_name(p_search_data->inq_res.bd_addr, &bdname, &remote_name_len);
      }

      /* Check EIR for services */
@@ -3125,39 +3124,40 @@ bool btif_dm_get_smp_config(tBTE_APPL_CFG* p_cfg) {
  char conf[64];
  char* pch;
  char* endptr;
  char* saveptr;

  strncpy(conf, recv->c_str(), 64);
  conf[63] = 0;  // null terminate

  pch = strtok(conf, ",");
  pch = strtok_r(conf, ",", &saveptr);
  if (pch != NULL) {
    p_cfg->ble_auth_req = (uint8_t)strtoul(pch, &endptr, 16);
  } else {
    return false;
  }

  pch = strtok(NULL, ",");
  pch = strtok_r(NULL, ",", &saveptr);
  if (pch != NULL) {
    p_cfg->ble_io_cap = (uint8_t)strtoul(pch, &endptr, 16);
  } else {
    return false;
  }

  pch = strtok(NULL, ",");
  pch = strtok_r(NULL, ",", &saveptr);
  if (pch != NULL) {
    p_cfg->ble_init_key = (uint8_t)strtoul(pch, &endptr, 16);
  } else {
    return false;
  }

  pch = strtok(NULL, ",");
  pch = strtok_r(NULL, ",", &saveptr);
  if (pch != NULL) {
    p_cfg->ble_resp_key = (uint8_t)strtoul(pch, &endptr, 16);
  } else {
    return false;
  }

  pch = strtok(NULL, ",");
  pch = strtok_r(NULL, ",", &saveptr);
  if (pch != NULL) {
    p_cfg->ble_max_key_size = (uint8_t)strtoul(pch, &endptr, 16);
  } else {
@@ -3770,7 +3770,8 @@ void btif_debug_bond_event_dump(int fd) {

    char eventtime[20];
    char temptime[20];
    struct tm* tstamp = localtime(&event->timestamp.tv_sec);
    struct tm buf;
    struct tm* tstamp = localtime_r(&event->timestamp.tv_sec, &buf);
    strftime(temptime, sizeof(temptime), "%H:%M:%S", tstamp);
    snprintf(eventtime, sizeof(eventtime), "%s.%03ld", temptime,
             event->timestamp.tv_nsec / 1000000);