From 5a20743a03c05e1fdf35713874890e892c734676 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 11 Oct 2020 10:08:03 +1000 Subject: [PATCH] Core Audio: Fix a compilation warning. --- miniaudio.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 853fd548..08f259e3 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -22828,7 +22828,14 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout* Need to use the tag to determine the channel map. For now I'm just assuming a default channel map, but later on this should be updated to determine the mapping based on the tag. */ - UInt32 channelCount = ma_min(AudioChannelLayoutTag_GetNumberOfChannels(pChannelLayout->mChannelLayoutTag), channelMapCap); + UInt32 channelCount; + + /* Our channel map retrieval APIs below take 32-bit integers, so we'll want to clamp the channel map capacity. */ + if (channelMapCap > 0xFFFFFFFF) { + channelMapCap = 0xFFFFFFFF; + } + + channelCount = ma_min(AudioChannelLayoutTag_GetNumberOfChannels(pChannelLayout->mChannelLayoutTag), (UInt32)channelMapCap); switch (pChannelLayout->mChannelLayoutTag) {