From bea8bfccc9650396f26bc462b0366cc92657a54a Mon Sep 17 00:00:00 2001 From: Marco Simonelli <msimonelli@protonmail.com> Date: Fri, 10 Mar 2023 11:59:37 +0000 Subject: [PATCH] Bug 41459: WebRTC fails to build under mingw (Part 4) - fixes requried to build netwerk/sctp --- netwerk/sctp/src/moz.build | 2 ++ netwerk/sctp/src/netinet/sctp_cc_functions.c | 4 ++++ netwerk/sctp/src/netinet/sctp_indata.c | 5 +++++ netwerk/sctp/src/netinet/sctp_input.c | 4 ++++ netwerk/sctp/src/netinet/sctp_output.c | 5 +++++ netwerk/sctp/src/netinet/sctp_usrreq.c | 4 ++++ netwerk/sctp/src/netinet/sctputil.c | 4 ++++ netwerk/sctp/src/user_mbuf.c | 4 ++++ netwerk/sctp/src/user_socket.c | 5 ++++- 9 files changed, 36 insertions(+), 1 deletion(-) diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build index 45503a6e9433f..dc1e716c5a687 100644 --- a/netwerk/sctp/src/moz.build +++ b/netwerk/sctp/src/moz.build @@ -59,3 +59,5 @@ if CONFIG['OS_TARGET'] in ('Linux', 'Android'): DEFINES['_GNU_SOURCE'] = 1 elif CONFIG['OS_TARGET'] == 'Darwin': DEFINES['__APPLE_USE_RFC_2292'] = 1 +elif CONFIG['OS_TARGET'] == 'WINNT': + DEFINES['_CRT_RAND_S'] = True diff --git a/netwerk/sctp/src/netinet/sctp_cc_functions.c b/netwerk/sctp/src/netinet/sctp_cc_functions.c index 176338a05e718..77193d8f9de60 100644 --- a/netwerk/sctp/src/netinet/sctp_cc_functions.c +++ b/netwerk/sctp/src/netinet/sctp_cc_functions.c @@ -49,6 +49,10 @@ #include <netinet/sctp_kdtrace.h> #endif +#if defined(_WIN32) && defined(__MINGW32__) +#include <minmax.h> +#endif + #define SHIFT_MPTCP_MULTI_N 40 #define SHIFT_MPTCP_MULTI_Z 16 #define SHIFT_MPTCP_MULTI 8 diff --git a/netwerk/sctp/src/netinet/sctp_indata.c b/netwerk/sctp/src/netinet/sctp_indata.c index 91980d3a24004..1c94568f7566e 100644 --- a/netwerk/sctp/src/netinet/sctp_indata.c +++ b/netwerk/sctp/src/netinet/sctp_indata.c @@ -53,6 +53,11 @@ #if defined(__FreeBSD__) && !defined(__Userspace__) #include <netinet/sctp_lock_bsd.h> #endif + +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + /* * NOTES: On the outbound side of things I need to check the sack timer to * see if I should generate a sack into the chunk queue (if I have data to diff --git a/netwerk/sctp/src/netinet/sctp_input.c b/netwerk/sctp/src/netinet/sctp_input.c index 361b8b22e2e70..7430d346ea5cd 100644 --- a/netwerk/sctp/src/netinet/sctp_input.c +++ b/netwerk/sctp/src/netinet/sctp_input.c @@ -58,6 +58,10 @@ #include <sys/smp.h> #endif +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + static void sctp_stop_all_cookie_timers(struct sctp_tcb *stcb) { diff --git a/netwerk/sctp/src/netinet/sctp_output.c b/netwerk/sctp/src/netinet/sctp_output.c index 85b788640448d..8be281fc4afad 100644 --- a/netwerk/sctp/src/netinet/sctp_output.c +++ b/netwerk/sctp/src/netinet/sctp_output.c @@ -74,6 +74,11 @@ #if defined(__Userspace__) && defined(INET6) #include <netinet6/sctp6_var.h> #endif + +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + #if defined(__APPLE__) && !defined(__Userspace__) #if !(defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD)) #define SCTP_MAX_LINKHDR 16 diff --git a/netwerk/sctp/src/netinet/sctp_usrreq.c b/netwerk/sctp/src/netinet/sctp_usrreq.c index df4424e2fbeb2..a9f9c8d863054 100644 --- a/netwerk/sctp/src/netinet/sctp_usrreq.c +++ b/netwerk/sctp/src/netinet/sctp_usrreq.c @@ -63,6 +63,10 @@ #include <netinet/sctp_peeloff.h> #endif /* HAVE_SCTP_PEELOFF_SOCKOPT */ +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + extern const struct sctp_cc_functions sctp_cc_functions[]; extern const struct sctp_ss_functions sctp_ss_functions[]; diff --git a/netwerk/sctp/src/netinet/sctputil.c b/netwerk/sctp/src/netinet/sctputil.c index af062001da4f7..3fd8822c6266b 100644 --- a/netwerk/sctp/src/netinet/sctputil.c +++ b/netwerk/sctp/src/netinet/sctputil.c @@ -77,6 +77,10 @@ #endif #endif +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + extern const struct sctp_cc_functions sctp_cc_functions[]; extern const struct sctp_ss_functions sctp_ss_functions[]; diff --git a/netwerk/sctp/src/user_mbuf.c b/netwerk/sctp/src/user_mbuf.c index 85badc0fa520f..83b6ee3d8dd75 100644 --- a/netwerk/sctp/src/user_mbuf.c +++ b/netwerk/sctp/src/user_mbuf.c @@ -35,6 +35,10 @@ * */ +#if defined(_WIN32) && !defined(_MSC_VER) +#include <minmax.h> +#endif + #include <stdio.h> #include <string.h> /* #include <sys/param.h> This defines MSIZE 256 */ diff --git a/netwerk/sctp/src/user_socket.c b/netwerk/sctp/src/user_socket.c index cde6ecc417b52..9bdd51e105d05 100644 --- a/netwerk/sctp/src/user_socket.c +++ b/netwerk/sctp/src/user_socket.c @@ -60,9 +60,12 @@ #endif userland_mutex_t accept_mtx; userland_cond_t accept_cond; -#ifdef _WIN32 +#if defined(_WIN32) #include <time.h> #include <sys/timeb.h> +#if !defined(_MSC_VER) +#include <minmax.h> +#endif #endif MALLOC_DEFINE(M_PCB, "sctp_pcb", "sctp pcb"); -- GitLab