SDL_mixer: Fix straightforward unsigned/signed comparisons

From 899b5d436eb7fdad2c90a9d0ec0f2048a90a3455 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 23 Nov 2025 21:14:41 +0100
Subject: [PATCH] Fix straightforward unsigned/signed comparisons

---
 src/SDL_mixer.c               | 2 +-
 src/SDL_mixer_metadata_tags.c | 2 +-
 src/decoder_flac.c            | 4 ++--
 src/decoder_opus.c            | 2 +-
 src/decoder_sinewave.c        | 2 +-
 src/decoder_stb_vorbis.c      | 2 +-
 src/decoder_wavpack.c         | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/SDL_mixer.c b/src/SDL_mixer.c
index f2648b16..333119ff 100644
--- a/src/SDL_mixer.c
+++ b/src/SDL_mixer.c
@@ -630,7 +630,7 @@ bool MIX_Generate(MIX_Mixer *mixer, void *buffer, int buflen)
 
 static void InitDecoders(void)
 {
-    for (int i = 0; i < SDL_arraysize(decoders); i++) {
+    for (size_t i = 0; i < SDL_arraysize(decoders); i++) {
         const MIX_Decoder *decoder = decoders[i];
         if (!decoder->init || decoder->init()) {
             available_decoders[num_available_decoders++] = decoder;
diff --git a/src/SDL_mixer_metadata_tags.c b/src/SDL_mixer_metadata_tags.c
index 8a7b2611..1e89253d 100644
--- a/src/SDL_mixer_metadata_tags.c
+++ b/src/SDL_mixer_metadata_tags.c
@@ -199,7 +199,7 @@ static Sint32 get_id3v2_len(const Uint8 *data, size_t length)
     size += ID3v2_HEADER_SIZE; // header size
     // ID3v2 header[5] is flags (bits 4-7 only, 0-3 are zero).
     // bit 4 set: footer is present (a copy of the header but
-    // with "3DI" as ident.) 
+    // with "3DI" as ident.)
     if (data[5] & 0x10) {
         size += ID3v2_HEADER_SIZE; // footer size
     }
diff --git a/src/decoder_flac.c b/src/decoder_flac.c
index c67908d6..93a83ec7 100644
--- a/src/decoder_flac.c
+++ b/src/decoder_flac.c
@@ -209,7 +209,7 @@ static FLAC__StreamDecoderWriteStatus FLAC_IoWrite(const FLAC__StreamDecoder *de
 
     if (amount > 0) {
         void *channel_arrays[32];
-        SDL_assert(SDL_arraysize(channel_arrays) >= channels);
+        SDL_assert(SDL_arraysize(channel_arrays) >= (size_t)channels);
 
         // (If we padded out to 5.1 to get a front-center channel, the unnecessary channels happen
         //   to be at the end, so it'll assume those padded channels are silent.)
@@ -223,7 +223,7 @@ static FLAC__StreamDecoderWriteStatus FLAC_IoWrite(const FLAC__StreamDecoder *de
             for (int channel = 0; channel < channels; channel++) { \
                 const Sint32 *src = (const Sint32 *) buffer[channel]; \
                 typ *dst = (typ *) channel_arrays[channel]; \
-                for (int i = 0; i < amount; i++) { \
+                for (size_t i = 0; i < amount; i++) { \
                     dst[i] = (typ) (src[i] << shift); \
                 } \
             } \
diff --git a/src/decoder_opus.c b/src/decoder_opus.c
index c7bbeb0d..f181dc28 100644
--- a/src/decoder_opus.c
+++ b/src/decoder_opus.c
@@ -234,7 +234,7 @@ static bool SDLCALL OPUS_decode(void *track_userdata, SDL_AudioStream *stream)
         return false;  // EOF
     }
 
-    SDL_assert((amount * channels) <= SDL_arraysize(samples));
+    SDL_assert((amount * channels) <= (int)SDL_arraysize(samples));
 
     if (bitstream != tdata->current_bitstream) {
         const OpusHead *info = opus.op_head(tdata->of, -1);
diff --git a/src/decoder_sinewave.c b/src/decoder_sinewave.c
index b394f422..91992733 100644
--- a/src/decoder_sinewave.c
+++ b/src/decoder_sinewave.c
@@ -100,7 +100,7 @@ static bool SDLCALL SINEWAVE_decode(void *track_userdata, SDL_AudioStream *strea
     int current_sine_sample = tdata->current_sine_sample;
     float samples[256];
 
-    for (int i = 0; i < SDL_arraysize(samples); i++) {
+    for (size_t i = 0; i < SDL_arraysize(samples); i++) {
         const float phase = current_sine_sample * hz / fsample_rate;
         samples[i] = SDL_sinf(phase * 2.0f * SDL_PI_F) * amplitude;
         current_sine_sample++;
diff --git a/src/decoder_stb_vorbis.c b/src/decoder_stb_vorbis.c
index cc1b6cdd..6d21a5fb 100644
--- a/src/decoder_stb_vorbis.c
+++ b/src/decoder_stb_vorbis.c
@@ -237,7 +237,7 @@ static bool SDLCALL STBVORBIS_decode(void *track_userdata, SDL_AudioStream *stre
             tdata->skip_samples -= amount;
             return true;  // throw this all away; just try again next iteration.
         }
-        SDL_assert(num_channels <= SDL_arraysize(outputs));
+        SDL_assert(num_channels <= (int)SDL_arraysize(outputs));
         for (int i = 0; i < num_channels; i++) {
             outputs[i] = pcm_channels[i] + skip;
         }
diff --git a/src/decoder_wavpack.c b/src/decoder_wavpack.c
index 5b93c86c..f3fd0ace 100644
--- a/src/decoder_wavpack.c
+++ b/src/decoder_wavpack.c
@@ -410,7 +410,7 @@ static bool SDLCALL WAVPACK_init_audio(SDL_IOStream *io, SDL_AudioSpec *spec, SD
 
     adata->wvcdata = wvcdata;
     adata->wvcdatalen = wvcdatalen;
-    adata->numsamples = 
+    adata->numsamples =
     #if !defined(WAVPACK4_OR_OLDER) || defined(WAVPACK_DYNAMIC)
       wavpack.WavpackGetNumSamples64 ? wavpack.WavpackGetNumSamples64(ctx) :
     #endif