mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 01:27:41 +00:00
fix warnings for using %u with int vars
This commit is contained in:
parent
1ba1a8829a
commit
f04a0c3191
@ -64,7 +64,7 @@ size_t mbed_memory_allocated_max;
|
||||
size_t mbed_memory_space_max;
|
||||
size_t mbed_memory_max;
|
||||
size_t mbed_memory_smallest_buffer = 0xfffffff;
|
||||
int mbed_memory_num_allocations;
|
||||
unsigned int mbed_memory_num_allocations;
|
||||
|
||||
#define NUM_SIZES 150
|
||||
int current_individual_allocation[NUM_SIZES];
|
||||
@ -94,7 +94,7 @@ static void dump_allocations(void){
|
||||
mbed_memory_allocated_current, overhead, mbed_memory_allocated_current + overhead,
|
||||
mbed_memory_allocated_max);
|
||||
int i;
|
||||
int total = 0;
|
||||
unsigned int total = 0;
|
||||
printf("- current : [ ");
|
||||
for (i=0;i<sizeof(current_individual_allocation) / sizeof(int);i++){
|
||||
printf("%02u ", current_individual_allocation[i]);
|
||||
|
@ -352,7 +352,7 @@ static int hfp_hf_send_chup(uint16_t cid){
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
static int hfp_hf_send_chld(uint16_t cid, int number){
|
||||
static int hfp_hf_send_chld(uint16_t cid, unsigned int number){
|
||||
char buffer[20];
|
||||
sprintf(buffer, "AT%s=%u\r\n", HFP_SUPPORT_CALL_HOLD_AND_MULTIPARTY_SERVICES, number);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
|
@ -626,8 +626,8 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_
|
||||
int indent = *(int*) my_context;
|
||||
int i;
|
||||
for (i=0; i<indent;i++) printf(" ");
|
||||
int pos = de_get_header_size(element);
|
||||
int end_pos = de_get_len(element);
|
||||
unsigned int pos = de_get_header_size(element);
|
||||
unsigned int end_pos = de_get_len(element);
|
||||
printf("type %5s (%u), element len %2u ", type_names[de_type], de_type, end_pos);
|
||||
if (de_type == DE_DES) {
|
||||
printf("\n");
|
||||
@ -636,7 +636,7 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_
|
||||
} else if (de_type == DE_UUID && de_size == DE_SIZE_128) {
|
||||
printf(", value: %s\n", uuid128_to_str(element+1));
|
||||
} else if (de_type == DE_STRING) {
|
||||
int len = 0;
|
||||
unsigned int len = 0;
|
||||
switch (de_size){
|
||||
case DE_SIZE_VAR_8:
|
||||
len = element[1];
|
||||
|
24
src/hci.c
24
src/hci.c
@ -291,8 +291,8 @@ static int nr_hci_connections(void){
|
||||
|
||||
static int hci_number_free_acl_slots_for_connection_type(bd_addr_type_t address_type){
|
||||
|
||||
int num_packets_sent_classic = 0;
|
||||
int num_packets_sent_le = 0;
|
||||
unsigned int num_packets_sent_classic = 0;
|
||||
unsigned int num_packets_sent_le = 0;
|
||||
|
||||
btstack_linked_item_t *it;
|
||||
for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){
|
||||
@ -355,7 +355,7 @@ int hci_number_free_acl_slots_for_handle(hci_con_handle_t con_handle){
|
||||
}
|
||||
|
||||
static int hci_number_free_sco_slots(void){
|
||||
int num_sco_packets_sent = 0;
|
||||
unsigned int num_sco_packets_sent = 0;
|
||||
btstack_linked_item_t *it;
|
||||
for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){
|
||||
hci_connection_t * connection = (hci_connection_t *) it;
|
||||
@ -498,7 +498,7 @@ static int hci_send_acl_packet_fragments(hci_connection_t *connection){
|
||||
|
||||
// count packet
|
||||
connection->num_acl_packets_sent++;
|
||||
log_debug("hci_send_acl_packet_fragments loop before send (more fragments %u)", more_fragments);
|
||||
log_debug("hci_send_acl_packet_fragments loop before send (more fragments %d)", more_fragments);
|
||||
|
||||
// update state for next fragment (if any) as "transport done" might be sent during send_packet already
|
||||
if (more_fragments){
|
||||
@ -516,7 +516,7 @@ static int hci_send_acl_packet_fragments(hci_connection_t *connection){
|
||||
hci_dump_packet(HCI_ACL_DATA_PACKET, 0, packet, size);
|
||||
err = hci_stack->hci_transport->send_packet(HCI_ACL_DATA_PACKET, packet, size);
|
||||
|
||||
log_debug("hci_send_acl_packet_fragments loop after send (more fragments %u)", more_fragments);
|
||||
log_debug("hci_send_acl_packet_fragments loop after send (more fragments %d)", more_fragments);
|
||||
|
||||
// done yet?
|
||||
if (!more_fragments) break;
|
||||
@ -639,7 +639,7 @@ static void acl_handler(uint8_t *packet, int size){
|
||||
|
||||
// assert packet is complete
|
||||
if (acl_length + 4 != size){
|
||||
log_error("hci.c: acl_handler called with ACL packet of wrong size %u, expected %u => dropping packet", size, acl_length + 4);
|
||||
log_error("hci.c: acl_handler called with ACL packet of wrong size %d, expected %u => dropping packet", size, acl_length + 4);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -769,7 +769,7 @@ static uint16_t hci_acl_packet_types_for_buffer_size_and_local_features(uint16_t
|
||||
}
|
||||
// disable packet types due to missing local supported features
|
||||
for (i=0;i<sizeof(packet_type_feature_requirement_bit);i++){
|
||||
int bit_idx = packet_type_feature_requirement_bit[i];
|
||||
unsigned int bit_idx = packet_type_feature_requirement_bit[i];
|
||||
int feature_set = (local_supported_features[bit_idx >> 3] & (1<<(bit_idx & 7))) != 0;
|
||||
if (feature_set) continue;
|
||||
log_info("Features bit %02u is not set, removing packet types 0x%04x", bit_idx, packet_type_feature_packet_mask[i]);
|
||||
@ -1251,7 +1251,7 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){
|
||||
btstack_run_loop_remove_timer(&hci_stack->timeout);
|
||||
break;
|
||||
case HCI_INIT_W4_SEND_READ_LOCAL_VERSION_INFORMATION:
|
||||
log_info("Received local version info, need baud change %u", need_baud_change);
|
||||
log_info("Received local version info, need baud change %d", need_baud_change);
|
||||
if (need_baud_change){
|
||||
hci_stack->substate = HCI_INIT_SEND_BAUD_CHANGE;
|
||||
return;
|
||||
@ -1397,7 +1397,7 @@ static void event_handler(uint8_t *packet, int size){
|
||||
|
||||
// assert packet is complete
|
||||
if (size != event_length + 2){
|
||||
log_error("hci.c: event_handler called with event packet of wrong size %u, expected %u => dropping packet", size, event_length + 2);
|
||||
log_error("hci.c: event_handler called with event packet of wrong size %d, expected %u => dropping packet", size, event_length + 2);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2218,7 +2218,7 @@ static void hci_power_transition_to_initializing(void){
|
||||
|
||||
int hci_power_control(HCI_POWER_MODE power_mode){
|
||||
|
||||
log_info("hci_power_control: %u, current mode %u", power_mode, hci_stack->state);
|
||||
log_info("hci_power_control: %d, current mode %u", power_mode, hci_stack->state);
|
||||
|
||||
int err = 0;
|
||||
switch (hci_stack->state){
|
||||
@ -2228,7 +2228,7 @@ int hci_power_control(HCI_POWER_MODE power_mode){
|
||||
case HCI_POWER_ON:
|
||||
err = hci_power_control_on();
|
||||
if (err) {
|
||||
log_error("hci_power_control_on() error %u", err);
|
||||
log_error("hci_power_control_on() error %d", err);
|
||||
return err;
|
||||
}
|
||||
hci_power_transition_to_initializing();
|
||||
@ -3273,7 +3273,7 @@ int gap_dedicated_bonding(bd_addr_t device, int mitm_protection_required){
|
||||
// configure LEVEL_2/3, dedicated bonding
|
||||
connection->state = SEND_CREATE_CONNECTION;
|
||||
connection->requested_security_level = mitm_protection_required ? LEVEL_3 : LEVEL_2;
|
||||
log_info("gap_dedicated_bonding, mitm %u -> level %u", mitm_protection_required, connection->requested_security_level);
|
||||
log_info("gap_dedicated_bonding, mitm %d -> level %u", mitm_protection_required, connection->requested_security_level);
|
||||
connection->bonding_flags = BONDING_DEDICATED;
|
||||
|
||||
// wait for GAP Security Result and send GAP Dedicated Bonding complete
|
||||
|
@ -155,11 +155,11 @@ static void printf_timestamp(void){
|
||||
uint32_t time_ms = btstack_run_loop_get_time_ms();
|
||||
int seconds = time_ms / 1000;
|
||||
int minutes = seconds / 60;
|
||||
int hours = minutes / 60;
|
||||
unsigned int hours = minutes / 60;
|
||||
|
||||
int p_ms = time_ms - (seconds * 1000);
|
||||
int p_seconds = seconds - (minutes * 60);
|
||||
int p_minutes = minutes - (hours * 60);
|
||||
uint16_t p_ms = time_ms - (seconds * 1000);
|
||||
uint16_t p_seconds = seconds - (minutes * 60);
|
||||
uint16_t p_minutes = minutes - (hours * 60);
|
||||
printf("[%02u:%02u:%02u.%03u] ", hours, p_minutes, p_seconds, p_ms);
|
||||
}
|
||||
#endif
|
||||
|
@ -197,7 +197,7 @@ static void hci_transport_h4_block_read(void){
|
||||
bytes_to_read = little_endian_read_16( hci_packet, 3);
|
||||
// check ACL length
|
||||
if (HCI_ACL_HEADER_SIZE + bytes_to_read > HCI_PACKET_BUFFER_SIZE){
|
||||
log_error("hci_transport_h4: invalid ACL payload len %u - only space for %u", bytes_to_read, HCI_PACKET_BUFFER_SIZE - HCI_ACL_HEADER_SIZE);
|
||||
log_error("hci_transport_h4: invalid ACL payload len %d - only space for %u", bytes_to_read, HCI_PACKET_BUFFER_SIZE - HCI_ACL_HEADER_SIZE);
|
||||
hci_transport_h4_reset_statemachine();
|
||||
break;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static void hci_transport_slip_init(void);
|
||||
|
||||
// -----------------------------
|
||||
static void hci_transport_inactivity_timeout_handler(btstack_timer_source_t * ts){
|
||||
log_info("h5: inactivity timeout. link state %u, peer asleep %u, actions 0x%02x, outgoing packet %u",
|
||||
log_info("h5: inactivity timeout. link state %d, peer asleep %u, actions 0x%02x, outgoing packet %u",
|
||||
link_state, link_peer_asleep, hci_transport_link_actions, hci_transport_link_have_outgoing_packet());
|
||||
if (hci_transport_link_have_outgoing_packet()) return;
|
||||
if (link_state != LINK_ACTIVE) return;
|
||||
@ -176,7 +176,7 @@ static void hci_transport_slip_encode_chunk_and_send(int pos){
|
||||
slip_outgoing_buffer[pos++] = BTSTACK_SLIP_SOF;
|
||||
}
|
||||
slip_write_active = 1;
|
||||
log_info("hci_transport_slip: send %u bytes", pos);
|
||||
log_info("hci_transport_slip: send %d bytes", pos);
|
||||
btstack_uart->send_block(slip_outgoing_buffer, pos);
|
||||
}
|
||||
|
||||
@ -424,10 +424,10 @@ static void hci_transport_h5_process_frame(uint16_t frame_size){
|
||||
uint8_t * slip_payload = &hci_packet_with_pre_buffer[HCI_INCOMING_PRE_BUFFER_SIZE + 4];
|
||||
int frame_size_without_header = frame_size - 4;
|
||||
|
||||
int seq_nr = slip_header[0] & 0x07;
|
||||
int ack_nr = (slip_header[0] >> 3) & 0x07;
|
||||
int data_integrity_check_present = (slip_header[0] & 0x40) != 0;
|
||||
int reliable_packet = (slip_header[0] & 0x80) != 0;
|
||||
uint8_t seq_nr = slip_header[0] & 0x07;
|
||||
uint8_t ack_nr = (slip_header[0] >> 3) & 0x07;
|
||||
uint8_t data_integrity_check_present = (slip_header[0] & 0x40) != 0;
|
||||
uint8_t reliable_packet = (slip_header[0] & 0x80) != 0;
|
||||
uint8_t link_packet_type = slip_header[1] & 0x0f;
|
||||
uint16_t link_payload_len = (slip_header[1] >> 4) | (slip_header[2] << 4);
|
||||
|
||||
@ -716,7 +716,7 @@ static int hci_transport_h5_can_send_packet_now(uint8_t packet_type){
|
||||
|
||||
static int hci_transport_h5_send_packet(uint8_t packet_type, uint8_t *packet, int size){
|
||||
if (!hci_transport_h5_can_send_packet_now(packet_type)){
|
||||
log_error("hci_transport_h5_send_packet called but in state %u", link_state);
|
||||
log_error("hci_transport_h5_send_packet called but in state %d", link_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user