bt: fix gcc-12 compile errors

This commit is contained in:
Alexey Lapshin
2023-02-06 11:34:31 +07:00
parent a32bbedcd9
commit d4b7be4a73
15 changed files with 40 additions and 44 deletions

View File

@@ -494,7 +494,7 @@ esp_err_t esp_ble_mesh_set_fast_prov_info(esp_ble_mesh_fast_prov_info_t *fast_pr
arg.set_fast_prov_info.iv_index = fast_prov_info->iv_index;
arg.set_fast_prov_info.offset = fast_prov_info->offset;
arg.set_fast_prov_info.match_len = fast_prov_info->match_len;
if (fast_prov_info->match_len && fast_prov_info->match_val) {
if (fast_prov_info->match_len) {
memcpy(arg.set_fast_prov_info.match_val, fast_prov_info->match_val, fast_prov_info->match_len);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)

View File

@@ -50,7 +50,7 @@ static void btc_ble_mesh_ble_free_req_data(btc_msg_t *msg)
#if CONFIG_BLE_MESH_SUPPORT_BLE_SCAN
esp_ble_mesh_ble_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -116,7 +116,7 @@ void btc_ble_mesh_ble_call_handler(btc_msg_t *msg)
esp_ble_mesh_ble_cb_param_t param = {0};
btc_ble_mesh_ble_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -87,7 +87,7 @@ void btc_ble_mesh_config_client_arg_deep_free(btc_msg_t *msg)
{
btc_ble_mesh_config_client_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -232,7 +232,7 @@ static void btc_ble_mesh_config_client_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_cfg_client_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -618,7 +618,7 @@ void btc_ble_mesh_config_client_call_handler(btc_msg_t *msg)
btc_ble_mesh_config_client_args_t *arg = NULL;
esp_ble_mesh_cfg_client_cb_param_t cb = {0};
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -656,7 +656,7 @@ void btc_ble_mesh_config_client_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_cfg_client_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -748,7 +748,7 @@ void btc_ble_mesh_config_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_cfg_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -111,7 +111,7 @@ void btc_ble_mesh_generic_client_arg_deep_free(btc_msg_t *msg)
{
btc_ble_mesh_generic_client_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -295,7 +295,7 @@ static void btc_ble_mesh_generic_client_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_generic_client_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -447,7 +447,7 @@ void btc_ble_mesh_generic_client_call_handler(btc_msg_t *msg)
esp_ble_mesh_generic_client_cb_param_t cb = {0};
bt_mesh_client_common_param_t common = {0};
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -507,7 +507,7 @@ void btc_ble_mesh_generic_client_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_generic_client_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -629,7 +629,7 @@ static void btc_ble_mesh_generic_server_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_generic_server_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -738,7 +738,7 @@ void btc_ble_mesh_generic_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_generic_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -551,7 +551,7 @@ void btc_ble_mesh_health_server_call_handler(btc_msg_t *msg)
esp_ble_mesh_health_server_cb_param_t param = {0};
btc_ble_mesh_health_server_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -577,7 +577,7 @@ void btc_ble_mesh_health_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_health_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -452,7 +452,7 @@ static void btc_ble_mesh_lighting_server_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_lighting_server_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -553,7 +553,7 @@ void btc_ble_mesh_lighting_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_lighting_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -124,7 +124,7 @@ void btc_ble_mesh_prov_arg_deep_free(btc_msg_t *msg)
{
btc_ble_mesh_prov_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -200,7 +200,7 @@ void btc_ble_mesh_model_arg_deep_free(btc_msg_t *msg)
{
btc_ble_mesh_model_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -309,7 +309,7 @@ static void btc_ble_mesh_model_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_model_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -2278,9 +2278,7 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
/* Callback operation completion events */
btc_ble_mesh_prov_set_complete_cb(&param, act);
if (msg->arg) {
btc_ble_mesh_prov_arg_deep_free(msg);
}
return;
}
@@ -2307,7 +2305,7 @@ void btc_ble_mesh_model_call_handler(btc_msg_t *msg)
btc_ble_mesh_model_args_t *arg = NULL;
int err = 0;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -2403,7 +2401,7 @@ void btc_ble_mesh_model_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_model_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -179,7 +179,7 @@ void btc_ble_mesh_sensor_client_arg_deep_free(btc_msg_t *msg)
{
btc_ble_mesh_sensor_client_args_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -378,7 +378,7 @@ static void btc_ble_mesh_sensor_client_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_sensor_client_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -529,7 +529,7 @@ void btc_ble_mesh_sensor_client_call_handler(btc_msg_t *msg)
esp_ble_mesh_sensor_client_cb_param_t cb = {0};
bt_mesh_client_common_param_t common = {0};
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -589,7 +589,7 @@ void btc_ble_mesh_sensor_client_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_sensor_client_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -761,7 +761,7 @@ static void btc_ble_mesh_sensor_server_free_req_data(btc_msg_t *msg)
{
esp_ble_mesh_sensor_server_cb_param_t *arg = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}
@@ -870,7 +870,7 @@ void btc_ble_mesh_sensor_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_sensor_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -456,7 +456,7 @@ void btc_ble_mesh_time_scene_server_cb_handler(btc_msg_t *msg)
{
esp_ble_mesh_time_scene_server_cb_param_t *param = NULL;
if (!msg || !msg->arg) {
if (!msg) {
BT_ERR("%s, Invalid parameter", __func__);
return;
}

View File

@@ -699,7 +699,7 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
cb_data.req_data.data_len = 0;
cb_data.req_data.handle = p_msg->api_indicate.attr_id;
if (p_msg->api_indicate.value && (p_msg->api_indicate.len > 0)) {
if (p_msg->api_indicate.len > 0) {
cb_data.req_data.value = (uint8_t *) osi_malloc(p_msg->api_indicate.len);
if (cb_data.req_data.value != NULL) {
memset(cb_data.req_data.value, 0, p_msg->api_indicate.len);
@@ -709,10 +709,8 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
APPL_TRACE_ERROR("%s, malloc failed", __func__);
}
} else {
if (p_msg->api_indicate.value) {
APPL_TRACE_ERROR("%s, incorrect length", __func__);
}
}
(*p_rcb->p_cback)(BTA_GATTS_CONF_EVT, &cb_data);
if (cb_data.req_data.value != NULL) {
osi_free(cb_data.req_data.value);

View File

@@ -1472,10 +1472,10 @@ void btc_hf_cb_handler(btc_msg_t *msg)
case BTA_AG_AT_D_EVT:
{
do {
if (event == BTA_AG_AT_D_EVT && p_data->val.str) { // dial_number_or_memory
if (event == BTA_AG_AT_D_EVT) { // dial_number_or_memory
memset(&param, 0, sizeof(esp_hf_cb_param_t));
param.out_call.num_or_loc = osi_malloc((strlen(p_data->val.str) + 1) * sizeof(char));
sprintf(param.out_call.num_or_loc, p_data->val.str);
sprintf(param.out_call.num_or_loc, "%s", p_data->val.str);
btc_hf_cb_to_app(ESP_HF_DIAL_EVT, &param);
send_indicator_update(BTA_AG_IND_CALLSETUP,BTA_AG_CALLSETUP_OUTGOING);
osi_free(param.out_call.num_or_loc);

View File

@@ -111,7 +111,7 @@ static void smp_connect_callback (UINT16 channel, BD_ADDR bd_addr, BOOLEAN conne
if (transport == BT_TRANSPORT_BR_EDR || memcmp(bd_addr, dummy_bda, BD_ADDR_LEN) == 0) {
return;
}
if(!connected && &p_cb->rsp_timer_ent) {
if(!connected) {
//free timer
btu_free_timer(&p_cb->rsp_timer_ent);
}

View File

@@ -219,7 +219,7 @@ for (int i = 0; i < param->disc_res.num_prop; i++) {
Pay attention that some Bluetooth devices may put their name in EIR data. We can get the device name from EIR data.
```c
if (p_dev->eir && p_dev->bdname_len == 0) {
if (p_dev->bdname_len == 0) {
get_name_from_eir(p_dev->eir, p_dev->bdname, &p_dev->bdname_len);
}
```

View File

@@ -181,7 +181,7 @@ static void update_device_info(esp_bt_gap_cb_param_t *param)
p_dev->eir_len = eir_len;
}
if (p_dev->eir && p_dev->bdname_len == 0) {
if (p_dev->bdname_len == 0) {
get_name_from_eir(p_dev->eir, p_dev->bdname, &p_dev->bdname_len);
}

View File

@@ -262,7 +262,7 @@ void esp_bt_hidd_cb(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
ESP_LOGI(TAG, "setting hid parameters success!");
ESP_LOGI(TAG, "setting to connectable, discoverable");
esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_GENERAL_DISCOVERABLE);
if (param->register_app.in_use && param->register_app.bd_addr != NULL) {
if (param->register_app.in_use) {
ESP_LOGI(TAG, "start virtual cable plug!");
esp_bt_hid_device_connect(param->register_app.bd_addr);
}