From fe934656751a40989f1d282e4ab6952e6aefa929 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 30 Oct 2019 15:35:10 +0100 Subject: [PATCH] avrcp_target: increase notifications_transaction_label array to fit max notification id --- src/classic/avrcp.h | 4 ++-- src/classic/avrcp_target.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/classic/avrcp.h b/src/classic/avrcp.h index 5da56b08d..b31266a2c 100644 --- a/src/classic/avrcp.h +++ b/src/classic/avrcp.h @@ -162,7 +162,7 @@ typedef enum { AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b, // The Addressed Player has been changed, see 6.9.2. AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c, // The UIDs have changed, see 6.10.3.3. AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d, // The volume has been changed locally on the TG, see 6.13.3. - AVRCP_NOTIFICATION_EVENT_COUNT = 0x0d + AVRCP_NOTIFICATION_EVENT_MAX_VALUE = 0x0d } avrcp_notification_event_id_t; @@ -436,7 +436,7 @@ typedef struct { uint16_t notifications_enabled; uint16_t notifications_to_register; uint16_t notifications_to_deregister; - uint8_t notifications_transaction_label[AVRCP_NOTIFICATION_EVENT_COUNT]; + uint8_t notifications_transaction_label[AVRCP_NOTIFICATION_EVENT_MAX_VALUE+1]; avrcp_subunit_type_t unit_type; uint32_t company_id; diff --git a/src/classic/avrcp_target.c b/src/classic/avrcp_target.c index 2d166817d..f87345736 100644 --- a/src/classic/avrcp_target.c +++ b/src/classic/avrcp_target.c @@ -769,12 +769,12 @@ uint8_t avrcp_target_volume_changed(uint16_t avrcp_cid, uint8_t volume_percentag } static void avrcp_target_set_transaction_label_for_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t notification, uint8_t transaction_label){ - if (notification > AVRCP_NOTIFICATION_EVENT_COUNT) return; + if (notification > AVRCP_NOTIFICATION_EVENT_MAX_VALUE) return; connection->notifications_transaction_label[notification] = transaction_label; } static uint8_t avrcp_target_get_transaction_label_for_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t notification){ - if (notification > AVRCP_NOTIFICATION_EVENT_COUNT) return 0; + if (notification > AVRCP_NOTIFICATION_EVENT_MAX_VALUE) return 0; return connection->notifications_transaction_label[notification]; }