From 5c86dd9153caabab22365a0e4a233a156410e350 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 20 Jul 2025 07:44:06 +1000 Subject: [PATCH 1/2] Fix a possible division by zero error. --- miniaudio.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 29c080c3..9a26d020 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -79022,7 +79022,12 @@ MA_API ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound) MA_API ma_uint64 ma_sound_get_time_in_milliseconds(const ma_sound* pSound) { - return ma_sound_get_time_in_pcm_frames(pSound) * 1000 / ma_engine_get_sample_rate(ma_sound_get_engine(pSound)); + ma_uint32 sampleRate = ma_engine_get_sample_rate(ma_sound_get_engine(pSound)); + if (sampleRate == 0) { + return 0; /* Prevent a division by zero. */ + } + + return ma_sound_get_time_in_pcm_frames(pSound) * 1000 / sampleRate; } MA_API void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping) From 629d50907278cd98b51632d8291cce69f60db31e Mon Sep 17 00:00:00 2001 From: andy5995 Date: Tue, 15 Jul 2025 02:17:48 -0500 Subject: [PATCH 2/2] Fix warning: function declaration without a prototype Harmless warning on FreeBSD 14.2, https://cirrus-ci.com/task/4700955851096064?logs=build#L44 ``` ../subprojects/miniaudio-0.11.22/miniaudio.h:36997:36: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] 36997 | static int ma_open_temp_device__oss() | ^ | void ``` --- miniaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 9a26d020..b2f7b1a5 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -38326,7 +38326,7 @@ OSS Backend #define MA_OSS_DEFAULT_DEVICE_NAME "/dev/dsp" -static int ma_open_temp_device__oss() +static int ma_open_temp_device__oss(void) { /* The OSS sample code uses "/dev/mixer" as the device for getting system properties so I'm going to do the same. */ int fd = open("/dev/mixer", O_RDONLY, 0);