From 05af7d2ec631b2d929a64fcb235aac7ba5ee3c93 Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Wed, 11 Dec 2024 20:33:49 +0000 Subject: [PATCH] Made the pointer to the biquads constant so that they can't be modified. --- iir/Cascade.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/iir/Cascade.h b/iir/Cascade.h index 981c767..747563b 100644 --- a/iir/Cascade.h +++ b/iir/Cascade.h @@ -58,8 +58,9 @@ namespace Iir { **/ struct IIR_EXPORT Storage { - int maxStages = 0; - Biquad* stageArray = nullptr; + Storage(const int maxNumBiquads, Biquad* const biquadArray) : maxStages(maxNumBiquads), stageArray(biquadArray) {} + const int maxStages = 0; + Biquad* const stageArray = nullptr; }; /** @@ -166,10 +167,8 @@ namespace Iir { **/ const Cascade::Storage getCascadeStorage() { - Cascade::Storage s; - s.maxStages = MaxStages; - s.stageArray = m_stages; - return s; + const Cascade::Storage s(MaxStages, m_stages); + return s; } private: