From 7854b3c612e09e310362acd485892aee60b5e32e Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 3 Sep 2022 01:28:00 +0300
Subject: [PATCH] restore compatibility with c++ compilers
---
src/SDL12_compat.c | 10 +++++-----
src/SDL20_syms.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b893833e..3755079a 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1638,10 +1638,10 @@ Init12Joystick(void)
if (JoysticksAreGameControllers) {
JoystickList[NumJoysticks].dev.controller = SDL20_GameControllerOpen(i);
- opened = JoystickList[NumJoysticks].dev.controller != NULL;
+ opened = JoystickList[NumJoysticks].dev.controller != NULL ? SDL_TRUE : SDL_FALSE;
} else {
JoystickList[NumJoysticks].dev.joystick = SDL20_JoystickOpen(i);
- opened = JoystickList[NumJoysticks].dev.joystick != NULL;
+ opened = JoystickList[NumJoysticks].dev.joystick != NULL ? SDL_TRUE : SDL_FALSE;
}
if (!opened) {
@@ -8331,7 +8331,7 @@ SDL_CDOpen(int drive)
readdir() is surprisingly hard to do without a bunch of different
platform backends! We just open files until we fail to do so,
and then stop. */
- while (SDL_TRUE) {
+ for (;;) {
SDL_RWops *rw;
drmp3_uint64 pcmframes;
drmp3_uint32 samplerate;
@@ -8398,6 +8398,7 @@ SDL_CDOpen(int drive)
break; /* max tracks you can have on an audio CD. */
}
}
+
if (!has_audio) {
retval->numtracks = 0; /* data-only */
}
@@ -8983,8 +8984,7 @@ SDL_OpenAudio(SDL_AudioSpec *want, SDL_AudioSpec *obtained)
if (!want->format) {
const char *env = SDL20_getenv("SDL_AUDIO_FORMAT"); /* SDL 1.2 checks this. */
if (env != NULL) {
- if (0) {}
- else if (SDL20_strcmp(env, "U8") == 0) { want->format = AUDIO_U8; }
+ if (SDL20_strcmp(env, "U8") == 0) { want->format = AUDIO_U8; }
else if (SDL20_strcmp(env, "S8") == 0) { want->format = AUDIO_S8; }
else if (SDL20_strcmp(env, "U16") == 0) { want->format = AUDIO_U16SYS; }
else if (SDL20_strcmp(env, "S16") == 0) { want->format = AUDIO_S16SYS; }
diff --git a/src/SDL20_syms.h b/src/SDL20_syms.h
index 8c4bf0af..df76bfab 100644
--- a/src/SDL20_syms.h
+++ b/src/SDL20_syms.h
@@ -240,8 +240,8 @@ SDL20_SYM(SDL_GameController *,GameControllerOpen,(int a),(a),return)
SDL20_SYM(void,GameControllerClose,(SDL_GameController *a),(a),)
SDL20_SYM(int,GameControllerEventState,(int a),(a),return)
SDL20_SYM(void,GameControllerUpdate,(void),(),)
-SDL20_SYM(Sint16,GameControllerGetAxis,(SDL_GameController *a, SDL_GameControllerAxis b),(a,b),return)
-SDL20_SYM(Uint8,GameControllerGetButton,(SDL_GameController *a, SDL_GameControllerButton b),(a,b),return)
+SDL20_SYM(Sint16,GameControllerGetAxis,(SDL_GameController *a, int b),(a,b),return) /* SDL_GameControllerAxis b */
+SDL20_SYM(Uint8,GameControllerGetButton,(SDL_GameController *a, int b),(a,b),return) /* SDL_GameControllerButton b */
SDL20_SYM(int,NumJoysticks,(void),(),return)
SDL20_SYM(const char *,JoystickNameForIndex,(int a),(a),return)