mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
tool/btstack_event_generator: avoid cast of composite expression to wider/different type
This commit is contained in:
parent
f9aa0bbcf0
commit
e52cfa762f
@ -13794,8 +13794,8 @@ static inline const uint8_t * gattservice_subevent_bass_client_notify_receive_st
|
||||
* @note: btstack_type 3
|
||||
*/
|
||||
static inline uint32_t gattservice_subevent_bass_client_notify_receive_state_subgroup_get_language_code(const uint8_t * event){
|
||||
uint16_t offset = 16u + event[15];
|
||||
return little_endian_read_24(event, (int)(int16_t) offset);
|
||||
uint8_t offset = 16u + event[15];
|
||||
return little_endian_read_24(event, (int)(int8_t) offset);
|
||||
}
|
||||
/**
|
||||
* @brief Get field ccids_num from event GATTSERVICE_SUBEVENT_BASS_CLIENT_NOTIFY_RECEIVE_STATE_SUBGROUP
|
||||
@ -13849,8 +13849,8 @@ static inline const uint8_t * gattservice_subevent_bass_client_notify_receive_st
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t gattservice_subevent_bass_client_notify_receive_state_subgroup_get_extended_metadata_type(const uint8_t * event){
|
||||
uint16_t offset = 16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u];
|
||||
return little_endian_read_16(event, (int)(int16_t) offset);
|
||||
uint8_t offset = 16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u];
|
||||
return little_endian_read_16(event, (int)(int8_t) offset);
|
||||
}
|
||||
/**
|
||||
* @brief Get field extended_metadata_value_length from event GATTSERVICE_SUBEVENT_BASS_CLIENT_NOTIFY_RECEIVE_STATE_SUBGROUP
|
||||
@ -13877,8 +13877,8 @@ static inline const uint8_t * gattservice_subevent_bass_client_notify_receive_st
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t gattservice_subevent_bass_client_notify_receive_state_subgroup_get_vendor_specific_metadata_type(const uint8_t * event){
|
||||
uint16_t offset = 16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u] + 2u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u] + 2u];
|
||||
return little_endian_read_16(event, (int)(int16_t) offset);
|
||||
uint8_t offset = 16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u] + 2u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u + 1u + event[16u + event[15] + 3u + 1u + event[16u + event[15] + 3u] + 1u] + 2u];
|
||||
return little_endian_read_16(event, (int)(int8_t) offset);
|
||||
}
|
||||
/**
|
||||
* @brief Get field vendor_specific_metadata_value_length from event GATTSERVICE_SUBEVENT_BASS_CLIENT_NOTIFY_RECEIVE_STATE_SUBGROUP
|
||||
|
@ -273,8 +273,8 @@ def create_getter(event_name, field_name, field_type, offset, offset_is_number,
|
||||
requires_signed = 'little_endian' in read_code or 'gatt_client_deserialize' in read_code
|
||||
code = ''
|
||||
if requires_signed and not offset_is_number:
|
||||
code += 'uint16_t offset = %s;\n ' % offset
|
||||
offset = '(int)(int16_t) offset'
|
||||
code += 'uint8_t offset = %s;\n ' % offset
|
||||
offset = '(int)(int8_t) offset'
|
||||
code += read_code.format(offset=offset, result_name=result_name)
|
||||
return template.format(description=description, fn_name=fn_name, result_name=result_name, result_type=result_type, code=code, format=field_type)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user