diff options
author | Chris Robinson <[email protected]> | 2017-04-18 14:11:15 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-04-18 14:11:15 -0700 |
commit | 55011d4bfd46c920580d1aa6663bcfdb1e996d3e (patch) | |
tree | 67040a4f7e98acedc060930e146854f61dd8e71b /Alc/ALc.c | |
parent | de62ab97e912525f20272153f6a4c896e833839d (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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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)); |