This commit is contained in:
Spartan322
2025-08-16 23:07:50 -04:00
90 changed files with 1009 additions and 230 deletions

View File

@@ -995,6 +995,7 @@ Patches:
- `0003-std-include.patch` (GH-108144)
- `0004-errno-include.patch` (GH-108354)
- `0005-fix-libudev-dbus.patch` (GH-108373)
- `0006-fix-cs-environ.patch` (GH-109283)
The SDL source code folder includes `hidapi` library inside of folder `thirdparty/sdl/hidapi/`.
Its version and license is described in this file under `hidapi`.
@@ -1064,6 +1065,7 @@ Files extracted from upstream source:
Patches:
- `0001-revert-tvglines-bezier-precision.patch` (GH-96658)
- `0002-use-heap-alloc.patch` (GH-109530)
## tinyexr

View File

@@ -0,0 +1,65 @@
diff --git a/thirdparty/sdl/stdlib/SDL_getenv.c b/thirdparty/sdl/stdlib/SDL_getenv.c
index b4a19224655..e23f8a0ea0d 100644
--- a/thirdparty/sdl/stdlib/SDL_getenv.c
+++ b/thirdparty/sdl/stdlib/SDL_getenv.c
@@ -50,6 +50,9 @@ extern char **environ;
static char **environ;
#endif
+#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
+#include <stdlib.h>
+#endif
struct SDL_Environment
{
@@ -149,6 +152,9 @@ SDL_Environment *SDL_CreateEnvironment(bool populated)
const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name)
{
+#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
+ return getenv(name);
+#else
const char *result = NULL;
if (!env) {
@@ -168,6 +174,7 @@ const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name)
SDL_UnlockMutex(env->lock);
return result;
+#endif
}
typedef struct CountEnvStringsData
@@ -246,6 +253,9 @@ char **SDL_GetEnvironmentVariables(SDL_Environment *env)
bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const char *value, bool overwrite)
{
+#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
+ return setenv(name, value, overwrite);
+#else
bool result = false;
if (!env) {
@@ -281,10 +291,14 @@ bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const ch
SDL_UnlockMutex(env->lock);
return result;
+#endif
}
bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
{
+#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
+ return unsetenv(name);
+#else
bool result = false;
if (!env) {
@@ -305,6 +319,7 @@ bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
SDL_UnlockMutex(env->lock);
return result;
+#endif
}
void SDL_DestroyEnvironment(SDL_Environment *env)

View File

@@ -50,6 +50,9 @@ extern char **environ;
static char **environ;
#endif
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
#include <stdlib.h>
#endif
struct SDL_Environment
{
@@ -149,6 +152,9 @@ SDL_Environment *SDL_CreateEnvironment(bool populated)
const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name)
{
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
return getenv(name);
#else
const char *result = NULL;
if (!env) {
@@ -168,6 +174,7 @@ const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name)
SDL_UnlockMutex(env->lock);
return result;
#endif
}
typedef struct CountEnvStringsData
@@ -246,6 +253,9 @@ char **SDL_GetEnvironmentVariables(SDL_Environment *env)
bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const char *value, bool overwrite)
{
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
return setenv(name, value, overwrite);
#else
bool result = false;
if (!env) {
@@ -281,10 +291,14 @@ bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const ch
SDL_UnlockMutex(env->lock);
return result;
#endif
}
bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
{
#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD)
return unsetenv(name);
#else
bool result = false;
if (!env) {
@@ -305,6 +319,7 @@ bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name)
SDL_UnlockMutex(env->lock);
return result;
#endif
}
void SDL_DestroyEnvironment(SDL_Environment *env)

View File

@@ -0,0 +1,44 @@
diff --git a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
index 81d5c098a2..4c0a0f53db 100644
--- a/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
+++ b/thirdparty/thorvg/src/loaders/svg/tvgXmlParser.cpp
@@ -475,11 +475,14 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
if (!buf) return false;
end = buf + bufLength;
- key = (char*)alloca(end - buf + 1);
- val = (char*)alloca(end - buf + 1);
if (buf == end) return true;
+ char* key_buf = (char*)malloc(end - buf + 1);
+ char* val_buf = (char*)malloc(end - buf + 1);
+
+ key = key_buf;
+ val = val_buf;
do {
char* sep = (char*)strchr(buf, ':');
next = (char*)strchr(buf, ';');
@@ -487,7 +490,11 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
if (auto src = strstr(buf, "src")) {//src tag from css font-face contains extra semicolon
if (src < sep) {
if (next + 1 < end) next = (char*)strchr(next + 1, ';');
- else return true;
+ else {
+ free(key_buf);
+ free(val_buf);
+ return true;
+ }
}
}
@@ -534,6 +541,9 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
buf = next + 1;
} while (true);
+ free(key_buf);
+ free(val_buf);
+
return true;
}

View File

@@ -475,11 +475,14 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
if (!buf) return false;
end = buf + bufLength;
key = (char*)alloca(end - buf + 1);
val = (char*)alloca(end - buf + 1);
if (buf == end) return true;
char* key_buf = (char*)malloc(end - buf + 1);
char* val_buf = (char*)malloc(end - buf + 1);
key = key_buf;
val = val_buf;
do {
char* sep = (char*)strchr(buf, ':');
next = (char*)strchr(buf, ';');
@@ -487,7 +490,11 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
if (auto src = strstr(buf, "src")) {//src tag from css font-face contains extra semicolon
if (src < sep) {
if (next + 1 < end) next = (char*)strchr(next + 1, ';');
else return true;
else {
free(key_buf);
free(val_buf);
return true;
}
}
}
@@ -534,6 +541,9 @@ bool simpleXmlParseW3CAttribute(const char* buf, unsigned bufLength, simpleXMLAt
buf = next + 1;
} while (true);
free(key_buf);
free(val_buf);
return true;
}