From 415cb78f5e89d72e34272c4e6417844368137477 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 21 Dec 2023 18:01:05 +0000 Subject: [PATCH] cleanup: Some portability/warning fixes for Windows builds. --- .../bootstrap_daemon/docker/tox-bootstrapd.sha256 | 2 +- toxcore/network.c | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index dfb428d9..60520c16 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 @@ -1 +1 @@ -7923791feaca748f570f81dd79556c7763fa2f7611e3790129fe44ffa95cf916 /usr/local/bin/tox-bootstrapd +269d2d95028f192bbf65a01b938068b8fc9e798bbe1d5ecaf67cae124e45c2a9 /usr/local/bin/tox-bootstrapd diff --git a/toxcore/network.c b/toxcore/network.c index 6148033e..00e7df99 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -21,7 +21,7 @@ #define _XOPEN_SOURCE 700 #endif -#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP +#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_WINXP #undef _WIN32_WINNT #define _WIN32_WINNT 0x501 #endif @@ -361,13 +361,9 @@ IP4 get_ip4_loopback(void) IP6 get_ip6_loopback(void) { - IP6 loopback; -#ifdef ESP_PLATFORM - loopback = empty_ip_port.ip.ip.v6; + /* in6addr_loopback isn't available everywhere, so we do it ourselves. */ + IP6 loopback = empty_ip_port.ip.ip.v6; loopback.uint8[15] = 1; -#else - get_ip6(&loopback, &in6addr_loopback); -#endif return loopback; } @@ -565,7 +561,7 @@ non_null() static int sys_getsockopt(void *obj, int sock, int level, int optname, void *optval, size_t *optlen) { socklen_t len = *optlen; - const int ret = getsockopt(sock, level, optname, optval, &len); + const int ret = getsockopt(sock, level, optname, (char *)optval, &len); *optlen = len; return ret; } @@ -573,7 +569,7 @@ static int sys_getsockopt(void *obj, int sock, int level, int optname, void *opt non_null() static int sys_setsockopt(void *obj, int sock, int level, int optname, const void *optval, size_t optlen) { - return setsockopt(sock, level, optname, optval, optlen); + return setsockopt(sock, level, optname, (const char *)optval, optlen); } static const Network_Funcs system_network_funcs = {