diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 64d9a93b9f2..5831e2f900a 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -268,7 +268,7 @@ Copyright: lieff License: CC0-1.0 Files: ./thirdparty/miniupnpc/ -Comment: MiniUPnPc +Comment: MiniUPnP Project Copyright: 2005-2021, Thomas Bernard License: BSD-3-clause diff --git a/modules/upnp/SCsub b/modules/upnp/SCsub index b2fed0cb23b..4b385b820db 100644 --- a/modules/upnp/SCsub +++ b/modules/upnp/SCsub @@ -26,9 +26,9 @@ if env["builtin_miniupnpc"]: "receivedata.c", "addr_is_reserved.c", ] - thirdparty_sources = [thirdparty_dir + "miniupnpc/" + file for file in thirdparty_sources] + thirdparty_sources = [thirdparty_dir + "src/" + file for file in thirdparty_sources] - env_upnp.Prepend(CPPPATH=[thirdparty_dir]) + env_upnp.Prepend(CPPPATH=[thirdparty_dir + "include"]) env_upnp.Append(CPPDEFINES=["MINIUPNP_STATICLIB"]) env_upnp.Append(CPPDEFINES=["MINIUPNPC_SET_SOCKET_TIMEOUT"]) diff --git a/modules/upnp/upnp.cpp b/modules/upnp/upnp.cpp index 745876dc4a9..baa6c06cd84 100644 --- a/modules/upnp/upnp.cpp +++ b/modules/upnp/upnp.cpp @@ -30,8 +30,8 @@ #include "upnp.h" -#include -#include +#include +#include #include diff --git a/modules/upnp/upnp.h b/modules/upnp/upnp.h index a4c23fda331..0534cd8104b 100644 --- a/modules/upnp/upnp.h +++ b/modules/upnp/upnp.h @@ -35,7 +35,7 @@ #include "upnp_device.h" -#include +#include class UPNP : public Reference { GDCLASS(UPNP, Reference); diff --git a/modules/upnp/upnp_device.cpp b/modules/upnp/upnp_device.cpp index 7c7fcbc7a9c..297b0da97c7 100644 --- a/modules/upnp/upnp_device.cpp +++ b/modules/upnp/upnp_device.cpp @@ -32,7 +32,7 @@ #include "upnp.h" -#include +#include String UPNPDevice::query_external_address() const { ERR_FAIL_COND_V(!is_valid_gateway(), ""); diff --git a/thirdparty/README.md b/thirdparty/README.md index 361f2de526f..ca05b6d9a3c 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -308,22 +308,19 @@ Files extracted from upstream repository: ## miniupnpc - Upstream: https://github.com/miniupnp/miniupnp -- Version: 2.2.2 (81029a860baf1f727903e5b85307903b3f40cbc8, 2021) +- Version: 2.2.3 (2df8120326ed4246e049a7a6de707539604cd514, 2021) - License: BSD-3-Clause Files extracted from upstream source: -- All `*.c` and `*.h` files from `miniupnpc` to `thirdparty/miniupnpc/miniupnpc` +- Copy `miniupnpc/src` and `miniupnpc/include` to `thirdparty/miniupnpc` - Remove the following test or sample files: - `listdevices.c minihttptestserver.c miniupnpcmodule.c upnpc.c upnperrors.* test* wingenminiupnpcstrings.c` + `listdevices.c minihttptestserver.c miniupnpcmodule.c upnpc.c upnperrors.* test*` - `LICENSE` -The only modified file is `miniupnpcstrings.h`, which was created for Godot -(it is usually autogenerated by cmake). Bump the version number for miniupnpc in that -file when upgrading. - -Note: The following upstream patch has been applied, remove this notice on next update. -https://github.com/miniupnp/miniupnp/commit/3a08dd4b89af2e9effa22a136bac86f2f306fd79 +The only modified file is `src/miniupnpcstrings.h`, which was created for Godot +(it is usually autogenerated by cmake). Bump the version number for miniupnpc in +that file when upgrading. ## minizip diff --git a/thirdparty/miniupnpc/LICENSE b/thirdparty/miniupnpc/LICENSE index 6ddd381baaa..fe9118c07ed 100644 --- a/thirdparty/miniupnpc/LICENSE +++ b/thirdparty/miniupnpc/LICENSE @@ -1,4 +1,4 @@ -MiniUPnPc +MiniUPnP Project Copyright (c) 2005-2020, Thomas BERNARD All rights reserved. @@ -24,4 +24,3 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h b/thirdparty/miniupnpc/include/igd_desc_parse.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/igd_desc_parse.h rename to thirdparty/miniupnpc/include/igd_desc_parse.h diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpc.h b/thirdparty/miniupnpc/include/miniupnpc.h similarity index 98% rename from thirdparty/miniupnpc/miniupnpc/miniupnpc.h rename to thirdparty/miniupnpc/include/miniupnpc.h index 3aef8ea4433..a10bd950a81 100644 --- a/thirdparty/miniupnpc/miniupnpc/miniupnpc.h +++ b/thirdparty/miniupnpc/include/miniupnpc.h @@ -1,4 +1,4 @@ -/* $Id: miniupnpc.h,v 1.58 2021/03/02 23:49:52 nanard Exp $ */ +/* $Id: miniupnpc.h,v 1.59 2021/09/28 21:39:17 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * Project: miniupnp * http://miniupnp.free.fr/ @@ -20,7 +20,7 @@ #define UPNPDISCOVER_MEMORY_ERROR (-102) /* versions : */ -#define MINIUPNPC_VERSION "2.2.2" +#define MINIUPNPC_VERSION "2.2.3" #define MINIUPNPC_API_VERSION 17 /* Source port: diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h b/thirdparty/miniupnpc/include/miniupnpc_declspec.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniupnpc_declspec.h rename to thirdparty/miniupnpc/include/miniupnpc_declspec.h diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h b/thirdparty/miniupnpc/include/miniupnpctypes.h similarity index 75% rename from thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h rename to thirdparty/miniupnpc/include/miniupnpctypes.h index 307ce396990..26ed4f00592 100644 --- a/thirdparty/miniupnpc/miniupnpc/miniupnpctypes.h +++ b/thirdparty/miniupnpc/include/miniupnpctypes.h @@ -1,13 +1,15 @@ /* $Id: miniupnpctypes.h,v 1.1 2011/02/15 11:10:40 nanard Exp $ */ /* Miniupnp project : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org * Author : Thomas Bernard - * Copyright (c) 2011 Thomas Bernard + * Copyright (c) 2021 Thomas Bernard * This software is subject to the conditions detailed in the * LICENCE file provided within this distribution */ #ifndef MINIUPNPCTYPES_H_INCLUDED #define MINIUPNPCTYPES_H_INCLUDED -#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) +/* Use unsigned long long when available : + * strtoull is C99 */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define UNSIGNED_INTEGER unsigned long long #define STRTOUI strtoull #else diff --git a/thirdparty/miniupnpc/miniupnpc/miniwget.h b/thirdparty/miniupnpc/include/miniwget.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniwget.h rename to thirdparty/miniupnpc/include/miniwget.h diff --git a/thirdparty/miniupnpc/miniupnpc/portlistingparse.h b/thirdparty/miniupnpc/include/portlistingparse.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/portlistingparse.h rename to thirdparty/miniupnpc/include/portlistingparse.h diff --git a/thirdparty/miniupnpc/miniupnpc/upnpcommands.h b/thirdparty/miniupnpc/include/upnpcommands.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/upnpcommands.h rename to thirdparty/miniupnpc/include/upnpcommands.h diff --git a/thirdparty/miniupnpc/miniupnpc/upnpdev.h b/thirdparty/miniupnpc/include/upnpdev.h similarity index 82% rename from thirdparty/miniupnpc/miniupnpc/upnpdev.h rename to thirdparty/miniupnpc/include/upnpdev.h index 9b2cb431ba6..171d495be35 100644 --- a/thirdparty/miniupnpc/miniupnpc/upnpdev.h +++ b/thirdparty/miniupnpc/include/upnpdev.h @@ -1,8 +1,8 @@ -/* $Id: upnpdev.h,v 1.3 2020/05/29 15:57:42 nanard Exp $ */ +/* $Id: upnpdev.h,v 1.4 2021/08/21 09:45:01 nanard Exp $ */ /* Project : miniupnp * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ * Author : Thomas BERNARD - * copyright (c) 2005-2020 Thomas Bernard + * copyright (c) 2005-2021 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENSE file. */ #ifndef UPNPDEV_H_INCLUDED @@ -20,7 +20,7 @@ struct UPNPDev { char * st; char * usn; unsigned int scope_id; -#if defined(__STDC_VERSION) && __STDC_VERSION__ >= 199901L +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 flexible array member */ char buffer[]; #elif defined(__GNUC__) diff --git a/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h b/thirdparty/miniupnpc/include/upnpreplyparse.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/upnpreplyparse.h rename to thirdparty/miniupnpc/include/upnpreplyparse.h diff --git a/thirdparty/miniupnpc/miniupnpc/addr_is_reserved.c b/thirdparty/miniupnpc/src/addr_is_reserved.c similarity index 96% rename from thirdparty/miniupnpc/miniupnpc/addr_is_reserved.c rename to thirdparty/miniupnpc/src/addr_is_reserved.c index 7e586d7da2a..18c64242015 100644 --- a/thirdparty/miniupnpc/miniupnpc/addr_is_reserved.c +++ b/thirdparty/miniupnpc/src/addr_is_reserved.c @@ -56,7 +56,7 @@ int addr_is_reserved(const char * addr_str) uint32_t addr_n, address; size_t i; -#if defined(_WIN32) && (!defined(_WIN32_WINNT_VISTA) || (_WIN32_WINNT < _WIN32_WINNT_VISTA)) +#if defined(_WIN32) && _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA addr_n = inet_addr(addr_str); if (addr_n == INADDR_NONE) return 1; diff --git a/thirdparty/miniupnpc/miniupnpc/addr_is_reserved.h b/thirdparty/miniupnpc/src/addr_is_reserved.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/addr_is_reserved.h rename to thirdparty/miniupnpc/src/addr_is_reserved.h diff --git a/thirdparty/miniupnpc/miniupnpc/codelength.h b/thirdparty/miniupnpc/src/codelength.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/codelength.h rename to thirdparty/miniupnpc/src/codelength.h diff --git a/thirdparty/miniupnpc/miniupnpc/connecthostport.c b/thirdparty/miniupnpc/src/connecthostport.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/connecthostport.c rename to thirdparty/miniupnpc/src/connecthostport.c diff --git a/thirdparty/miniupnpc/miniupnpc/connecthostport.h b/thirdparty/miniupnpc/src/connecthostport.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/connecthostport.h rename to thirdparty/miniupnpc/src/connecthostport.h diff --git a/thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c b/thirdparty/miniupnpc/src/igd_desc_parse.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/igd_desc_parse.c rename to thirdparty/miniupnpc/src/igd_desc_parse.c diff --git a/thirdparty/miniupnpc/miniupnpc/minisoap.c b/thirdparty/miniupnpc/src/minisoap.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minisoap.c rename to thirdparty/miniupnpc/src/minisoap.c diff --git a/thirdparty/miniupnpc/miniupnpc/minisoap.h b/thirdparty/miniupnpc/src/minisoap.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minisoap.h rename to thirdparty/miniupnpc/src/minisoap.h diff --git a/thirdparty/miniupnpc/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/src/minissdpc.c similarity index 97% rename from thirdparty/miniupnpc/miniupnpc/minissdpc.c rename to thirdparty/miniupnpc/src/minissdpc.c index 5d3a0fd049c..edebb1600a0 100644 --- a/thirdparty/miniupnpc/miniupnpc/minissdpc.c +++ b/thirdparty/miniupnpc/src/minissdpc.c @@ -1,4 +1,4 @@ -/* $Id: minissdpc.c,v 1.47 2021/03/02 23:38:30 nanard Exp $ */ +/* $Id: minissdpc.c,v 1.49 2021/05/13 11:00:36 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * Project : miniupnp * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ @@ -460,7 +460,7 @@ parseMSEARCHReply(const char * reply, int size, static int upnp_gettimeofday(struct timeval * tv) { #if defined(_WIN32) -#if defined(_WIN32_WINNT_VISTA) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if _WIN32_WINNT >= 0x0600 // _WIN32_WINNT_VISTA ULONGLONG ts = GetTickCount64(); #else DWORD ts = GetTickCount(); @@ -469,14 +469,29 @@ static int upnp_gettimeofday(struct timeval * tv) tv->tv_usec = (ts % 1000) * 1000; return 0; /* success */ #elif defined(CLOCK_MONOTONIC_FAST) || defined(CLOCK_MONOTONIC) - struct timespec ts; - int ret_code = clock_gettime(UPNP_CLOCKID, &ts); - if (ret_code == 0) - { - tv->tv_sec = ts.tv_sec; - tv->tv_usec = ts.tv_nsec / 1000; +#if defined(__APPLE__) +#if defined(__clang__) + if (__builtin_available(macOS 10.12, iOS 10.0, tvOS 10.0, watchOS 3.0, *)) { +#else /* !defined(__clang__) */ + if (clock_gettime != NULL) { +#endif /* defined(__clang__) */ +#endif /* defined(__APPLE__) */ + struct timespec ts; + int ret_code = clock_gettime(UPNP_CLOCKID, &ts); + if (ret_code == 0) + { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return ret_code; +#if defined(__APPLE__) } - return ret_code; + else + { + /* fall-back for earlier Apple platforms */ + return gettimeofday(tv, NULL); + } +#endif /* defined(__APPLE__) */ #else return gettimeofday(tv, NULL); #endif @@ -705,7 +720,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[], } } - if(multicastif) + if(multicastif && multicastif[0] != '\0') { if(ipv6) { #if !defined(_WIN32) @@ -732,7 +747,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[], } else { struct in_addr mc_if; #if defined(_WIN32) -#if defined(_WIN32_WINNT_VISTA) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if _WIN32_WINNT >= 0x0600 // _WIN32_WINNT_VISTA InetPtonA(AF_INET, multicastif, &mc_if); #else mc_if.s_addr = inet_addr(multicastif); /* old Windows SDK do not support InetPtoA() */ diff --git a/thirdparty/miniupnpc/miniupnpc/minissdpc.h b/thirdparty/miniupnpc/src/minissdpc.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minissdpc.h rename to thirdparty/miniupnpc/src/minissdpc.h diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpc.c b/thirdparty/miniupnpc/src/miniupnpc.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniupnpc.c rename to thirdparty/miniupnpc/src/miniupnpc.c diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h b/thirdparty/miniupnpc/src/miniupnpc_socketdef.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniupnpc_socketdef.h rename to thirdparty/miniupnpc/src/miniupnpc_socketdef.h diff --git a/thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h b/thirdparty/miniupnpc/src/miniupnpcstrings.h similarity index 89% rename from thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h rename to thirdparty/miniupnpc/src/miniupnpcstrings.h index 7b3d04074a4..eefbc8dbddc 100644 --- a/thirdparty/miniupnpc/miniupnpc/miniupnpcstrings.h +++ b/thirdparty/miniupnpc/src/miniupnpcstrings.h @@ -4,7 +4,7 @@ #include "core/version.h" #define OS_STRING VERSION_NAME "/1.0" -#define MINIUPNPC_VERSION_STRING "2.2.2" +#define MINIUPNPC_VERSION_STRING "2.2.3" #if 0 /* according to "UPnP Device Architecture 1.0" */ diff --git a/thirdparty/miniupnpc/miniupnpc/miniwget.c b/thirdparty/miniupnpc/src/miniwget.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniwget.c rename to thirdparty/miniupnpc/src/miniwget.c diff --git a/thirdparty/miniupnpc/miniupnpc/miniwget_private.h b/thirdparty/miniupnpc/src/miniwget_private.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/miniwget_private.h rename to thirdparty/miniupnpc/src/miniwget_private.h diff --git a/thirdparty/miniupnpc/miniupnpc/minixml.c b/thirdparty/miniupnpc/src/minixml.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minixml.c rename to thirdparty/miniupnpc/src/minixml.c diff --git a/thirdparty/miniupnpc/miniupnpc/minixml.h b/thirdparty/miniupnpc/src/minixml.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minixml.h rename to thirdparty/miniupnpc/src/minixml.h diff --git a/thirdparty/miniupnpc/miniupnpc/minixmlvalid.c b/thirdparty/miniupnpc/src/minixmlvalid.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/minixmlvalid.c rename to thirdparty/miniupnpc/src/minixmlvalid.c diff --git a/thirdparty/miniupnpc/miniupnpc/portlistingparse.c b/thirdparty/miniupnpc/src/portlistingparse.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/portlistingparse.c rename to thirdparty/miniupnpc/src/portlistingparse.c diff --git a/thirdparty/miniupnpc/miniupnpc/receivedata.c b/thirdparty/miniupnpc/src/receivedata.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/receivedata.c rename to thirdparty/miniupnpc/src/receivedata.c diff --git a/thirdparty/miniupnpc/miniupnpc/receivedata.h b/thirdparty/miniupnpc/src/receivedata.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/receivedata.h rename to thirdparty/miniupnpc/src/receivedata.h diff --git a/thirdparty/miniupnpc/miniupnpc/upnpcommands.c b/thirdparty/miniupnpc/src/upnpcommands.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/upnpcommands.c rename to thirdparty/miniupnpc/src/upnpcommands.c diff --git a/thirdparty/miniupnpc/miniupnpc/upnpdev.c b/thirdparty/miniupnpc/src/upnpdev.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/upnpdev.c rename to thirdparty/miniupnpc/src/upnpdev.c diff --git a/thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c b/thirdparty/miniupnpc/src/upnpreplyparse.c similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/upnpreplyparse.c rename to thirdparty/miniupnpc/src/upnpreplyparse.c diff --git a/thirdparty/miniupnpc/miniupnpc/win32_snprintf.h b/thirdparty/miniupnpc/src/win32_snprintf.h similarity index 100% rename from thirdparty/miniupnpc/miniupnpc/win32_snprintf.h rename to thirdparty/miniupnpc/src/win32_snprintf.h