From 5838a2ed380d2f858d439d9a428561c2dd5b22ac Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 21 Sep 2015 18:10:47 +0200 Subject: [PATCH] use PRIu32 for printf of 32-bit integers --- ble/ancs_client_lib.c | 2 +- ble/att_server.c | 3 ++- ble/sm.c | 3 ++- src/hci.c | 5 +++-- src/sdp_parser.c | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ble/ancs_client_lib.c b/ble/ancs_client_lib.c index 8ec6d75c4..33841516f 100644 --- a/ble/ancs_client_lib.c +++ b/ble/ancs_client_lib.c @@ -293,7 +293,7 @@ static void handle_gatt_client_event(le_event_t * event){ } else if (value_event->value_handle == ancs_notification_source_characteristic.value_handle){ ancs_notification_uid = READ_BT_32(value_event->blob, 4); printf("Notification received: EventID %02x, EventFlags %02x, CategoryID %02x, CategoryCount %u, UID %04x\n", - value_event->blob[0], value_event->blob[1], value_event->blob[2], value_event->blob[3], ancs_notification_uid); + value_event->blob[0], value_event->blob[1], value_event->blob[2], value_event->blob[3], (int) ancs_notification_uid); static uint8_t get_notification_attributes[] = {0, 0,0,0,0, 0, 1,32,0, 2,32,0, 3,32,0, 4, 5}; bt_store_32(get_notification_attributes, 1, ancs_notification_uid); ancs_notification_uid = 0; diff --git a/ble/att_server.c b/ble/att_server.c index d1d32c745..59a7a3974 100644 --- a/ble/att_server.c +++ b/ble/att_server.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "btstack-config.h" @@ -257,7 +258,7 @@ static void att_run(void){ // check counter uint32_t counter_packet = READ_BT_32(att_request_buffer, att_request_size-12); uint32_t counter_db = le_device_db_remote_counter_get(att_ir_le_device_db_index); - log_info("ATT Signed Write, DB counter %u, packet counter %u", counter_db, counter_packet); + log_info("ATT Signed Write, DB counter %"PRIu32", packet counter %"PRIu32, counter_db, counter_packet); if (counter_packet < counter_db){ log_info("ATT Signed Write, db reports higher counter, abort"); att_server_state = ATT_SERVER_IDLE; diff --git a/ble/sm.c b/ble/sm.c index 8ce2cf93c..8b0296321 100644 --- a/ble/sm.c +++ b/ble/sm.c @@ -37,6 +37,7 @@ #include #include +#include #include @@ -470,7 +471,7 @@ static void sm_notify_client(uint8_t type, uint8_t addr_type, bd_addr_t address, event.passkey = passkey; event.le_device_db_index = index; - log_info("sm_notify_client %02x, addres_type %u, address %s, num '%06u', index %u", event.type, event.addr_type, bd_addr_to_str(event.address), event.passkey, event.le_device_db_index); + log_info("sm_notify_client %02x, addres_type %u, address %s, num '%06"PRIu32"', index %u", event.type, event.addr_type, bd_addr_to_str(event.address), event.passkey, event.le_device_db_index); if (!sm_client_packet_handler) return; sm_client_packet_handler(HCI_EVENT_PACKET, 0, (uint8_t*) &event, sizeof(event)); diff --git a/src/hci.c b/src/hci.c index c7cf90f92..32e4be948 100644 --- a/src/hci.c +++ b/src/hci.c @@ -54,6 +54,7 @@ #include #include #include +#include #ifndef EMBEDDED #ifdef _WIN32 @@ -829,7 +830,7 @@ static void hci_initialization_timeout_handler(timer_source_t * ds){ hci_stack->num_cmd_packets = 1; hci_run(); case HCI_INIT_W4_SEND_BAUD_CHANGE: - log_info("Local baud rate change to %u", ((hci_uart_config_t *)hci_stack->config)->baudrate_main); + log_info("Local baud rate change to %"PRIu32, ((hci_uart_config_t *)hci_stack->config)->baudrate_main); hci_stack->hci_transport->set_baudrate(((hci_uart_config_t *)hci_stack->config)->baudrate_main); break; default: @@ -1103,7 +1104,7 @@ static void hci_initializing_event_handler(uint8_t * packet, uint16_t size){ // for CC256x, baud rate gets changed now if (hci_stack->manufacturer != 0x0030){ uint32_t new_baud = ((hci_uart_config_t *)hci_stack->config)->baudrate_main; - log_info("Local baud rate change to %u", new_baud); + log_info("Local baud rate change to %"PRIu32, new_baud); hci_stack->hci_transport->set_baudrate(new_baud); } hci_stack->substate = HCI_INIT_CUSTOM_INIT; diff --git a/src/sdp_parser.c b/src/sdp_parser.c index c88047a8b..067572516 100644 --- a/src/sdp_parser.c +++ b/src/sdp_parser.c @@ -145,7 +145,7 @@ void parse(uint8_t eventByte){ case GET_ATTRIBUTE_ID_HEADER_LENGTH: if (!de_state_size(eventByte, &de_header_state)) break; attribute_id = 0; - log_info("ID data is stored in %d bytes.", de_header_state.de_size); + log_info("ID data is stored in %d bytes.", (int) de_header_state.de_size); state = GET_ATTRIBUTE_ID; break;