From dac33b436923a716415e7dd8617010a6fd90b4e5 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 25 Oct 2026 15:58:53 -0400
Subject: [PATCH] audio: SDL_AUDIO_FRAMESIZE "returns" an unsigned int.
Otherwise, this macro would always trigger a `-Wsign-conversion` warning,
since it multiplies an unsigned int by a signed int.
Fixes #16539.
---
include/SDL3/SDL_audio.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h
index 5f5d586c920c4..af5fc9585ed56 100644
--- a/include/SDL3/SDL_audio.h
+++ b/include/SDL3/SDL_audio.h
@@ -415,6 +415,8 @@ typedef struct SDL_AudioSpec
* This reports on the size of an audio sample frame: stereo Sint16 data (2
* channels of 2 bytes each) would be 4 bytes per frame, for example.
*
+ * This casts the value to unsigned int to avoid implicit sign conversion.
+ *
* \param x an SDL_AudioSpec to query.
* \returns the number of bytes used per sample frame.
*
@@ -422,7 +424,7 @@ typedef struct SDL_AudioSpec
*
* \since This macro is available since SDL 3.2.0.
*/
-#define SDL_AUDIO_FRAMESIZE(x) (SDL_AUDIO_BYTESIZE((x).format) * (x).channels)
+#define SDL_AUDIO_FRAMESIZE(x) (((unsigned int)SDL_AUDIO_BYTESIZE((x).format)) * ((unsigned int)((x).channels)))
/**
* The opaque handle that represents an audio stream.