From 8c3b1e5ad517ce3adad58ba9bd1dabb3daac56c7 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 9 Sep 2024 15:54:11 -0700
Subject: [PATCH] Updated for switching *int64 to *long long in SDL3
---
src/sdl2_compat.c | 26 ++++++++++++++++++++++++--
src/sdl3_syms.h | 8 ++++----
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index e360070..e73db12 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -966,6 +966,30 @@ SDL_Error(SDL_errorcode code)
return -1;
}
+SDL_DECLSPEC char *SDLCALL
+SDL_lltoa(Sint64 value, char *str, int radix)
+{
+ return SDL3_lltoa((long long)value, str, radix);
+}
+
+SDL_DECLSPEC char *
+SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix)
+{
+ return SDL3_ulltoa((unsigned long long)value, str, radix);
+}
+
+SDL_DECLSPEC Sint64 SDLCALL
+SDL_strtoll(const char *str, char **endp, int base)
+{
+ return (Sint64)SDL3_strtoll(str, endp, base);
+}
+
+SDL_DECLSPEC Uint64 SDLCALL
+SDL_strtoull(const char *str, char **endp, int base)
+{
+ return (Uint64)SDL3_strtoull(str, endp, base);
+}
+
SDL_DECLSPEC int SDLCALL
SDL_sscanf(const char *text, const char *fmt, ...)
{
@@ -1874,7 +1898,6 @@ SDL_GetKeyFromName(const char *name)
SDL_DECLSPEC const Uint8 *SDLCALL
SDL_GetKeyboardState(int *numkeys)
{
- SDL_COMPILE_TIME_ASSERT(bool_size, sizeof(SDL_bool) == sizeof(Uint8));
return (const Uint8 *)SDL3_GetKeyboardState(numkeys);
}
@@ -8177,7 +8200,6 @@ SDL_DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *contr
SDL_DECLSPEC int SDLCALL
SDL_GameControllerGetTouchpadFinger(SDL_GameController *gamecontroller, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure)
{
- SDL_COMPILE_TIME_ASSERT(bool_size, sizeof(SDL_bool) == sizeof(Uint8));
return SDL3_GetGamepadTouchpadFinger(gamecontroller, touchpad, finger, (SDL_bool *)state, x, y, pressure) ? 0 : -1;
}
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index d052539..db659e6 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -775,7 +775,7 @@ SDL3_SYM_PASSTHROUGH(int,isspace,(int a),(a),return)
SDL3_SYM_PASSTHROUGH(int,isupper,(int a),(a),return)
SDL3_SYM_PASSTHROUGH(int,isxdigit,(int a),(a),return)
SDL3_SYM_PASSTHROUGH(char*,itoa,(int a, char *b, int c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(char*,lltoa,(Sint64 a, char *b, int c),(a,b,c),return)
+SDL3_SYM(char*,lltoa,(long long a, char *b, int c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(double,log,(double a),(a),return)
SDL3_SYM_PASSTHROUGH(double,log10,(double a),(a),return)
SDL3_SYM_PASSTHROUGH(float,log10f,(float a),(a),return)
@@ -820,9 +820,9 @@ SDL3_SYM_PASSTHROUGH(char*,strstr,(const char *a, const char *b),(a,b),return)
SDL3_SYM_PASSTHROUGH(double,strtod,(const char *a, char **b),(a,b),return)
SDL3_SYM_RENAMED(char*,strtokr,strtok_r,(char *a, const char *b, char **c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(long,strtol,(const char *a, char **b, int c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(Sint64,strtoll,(const char *a, char **b, int c),(a,b,c),return)
+SDL3_SYM(long long,strtoll,(const char *a, char **b, int c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(unsigned long,strtoul,(const char *a, char **b, int c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(Uint64,strtoull,(const char *a, char **b, int c),(a,b,c),return)
+SDL3_SYM(unsigned long long,strtoull,(const char *a, char **b, int c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(char*,strupr,(char *a),(a),return)
SDL3_SYM_PASSTHROUGH(double,tan,(double a),(a),return)
SDL3_SYM_PASSTHROUGH(float,tanf,(float a),(a),return)
@@ -831,7 +831,7 @@ SDL3_SYM_PASSTHROUGH(int,toupper,(int a),(a),return)
SDL3_SYM_PASSTHROUGH(double,trunc,(double a),(a),return)
SDL3_SYM_PASSTHROUGH(float,truncf,(float a),(a),return)
SDL3_SYM_PASSTHROUGH(char*,uitoa,(unsigned int a, char *b, int c),(a,b,c),return)
-SDL3_SYM_PASSTHROUGH(char*,ulltoa,(Uint64 a, char *b, int c),(a,b,c),return)
+SDL3_SYM(char*,ulltoa,(unsigned long long a, char *b, int c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(char*,ultoa,(unsigned long a, char *b, int c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(size_t,utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
SDL3_SYM_PASSTHROUGH(size_t,utf8strlen,(const char *a),(a),return)