Feature #864 ยป 0035-sdl3-Update-SDL_Init-return-value-checking.patch
client/audio_sdl.c | ||
---|---|---|
This will need to be changed if SDL is used elsewhere.
|
||
**************************************************************************/
|
||
static int init_sdl_audio(void)
|
||
static bool init_sdl_audio(void)
|
||
{
|
||
#ifdef AUDIO_SDL3
|
||
return SDL_Init(SDL_INIT_AUDIO);
|
||
... | ... | |
SDL_SetHint(SDL_HINT_AUDIO_RESAMPLING_MODE, "medium");
|
||
if (SDL_WasInit(SDL_INIT_VIDEO)) {
|
||
return SDL_InitSubSystem(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE);
|
||
return SDL_InitSubSystem(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) >= 0;
|
||
} else {
|
||
return SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE);
|
||
return SDL_Init(SDL_INIT_AUDIO | SDL_INIT_NOPARACHUTE) >= 0;
|
||
}
|
||
#endif /* AUDIO_SDL3 */
|
||
}
|
||
... | ... | |
{
|
||
int i;
|
||
if (init_sdl_audio() < 0) {
|
||
if (!init_sdl_audio()) {
|
||
return FALSE;
|
||
}
|
||
client/gui-sdl3/graphics.c | ||
---|---|---|
**************************************************************************/
|
||
void init_sdl(int flags)
|
||
{
|
||
bool error;
|
||
bool success;
|
||
main_data.screen = NULL;
|
||
main_data.guis = NULL;
|
||
... | ... | |
main_data.guis_count = 0;
|
||
if (SDL_WasInit(SDL_INIT_AUDIO)) {
|
||
error = (SDL_InitSubSystem(flags) < 0);
|
||
success = SDL_InitSubSystem(flags);
|
||
} else {
|
||
error = (SDL_Init(flags) < 0);
|
||
success = SDL_Init(flags);
|
||
}
|
||
if (error) {
|
||
if (!success) {
|
||
log_fatal(_("Unable to initialize SDL3 library: %s"), SDL_GetError());
|
||
exit(EXIT_FAILURE);
|
||
}
|
||
... | ... | |
atexit(SDL_Quit);
|
||
/* Initialize the TTF library */
|
||
if (TTF_Init() < 0) {
|
||
if (!TTF_Init()) {
|
||
log_fatal(_("Unable to initialize SDL3_ttf library: %s"), SDL_GetError());
|
||
exit(EXIT_FAILURE);
|
||
}
|