From 4c0a414c5f83270ded3deb66036f77ae754e4555 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 23 Sep 2019 14:12:48 +0200 Subject: [PATCH] Fix some compiler warnings found by GCC 9 and Clang 10. --- src/address.c | 2 +- src/entry.c | 4 ++-- src/iface-linux.c | 2 +- src/iface.c | 2 +- src/rr.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/address.c b/src/address.c index 7eced15..c207fdc 100644 --- a/src/address.c +++ b/src/address.c @@ -58,7 +58,7 @@ char *catta_address_snprint(char *s, size_t length, const CattaAddress *a) { assert(length); assert(a); - if (!(inet_ntop(catta_proto_to_af(a->proto), (void *)a->data.data, s, length))) + if (!(inet_ntop(catta_proto_to_af(a->proto), a->data.data, s, length))) return NULL; return s; diff --git a/src/entry.c b/src/entry.c index b408701..82c1553 100644 --- a/src/entry.c +++ b/src/entry.c @@ -901,7 +901,7 @@ static CattaEntry *server_add_dns_server_name( uint16_t port /** should be 53 */) { CattaEntry *e; - char t[CATTA_DOMAIN_NAME_MAX], normalized_d[CATTA_DOMAIN_NAME_MAX], *n; + char t[CATTA_DOMAIN_NAME_MAX + 20], normalized_d[CATTA_DOMAIN_NAME_MAX], *n; CattaRecord *r; @@ -957,7 +957,7 @@ int catta_server_add_dns_server_address( uint16_t port /** should be 53 */) { CattaRecord *r; - char n[64], h[64]; + char n[64 + 20], h[64]; CattaEntry *a_entry, *s_entry; assert(s); diff --git a/src/iface-linux.c b/src/iface-linux.c index a3dc769..e8b632a 100644 --- a/src/iface-linux.c +++ b/src/iface-linux.c @@ -383,7 +383,7 @@ void catta_interface_monitor_sync(CattaInterfaceMonitor *m) { * dumping */ while (!m->list_complete) - if (!catta_netlink_work(m->osdep.netlink, 1) == 0) + if (catta_netlink_work(m->osdep.netlink, 1) != 0) break; /* At this point Catta knows about all local interfaces and diff --git a/src/iface.c b/src/iface.c index 8ab84a4..09b945f 100644 --- a/src/iface.c +++ b/src/iface.c @@ -132,7 +132,7 @@ void catta_hw_interface_update_rrs(CattaHwInterface *hw, int remove_rrs) { return; /* OOM */ if (catta_s_entry_group_is_empty(hw->entry_group)) { - char name[CATTA_LABEL_MAX], unescaped[CATTA_LABEL_MAX], mac[256]; + char name[CATTA_LABEL_MAX + 256 + 20], unescaped[CATTA_LABEL_MAX], mac[256]; const char *p = m->server->host_name; catta_unescape_label(&p, unescaped, sizeof(unescaped)); diff --git a/src/rr.c b/src/rr.c index 6d9fb8e..eeab99a 100644 --- a/src/rr.c +++ b/src/rr.c @@ -254,11 +254,11 @@ char *catta_record_to_string(const CattaRecord *r) { switch (r->key->type) { case CATTA_DNS_TYPE_A: - inet_ntop(AF_INET, (void *)&r->data.a.address.address, t = buf, sizeof(buf)); + inet_ntop(AF_INET, &r->data.a.address.address, t = buf, sizeof(buf)); break; case CATTA_DNS_TYPE_AAAA: - inet_ntop(AF_INET6, (void *)&r->data.aaaa.address.address, t = buf, sizeof(buf)); + inet_ntop(AF_INET6, &r->data.aaaa.address.address, t = buf, sizeof(buf)); break; case CATTA_DNS_TYPE_PTR: -- 2.39.2