Thirdparty: Harmonize patches to document downstream changes

This commit is contained in:
Rémi Verschelde
2025-01-31 10:58:38 +01:00
parent 0d14ae58b0
commit 91907a89f7
141 changed files with 1274 additions and 3849 deletions

2599
thirdparty/misc/FastNoiseLite.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,19 +24,19 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TALK_BASE_IFADDRS_ANDROID_H_
#define TALK_BASE_IFADDRS_ANDROID_H_
#include <stdio.h>
#include <sys/socket.h>
// Implementation of getifaddrs for Android.
// Fills out a list of ifaddr structs (see below) which contain information
// about every network interface available on the host.
// See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function).
// -- GODOT start --
#ifdef __cplusplus
extern "C" {
#endif
// -- GODOT end --
struct ifaddrs {
struct ifaddrs* ifa_next;
char* ifa_name;
@ -45,7 +45,6 @@ struct ifaddrs {
struct sockaddr* ifa_netmask;
// Real ifaddrs has broadcast, point to point and data members.
// We don't need them (yet?).
// -- GODOT start --
// We never initialize the following members. We only define them to match the ifaddrs struct.
union
{
@ -53,13 +52,12 @@ struct ifaddrs {
struct sockaddr *ifu_dstaddr;
} ifa_ifu;
void *ifa_data;
// -- GODOT end --
};
// -- GODOT start --
#ifdef __cplusplus
}
#endif
// -- GODOT end --
int getifaddrs(struct ifaddrs** result);
void freeifaddrs(struct ifaddrs* addrs);
#endif // TALK_BASE_IFADDRS_ANDROID_H_

175
thirdparty/misc/nvapi_minimal.h vendored Normal file
View File

@ -0,0 +1,175 @@
#ifndef NVAPI_MINIMAL_H
#define NVAPI_MINIMAL_H
typedef uint32_t NvU32;
typedef uint16_t NvU16;
typedef uint8_t NvU8;
#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16))
#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
NV_DECLARE_HANDLE(NvDRSSessionHandle);
NV_DECLARE_HANDLE(NvDRSProfileHandle);
#define NVAPI_UNICODE_STRING_MAX 2048
#define NVAPI_BINARY_DATA_MAX 4096
typedef NvU16 NvAPI_UnicodeString[NVAPI_UNICODE_STRING_MAX];
typedef char NvAPI_ShortString[64];
#define NVAPI_SETTING_MAX_VALUES 100
typedef enum _NVDRS_SETTING_TYPE
{
NVDRS_DWORD_TYPE,
NVDRS_BINARY_TYPE,
NVDRS_STRING_TYPE,
NVDRS_WSTRING_TYPE
} NVDRS_SETTING_TYPE;
typedef enum _NVDRS_SETTING_LOCATION
{
NVDRS_CURRENT_PROFILE_LOCATION,
NVDRS_GLOBAL_PROFILE_LOCATION,
NVDRS_BASE_PROFILE_LOCATION,
NVDRS_DEFAULT_PROFILE_LOCATION
} NVDRS_SETTING_LOCATION;
typedef struct _NVDRS_GPU_SUPPORT
{
NvU32 geforce : 1;
NvU32 quadro : 1;
NvU32 nvs : 1;
NvU32 reserved4 : 1;
NvU32 reserved5 : 1;
NvU32 reserved6 : 1;
NvU32 reserved7 : 1;
NvU32 reserved8 : 1;
NvU32 reserved9 : 1;
NvU32 reserved10 : 1;
NvU32 reserved11 : 1;
NvU32 reserved12 : 1;
NvU32 reserved13 : 1;
NvU32 reserved14 : 1;
NvU32 reserved15 : 1;
NvU32 reserved16 : 1;
NvU32 reserved17 : 1;
NvU32 reserved18 : 1;
NvU32 reserved19 : 1;
NvU32 reserved20 : 1;
NvU32 reserved21 : 1;
NvU32 reserved22 : 1;
NvU32 reserved23 : 1;
NvU32 reserved24 : 1;
NvU32 reserved25 : 1;
NvU32 reserved26 : 1;
NvU32 reserved27 : 1;
NvU32 reserved28 : 1;
NvU32 reserved29 : 1;
NvU32 reserved30 : 1;
NvU32 reserved31 : 1;
NvU32 reserved32 : 1;
} NVDRS_GPU_SUPPORT;
//! Enum to decide on the datatype of setting value.
typedef struct _NVDRS_BINARY_SETTING
{
NvU32 valueLength; //!< valueLength should always be in number of bytes.
NvU8 valueData[NVAPI_BINARY_DATA_MAX];
} NVDRS_BINARY_SETTING;
typedef struct _NVDRS_SETTING_VALUES
{
NvU32 version; //!< Structure Version
NvU32 numSettingValues; //!< Total number of values available in a setting.
NVDRS_SETTING_TYPE settingType; //!< Type of setting value.
union //!< Setting can hold either DWORD or Binary value or string. Not mixed types.
{
NvU32 u32DefaultValue; //!< Accessing default DWORD value of this setting.
NVDRS_BINARY_SETTING binaryDefaultValue; //!< Accessing default Binary value of this setting.
//!< Must be allocated by caller with valueLength specifying buffer size, or only valueLength will be filled in.
NvAPI_UnicodeString wszDefaultValue; //!< Accessing default unicode string value of this setting.
};
union //!< Setting values can be of either DWORD, Binary values or String type,
{ //!< NOT mixed types.
NvU32 u32Value; //!< All possible DWORD values for a setting
NVDRS_BINARY_SETTING binaryValue; //!< All possible Binary values for a setting
NvAPI_UnicodeString wszValue; //!< Accessing current unicode string value of this setting.
}settingValues[NVAPI_SETTING_MAX_VALUES];
} NVDRS_SETTING_VALUES;
//! Macro for constructing the version field of ::_NVDRS_SETTING_VALUES
#define NVDRS_SETTING_VALUES_VER MAKE_NVAPI_VERSION(NVDRS_SETTING_VALUES,1)
typedef struct _NVDRS_SETTING_V1
{
NvU32 version; //!< Structure Version
NvAPI_UnicodeString settingName; //!< String name of setting
NvU32 settingId; //!< 32 bit setting Id
NVDRS_SETTING_TYPE settingType; //!< Type of setting value.
NVDRS_SETTING_LOCATION settingLocation; //!< Describes where the value in CurrentValue comes from.
NvU32 isCurrentPredefined; //!< It is different than 0 if the currentValue is a predefined Value,
//!< 0 if the currentValue is a user value.
NvU32 isPredefinedValid; //!< It is different than 0 if the PredefinedValue union contains a valid value.
union //!< Setting can hold either DWORD or Binary value or string. Not mixed types.
{
NvU32 u32PredefinedValue; //!< Accessing default DWORD value of this setting.
NVDRS_BINARY_SETTING binaryPredefinedValue; //!< Accessing default Binary value of this setting.
//!< Must be allocated by caller with valueLength specifying buffer size,
//!< or only valueLength will be filled in.
NvAPI_UnicodeString wszPredefinedValue; //!< Accessing default unicode string value of this setting.
};
union //!< Setting can hold either DWORD or Binary value or string. Not mixed types.
{
NvU32 u32CurrentValue; //!< Accessing current DWORD value of this setting.
NVDRS_BINARY_SETTING binaryCurrentValue; //!< Accessing current Binary value of this setting.
//!< Must be allocated by caller with valueLength specifying buffer size,
//!< or only valueLength will be filled in.
NvAPI_UnicodeString wszCurrentValue; //!< Accessing current unicode string value of this setting.
};
} NVDRS_SETTING_V1;
//! Macro for constructing the version field of ::_NVDRS_SETTING
#define NVDRS_SETTING_VER1 MAKE_NVAPI_VERSION(NVDRS_SETTING_V1, 1)
typedef NVDRS_SETTING_V1 NVDRS_SETTING;
#define NVDRS_SETTING_VER NVDRS_SETTING_VER1
typedef struct _NVDRS_APPLICATION_V4
{
NvU32 version; //!< Structure Version
NvU32 isPredefined; //!< Is the application userdefined/predefined
NvAPI_UnicodeString appName; //!< String name of the Application
NvAPI_UnicodeString userFriendlyName; //!< UserFriendly name of the Application
NvAPI_UnicodeString launcher; //!< Indicates the name (if any) of the launcher that starts the Application
NvAPI_UnicodeString fileInFolder; //!< Select this application only if this file is found.
//!< When specifying multiple files, separate them using the ':' character.
NvU32 isMetro:1; //!< Windows 8 style app
NvU32 isCommandLine:1; //!< Command line parsing for the application name
NvU32 reserved:30; //!< Reserved. Should be 0.
NvAPI_UnicodeString commandLine; //!< If isCommandLine is set to 0 this must be an empty. If isCommandLine is set to 1
//!< this contains application's command line as if it was returned by GetCommandLineW.
} NVDRS_APPLICATION_V4;
#define NVDRS_APPLICATION_VER_V4 MAKE_NVAPI_VERSION(NVDRS_APPLICATION_V4,4)
typedef NVDRS_APPLICATION_V4 NVDRS_APPLICATION;
#define NVDRS_APPLICATION_VER NVDRS_APPLICATION_VER_V4
typedef struct _NVDRS_PROFILE_V1
{
NvU32 version; //!< Structure Version
NvAPI_UnicodeString profileName; //!< String name of the Profile
NVDRS_GPU_SUPPORT gpuSupport; //!< This read-only flag indicates the profile support on either
//!< Quadro, or Geforce, or both.
NvU32 isPredefined; //!< Is the Profile user-defined, or predefined
NvU32 numOfApps; //!< Total number of applications that belong to this profile. Read-only
NvU32 numOfSettings; //!< Total number of settings applied for this Profile. Read-only
} NVDRS_PROFILE_V1;
typedef NVDRS_PROFILE_V1 NVDRS_PROFILE;
//! Macro for constructing the version field of ::NVDRS_PROFILE
#define NVDRS_PROFILE_VER1 MAKE_NVAPI_VERSION(NVDRS_PROFILE_V1,1)
#define NVDRS_PROFILE_VER NVDRS_PROFILE_VER1
#endif

View File

@ -0,0 +1,43 @@
diff --git a/thirdparty/misc/FastNoiseLite.h b/thirdparty/misc/FastNoiseLite.h
index ed97b0fcac..fb6dbcb92a 100644
--- a/thirdparty/misc/FastNoiseLite.h
+++ b/thirdparty/misc/FastNoiseLite.h
@@ -52,6 +52,8 @@
#include <cmath>
+namespace fastnoiselite {
+
class FastNoiseLite
{
public:
@@ -1609,6 +1611,12 @@ private:
}
}
+// GCC raises warnings when integer overflows occur, which are needed for hashing here.
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
+#endif
+
template <typename FNfloat>
float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const
{
@@ -1763,6 +1771,9 @@ private:
}
}
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
// Perlin Noise
@@ -2583,4 +2594,6 @@ const T FastNoiseLite::Lookup<T>::RandVecs3D[] =
-0.7870349638f, 0.03447489231f, 0.6159443543f, 0, -0.2015596421f, 0.6859872284f, 0.6991389226f, 0, -0.08581082512f, -0.10920836f, -0.9903080513f, 0, 0.5532693395f, 0.7325250401f, -0.396610771f, 0, -0.1842489331f, -0.9777375055f, -0.1004076743f, 0, 0.0775473789f, -0.9111505856f, 0.4047110257f, 0, 0.1399838409f, 0.7601631212f, -0.6344734459f, 0, 0.4484419361f, -0.845289248f, 0.2904925424f, 0
};
+} // namespace fastnoiselite
+
#endif

View File

@ -0,0 +1,32 @@
diff --git a/thirdparty/misc/ifaddrs-android.h b/thirdparty/misc/ifaddrs-android.h
index e7d81e813f..04ff2ca58b 100644
--- a/thirdparty/misc/ifaddrs-android.h
+++ b/thirdparty/misc/ifaddrs-android.h
@@ -34,6 +34,9 @@
// Fills out a list of ifaddr structs (see below) which contain information
// about every network interface available on the host.
// See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function).
+#ifdef __cplusplus
+extern "C" {
+#endif
struct ifaddrs {
struct ifaddrs* ifa_next;
char* ifa_name;
@@ -42,7 +45,17 @@ struct ifaddrs {
struct sockaddr* ifa_netmask;
// Real ifaddrs has broadcast, point to point and data members.
// We don't need them (yet?).
+ // We never initialize the following members. We only define them to match the ifaddrs struct.
+ union
+ {
+ struct sockaddr *ifu_broadaddr;
+ struct sockaddr *ifu_dstaddr;
+ } ifa_ifu;
+ void *ifa_data;
};
+#ifdef __cplusplus
+}
+#endif
int getifaddrs(struct ifaddrs** result);
void freeifaddrs(struct ifaddrs* addrs);

View File

@ -1,5 +1,5 @@
diff --git a/thirdparty/misc/polypartition.cpp b/thirdparty/misc/polypartition.cpp
index 3a8a6efa83..8c5409bf24 100644
index 3a8a6efa83..a725125ed0 100644
--- a/thirdparty/misc/polypartition.cpp
+++ b/thirdparty/misc/polypartition.cpp
@@ -26,7 +26,6 @@
@ -528,15 +528,15 @@ index 3a8a6efa83..8c5409bf24 100644
// a tree, complexity requirements for operations are the same as
// for the balanced binary search tree.
- std::set<ScanLineEdge> edgeTree;
+ Set<ScanLineEdge> edgeTree;
+ RBSet<ScanLineEdge> edgeTree;
// Store iterators to the edge tree elements.
// This makes deleting existing edges much faster.
- std::set<ScanLineEdge>::iterator *edgeTreeIterators, edgeIter;
- edgeTreeIterators = new std::set<ScanLineEdge>::iterator[maxnumvertices];
- std::pair<std::set<ScanLineEdge>::iterator, bool> edgeTreeRet;
+ Set<ScanLineEdge>::Element **edgeTreeIterators, *edgeIter;
+ edgeTreeIterators = new Set<ScanLineEdge>::Element *[maxnumvertices];
+ //Pair<Set<ScanLineEdge>::iterator, bool> edgeTreeRet;
+ RBSet<ScanLineEdge>::Element **edgeTreeIterators, *edgeIter;
+ edgeTreeIterators = new RBSet<ScanLineEdge>::Element *[maxnumvertices];
+ //Pair<RBSet<ScanLineEdge>::iterator, bool> edgeTreeRet;
for (i = 0; i < numvertices; i++) {
- edgeTreeIterators[i] = edgeTree.end();
+ edgeTreeIterators[i] = nullptr;
@ -671,8 +671,8 @@ index 3a8a6efa83..8c5409bf24 100644
void TPPLPartition::AddDiagonal(MonotoneVertex *vertices, long *numvertices, long index1, long index2,
- TPPLVertexType *vertextypes, std::set<ScanLineEdge>::iterator *edgeTreeIterators,
- std::set<ScanLineEdge> *edgeTree, long *helpers) {
+ TPPLVertexType *vertextypes, Set<ScanLineEdge>::Element **edgeTreeIterators,
+ Set<ScanLineEdge> *edgeTree, long *helpers) {
+ TPPLVertexType *vertextypes, RBSet<ScanLineEdge>::Element **edgeTreeIterators,
+ RBSet<ScanLineEdge> *edgeTree, long *helpers) {
long newindex1, newindex2;
newindex1 = *numvertices;
@ -713,7 +713,7 @@ index 3a8a6efa83..8c5409bf24 100644
}
}
diff --git a/thirdparty/misc/polypartition.h b/thirdparty/misc/polypartition.h
index f163f5d217..b2d905a3ef 100644
index e1df6cef9e..c084bdf74c 100644
--- a/thirdparty/misc/polypartition.h
+++ b/thirdparty/misc/polypartition.h
@@ -24,8 +24,9 @@
@ -724,7 +724,7 @@ index f163f5d217..b2d905a3ef 100644
-#include <set>
+#include "core/math/vector2.h"
+#include "core/templates/list.h"
+#include "core/templates/set.h"
+#include "core/templates/rb_set.h"
typedef double tppl_float;
@ -809,8 +809,8 @@ index f163f5d217..b2d905a3ef 100644
void AddDiagonal(MonotoneVertex *vertices, long *numvertices, long index1, long index2,
- TPPLVertexType *vertextypes, std::set<ScanLineEdge>::iterator *edgeTreeIterators,
- std::set<ScanLineEdge> *edgeTree, long *helpers);
+ TPPLVertexType *vertextypes, Set<ScanLineEdge>::Element **edgeTreeIterators,
+ Set<ScanLineEdge> *edgeTree, long *helpers);
+ TPPLVertexType *vertextypes, RBSet<ScanLineEdge>::Element **edgeTreeIterators,
+ RBSet<ScanLineEdge> *edgeTree, long *helpers);
// Triangulates a monotone polygon, used in Triangulate_MONO.
int TriangulateMonotone(TPPLPoly *inPoly, TPPLPolyList *triangles);

View File

@ -0,0 +1,54 @@
diff --git a/thirdparty/misc/smaz.c b/thirdparty/misc/smaz.c
index aa674c3858..6f9ea20e67 100644
--- a/thirdparty/misc/smaz.c
+++ b/thirdparty/misc/smaz.c
@@ -1,7 +1,7 @@
#include <string.h>
/* Our compression codebook, used for compression */
-static char *Smaz_cb[241] = {
+static const char *Smaz_cb[241] = {
"\002s,\266", "\003had\232\002leW", "\003on \216", "", "\001yS",
"\002ma\255\002li\227", "\003or \260", "", "\002ll\230\003s t\277",
"\004fromg\002mel", "", "\003its\332", "\001z\333", "\003ingF", "\001>\336",
@@ -76,7 +76,7 @@ static char *Smaz_rcb[254] = {
"e, ", " it", "whi", " ma", "ge", "x", "e c", "men", ".com"
};
-int smaz_compress(char *in, int inlen, char *out, int outlen) {
+int smaz_compress(const char *in, int inlen, char *out, int outlen) {
unsigned int h1,h2,h3=0;
int verblen = 0, _outlen = outlen;
char verb[256], *_out = out;
@@ -154,7 +154,7 @@ out:
return out-_out;
}
-int smaz_decompress(char *in, int inlen, char *out, int outlen) {
+int smaz_decompress(const char *in, int inlen, char *out, int outlen) {
unsigned char *c = (unsigned char*) in;
char *_out = out;
int _outlen = outlen;
@@ -179,7 +179,7 @@ int smaz_decompress(char *in, int inlen, char *out, int outlen) {
inlen -= 2+len;
} else {
/* Codebook entry */
- char *s = Smaz_rcb[*c];
+ const char *s = Smaz_rcb[*c];
int len = strlen(s);
if (outlen < len) return _outlen+1;
diff --git a/thirdparty/misc/smaz.h b/thirdparty/misc/smaz.h
index ce9c35d6b2..d8e1f8a6a5 100644
--- a/thirdparty/misc/smaz.h
+++ b/thirdparty/misc/smaz.h
@@ -1,7 +1,7 @@
#ifndef _SMAZ_H
#define _SMAZ_H
-int smaz_compress(char *in, int inlen, char *out, int outlen);
-int smaz_decompress(char *in, int inlen, char *out, int outlen);
+int smaz_compress(const char *in, int inlen, char *out, int outlen);
+int smaz_decompress(const char *in, int inlen, char *out, int outlen);
#endif