Skip to content

Commit

Permalink
btstack_event: use uint8_t and uint16_t for types 'J' and 'L' (MISRAC…
Browse files Browse the repository at this point in the history
…2012-Rule-10.3)
  • Loading branch information
mringwal committed May 11, 2019
1 parent e501bae commit 38d9ec0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions src/btstack_event.h
Expand Up @@ -1775,7 +1775,7 @@ static inline uint16_t sdp_event_query_attribute_value_get_attribute_id(const ui
* @return attribute_length * @return attribute_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){ static inline uint16_t sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -1955,7 +1955,7 @@ static inline uint16_t gatt_event_characteristic_value_query_result_get_value_ha
* @return value_length * @return value_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_characteristic_value_query_result_get_value_length(const uint8_t * event){ static inline uint16_t gatt_event_characteristic_value_query_result_get_value_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -2003,7 +2003,7 @@ static inline uint16_t gatt_event_long_characteristic_value_query_result_get_val
* @return value_length * @return value_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_long_characteristic_value_query_result_get_value_length(const uint8_t * event){ static inline uint16_t gatt_event_long_characteristic_value_query_result_get_value_length(const uint8_t * event){
return little_endian_read_16(event, 8); return little_endian_read_16(event, 8);
} }
/** /**
Expand Down Expand Up @@ -2042,7 +2042,7 @@ static inline uint16_t gatt_event_notification_get_value_handle(const uint8_t *
* @return value_length * @return value_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_notification_get_value_length(const uint8_t * event){ static inline uint16_t gatt_event_notification_get_value_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -2081,7 +2081,7 @@ static inline uint16_t gatt_event_indication_get_value_handle(const uint8_t * ev
* @return value_length * @return value_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_indication_get_value_length(const uint8_t * event){ static inline uint16_t gatt_event_indication_get_value_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -2120,7 +2120,7 @@ static inline uint16_t gatt_event_characteristic_descriptor_query_result_get_des
* @return descriptor_length * @return descriptor_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ static inline uint16_t gatt_event_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -2159,7 +2159,7 @@ static inline uint16_t gatt_event_long_characteristic_descriptor_query_result_ge
* @return descriptor_length * @return descriptor_length
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int gatt_event_long_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){ static inline uint16_t gatt_event_long_characteristic_descriptor_query_result_get_descriptor_length(const uint8_t * event){
return little_endian_read_16(event, 6); return little_endian_read_16(event, 6);
} }
/** /**
Expand Down Expand Up @@ -3098,7 +3098,7 @@ static inline uint8_t gap_event_advertising_report_get_rssi(const uint8_t * even
* @return data_length * @return data_length
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int gap_event_advertising_report_get_data_length(const uint8_t * event){ static inline uint8_t gap_event_advertising_report_get_data_length(const uint8_t * event){
return event[11]; return event[11];
} }
/** /**
Expand Down Expand Up @@ -3180,7 +3180,7 @@ static inline uint8_t gap_event_inquiry_result_get_name_available(const uint8_t
* @return name_len * @return name_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int gap_event_inquiry_result_get_name_len(const uint8_t * event){ static inline uint8_t gap_event_inquiry_result_get_name_len(const uint8_t * event){
return event[17]; return event[17];
} }
/** /**
Expand Down Expand Up @@ -3702,7 +3702,7 @@ static inline uint8_t hsp_subevent_speaker_gain_changed_get_gain(const uint8_t *
* @return value_length * @return value_length
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int hsp_subevent_hs_command_get_value_length(const uint8_t * event){ static inline uint8_t hsp_subevent_hs_command_get_value_length(const uint8_t * event){
return event[3]; return event[3];
} }
/** /**
Expand All @@ -3721,7 +3721,7 @@ static inline const uint8_t * hsp_subevent_hs_command_get_value(const uint8_t *
* @return value_length * @return value_length
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int hsp_subevent_ag_indication_get_value_length(const uint8_t * event){ static inline uint8_t hsp_subevent_ag_indication_get_value_length(const uint8_t * event){
return event[3]; return event[3];
} }
/** /**
Expand Down Expand Up @@ -4510,7 +4510,7 @@ static inline uint16_t avdtp_subevent_signaling_media_codec_other_capability_get
* @return media_codec_information_len * @return media_codec_information_len
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int avdtp_subevent_signaling_media_codec_other_capability_get_media_codec_information_len(const uint8_t * event){ static inline uint16_t avdtp_subevent_signaling_media_codec_other_capability_get_media_codec_information_len(const uint8_t * event){
return little_endian_read_16(event, 10); return little_endian_read_16(event, 10);
} }
/** /**
Expand Down Expand Up @@ -4676,7 +4676,7 @@ static inline uint16_t avdtp_subevent_signaling_content_protection_capability_ge
* @return cp_type_value_len * @return cp_type_value_len
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int avdtp_subevent_signaling_content_protection_capability_get_cp_type_value_len(const uint8_t * event){ static inline uint16_t avdtp_subevent_signaling_content_protection_capability_get_cp_type_value_len(const uint8_t * event){
return little_endian_read_16(event, 9); return little_endian_read_16(event, 9);
} }
/** /**
Expand Down Expand Up @@ -5050,7 +5050,7 @@ static inline uint16_t avdtp_subevent_signaling_media_codec_other_configuration_
* @return media_codec_information_len * @return media_codec_information_len
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int avdtp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(const uint8_t * event){ static inline uint16_t avdtp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(const uint8_t * event){
return little_endian_read_16(event, 11); return little_endian_read_16(event, 11);
} }
/** /**
Expand Down Expand Up @@ -5391,7 +5391,7 @@ static inline uint16_t a2dp_subevent_signaling_media_codec_other_configuration_g
* @return media_codec_information_len * @return media_codec_information_len
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int a2dp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(const uint8_t * event){ static inline uint16_t a2dp_subevent_signaling_media_codec_other_configuration_get_media_codec_information_len(const uint8_t * event){
return little_endian_read_16(event, 11); return little_endian_read_16(event, 11);
} }
/** /**
Expand Down Expand Up @@ -6188,7 +6188,7 @@ static inline uint8_t avrcp_subevent_now_playing_title_info_get_command_type(con
* @return value_len * @return value_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int avrcp_subevent_now_playing_title_info_get_value_len(const uint8_t * event){ static inline uint8_t avrcp_subevent_now_playing_title_info_get_value_len(const uint8_t * event){
return event[6]; return event[6];
} }
/** /**
Expand Down Expand Up @@ -6225,7 +6225,7 @@ static inline uint8_t avrcp_subevent_now_playing_artist_info_get_command_type(co
* @return value_len * @return value_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int avrcp_subevent_now_playing_artist_info_get_value_len(const uint8_t * event){ static inline uint8_t avrcp_subevent_now_playing_artist_info_get_value_len(const uint8_t * event){
return event[6]; return event[6];
} }
/** /**
Expand Down Expand Up @@ -6262,7 +6262,7 @@ static inline uint8_t avrcp_subevent_now_playing_album_info_get_command_type(con
* @return value_len * @return value_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int avrcp_subevent_now_playing_album_info_get_value_len(const uint8_t * event){ static inline uint8_t avrcp_subevent_now_playing_album_info_get_value_len(const uint8_t * event){
return event[6]; return event[6];
} }
/** /**
Expand Down Expand Up @@ -6299,7 +6299,7 @@ static inline uint8_t avrcp_subevent_now_playing_genre_info_get_command_type(con
* @return value_len * @return value_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int avrcp_subevent_now_playing_genre_info_get_value_len(const uint8_t * event){ static inline uint8_t avrcp_subevent_now_playing_genre_info_get_value_len(const uint8_t * event){
return event[6]; return event[6];
} }
/** /**
Expand Down Expand Up @@ -6721,7 +6721,7 @@ static inline uint16_t pbap_subevent_card_result_get_goep_cid(const uint8_t * ev
* @return name_len * @return name_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int pbap_subevent_card_result_get_name_len(const uint8_t * event){ static inline uint8_t pbap_subevent_card_result_get_name_len(const uint8_t * event){
return event[5]; return event[5];
} }
/** /**
Expand All @@ -6739,7 +6739,7 @@ static inline const uint8_t * pbap_subevent_card_result_get_name(const uint8_t *
* @return handle_len * @return handle_len
* @note: btstack_type J * @note: btstack_type J
*/ */
static inline int pbap_subevent_card_result_get_handle_len(const uint8_t * event){ static inline uint8_t pbap_subevent_card_result_get_handle_len(const uint8_t * event){
return event[6 + event[5]]; return event[6 + event[5]];
} }
/** /**
Expand Down Expand Up @@ -7120,7 +7120,7 @@ static inline uint16_t map_subevent_folder_listing_item_get_map_cid(const uint8_
* @return name_len * @return name_len
* @note: btstack_type L * @note: btstack_type L
*/ */
static inline int map_subevent_folder_listing_item_get_name_len(const uint8_t * event){ static inline uint16_t map_subevent_folder_listing_item_get_name_len(const uint8_t * event){
return little_endian_read_16(event, 5); return little_endian_read_16(event, 5);
} }
/** /**
Expand Down
2 changes: 1 addition & 1 deletion tool/btstack_event_generator.py
Expand Up @@ -203,7 +203,7 @@ def c_type_for_btstack_type(type):
param_types = { '1' : 'uint8_t', '2' : 'uint16_t', '3' : 'uint32_t', '4' : 'uint32_t', 'H' : 'hci_con_handle_t', 'B' : 'bd_addr_t', param_types = { '1' : 'uint8_t', '2' : 'uint16_t', '3' : 'uint32_t', '4' : 'uint32_t', 'H' : 'hci_con_handle_t', 'B' : 'bd_addr_t',
'D' : 'const uint8_t *', 'E' : 'const uint8_t * ', 'N' : 'const char *' , 'P' : 'const uint8_t *', 'A' : 'const uint8_t *', 'D' : 'const uint8_t *', 'E' : 'const uint8_t * ', 'N' : 'const char *' , 'P' : 'const uint8_t *', 'A' : 'const uint8_t *',
'R' : 'const uint8_t *', 'S' : 'const uint8_t *', 'R' : 'const uint8_t *', 'S' : 'const uint8_t *',
'J' : 'int', 'L' : 'int', 'V' : 'const uint8_t *', 'U' : 'BT_UUID', 'J' : 'uint8_t', 'L' : 'uint16_t', 'V' : 'const uint8_t *', 'U' : 'BT_UUID',
'Q' : 'uint8_t *', 'Q' : 'uint8_t *',
'X' : 'gatt_client_service_t *', 'Y' : 'gatt_client_characteristic_t *', 'Z' : 'gatt_client_characteristic_descriptor_t *', 'X' : 'gatt_client_service_t *', 'Y' : 'gatt_client_characteristic_t *', 'Z' : 'gatt_client_characteristic_descriptor_t *',
'T' : 'const char *'} 'T' : 'const char *'}
Expand Down

0 comments on commit 38d9ec0

Please sign in to comment.