From 9506ae59be6efde85bc1b8dd1fe0ebbe009fb1f1 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 9 Jun 2020 23:18:04 +0200 Subject: [PATCH] Fix compiler warnings on macOS. --- examples/manynodes.c | 2 +- src/meshlink.h | 2 +- src/netutl.c | 3 ++- src/utcp-test.c | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/manynodes.c b/examples/manynodes.c index 923b5542..82beff3c 100644 --- a/examples/manynodes.c +++ b/examples/manynodes.c @@ -123,7 +123,7 @@ static void exportmeshgraph_timer(int signum) { gettimeofday(&ts, NULL); char name[1024]; - snprintf(name, sizeof(name), "%sgraph_%ld_%03ld.json", namesprefix, ts.tv_sec, ts.tv_usec / 1000); + snprintf(name, sizeof(name), "%sgraph_%ld_%03ld.json", namesprefix, ts.tv_sec, ts.tv_usec / 1000L); exportmeshgraph(name); } diff --git a/src/meshlink.h b/src/meshlink.h index f5044975..25a52d19 100644 --- a/src/meshlink.h +++ b/src/meshlink.h @@ -71,7 +71,7 @@ typedef enum { MESHLINK_EPEER, ///< A peer caused an error MESHLINK_ENOTSUP, ///< The operation is not supported in the current configuration of MeshLink MESHLINK_EBUSY, ///< The MeshLink instance is already in use by another process - MESHLINK_EBLACKLISTED, ///< The operation is not allowed because the node is blacklisted + MESHLINK_EBLACKLISTED ///< The operation is not allowed because the node is blacklisted } meshlink_errno_t; /// Device class diff --git a/src/netutl.c b/src/netutl.c index 6e728350..5406bbb8 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -282,7 +282,8 @@ void packmsg_add_sockaddr(packmsg_output_t *out, const sockaddr_t *sa) { } sockaddr_t packmsg_get_sockaddr(packmsg_input_t *in) { - sockaddr_t sa = {0}; + sockaddr_t sa; + memset(&sa, 0, sizeof sa); int8_t type; const void *data; diff --git a/src/utcp-test.c b/src/utcp-test.c index f48ac694..d78c4b86 100644 --- a/src/utcp-test.c +++ b/src/utcp-test.c @@ -164,6 +164,8 @@ static void set_mtu(struct utcp *u, int s) { getsockopt(s, IPPROTO_IP, IP_MTU, &mtu, &optlen); } +#else + (void)s; #endif if(!mtu || mtu == 65535) { -- 2.39.5