mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/compiler_err_when_performance_optimization_enabled' into 'master'
Bugfix/compiler err when performance optimization enabled Closes BT-688 See merge request espressif/esp-idf!7958
This commit is contained in:
commit
df56535b7a
@ -972,7 +972,7 @@ static esp_err_t try_heap_caps_add_region(intptr_t start, intptr_t end)
|
||||
esp_err_t esp_bt_controller_mem_release(esp_bt_mode_t mode)
|
||||
{
|
||||
bool update = true;
|
||||
intptr_t mem_start, mem_end;
|
||||
intptr_t mem_start=(intptr_t) NULL, mem_end=(intptr_t) NULL;
|
||||
|
||||
if (btdm_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
|
@ -116,7 +116,7 @@ void BTA_AvRegister(tBTA_AV_CHNL chnl, const char *p_service_name, UINT8 app_id,
|
||||
p_buf->hdr.layer_specific = chnl;
|
||||
p_buf->hdr.event = BTA_AV_API_REGISTER_EVT;
|
||||
if (p_service_name) {
|
||||
BCM_STRNCPY_S(p_buf->p_service_name, sizeof(p_buf->p_service_name), p_service_name, BTA_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S(p_buf->p_service_name, p_service_name, BTA_SERVICE_NAME_LEN);
|
||||
p_buf->p_service_name[BTA_SERVICE_NAME_LEN - 1] = 0;
|
||||
} else {
|
||||
p_buf->p_service_name[0] = 0;
|
||||
|
@ -483,8 +483,7 @@ static void bta_av_api_sink_enable(tBTA_AV_DATA *p_data)
|
||||
activate_sink = p_data->hdr.layer_specific;
|
||||
APPL_TRACE_DEBUG("bta_av_api_sink_enable %d \n", activate_sink)
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
BCM_STRNCPY_S(p_service_name, sizeof(p_service_name),
|
||||
BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S(p_service_name, BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
|
||||
if (activate_sink) {
|
||||
AVDT_SINK_Activate();
|
||||
@ -526,7 +525,7 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
tBTA_UTL_COD cod;
|
||||
UINT8 index = 0;
|
||||
char p_avk_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
BCM_STRNCPY_S(p_avk_service_name, sizeof(p_avk_service_name), BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S(p_avk_service_name, BTIF_AVK_SERVICE_NAME, BTA_SERVICE_NAME_LEN);
|
||||
|
||||
memset(&cs, 0, sizeof(tAVDT_CS));
|
||||
|
||||
|
@ -1879,7 +1879,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
|
||||
if (SDP_FindServiceUUIDInRec(p_sdp_rec, &service_uuid)) {
|
||||
/* send result back to app now, one by one */
|
||||
bdcpy (result.disc_ble_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN));
|
||||
result.disc_ble_res.bd_name[BD_NAME_LEN] = 0;
|
||||
result.disc_ble_res.service.len = service_uuid.len;
|
||||
result.disc_ble_res.service.uu.uuid16 = service_uuid.uu.uuid16;
|
||||
@ -2020,8 +2020,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
|
||||
|
||||
}
|
||||
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
|
||||
bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is null terminated */
|
||||
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
@ -2047,8 +2046,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
|
||||
p_msg->disc_result.result.disc_res.result = BTA_FAILURE;
|
||||
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
|
||||
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
|
||||
bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name,bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is null terminated */
|
||||
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
@ -2432,8 +2430,7 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
|
||||
p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT;
|
||||
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
|
||||
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
|
||||
bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name,bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is terminated */
|
||||
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
@ -2618,8 +2615,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
|
||||
p_msg->disc_result.result.disc_res.result = BTA_SUCCESS;
|
||||
p_msg->disc_result.result.disc_res.services = bta_dm_search_cb.services_found;
|
||||
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
|
||||
(char *)bta_dm_search_cb.peer_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name,(char *)bta_dm_search_cb.peer_name, (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is terminated */
|
||||
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
@ -2763,7 +2759,7 @@ static void bta_dm_service_search_remname_cback (BD_ADDR bd_addr, DEV_CLASS dc,
|
||||
rem_name.length = (BD_NAME_LEN - 1);
|
||||
rem_name.remote_bd_name[(BD_NAME_LEN - 1)] = 0;
|
||||
}
|
||||
BCM_STRNCPY_S((char *)rem_name.remote_bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)rem_name.remote_bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
rem_name.status = BTM_SUCCESS;
|
||||
|
||||
bta_dm_remname_cback(&rem_name);
|
||||
@ -2805,7 +2801,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
|
||||
p_remote_name->remote_bd_name);
|
||||
/* remote name discovery is done but it could be failed */
|
||||
bta_dm_search_cb.name_discover_done = TRUE;
|
||||
BCM_STRNCPY_S((char *)bta_dm_search_cb.peer_name, sizeof(BD_NAME), (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)bta_dm_search_cb.peer_name, (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
|
||||
bta_dm_search_cb.peer_name[BD_NAME_LEN] = 0;
|
||||
|
||||
BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
|
||||
@ -2818,7 +2814,7 @@ static void bta_dm_remname_cback (tBTM_REMOTE_DEV_NAME *p_remote_name)
|
||||
|
||||
if ((p_msg = (tBTA_DM_REM_NAME *) osi_malloc(sizeof(tBTA_DM_REM_NAME))) != NULL) {
|
||||
bdcpy (p_msg->result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->result.disc_res.bd_name, sizeof(BD_NAME), (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)p_msg->result.disc_res.bd_name, (char *)p_remote_name->remote_bd_name, (BD_NAME_LEN));
|
||||
|
||||
/* make sure the string is null terminated */
|
||||
p_msg->result.disc_res.bd_name[BD_NAME_LEN] = 0;
|
||||
@ -2849,7 +2845,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
||||
bdcpy(sec_event.authorize.bd_addr, bd_addr);
|
||||
memcpy(sec_event.authorize.dev_class, dev_class, DEV_CLASS_LEN);
|
||||
|
||||
BCM_STRNCPY_S((char *)sec_event.authorize.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.authorize.bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is null terminated */
|
||||
sec_event.authorize.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
@ -2963,7 +2959,7 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
|
||||
|
||||
bdcpy(sec_event.pin_req.bd_addr, bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.pin_req.dev_class, dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, (char *)bd_name, (BD_NAME_LEN - 1));
|
||||
sec_event.pin_req.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
sec_event.pin_req.min_16_digit = min_16_digit;
|
||||
|
||||
@ -3134,8 +3130,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
|
||||
copy these values into key_notif from cfm_req */
|
||||
bdcpy(sec_event.key_notif.bd_addr, p_data->cfm_req.bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->cfm_req.dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
|
||||
(char *)p_data->cfm_req.bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, (char *)p_data->cfm_req.bd_name, (BD_NAME_LEN - 1));
|
||||
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
}
|
||||
}
|
||||
@ -3156,8 +3151,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
|
||||
} else {
|
||||
bdcpy(sec_event.key_notif.bd_addr, p_data->key_notif.bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->key_notif.dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
|
||||
(char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, (char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
|
||||
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
}
|
||||
}
|
||||
@ -3178,8 +3172,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
|
||||
} else {
|
||||
bdcpy(sec_event.key_notif.bd_addr, p_data->key_notif.bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.key_notif.dev_class, p_data->key_notif.dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME),
|
||||
(char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name,(char *)p_data->key_notif.bd_name, (BD_NAME_LEN - 1));
|
||||
sec_event.key_notif.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
}
|
||||
}
|
||||
@ -3208,7 +3201,7 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
|
||||
|
||||
bdcpy(sec_event.rmt_oob.bd_addr, p_data->rmt_oob.bd_addr);
|
||||
BTA_COPY_DEVICE_CLASS(sec_event.rmt_oob.dev_class, p_data->rmt_oob.dev_class);
|
||||
BCM_STRNCPY_S((char *)sec_event.rmt_oob.bd_name, sizeof(BD_NAME), (char *)p_data->rmt_oob.bd_name, (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)sec_event.rmt_oob.bd_name, (char *)p_data->rmt_oob.bd_name, (BD_NAME_LEN - 1));
|
||||
sec_event.rmt_oob.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
|
||||
bta_dm_cb.p_sec_cback(BTA_DM_SP_RMT_OOB_EVT, &sec_event);
|
||||
@ -4616,8 +4609,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
|
||||
bdcpy(sec_event.ble_req.bd_addr, bda);
|
||||
p_name = BTM_SecReadDevName(bda);
|
||||
if (p_name != NULL) {
|
||||
BCM_STRNCPY_S((char *)sec_event.ble_req.bd_name,
|
||||
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)sec_event.ble_req.bd_name,p_name, (BD_NAME_LEN));
|
||||
} else {
|
||||
sec_event.ble_req.bd_name[0] = 0;
|
||||
}
|
||||
@ -4629,8 +4621,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
|
||||
bdcpy(sec_event.key_notif.bd_addr, bda);
|
||||
p_name = BTM_SecReadDevName(bda);
|
||||
if (p_name != NULL) {
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name,
|
||||
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, p_name, (BD_NAME_LEN));
|
||||
} else {
|
||||
sec_event.key_notif.bd_name[0] = 0;
|
||||
}
|
||||
@ -4651,7 +4642,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
|
||||
|
||||
case BTM_LE_NC_REQ_EVT:
|
||||
bdcpy(sec_event.key_notif.bd_addr, bda);
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)sec_event.key_notif.bd_name,bta_dm_get_remname(), (BD_NAME_LEN));
|
||||
sec_event.ble_req.bd_name[BD_NAME_LEN] = 0;
|
||||
sec_event.key_notif.passkey = p_data->key_notif;
|
||||
bta_dm_cb.p_sec_cback(BTA_DM_BLE_NC_REQ_EVT, &sec_event);
|
||||
@ -4671,8 +4662,7 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D
|
||||
#endif
|
||||
p_name = BTM_SecReadDevName(bda);
|
||||
if (p_name != NULL) {
|
||||
BCM_STRNCPY_S((char *)sec_event.auth_cmpl.bd_name,
|
||||
sizeof(BD_NAME), p_name, (BD_NAME_LEN));
|
||||
BCM_STRNCPY_S((char *)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN));
|
||||
} else {
|
||||
sec_event.auth_cmpl.bd_name[0] = 0;
|
||||
}
|
||||
@ -5962,7 +5952,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
|
||||
|
||||
/* send result back to app now, one by one */
|
||||
bdcpy (result.disc_ble_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, sizeof(BD_NAME), bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)result.disc_ble_res.bd_name, bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
result.disc_ble_res.bd_name[BD_NAME_LEN] = 0;
|
||||
memcpy(&result.disc_ble_res.service, &service_id.uuid, sizeof(tBT_UUID));
|
||||
|
||||
@ -6005,8 +5995,7 @@ static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
|
||||
p_msg->disc_result.result.disc_res.num_uuids = 0;
|
||||
p_msg->disc_result.result.disc_res.p_uuid_list = NULL;
|
||||
bdcpy (p_msg->disc_result.result.disc_res.bd_addr, bta_dm_search_cb.peer_bdaddr);
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name, sizeof(BD_NAME),
|
||||
bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
BCM_STRNCPY_S((char *)p_msg->disc_result.result.disc_res.bd_name,bta_dm_get_remname(), (BD_NAME_LEN - 1));
|
||||
|
||||
/* make sure the string is terminated */
|
||||
p_msg->disc_result.result.disc_res.bd_name[BD_NAME_LEN - 1] = 0;
|
||||
|
@ -174,7 +174,7 @@ void BTA_DmSetDeviceName(const char *p_name)
|
||||
if ((p_msg = (tBTA_DM_API_SET_NAME *) osi_malloc(sizeof(tBTA_DM_API_SET_NAME))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SET_NAME_EVT;
|
||||
/* truncate the name if needed */
|
||||
BCM_STRNCPY_S((char *)p_msg->name, sizeof(p_msg->name), p_name, BD_NAME_LEN - 1);
|
||||
BCM_STRNCPY_S((char *)p_msg->name, p_name, BD_NAME_LEN - 1);
|
||||
p_msg->name[BD_NAME_LEN - 1] = 0;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
|
@ -122,7 +122,7 @@ void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT f
|
||||
p_buf->app_id = app_id;
|
||||
for (i = 0; i < BTA_AG_NUM_IDX; i++) {
|
||||
if(p_service_names[i]) {
|
||||
BCM_STRNCPY_S(p_buf->p_name[i], BTA_SERVICE_NAME_LEN+1, p_service_names[i], BTA_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S(p_buf->p_name[i], p_service_names[i], BTA_SERVICE_NAME_LEN);
|
||||
p_buf->p_name[i][BTA_SERVICE_NAME_LEN] = 0;
|
||||
} else {
|
||||
p_buf->p_name[i][0] = 0;
|
||||
|
@ -356,7 +356,7 @@ static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg, INT1
|
||||
*p++ = '\n';
|
||||
|
||||
/* copy result code string */
|
||||
BCM_STRCPY_S(p, sizeof(buf), bta_ag_result_tbl[code].p_res);
|
||||
BCM_STRCPY_S(p, bta_ag_result_tbl[code].p_res);
|
||||
#if defined(BTA_HSP_RESULT_REPLACE_COLON) && (BTA_HSP_RESULT_REPLACE_COLON == TRUE)
|
||||
if(p_scb->conn_service == BTA_AG_HSP) {
|
||||
/* If HSP then ":"symbol should be changed as "=" for HSP compatibility */
|
||||
@ -382,7 +382,7 @@ static void bta_ag_send_result(tBTA_AG_SCB *p_scb, UINT8 code, char *p_arg, INT1
|
||||
if (bta_ag_result_tbl[code].fmt == BTA_AG_RES_FMT_INT) {
|
||||
p += utl_itoa((UINT16) int_arg, p);
|
||||
} else if (bta_ag_result_tbl[code].fmt == BTA_AG_RES_FMT_STR) {
|
||||
BCM_STRCPY_S(p, sizeof(buf), p_arg);
|
||||
BCM_STRCPY_S(p, p_arg);
|
||||
p += strlen(p_arg);
|
||||
}
|
||||
/* finish with \r\n */
|
||||
@ -426,14 +426,14 @@ static void bta_ag_send_multi_result(tBTA_AG_SCB *p_scb, tBTA_AG_MULTI_RESULT_CB
|
||||
*p++ = '\n';
|
||||
|
||||
/* copy result code string */
|
||||
BCM_STRCPY_S(p, sizeof(buf), bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].p_res);
|
||||
BCM_STRCPY_S(p, bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].p_res);
|
||||
p += strlen(bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].p_res);
|
||||
|
||||
/* copy argument if any */
|
||||
if (bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].fmt == BTA_AG_RES_FMT_INT) {
|
||||
p += utl_itoa((UINT16) m_res_cb->res_cb[res_idx].int_arg, p);
|
||||
} else if (bta_ag_result_tbl[m_res_cb->res_cb[res_idx].code].fmt == BTA_AG_RES_FMT_STR) {
|
||||
BCM_STRCPY_S(p, sizeof(buf), m_res_cb->res_cb[res_idx].p_arg);
|
||||
BCM_STRCPY_S(p, m_res_cb->res_cb[res_idx].p_arg);
|
||||
p += strlen(m_res_cb->res_cb[res_idx].p_arg);
|
||||
}
|
||||
/* finish with \r\n */
|
||||
@ -716,7 +716,7 @@ static void bta_ag_process_unat_res(char *unat_result)
|
||||
/* Add EOF */
|
||||
trim_data[j] = '\0';
|
||||
str_leng = str_leng - 4;
|
||||
BCM_STRNCPY_S(unat_result, BTA_AG_AT_MAX_LEN+1, trim_data,str_leng+1);
|
||||
BCM_STRNCPY_S(unat_result, trim_data, BTA_AG_AT_MAX_LEN);
|
||||
i=0;
|
||||
j=0;
|
||||
if(str_leng <4) {
|
||||
@ -797,7 +797,7 @@ void bta_ag_at_hsp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
val.hdr.handle = bta_ag_scb_to_idx(p_scb);
|
||||
val.hdr.app_id = p_scb->app_id;
|
||||
val.num = (UINT16) int_arg;
|
||||
BCM_STRNCPY_S(val.str, sizeof(val.str), p_arg, BTA_AG_AT_MAX_LEN);
|
||||
BCM_STRNCPY_S(val.str, p_arg, BTA_AG_AT_MAX_LEN);
|
||||
val.str[BTA_AG_AT_MAX_LEN] = 0;
|
||||
/* call callback with event */
|
||||
(*bta_ag_cb.p_cback)(bta_ag_hsp_cb_evt[cmd], (tBTA_AG *) &val);
|
||||
@ -835,7 +835,7 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
val.hdr.app_id = p_scb->app_id;
|
||||
val.num = int_arg;
|
||||
bdcpy(val.bd_addr, p_scb->peer_addr);
|
||||
BCM_STRNCPY_S(val.str, sizeof(val.str), p_arg, BTA_AG_AT_MAX_LEN);
|
||||
BCM_STRNCPY_S(val.str, p_arg, BTA_AG_AT_MAX_LEN);
|
||||
val.str[BTA_AG_AT_MAX_LEN] = 0;
|
||||
event = bta_ag_hfp_cb_evt[cmd];
|
||||
|
||||
@ -1211,7 +1211,7 @@ void bta_ag_at_err_cback(tBTA_AG_SCB *p_scb, BOOLEAN unknown, char *p_arg)
|
||||
val.hdr.handle = bta_ag_scb_to_idx(p_scb);
|
||||
val.hdr.app_id = p_scb->app_id;
|
||||
val.num = 0;
|
||||
BCM_STRNCPY_S(val.str, sizeof(val.str), p_arg, BTA_AG_AT_MAX_LEN);
|
||||
BCM_STRNCPY_S(val.str, p_arg, BTA_AG_AT_MAX_LEN);
|
||||
val.str[BTA_AG_AT_MAX_LEN] = 0;
|
||||
(*bta_ag_cb.p_cback)(BTA_AG_AT_UNAT_EVT, (tBTA_AG *) &val);
|
||||
} else {
|
||||
|
@ -141,7 +141,7 @@ void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
|
||||
p_buf->features = features;
|
||||
p_buf->sec_mask = sec_mask;
|
||||
if (p_service_name) {
|
||||
BCM_STRNCPY_S(p_buf->name, BTA_SERVICE_NAME_LEN + 1, p_service_name, BTA_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S(p_buf->name, p_service_name, BTA_SERVICE_NAME_LEN);
|
||||
p_buf->name[BTA_SERVICE_NAME_LEN] = 0;
|
||||
} else {
|
||||
p_buf->name[0] = '\0';
|
||||
|
@ -1195,7 +1195,7 @@ UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
len = AVDT_MAX_CNAME_SIZE;
|
||||
}
|
||||
*p++ = (UINT8)len;
|
||||
BCM_STRNCPY_S((char *)p, len + 1, (char *)p_data->cname, len + 1);
|
||||
BCM_STRNCPY_S((char *)p, (char *)p_data->cname, AVDT_MAX_CNAME_SIZE + 1);
|
||||
p += len;
|
||||
break;
|
||||
}
|
||||
|
@ -119,8 +119,7 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
|
||||
|
||||
if (bd_name && bd_name[0]) {
|
||||
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, sizeof (p_dev_rec->sec_bd_name),
|
||||
(char *)bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, (char *)bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
}
|
||||
p_dev_rec->device_type |= dev_type;
|
||||
p_dev_rec->ble.ble_addr_type = addr_type;
|
||||
|
@ -108,8 +108,7 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
|
||||
|
||||
if (bd_name && bd_name[0]) {
|
||||
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, sizeof (p_dev_rec->sec_bd_name),
|
||||
(char *)bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, (char *)bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
}
|
||||
|
||||
p_dev_rec->num_read_pages = 0;
|
||||
|
@ -457,7 +457,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
|
||||
/* Save the device name if local storage is enabled */
|
||||
p = (UINT8 *)btm_cb.cfg.bd_name;
|
||||
if (p != (UINT8 *)p_name) {
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bd_name, sizeof(btm_cb.cfg.bd_name), p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
BCM_STRNCPY_S(btm_cb.cfg.bd_name, p_name, BTM_MAX_LOC_BD_NAME_LEN);
|
||||
btm_cb.cfg.bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
|
||||
}
|
||||
#else
|
||||
|
@ -585,7 +585,7 @@ static BOOLEAN btm_sec_set_security_level (CONNECTION_TYPE conn_type, const char
|
||||
if (is_originator) {
|
||||
p_srec->orig_mx_chan_id = mx_chan_id;
|
||||
#if BTM_SEC_SERVICE_NAME_LEN > 0
|
||||
BCM_STRNCPY_S ((char *)p_srec->orig_service_name, sizeof(p_srec->orig_service_name), p_name, BTM_SEC_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S ((char *)p_srec->orig_service_name, p_name, BTM_SEC_SERVICE_NAME_LEN);
|
||||
#endif
|
||||
/* clear out the old setting, just in case it exists */
|
||||
#if (L2CAP_UCD_INCLUDED == TRUE)
|
||||
@ -630,7 +630,7 @@ static BOOLEAN btm_sec_set_security_level (CONNECTION_TYPE conn_type, const char
|
||||
} else {
|
||||
p_srec->term_mx_chan_id = mx_chan_id;
|
||||
#if BTM_SEC_SERVICE_NAME_LEN > 0
|
||||
BCM_STRNCPY_S ((char *)p_srec->term_service_name, sizeof(p_srec->term_service_name), p_name, BTM_SEC_SERVICE_NAME_LEN);
|
||||
BCM_STRNCPY_S ((char *)p_srec->term_service_name, p_name, BTM_SEC_SERVICE_NAME_LEN);
|
||||
#endif
|
||||
/* clear out the old setting, just in case it exists */
|
||||
#if (L2CAP_UCD_INCLUDED == TRUE)
|
||||
@ -3024,7 +3024,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
||||
if (p_dev_rec) {
|
||||
old_sec_state = p_dev_rec->sec_state;
|
||||
if (status == HCI_SUCCESS) {
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, sizeof (p_dev_rec->sec_bd_name), (char *)p_bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
BCM_STRNCPY_S ((char *)p_dev_rec->sec_bd_name, (char *)p_bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
|
||||
BTM_TRACE_EVENT ("setting BTM_SEC_NAME_KNOWN sec_flags:0x%x\n", p_dev_rec->sec_flags);
|
||||
} else {
|
||||
@ -3520,7 +3520,7 @@ void btm_proc_sp_req_evt (tBTM_SP_EVT event, UINT8 *p)
|
||||
memcpy (evt_data.cfm_req.bd_addr, p_dev_rec->bd_addr, BD_ADDR_LEN);
|
||||
memcpy (evt_data.cfm_req.dev_class, p_dev_rec->dev_class, DEV_CLASS_LEN);
|
||||
|
||||
BCM_STRNCPY_S ((char *)evt_data.cfm_req.bd_name, sizeof(evt_data.cfm_req.bd_name), (char *)p_dev_rec->sec_bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
BCM_STRCPY_S ((char *)evt_data.cfm_req.bd_name,(char *)p_dev_rec->sec_bd_name);
|
||||
|
||||
switch (event) {
|
||||
case BTM_SP_CFM_REQ_EVT:
|
||||
@ -3745,7 +3745,7 @@ void btm_rem_oob_req (UINT8 *p)
|
||||
btm_cb.api.p_sp_callback) {
|
||||
memcpy (evt_data.bd_addr, p_dev_rec->bd_addr, BD_ADDR_LEN);
|
||||
memcpy (evt_data.dev_class, p_dev_rec->dev_class, DEV_CLASS_LEN);
|
||||
BCM_STRNCPY_S((char *)evt_data.bd_name, sizeof(evt_data.bd_name), (char *)p_dev_rec->sec_bd_name, BTM_MAX_REM_BD_NAME_LEN + 1);
|
||||
BCM_STRNCPY_S((char *)evt_data.bd_name, (char *)p_dev_rec->sec_bd_name, BTM_MAX_REM_BD_NAME_LEN);
|
||||
evt_data.bd_name[BTM_MAX_REM_BD_NAME_LEN] = 0;
|
||||
|
||||
btm_sec_change_pairing_state(BTM_PAIR_STATE_WAIT_LOCAL_OOB_RSP);
|
||||
|
@ -2325,7 +2325,7 @@ void gatt_dbg_display_uuid(tBT_UUID bt_uuid)
|
||||
bt_uuid.uu.uuid128[3], bt_uuid.uu.uuid128[2],
|
||||
bt_uuid.uu.uuid128[1], bt_uuid.uu.uuid128[0]);
|
||||
} else {
|
||||
BCM_STRNCPY_S(str_buf, sizeof(str_buf), "Unknown UUID 0", 15);
|
||||
BCM_STRNCPY_S(str_buf, "Unknown UUID 0", 15);
|
||||
}
|
||||
|
||||
GATT_TRACE_DEBUG ("UUID=[%s]", str_buf);
|
||||
|
@ -36,8 +36,8 @@ typedef bool BOOLEAN;
|
||||
#define PACKED __packed
|
||||
// #define INLINE __inline
|
||||
|
||||
#define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3))
|
||||
#define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4))
|
||||
#define BCM_STRCPY_S(x1,x2) strcpy((x1),(x2))
|
||||
#define BCM_STRNCPY_S(x1,x2,x3) strncpy((x1),(x2),(x3))
|
||||
|
||||
/* READ WELL !!
|
||||
**
|
||||
|
Loading…
Reference in New Issue
Block a user