Skip to content

Commit c7663cd

Browse files
committed
fix(mdns): Reformat mdns sources per indent-cont=120
1 parent e01e67e commit c7663cd

File tree

7 files changed

+76
-76
lines changed

7 files changed

+76
-76
lines changed

components/mdns/examples/query_advertise/main/mdns_example_main.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -44,12 +44,12 @@ static void initialise_mdns(void)
4444
char *hostname = generate_hostname();
4545

4646
//initialize mDNS
47-
ESP_ERROR_CHECK( mdns_init() );
47+
ESP_ERROR_CHECK(mdns_init());
4848
//set mDNS hostname (required if you want to advertise services)
49-
ESP_ERROR_CHECK( mdns_hostname_set(hostname) );
49+
ESP_ERROR_CHECK(mdns_hostname_set(hostname));
5050
ESP_LOGI(TAG, "mdns hostname set to: [%s]", hostname);
5151
//set default mDNS instance name
52-
ESP_ERROR_CHECK( mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE) );
52+
ESP_ERROR_CHECK(mdns_instance_name_set(EXAMPLE_MDNS_INSTANCE));
5353

5454
//structure with TXT records
5555
mdns_txt_item_t serviceTxtData[3] = {
@@ -59,10 +59,10 @@ static void initialise_mdns(void)
5959
};
6060

6161
//initialize service
62-
ESP_ERROR_CHECK( mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, serviceTxtData, 3) );
63-
ESP_ERROR_CHECK( mdns_service_subtype_add_for_host("ESP32-WebServer", "_http", "_tcp", NULL, "_server") );
62+
ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, serviceTxtData, 3));
63+
ESP_ERROR_CHECK(mdns_service_subtype_add_for_host("ESP32-WebServer", "_http", "_tcp", NULL, "_server"));
6464
#if CONFIG_MDNS_MULTIPLE_INSTANCE
65-
ESP_ERROR_CHECK( mdns_service_add("ESP32-WebServer1", "_http", "_tcp", 80, NULL, 0) );
65+
ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer1", "_http", "_tcp", 80, NULL, 0));
6666
#endif
6767

6868
#if CONFIG_MDNS_PUBLISH_DELEGATE_HOST
@@ -78,15 +78,15 @@ static void initialise_mdns(void)
7878
addr6.addr.type = ESP_IPADDR_TYPE_V6;
7979
addr4.next = &addr6;
8080
addr6.next = NULL;
81-
ESP_ERROR_CHECK( mdns_delegate_hostname_add(delegated_hostname, &addr4) );
82-
ESP_ERROR_CHECK( mdns_service_add_for_host("test0", "_http", "_tcp", delegated_hostname, 1234, serviceTxtData, 3) );
81+
ESP_ERROR_CHECK(mdns_delegate_hostname_add(delegated_hostname, &addr4));
82+
ESP_ERROR_CHECK(mdns_service_add_for_host("test0", "_http", "_tcp", delegated_hostname, 1234, serviceTxtData, 3));
8383
free(delegated_hostname);
8484
#endif // CONFIG_MDNS_PUBLISH_DELEGATE_HOST
8585

8686
//add another TXT item
87-
ESP_ERROR_CHECK( mdns_service_txt_item_set("_http", "_tcp", "path", "/foobar") );
87+
ESP_ERROR_CHECK(mdns_service_txt_item_set("_http", "_tcp", "path", "/foobar"));
8888
//change TXT item value
89-
ESP_ERROR_CHECK( mdns_service_txt_item_set_with_explicit_value_len("_http", "_tcp", "u", "admin", strlen("admin")) );
89+
ESP_ERROR_CHECK(mdns_service_txt_item_set_with_explicit_value_len("_http", "_tcp", "u", "admin", strlen("admin")));
9090
free(hostname);
9191
}
9292

@@ -377,12 +377,12 @@ static void query_mdns_host_with_gethostbyname(char *host)
377377
while (res->h_addr_list[i] != NULL) {
378378
ESP_LOGI(TAG, "gethostbyname: %s resolved to: %s", host,
379379
#if defined(CONFIG_LWIP_IPV6) && defined(CONFIG_LWIP_IPV4)
380-
res->h_addrtype == AF_INET ? inet_ntoa(*(struct in_addr *) (res->h_addr_list[i])) :
381-
inet6_ntoa(*(struct in6_addr *) (res->h_addr_list[i]))
380+
res->h_addrtype == AF_INET ? inet_ntoa(*(struct in_addr *)(res->h_addr_list[i])) :
381+
inet6_ntoa(*(struct in6_addr *)(res->h_addr_list[i]))
382382
#elif defined(CONFIG_LWIP_IPV6)
383-
inet6_ntoa(*(struct in6_addr *) (res->h_addr_list[i]))
383+
inet6_ntoa(*(struct in6_addr *)(res->h_addr_list[i]))
384384
#else
385-
inet_ntoa(*(struct in_addr *) (res->h_addr_list[i]))
385+
inet_ntoa(*(struct in_addr *)(res->h_addr_list[i]))
386386
#endif
387387
);
388388
i++;

components/mdns/include/mdns.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ esp_err_t mdns_service_instance_name_set(const char *service_type, const char *p
373373
* - ESP_ERR_NO_MEM memory error
374374
*/
375375
esp_err_t mdns_service_instance_name_set_for_host(const char *instance_old, const char *service_type, const char *proto, const char *hostname,
376-
const char *instance_name);
376+
const char *instance_name);
377377

378378
/**
379379
* @brief Set service port
@@ -407,7 +407,7 @@ esp_err_t mdns_service_port_set(const char *service_type, const char *proto, uin
407407
* - ESP_ERR_NO_MEM memory error
408408
*/
409409
esp_err_t mdns_service_port_set_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname,
410-
uint16_t port);
410+
uint16_t port);
411411

412412
/**
413413
* @brief Replace all TXT items for service
@@ -482,7 +482,7 @@ esp_err_t mdns_service_txt_item_set(const char *service_type, const char *proto,
482482
* - ESP_ERR_NO_MEM memory error
483483
*/
484484
esp_err_t mdns_service_txt_item_set_with_explicit_value_len(const char *service_type, const char *proto,
485-
const char *key, const char *value, uint8_t value_len);
485+
const char *key, const char *value, uint8_t value_len);
486486

487487
/**
488488
* @brief Set/Add TXT item for service TXT record with hostname
@@ -503,7 +503,7 @@ esp_err_t mdns_service_txt_item_set_with_explicit_value_len(const char *service_
503503
* - ESP_ERR_NO_MEM memory error
504504
*/
505505
esp_err_t mdns_service_txt_item_set_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname,
506-
const char *key, const char *value);
506+
const char *key, const char *value);
507507

508508
/**
509509
* @brief Set/Add TXT item for service TXT record with hostname and txt value length
@@ -523,8 +523,8 @@ esp_err_t mdns_service_txt_item_set_for_host(const char *instance, const char *s
523523
* - ESP_ERR_NO_MEM memory error
524524
*/
525525
esp_err_t mdns_service_txt_item_set_for_host_with_explicit_value_len(const char *instance, const char *service_type, const char *proto,
526-
const char *hostname, const char *key,
527-
const char *value, uint8_t value_len);
526+
const char *hostname, const char *key,
527+
const char *value, uint8_t value_len);
528528

529529
/**
530530
* @brief Remove TXT item for service TXT record
@@ -557,7 +557,7 @@ esp_err_t mdns_service_txt_item_remove(const char *service_type, const char *pro
557557
* - ESP_ERR_NO_MEM memory error
558558
*/
559559
esp_err_t mdns_service_txt_item_remove_for_host(const char *instance, const char *service_type, const char *proto, const char *hostname,
560-
const char *key);
560+
const char *key);
561561

562562
/**
563563
* @brief Add a subtype for service.
@@ -575,7 +575,7 @@ esp_err_t mdns_service_txt_item_remove_for_host(const char *instance, const char
575575
* - ESP_ERR_NO_MEM memory error
576576
*/
577577
esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const char *service_type, const char *proto,
578-
const char *hostname, const char *subtype);
578+
const char *hostname, const char *subtype);
579579

580580
/**
581581
* @brief Remove a subtype for service.
@@ -592,7 +592,7 @@ esp_err_t mdns_service_subtype_add_for_host(const char *instance_name, const cha
592592
* - ESP_ERR_NOT_FOUND Service not found
593593
*/
594594
esp_err_t mdns_service_subtype_remove_for_host(const char *instance_name, const char *service_type, const char *proto,
595-
const char *hostname, const char *subtype);
595+
const char *hostname, const char *subtype);
596596

597597
/**
598598
* @brief Add multiple subtypes for service at once.
@@ -611,7 +611,7 @@ esp_err_t mdns_service_subtype_remove_for_host(const char *instance_name, const
611611
* - ESP_ERR_NO_MEM memory error
612612
*/
613613
esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto,
614-
const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items);
614+
const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items);
615615

616616
/**
617617
* @brief Update subtype for service.
@@ -632,7 +632,7 @@ esp_err_t mdns_service_subtype_add_multiple_items_for_host(const char *instance_
632632
* - ESP_ERR_NO_MEM memory error
633633
*/
634634
esp_err_t mdns_service_subtype_update_multiple_items_for_host(const char *instance_name, const char *service_type, const char *proto,
635-
const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items);
635+
const char *hostname, mdns_subtype_item_t subtype[], uint8_t num_items);
636636
/**
637637
* @brief Remove and free all services from mDNS server
638638
*
@@ -686,7 +686,7 @@ bool mdns_query_async_get_results(mdns_search_once_t *search, uint32_t timeout,
686686
* NULL otherwise.
687687
*/
688688
mdns_search_once_t *mdns_query_async_new(const char *name, const char *service_type, const char *proto, uint16_t type,
689-
uint32_t timeout, size_t max_results, mdns_query_notify_t notifier);
689+
uint32_t timeout, size_t max_results, mdns_query_notify_t notifier);
690690

691691
/**
692692
* @brief Generic mDNS query
@@ -825,7 +825,7 @@ esp_err_t mdns_lookup_delegated_service(const char *instance, const char *servic
825825
* - ESP_ERR_INVALID_ARG parameter error
826826
*/
827827
esp_err_t mdns_lookup_selfhosted_service(const char *instance, const char *service_type, const char *proto, size_t max_results,
828-
mdns_result_t **result);
828+
mdns_result_t **result);
829829

830830
/**
831831
* @brief Query mDNS for A record

components/mdns/tests/host_test/components/esp_netif_linux/esp_netif_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ esp_err_t esp_netif_get_ip_info(esp_netif_t *esp_netif, esp_netif_ip_info_t *ip_
5151
if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_INET) {
5252
char addr[20];
5353
struct sockaddr_in *pAddr = (struct sockaddr_in *) tmp->ifa_addr;
54-
inet_ntop(AF_INET, &pAddr->sin_addr, addr, sizeof(addr) );
54+
inet_ntop(AF_INET, &pAddr->sin_addr, addr, sizeof(addr));
5555
if (strcmp(esp_netif->if_desc, tmp->ifa_name) == 0) {
5656
ESP_LOGD(TAG, "AF_INET4: %s: %s\n", tmp->ifa_name, addr);
5757
memcpy(&ip_info->ip.addr, &pAddr->sin_addr, 4);
@@ -105,7 +105,7 @@ esp_err_t esp_netif_get_ip6_linklocal(esp_netif_t *esp_netif, esp_ip6_addr_t *if
105105
if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_INET6) {
106106
char addr[64];
107107
struct sockaddr_in6 *pAddr = (struct sockaddr_in6 *)tmp->ifa_addr;
108-
inet_ntop(AF_INET6, &pAddr->sin6_addr, addr, sizeof(addr) );
108+
inet_ntop(AF_INET6, &pAddr->sin6_addr, addr, sizeof(addr));
109109
if (strcmp(esp_netif->if_desc, tmp->ifa_name) == 0) {
110110
ESP_LOGD(TAG, "AF_INET6: %s: %s\n", tmp->ifa_name, addr);
111111
memcpy(if_ip6->addr, &pAddr->sin6_addr, 4 * 4);

components/mdns/tests/host_test/main/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static void mdns_test_app(esp_netif_t *interface)
111111
.func = exit_console,
112112
.argtable = NULL
113113
};
114-
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd_exit) );
114+
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd_exit));
115115
mdns_console_register();
116116
ESP_ERROR_CHECK(esp_console_start_repl(repl));
117117
xEventGroupWaitBits(s_exit_signal, 1, pdTRUE, pdFALSE, portMAX_DELAY);

components/mdns/tests/test_afl_fuzz_host/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ int main(int argc, char **argv)
243243
//
244244
// Note: parameter1 is a file (mangled packet) which caused the crash
245245
file = fopen(argv[1], "r");
246-
assert(file >= 0 );
246+
assert(file >= 0);
247247
len = fread(buf, 1, 1460, file);
248248
fclose(file);
249249
}

components/mdns/tests/test_apps/main/main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -55,17 +55,17 @@ static void initialise_mdns(void)
5555
char *hostname = generate_hostname();
5656

5757
//initialize mDNS
58-
ESP_ERROR_CHECK( mdns_init() );
58+
ESP_ERROR_CHECK(mdns_init());
5959

6060
//set mDNS hostname (required if you want to advertise services)
61-
ESP_ERROR_CHECK( mdns_hostname_set(hostname) );
61+
ESP_ERROR_CHECK(mdns_hostname_set(hostname));
6262

6363
ESP_LOGI(TAG, "mdns hostname set to: [%s]", hostname);
6464
//set default mDNS instance name
65-
ESP_ERROR_CHECK( mdns_instance_name_set(CONFIG_TEST_MDNS_INSTANCE) );
65+
ESP_ERROR_CHECK(mdns_instance_name_set(CONFIG_TEST_MDNS_INSTANCE));
6666

6767
//initialize service
68-
ESP_ERROR_CHECK( mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, NULL, 0) );
68+
ESP_ERROR_CHECK(mdns_service_add("ESP32-WebServer", "_http", "_tcp", 80, NULL, 0));
6969

7070
#if CONFIG_TEST_MDNS_PUBLISH_DELEGATE_HOST
7171
char *delegated_hostname;
@@ -80,12 +80,12 @@ static void initialise_mdns(void)
8080
addr6.addr.type = ESP_IPADDR_TYPE_V6;
8181
addr4.next = &addr6;
8282
addr6.next = NULL;
83-
ESP_ERROR_CHECK( mdns_delegate_hostname_add(delegated_hostname, &addr4) );
84-
ESP_ERROR_CHECK( mdns_service_add_for_host("test0", "_http", "_tcp", delegated_hostname, 1234, NULL, 0) );
83+
ESP_ERROR_CHECK(mdns_delegate_hostname_add(delegated_hostname, &addr4));
84+
ESP_ERROR_CHECK(mdns_service_add_for_host("test0", "_http", "_tcp", delegated_hostname, 1234, NULL, 0));
8585
free(delegated_hostname);
8686
#endif // CONFIG_TEST_MDNS_PUBLISH_DELEGATE_HOST
8787

88-
ESP_ERROR_CHECK( mdns_service_subtype_add_for_host("ESP32-WebServer", "_http", "_tcp", NULL, "_server") );
88+
ESP_ERROR_CHECK(mdns_service_subtype_add_for_host("ESP32-WebServer", "_http", "_tcp", NULL, "_server"));
8989

9090
free(hostname);
9191
}

0 commit comments

Comments
 (0)