fix(bt): fix gcc 13.1.0 warnings

This commit is contained in:
Alexey Lapshin 2023-07-19 16:57:15 +04:00
parent 76dfcac597
commit 6a94453a18
4 changed files with 13 additions and 18 deletions

View File

@ -367,7 +367,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list)
int data_len;
uint8_t *p;
// malloc size: (len + RSSI + ssid buffer) * apCount;
uint malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount;
uint32_t malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount;
p = data = osi_malloc(malloc_size);
if (data == NULL) {
BTC_TRACE_ERROR("malloc error\n");
@ -376,7 +376,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list)
type = BLUFI_BUILD_TYPE(BLUFI_TYPE_DATA, BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST);
for (int i = 0; i < apCount; ++i)
{
uint len = strlen((const char *)list[i].ssid);
uint32_t len = strlen((const char *)list[i].ssid);
data_len = (p - data);
//current_len + ssid + rssi + total_len_value
if((data_len + len + 1 + 1) > malloc_size) {

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -140,9 +140,9 @@ esp_err_t esp_ble_mesh_node_input_string(const char *string)
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_INPUT_STRING;
memset(arg.input_string.string, 0, sizeof(arg.input_string.string));
strncpy(arg.input_string.string, string,
MIN(strlen(string), sizeof(arg.input_string.string)));
arg.input_string.string[sizeof(arg.input_string.string) - 1] = 0;
strncpy(arg.input_string.string, string, sizeof(arg.input_string.string) - 1);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
@ -163,8 +163,8 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name)
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_SET_DEVICE_NAME;
memset(arg.set_device_name.name, 0, sizeof(arg.set_device_name.name));
strncpy(arg.set_device_name.name, name, ESP_BLE_MESH_DEVICE_NAME_MAX_LEN);
arg.set_device_name.name[sizeof(arg.set_device_name.name) - 1] = 0;
strncpy(arg.set_device_name.name, name, sizeof(arg.set_device_name.name) - 1);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
@ -211,9 +211,8 @@ esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_PROVISIONER_INPUT_STR;
memset(arg.provisioner_input_str.string, 0, sizeof(arg.provisioner_input_str.string));
strncpy(arg.provisioner_input_str.string, string,
MIN(strlen(string), sizeof(arg.provisioner_input_str.string)));
arg.provisioner_input_str.string[sizeof(arg.provisioner_input_str.string) - 1] = 0;
strncpy(arg.provisioner_input_str.string, string, sizeof(arg.provisioner_input_str.string) - 1);
arg.provisioner_input_str.link_idx = link_idx;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)

View File

@ -35,6 +35,7 @@ typedef struct {
tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0};
extern void btm_ble_inter_set(bool extble_inter);
#if !UC_BT_STACK_NO_LOG
static const char *btm_ble_hci_status_to_str(tHCI_STATUS status)
{
switch(status) {
@ -184,6 +185,7 @@ static const char *btm_ble_hci_status_to_str(tHCI_STATUS status)
return NULL;
}
#endif /* !UC_BT_STACK_NO_LOG */
void btm_ble_extendadvcb_init(void)
{

View File

@ -947,6 +947,7 @@ static void btu_hcif_esco_connection_chg_evt (UINT8 *p)
static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_len,
void *p_cplt_cback)
{
uint8_t status;
switch (opcode) {
case HCI_INQUIRY_CANCEL:
/* Tell inquiry processing that we are done */
@ -1012,7 +1013,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_ble_clear_white_list_complete(p, evt_len);
break;
case HCI_BLE_WRITE_ADV_PARAMS: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci write adv params error 0x%x", status);
@ -1020,7 +1020,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
}
case HCI_BLE_RC_PARAM_REQ_REPLY: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci connection params reply command error 0x%x", status);
@ -1028,7 +1027,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
}
case HCI_BLE_RC_PARAM_REQ_NEG_REPLY: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci connection params neg reply command error %x", status);
@ -1096,13 +1094,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
case HCI_BLE_SET_EXT_ADV_DATA:
case HCI_BLE_SET_EXT_SCAN_RSP_DATA:
case HCI_BLE_SET_EXT_ADV_ENABLE: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
HCI_TRACE_EVENT("%s opcode 0x%x status 0x%x", __func__, opcode, status);
break;
}
case HCI_BLE_READ_PHY: {
uint8_t status;
uint16_t conn_handle;
uint8_t tx_phy;
uint8_t rx_phy;
@ -1125,7 +1121,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
case HCI_BLE_PERIOD_ADV_SYNC_TRANS:
case HCI_BLE_PERIOD_ADV_SET_INFO_TRANS:
case HCI_BLE_SET_PAST_PARAMS: {
UINT8 status;
UINT16 conn_handle;
STREAM_TO_UINT8(status, p);
STREAM_TO_UINT16(conn_handle, p);
@ -1140,7 +1135,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC) {
btm_vsc_complete (p, opcode, evt_len, (tBTM_CMPL_CB *)p_cplt_cback);
}
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("CC evt: op=0x%x, status=0x%x", opcode, status);