From 4c7a1d3ad3518ba5034209a8dbe8a788301e19d7 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 24 Mar 2023 10:35:22 +0100 Subject: [PATCH] avrcp: fix warnings --- src/classic/avdtp_util.c | 2 +- src/classic/avrcp.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/classic/avdtp_util.c b/src/classic/avdtp_util.c index 479c4713a..8a167d866 100644 --- a/src/classic/avdtp_util.c +++ b/src/classic/avdtp_util.c @@ -375,7 +375,7 @@ uint16_t avdtp_unpack_service_capabilities(avdtp_connection_t * connection, avdt caps->media_codec.media_type = (avdtp_media_type_t)(data[pos++] >> 4); caps->media_codec.media_codec_type = (avdtp_media_codec_type_t)(data[pos++]); caps->media_codec.media_codec_information_len = cap_len - 2; - caps->media_codec.media_codec_information = &data[pos]; + caps->media_codec.media_codec_information = &data[pos++]; break; case AVDTP_MEDIA_TRANSPORT: case AVDTP_REPORTING: diff --git a/src/classic/avrcp.c b/src/classic/avrcp.c index db288dd3e..2ac3c2d26 100644 --- a/src/classic/avrcp.c +++ b/src/classic/avrcp.c @@ -142,7 +142,9 @@ static const char * avrcp_media_attribute_id_name[] = { "NONE", "TITLE", "ARTIST", "ALBUM", "TRACK", "TOTAL TRACKS", "GENRE", "SONG LENGTH" }; const char * avrcp_attribute2str(uint8_t index){ - if ((index >= 1) && (index <= 7)) return avrcp_media_attribute_id_name[index]; + if (index > 7){ + index = 0; + } return avrcp_media_attribute_id_name[0]; } @@ -151,8 +153,8 @@ static const char * avrcp_play_status_name[] = { "ERROR" // 0xFF }; const char * avrcp_play_status2str(uint8_t index){ - if (index > 4) { - return avrcp_play_status_name[5]; + if (index > 4){ + index = 5; } return avrcp_play_status_name[index]; } @@ -1188,4 +1190,4 @@ void avrcp_init_fuzz(void){ void avrcp_packet_handler_fuzz(uint8_t *packet, uint16_t size){ avrcp_packet_handler(L2CAP_DATA_PACKET, FUZZ_CID, packet, size); } -#endif \ No newline at end of file +#endif