Added SDL_RWprintf() and SDL_RWvprintf() to do formatted printing to an SDL_rwops stream

Fixes https://github.com/libsdl-org/SDL/issues/2390
This commit is contained in:
Sam Lantinga 2023-11-04 13:57:16 -07:00
parent 52c4e3eab3
commit f9d11807c0
7 changed files with 133 additions and 2 deletions

View file

@ -144,6 +144,16 @@ static void SDL_InitDynamicAPI(void);
va_end(ap); \
return retval; \
} \
_static size_t SDLCALL SDL_RWprintf##name(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
{ \
size_t retval; \
va_list ap; \
initcall; \
va_start(ap, fmt); \
retval = jump_table.SDL_RWvprintf(context, fmt, ap); \
va_end(ap); \
return retval; \
} \
_static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
{ \
va_list ap; \
@ -285,6 +295,16 @@ static int SDLCALL SDL_swprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) wchar_t *buf,
va_end(ap);
return retval;
}
_static size_t SDLCALL SDL_RWprintf_LOGSDLCALLS(SDL_RWops *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
size_t retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_RWprintf");
va_start(ap, fmt);
retval = SDL_RWvprintf_REAL(context, fmt, ap);
va_end(ap);
return retval;
}
static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list ap;