Added SDL_swprintf() and SDL_vswprintf()

This commit is contained in:
Sam Lantinga
2023-05-24 09:41:22 -07:00
parent 6c28546828
commit c9d8a04945
8 changed files with 250 additions and 2 deletions

View File

@@ -123,6 +123,16 @@ static void SDL_InitDynamicAPI(void);
va_end(ap); \
return retval; \
} \
_static int SDLCALL SDL_swprintf##name(SDL_OUT_Z_CAP(maxlen) wchar_t *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ...) \
{ \
int retval; \
va_list ap; \
initcall; \
va_start(ap, fmt); \
retval = jump_table.SDL_vswprintf(buf, maxlen, fmt, ap); \
va_end(ap); \
return retval; \
} \
_static int SDLCALL SDL_asprintf##name(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
{ \
int retval; \

View File

@@ -859,6 +859,8 @@ SDL3_0.0.0 {
SDL_GetWindowDisplayScale;
SDL_GetWindowPixelDensity;
SDL_wcstol;
SDL_swprintf;
SDL_vswprintf;
# extra symbols go here (don't modify this line)
local: *;
};

View File

@@ -885,3 +885,5 @@
#define SDL_GetWindowDisplayScale SDL_GetWindowDisplayScale_REAL
#define SDL_GetWindowPixelDensity SDL_GetWindowPixelDensity_REAL
#define SDL_wcstol SDL_wcstol_REAL
#define SDL_swprintf SDL_swprintf_REAL
#define SDL_vswprintf SDL_vswprintf_REAL

View File

@@ -41,6 +41,7 @@ SDL_DYNAPI_PROC(void,SDL_LogWarn,(int a, SDL_PRINTF_FORMAT_STRING const char *b,
SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return)
SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_swprintf,(SDL_OUT_Z_CAP(b) wchar_t *a, size_t b, SDL_PRINTF_FORMAT_STRING const wchar_t *c, ...),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...),(a,b),return)
#endif
@@ -930,3 +931,4 @@ SDL_DYNAPI_PROC(float,SDL_GetDisplayContentScale,(SDL_DisplayID a),(a),return)
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(float,SDL_GetWindowPixelDensity,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(long,SDL_wcstol,(const wchar_t *a, wchar_t **b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_vswprintf,(wchar_t *a, size_t b, const wchar_t *c, va_list d),(a,b,c,d),return)

View File

@@ -144,6 +144,7 @@ def main():
func = func.replace("SDL_PRINTF_VARARG_FUNC(1)", "");
func = func.replace("SDL_PRINTF_VARARG_FUNC(2)", "");
func = func.replace("SDL_PRINTF_VARARG_FUNC(3)", "");
func = func.replace("SDL_WPRINTF_VARARG_FUNC(3)", "");
func = func.replace("SDL_SCANF_VARARG_FUNC(2)", "");
func = func.replace("__attribute__((analyzer_noreturn))", "");
func = func.replace("SDL_MALLOC", "");