avrcp: fix warnings

This commit is contained in:
Matthias Ringwald 2023-03-24 10:35:22 +01:00
parent 5f5e54377c
commit 4c7a1d3ad3
2 changed files with 7 additions and 5 deletions

View File

@ -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_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_type = (avdtp_media_codec_type_t)(data[pos++]);
caps->media_codec.media_codec_information_len = cap_len - 2; 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; break;
case AVDTP_MEDIA_TRANSPORT: case AVDTP_MEDIA_TRANSPORT:
case AVDTP_REPORTING: case AVDTP_REPORTING:

View File

@ -142,7 +142,9 @@ static const char * avrcp_media_attribute_id_name[] = {
"NONE", "TITLE", "ARTIST", "ALBUM", "TRACK", "TOTAL TRACKS", "GENRE", "SONG LENGTH" "NONE", "TITLE", "ARTIST", "ALBUM", "TRACK", "TOTAL TRACKS", "GENRE", "SONG LENGTH"
}; };
const char * avrcp_attribute2str(uint8_t index){ 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]; return avrcp_media_attribute_id_name[0];
} }
@ -151,8 +153,8 @@ static const char * avrcp_play_status_name[] = {
"ERROR" // 0xFF "ERROR" // 0xFF
}; };
const char * avrcp_play_status2str(uint8_t index){ const char * avrcp_play_status2str(uint8_t index){
if (index > 4) { if (index > 4){
return avrcp_play_status_name[5]; index = 5;
} }
return avrcp_play_status_name[index]; return avrcp_play_status_name[index];
} }