src: cast strlen() to uint16_t

This commit is contained in:
Matthias Ringwald 2024-03-06 10:13:01 +01:00
parent b1202089b0
commit 1a3bc516d3
4 changed files with 5 additions and 5 deletions

View File

@ -630,7 +630,7 @@ uint16_t btstack_next_cid_ignoring_zero(uint16_t current_cid){
}
uint16_t btstack_strcpy(char * dst, uint16_t dst_size, const char * src){
uint16_t bytes_to_copy = (uint16_t) btstack_min( dst_size - 1, strlen(src));
uint16_t bytes_to_copy = (uint16_t) btstack_min( dst_size - 1, (uint16_t) strlen(src));
(void) memcpy(dst, src, bytes_to_copy);
dst[bytes_to_copy] = 0;
return bytes_to_copy + 1;

View File

@ -267,9 +267,9 @@ static void avrcp_cover_art_client_handle_can_send_now(avrcp_cover_art_client_t
avrcp_cover_art_client_prepare_srm_header(cover_art_client);
goep_client_header_add_type(cover_art_client->goep_cid, cover_art_client->object_type);
if (cover_art_client->image_descriptor != NULL){
goep_client_header_add_variable(cover_art_client->goep_cid, OBEX_HEADER_IMG_DESCRIPTOR, (const uint8_t *) cover_art_client->image_descriptor, strlen(cover_art_client->image_descriptor));
goep_client_header_add_variable(cover_art_client->goep_cid, OBEX_HEADER_IMG_DESCRIPTOR, (const uint8_t *) cover_art_client->image_descriptor, (uint16_t) strlen(cover_art_client->image_descriptor));
}
uint8_t image_handle_len = btstack_max(7, strlen(cover_art_client->image_handle));
uint8_t image_handle_len = btstack_max(7, (uint16_t) strlen(cover_art_client->image_handle));
goep_client_header_add_unicode_prefix(cover_art_client->goep_cid, OBEX_HEADER_IMG_HANDLE, cover_art_client->image_handle, image_handle_len);
}
// state

View File

@ -896,7 +896,7 @@ static void hfp_ag_emit_general_simple_event(uint8_t event_subtype){
static void hfp_ag_emit_custom_command_event(hfp_connection_t * hfp_connection){
btstack_assert(sizeof(hfp_connection->line_buffer) < (255-5));
uint16_t line_len = strlen((const char*)hfp_connection->line_buffer) + 1;
uint16_t line_len = (uint16_t) strlen((const char*)hfp_connection->line_buffer) + 1;
uint8_t event[7 + sizeof(hfp_connection->line_buffer)];
event[0] = HCI_EVENT_HFP_META;
event[1] = 5 + line_len;

View File

@ -278,7 +278,7 @@ static void hfp_hf_emit_enhanced_voice_recognition_text(hfp_connection_t * hfp_c
static void hfp_hf_emit_custom_command_event(hfp_connection_t * hfp_connection){
btstack_assert(sizeof(hfp_connection->line_buffer) < (255-5));
uint16_t line_len = strlen((const char*)hfp_connection->line_buffer) + 1;
uint16_t line_len = (uint16_t) strlen((const char*)hfp_connection->line_buffer) + 1;
uint8_t event[7 + sizeof(hfp_connection->line_buffer)];
event[0] = HCI_EVENT_HFP_META;
event[1] = 5 + line_len;