hfp_ag+hfp_hf: fix warnings

This commit is contained in:
Matthias Ringwald 2024-03-01 11:06:15 +01:00
parent e2a5eb6349
commit 8cd06fb6a7
2 changed files with 9 additions and 1 deletions

View File

@ -2627,6 +2627,7 @@ static void hfp_ag_hci_event_packet_handler(uint8_t packet_type, uint16_t channe
void hfp_ag_init_codecs(uint8_t codecs_nr, const uint8_t * codecs){ void hfp_ag_init_codecs(uint8_t codecs_nr, const uint8_t * codecs){
btstack_assert(codecs_nr <= HFP_MAX_NUM_CODECS); btstack_assert(codecs_nr <= HFP_MAX_NUM_CODECS);
if (codecs_nr > HFP_MAX_NUM_CODECS) return;
hfp_ag_codecs_nr = codecs_nr; hfp_ag_codecs_nr = codecs_nr;
uint8_t i; uint8_t i;
@ -2641,13 +2642,18 @@ void hfp_ag_init_supported_features(uint32_t supported_features){
} }
void hfp_ag_init_ag_indicators(int ag_indicators_nr, const hfp_ag_indicator_t * ag_indicators){ void hfp_ag_init_ag_indicators(int ag_indicators_nr, const hfp_ag_indicator_t * ag_indicators){
btstack_assert(ag_indicators_nr <= HFP_MAX_NUM_INDICATORS);
if (ag_indicators_nr > HFP_MAX_NUM_CODECS) return;
hfp_ag_indicators_nr = ag_indicators_nr; hfp_ag_indicators_nr = ag_indicators_nr;
(void)memcpy(hfp_ag_indicators, ag_indicators, (void)memcpy(hfp_ag_indicators, ag_indicators,
ag_indicators_nr * sizeof(hfp_ag_indicator_t)); ag_indicators_nr * sizeof(hfp_ag_indicator_t));
} }
void hfp_ag_init_hf_indicators(int hf_indicators_nr, const hfp_generic_status_indicator_t * hf_indicators){ void hfp_ag_init_hf_indicators(int hf_indicators_nr, const hfp_generic_status_indicator_t * hf_indicators){
if (hf_indicators_nr > HFP_MAX_NUM_INDICATORS) return; btstack_assert(hf_indicators_nr <= HFP_MAX_NUM_INDICATORS);
if (hf_indicators_nr > HFP_MAX_NUM_CODECS) return;
hfp_ag_generic_status_indicators_nr = hf_indicators_nr; hfp_ag_generic_status_indicators_nr = hf_indicators_nr;
(void)memcpy(hfp_ag_generic_status_indicators, hf_indicators, (void)memcpy(hfp_ag_generic_status_indicators, hf_indicators,
hf_indicators_nr * sizeof(hfp_generic_status_indicator_t)); hf_indicators_nr * sizeof(hfp_generic_status_indicator_t));

View File

@ -1550,6 +1550,7 @@ void hfp_hf_deinit(void){
void hfp_hf_init_codecs(uint8_t codecs_nr, const uint8_t * codecs){ void hfp_hf_init_codecs(uint8_t codecs_nr, const uint8_t * codecs){
btstack_assert(codecs_nr <= HFP_MAX_NUM_CODECS); btstack_assert(codecs_nr <= HFP_MAX_NUM_CODECS);
if (codecs_nr > HFP_MAX_NUM_CODECS) return;
hfp_hf_codecs_nr = codecs_nr; hfp_hf_codecs_nr = codecs_nr;
uint8_t i; uint8_t i;
@ -1564,6 +1565,7 @@ void hfp_hf_init_supported_features(uint32_t supported_features){
void hfp_hf_init_hf_indicators(int indicators_nr, const uint16_t * indicators){ void hfp_hf_init_hf_indicators(int indicators_nr, const uint16_t * indicators){
btstack_assert(hfp_hf_indicators_nr < HFP_MAX_NUM_INDICATORS); btstack_assert(hfp_hf_indicators_nr < HFP_MAX_NUM_INDICATORS);
if (hfp_hf_indicators_nr > HFP_MAX_NUM_CODECS) return;
hfp_hf_indicators_nr = indicators_nr; hfp_hf_indicators_nr = indicators_nr;
int i; int i;