Skip to content

Commit

Permalink
global: fix sign-compare warnings
Browse files Browse the repository at this point in the history
* Original commit: espressif/esp-idf@753a929
  • Loading branch information
suda-morris authored and suren-gabrielyan-espressif committed May 27, 2022
1 parent 2cf9fd8 commit 1fe901f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions components/mdns/mdns.c
Expand Up @@ -1605,7 +1605,7 @@ static void _mdns_init_pcb_probe(mdns_if_t tcpip_if, mdns_ip_protocol_t ip_proto
mdns_srv_item_t * new_probe_services[len];
int new_probe_service_len = 0;
bool found;
for (int j=0; j < len; ++j) {
for (size_t j=0; j < len; ++j) {
found = false;
for (int i=0; i < pcb->probe_services_len; ++i) {
if (pcb->probe_services[i] == services[j]) {
Expand Down Expand Up @@ -2508,11 +2508,10 @@ static int _mdns_txt_items_count_get(const uint8_t * data, size_t len)
*/
static int _mdns_txt_item_name_get_len(const uint8_t * data, size_t len)
{
int i;
if (*data == '=') {
return -1;
}
for (i = 0; i < len; i++) {
for (size_t i = 0; i < len; i++) {
if (data[i] == '=') {
return i;
}
Expand Down Expand Up @@ -3483,7 +3482,6 @@ static void _mdns_search_result_add_srv(mdns_search_once_t * search, const char
*/
static void _mdns_search_result_add_txt(mdns_search_once_t * search, mdns_txt_item_t * txt, size_t txt_count, mdns_if_t tcpip_if, mdns_ip_protocol_t ip_protocol)
{
int i;
mdns_result_t * r = search->result;
while (r) {
if (r->tcpip_if == tcpip_if && r->ip_protocol == ip_protocol) {
Expand Down Expand Up @@ -3515,7 +3513,7 @@ static void _mdns_search_result_add_txt(mdns_search_once_t * search, mdns_txt_it
return;

free_txt:
for (i=0; i<txt_count; i++) {
for (size_t i=0; i<txt_count; i++) {
free((char *)(txt[i].key));
free((char *)(txt[i].value));
}
Expand Down Expand Up @@ -4702,15 +4700,14 @@ void mdns_query_results_free(mdns_result_t * results)
{
mdns_result_t * r;
mdns_ip_addr_t * a;
int i;

while (results) {
r = results;

free((char *)(r->hostname));
free((char *)(r->instance_name));

for (i=0; i<r->txt_count; i++) {
for (size_t i=0; i<r->txt_count; i++) {
free((char *)(r->txt[i].key));
free((char *)(r->txt[i].value));
}
Expand Down
4 changes: 2 additions & 2 deletions components/mdns/mdns_console.c
Expand Up @@ -24,7 +24,7 @@ static void mdns_print_results(mdns_result_t * results)
{
mdns_result_t * r = results;
mdns_ip_addr_t * a = NULL;
int i = 1, t;
int i = 1;
while (r) {
printf("%d: Interface: %s, Type: %s\n", i++, if_str[r->tcpip_if], ip_protocol_str[r->ip_protocol]);
if (r->instance_name) {
Expand All @@ -35,7 +35,7 @@ static void mdns_print_results(mdns_result_t * results)
}
if (r->txt_count) {
printf(" TXT : [%u] ", r->txt_count);
for (t=0; t<r->txt_count; t++) {
for (size_t t=0; t<r->txt_count; t++) {
printf("%s=%s; ", r->txt[t].key, r->txt[t].value);
}
printf("\n");
Expand Down

0 comments on commit 1fe901f

Please sign in to comment.