SDL_mixer: Updated for SDL3 change to use SDL_bool instead of int return code

From 1541accb21ca39f62b96918cbf6168ba10c05155 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 27 Aug 2024 10:39:57 -0700
Subject: [PATCH] Updated for SDL3 change to use SDL_bool instead of int return
 code

---
 examples/playmus.c            | 2 +-
 examples/playwave.c           | 2 +-
 external/SDL                  | 2 +-
 src/codecs/music_drflac.c     | 2 +-
 src/codecs/music_fluidsynth.c | 2 +-
 src/codecs/music_gme.c        | 2 +-
 src/codecs/music_minimp3.c    | 2 +-
 src/codecs/music_modplug.c    | 2 +-
 src/codecs/music_mpg123.c     | 4 ++--
 src/codecs/music_ogg.c        | 2 +-
 src/codecs/music_ogg_stb.c    | 2 +-
 src/codecs/music_opus.c       | 2 +-
 src/codecs/music_timidity.c   | 2 +-
 src/codecs/music_wavpack.c    | 2 +-
 src/codecs/music_xmp.c        | 2 +-
 src/mixer.c                   | 6 +++---
 16 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/examples/playmus.c b/examples/playmus.c
index d8747840..dee770e4 100644
--- a/examples/playmus.c
+++ b/examples/playmus.c
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
     }
 
     /* Initialize the SDL library */
-    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
+    if (!SDL_Init(SDL_INIT_AUDIO)) {
         SDL_Log("Couldn't initialize SDL: %s\n",SDL_GetError());
         return 255;
     }
diff --git a/examples/playwave.c b/examples/playwave.c
index 7e0ba1ed..4a1920fd 100644
--- a/examples/playwave.c
+++ b/examples/playwave.c
@@ -414,7 +414,7 @@ int main(int argc, char *argv[])
     }
 
     /* Initialize the SDL library */
-    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
+    if (!SDL_Init(SDL_INIT_AUDIO)) {
         SDL_Log("Couldn't initialize SDL: %s\n",SDL_GetError());
         return 255;
     }
diff --git a/external/SDL b/external/SDL
index 199e6929..85bbc602 160000
--- a/external/SDL
+++ b/external/SDL
@@ -1 +1 @@
-Subproject commit 199e6929e5284b8573f02dcb655d3803ed436615
+Subproject commit 85bbc6028ad36e2c1daa8fac60ae07562077b17e
diff --git a/src/codecs/music_drflac.c b/src/codecs/music_drflac.c
index bc8738a4..3614af08 100644
--- a/src/codecs/music_drflac.c
+++ b/src/codecs/music_drflac.c
@@ -280,7 +280,7 @@ static int DRFLAC_GetSome(void *context, void *data, int bytes, SDL_bool *done)
             amount -= (music->dec->currentPCMFrame - music->loop_end);
             music->loop_flag = SDL_TRUE;
         }
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount * sizeof(drflac_int16) * music->channels) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount * sizeof(drflac_int16) * music->channels)) {
             return -1;
         }
     } else {
diff --git a/src/codecs/music_fluidsynth.c b/src/codecs/music_fluidsynth.c
index 268ece48..3041d3d9 100644
--- a/src/codecs/music_fluidsynth.c
+++ b/src/codecs/music_fluidsynth.c
@@ -313,7 +313,7 @@ static int FLUIDSYNTH_GetSome(void *context, void *data, int bytes, SDL_bool *do
     if (music->synth_write(music->synth, 4096/*music_spec.samples*/, music->buffer, 0, 2, music->buffer, 1, 2) != FLUID_OK) {
         return Mix_SetError("Error generating FluidSynth audio");
     }
-    if (SDL_PutAudioStreamData(music->stream, music->buffer, music->buffer_size) < 0) {
+    if (!SDL_PutAudioStreamData(music->stream, music->buffer, music->buffer_size)) {
         return -1;
     }
     return 0;
diff --git a/src/codecs/music_gme.c b/src/codecs/music_gme.c
index aacf1dde..41aa9f72 100644
--- a/src/codecs/music_gme.c
+++ b/src/codecs/music_gme.c
@@ -317,7 +317,7 @@ static int GME_GetSome(void *context, void *data, int bytes, SDL_bool *done)
         return 0;
     }
 
-    if (SDL_PutAudioStreamData(music->stream, music->buffer, (int)music->buffer_size) < 0) {
+    if (!SDL_PutAudioStreamData(music->stream, music->buffer, (int)music->buffer_size)) {
         return -1;
     }
     return 0;
diff --git a/src/codecs/music_minimp3.c b/src/codecs/music_minimp3.c
index a22d6c6e..23a33383 100644
--- a/src/codecs/music_minimp3.c
+++ b/src/codecs/music_minimp3.c
@@ -171,7 +171,7 @@ static int MINIMP3_GetSome(void *context, void *data, int bytes, SDL_bool *done)
 
     amount = (int)mp3dec_ex_read(&music->dec, music->buffer, 4096/*music_spec.samples*/ * music->channels);
     if (amount > 0) {
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount * sizeof(mp3d_sample_t)) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount * sizeof(mp3d_sample_t))) {
             return -1;
         }
     } else {
diff --git a/src/codecs/music_modplug.c b/src/codecs/music_modplug.c
index ebc2e871..1518c68d 100644
--- a/src/codecs/music_modplug.c
+++ b/src/codecs/music_modplug.c
@@ -267,7 +267,7 @@ static int MODPLUG_GetSome(void *context, void *data, int bytes, SDL_bool *done)
 
     amount = modplug.ModPlug_Read(music->file, music->buffer, music->buffer_size);
     if (amount > 0) {
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else {
diff --git a/src/codecs/music_mpg123.c b/src/codecs/music_mpg123.c
index 823dc445..629d4611 100644
--- a/src/codecs/music_mpg123.c
+++ b/src/codecs/music_mpg123.c
@@ -389,7 +389,7 @@ static int MPG123_GetSome(void *context, void *data, int bytes, SDL_bool *done)
     result = mpg123.mpg123_read(music->handle, music->buffer, music->buffer_size, &amount);
     switch (result) {
     case MPG123_OK:
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount)) {
             return -1;
         }
         break;
@@ -424,7 +424,7 @@ static int MPG123_GetSome(void *context, void *data, int bytes, SDL_bool *done)
 
     case MPG123_DONE:
         if (amount > 0) {
-            if (SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount) < 0) {
+            if (!SDL_PutAudioStreamData(music->stream, music->buffer, (int)amount)) {
                 return -1;
             }
             break;
diff --git a/src/codecs/music_ogg.c b/src/codecs/music_ogg.c
index 54222504..255ebb42 100644
--- a/src/codecs/music_ogg.c
+++ b/src/codecs/music_ogg.c
@@ -423,7 +423,7 @@ static int OGG_GetSome(void *context, void *data, int bytes, SDL_bool *done)
     }
 
     if (amount > 0) {
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else if (!looped) {
diff --git a/src/codecs/music_ogg_stb.c b/src/codecs/music_ogg_stb.c
index cab061ec..4fc84fc6 100644
--- a/src/codecs/music_ogg_stb.c
+++ b/src/codecs/music_ogg_stb.c
@@ -358,7 +358,7 @@ static int OGG_GetSome(void *context, void *data, int bytes, SDL_bool *done)
     }
 
     if (amount > 0) {
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else if (!looped) {
diff --git a/src/codecs/music_opus.c b/src/codecs/music_opus.c
index 58ae3308..03d577e3 100644
--- a/src/codecs/music_opus.c
+++ b/src/codecs/music_opus.c
@@ -399,7 +399,7 @@ static int OPUS_GetSome(void *context, void *data, int bytes, SDL_bool *done)
 
     if (samples > 0) {
         filled = samples * music->op_info->channel_count * 2;
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, filled) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, filled)) {
             return -1;
         }
     } else if (!looped) {
diff --git a/src/codecs/music_timidity.c b/src/codecs/music_timidity.c
index 6eb16f03..726a7f91 100644
--- a/src/codecs/music_timidity.c
+++ b/src/codecs/music_timidity.c
@@ -176,7 +176,7 @@ static int TIMIDITY_GetSome(void *context, void *data, int bytes, SDL_bool *done
     if (music->stream) {
         expected = music->buffer_size;
         amount = Timidity_PlaySome(music->song, music->buffer, music->buffer_size);
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else {
diff --git a/src/codecs/music_wavpack.c b/src/codecs/music_wavpack.c
index 60d6f8c2..aa5afc77 100644
--- a/src/codecs/music_wavpack.c
+++ b/src/codecs/music_wavpack.c
@@ -554,7 +554,7 @@ static int WAVPACK_GetSome(void *context, void *data, int bytes, SDL_bool *done)
             amount *= sizeof(Sint32);
             break;
         }
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else {
diff --git a/src/codecs/music_xmp.c b/src/codecs/music_xmp.c
index 93a8632a..555e158d 100644
--- a/src/codecs/music_xmp.c
+++ b/src/codecs/music_xmp.c
@@ -344,7 +344,7 @@ static int XMP_GetSome(void *context, void *data, int bytes, SDL_bool *done)
     amount = music->buffer_size;
 
     if (ret == 0) {
-        if (SDL_PutAudioStreamData(music->stream, music->buffer, amount) < 0) {
+        if (!SDL_PutAudioStreamData(music->stream, music->buffer, amount)) {
             return -1;
         }
     } else {
diff --git a/src/mixer.c b/src/mixer.c
index f4b28785..129d02e1 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -485,7 +485,7 @@ int Mix_OpenAudio(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec)
     int i;
 
     if (!SDL_WasInit(SDL_INIT_AUDIO)) {
-        if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
+        if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) {
             return -1;
         }
     }
@@ -841,7 +841,7 @@ Mix_Chunk *Mix_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio)
 
     if (!loaded)  {
         if (SDL_memcmp(magic, "WAVE", 4) == 0 || SDL_memcmp(magic, "RIFF", 4) == 0) {
-            loaded = (SDL_LoadWAV_IO(src, closeio, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen) == 0) ? &wavespec : NULL;
+            loaded = SDL_LoadWAV_IO(src, closeio, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen) ? &wavespec : NULL;
         } else if (SDL_memcmp(magic, "FORM", 4) == 0) {
             loaded = Mix_LoadAIFF_IO(src, closeio, &wavespec, (Uint8 **)&chunk->abuf, &chunk->alen);
         } else if (SDL_memcmp(magic, "Crea", 4) == 0) {
@@ -872,7 +872,7 @@ Mix_Chunk *Mix_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio)
         Uint8 *dst_data = NULL;
         int dst_len = 0;
 
-        if (SDL_ConvertAudioSamples(&wavespec, chunk->abuf, chunk->alen, &mixer, &dst_data, &dst_len) < 0) {
+        if (!SDL_ConvertAudioSamples(&wavespec, chunk->abuf, chunk->alen, &mixer, &dst_data, &dst_len)) {
             SDL_free(chunk->abuf);
             SDL_free(chunk);
             return NULL;