aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-18 14:11:15 -0700
committerChris Robinson <[email protected]>2017-04-18 14:11:15 -0700
commit55011d4bfd46c920580d1aa6663bcfdb1e996d3e (patch)
tree67040a4f7e98acedc060930e146854f61dd8e71b /Alc/ALc.c
parentde62ab97e912525f20272153f6a4c896e833839d (diff)
Use a different way to get the size of structs with flexible array members
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index a352cacd..ecd8fd0d 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2501,7 +2501,7 @@ static ALvoid InitContext(ALCcontext *Context)
InitUIntMap(&Context->SourceMap, Context->Device->SourcesMax);
InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax);
- auxslots = al_calloc(DEF_ALIGN, offsetof(struct ALeffectslotArray, slot[0]));
+ auxslots = al_calloc(DEF_ALIGN, sizeof(struct ALeffectslotArray));
auxslots->count = 0;
ATOMIC_INIT(&Context->ActiveAuxSlots, auxslots);
@@ -2725,8 +2725,8 @@ void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends)
* property set (including the dynamically-sized Send[] array) in one
* chunk.
*/
- sizeof_props = RoundUp(offsetof(struct ALvoiceProps, Send[num_sends]), 16);
- sizeof_voice = RoundUp(offsetof(ALvoice, Send[num_sends]), 16);
+ sizeof_props = RoundUp(FAM_SIZE(struct ALvoiceProps, Send, num_sends), 16);
+ sizeof_voice = RoundUp(FAM_SIZE(ALvoice, Send, num_sends), 16);
size = sizeof(ALvoice*) + sizeof_voice + sizeof_props;
voices = al_calloc(16, RoundUp(size*num_voices, 16));