fix(common): removed Wno-format flag and fixed formatting warnings

This commit is contained in:
Suren Gabrielyan
2023-07-20 13:48:50 +04:00
parent 19baa7d43e
commit c48e44205d
27 changed files with 27 additions and 41 deletions

View File

@ -20,7 +20,6 @@ idf_component_register(
PRIV_INCLUDE_DIRS "private_include"
REQUIRES ${dependencies}
PRIV_REQUIRES ${private_dependencies})
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
if(${target} STREQUAL "linux")
target_link_libraries(${COMPONENT_LIB} PRIVATE "-lbsd")

View File

@ -1,3 +1,2 @@
idf_component_register(SRCS "mdns_example_main.c"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -94,7 +94,7 @@ static void mdns_print_results(mdns_result_t *results)
int i = 1, t;
while (r) {
if (r->esp_netif) {
printf("%d: Interface: %s, Type: %s, TTL: %u\n", i++, esp_netif_get_ifkey(r->esp_netif),
printf("%d: Interface: %s, Type: %s, TTL: %" PRIu32 "\n", i++, esp_netif_get_ifkey(r->esp_netif),
ip_protocol_str[r->ip_protocol], r->ttl);
}
if (r->instance_name) {

View File

@ -1476,7 +1476,7 @@ static void _mdns_dispatch_tx_packet(mdns_tx_packet_t *p)
_mdns_set_u16(packet, MDNS_HEAD_ADDITIONAL_OFFSET, count);
#ifdef MDNS_ENABLE_DEBUG
_mdns_dbg_printf("\nTX[%u][%u]: ", p->tcpip_if, p->ip_protocol);
_mdns_dbg_printf("\nTX[%lu][%lu]: ", (unsigned long)p->tcpip_if, (unsigned long)p->ip_protocol);
if (p->dst.type == ESP_IPADDR_TYPE_V4) {
_mdns_dbg_printf("To: " IPSTR ":%u, ", IP2STR(&p->dst.u_addr.ip4), p->port);
} else {
@ -3492,7 +3492,7 @@ void mdns_parse_packet(mdns_rx_packet_t *packet)
mdns_search_once_t *search_result = NULL;
#ifdef MDNS_ENABLE_DEBUG
_mdns_dbg_printf("\nRX[%u][%u]: ", packet->tcpip_if, (uint32_t)packet->ip_protocol);
_mdns_dbg_printf("\nRX[%lu][%lu]: ", (unsigned long)packet->tcpip_if, (unsigned long)packet->ip_protocol);
if (packet->src.type == ESP_IPADDR_TYPE_V4) {
_mdns_dbg_printf("From: " IPSTR ":%u, To: " IPSTR ", ", IP2STR(&packet->src.u_addr.ip4), packet->src_port, IP2STR(&packet->dest.u_addr.ip4));
} else {
@ -6537,7 +6537,7 @@ void mdns_debug_packet(const uint8_t *data, size_t len)
mdns_name_t *name = &n;
memset(name, 0, sizeof(mdns_name_t));
_mdns_dbg_printf("Packet[%u]: ", t);
_mdns_dbg_printf("Packet[%" PRIu32 "]: ", t);
header.id = _mdns_read_u16(data, MDNS_HEAD_ID_OFFSET);
header.flags = _mdns_read_u16(data, MDNS_HEAD_FLAGS_OFFSET);
@ -6675,7 +6675,7 @@ void mdns_debug_packet(const uint8_t *data, size_t len)
if (flush) {
_mdns_dbg_printf("FLUSH ");
}
_mdns_dbg_printf("%u ", ttl);
_mdns_dbg_printf("%" PRIu32, ttl);
_mdns_dbg_printf("[%u] ", data_len);
if (type == MDNS_TYPE_PTR) {
if (!_mdns_parse_fqdn(data, data_ptr, name, len)) {

View File

@ -372,7 +372,7 @@ static bool create_pcb(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
esp_err_t _mdns_pcb_init(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{
ESP_LOGI(TAG, "_mdns_pcb_init(tcpip_if=%d, ip_protocol=%d)", tcpip_if, ip_protocol);
ESP_LOGI(TAG, "_mdns_pcb_init(tcpip_if=%lu, ip_protocol=%lu)", (unsigned long)tcpip_if, (unsigned long)ip_protocol);
if (!create_pcb(tcpip_if, ip_protocol)) {
return ESP_FAIL;
}

View File

@ -159,7 +159,7 @@
#define PCB_STATE_IS_RUNNING(s) (s->state == PCB_RUNNING)
#ifndef HOOK_MALLOC_FAILED
#define HOOK_MALLOC_FAILED ESP_LOGE(TAG, "Cannot allocate memory (line: %d, free heap: %d bytes)", __LINE__, esp_get_free_heap_size());
#define HOOK_MALLOC_FAILED ESP_LOGE(TAG, "Cannot allocate memory (line: %d, free heap: %" PRIu32 " bytes)", __LINE__, esp_get_free_heap_size());
#endif
typedef size_t mdns_if_t;

View File

@ -1,3 +1,2 @@
idf_component_register(SRCS "main.c" "mdns_test.c"
INCLUDE_DIRS ".")
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@ -92,7 +92,7 @@ static void initialise_mdns(void)
void app_main(void)
{
ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version());
ESP_ERROR_CHECK(nvs_flash_init());