From deec86c3c31a244f3ee7d829399123b3a838acb6 Mon Sep 17 00:00:00 2001 From: Iscle Date: Wed, 24 Aug 2022 11:07:15 +0200 Subject: [PATCH] Initialize objects to zero using the "new" keyword with () option --- src/cpp/utils/PConvSingle_F32.cpp | 6 ++---- src/cpp/utils/TimeConstDelay.cpp | 3 +-- src/cpp/viper.cpp | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cpp/utils/PConvSingle_F32.cpp b/src/cpp/utils/PConvSingle_F32.cpp index 6ce768b..315d88d 100644 --- a/src/cpp/utils/PConvSingle_F32.cpp +++ b/src/cpp/utils/PConvSingle_F32.cpp @@ -56,8 +56,7 @@ int PConvSingle_F32::LoadKernel(float *buf, int param_2, int segmentSize) { if (param_2 > 0 && segmentSize > 0 && segmentSize % 2 == 0) { this->enabled = false; ReleaseResources(); - this->data = new PConvData; //(PConvData *) malloc(0x140); // TODO: Sizeof - memset(this->data, 0, 0x140); // Ditto + this->data = new PConvData(); //(PConvData *) malloc(0x140); // TODO: Sizeof this->segmentSize = segmentSize; int n = ProcessKernel(buf, param_2, 1); if (n != 0) { @@ -76,8 +75,7 @@ int PConvSingle_F32::LoadKernel(float *buf, float *param_2, int segmentSize, int if (param_5 > 0 && segmentSize > 0 && segmentSize % 2 == 0) { this->enabled = false; ReleaseResources(); - this->data = new PConvData; //(PConvData *) malloc(0x140); // TODO: Sizeof - memset(this->data, 0, 0x140); // Ditto + this->data = new PConvData(); //(PConvData *) malloc(0x140); // TODO: Sizeof this->segmentSize = segmentSize; int n = ProcessKernel(1, param_2, param_4, param_5); if (n != 0) { diff --git a/src/cpp/utils/TimeConstDelay.cpp b/src/cpp/utils/TimeConstDelay.cpp index a62d33b..8ce2d97 100644 --- a/src/cpp/utils/TimeConstDelay.cpp +++ b/src/cpp/utils/TimeConstDelay.cpp @@ -30,7 +30,6 @@ float TimeConstDelay::ProcessSample(float sample) { void TimeConstDelay::SetParameters(uint32_t samplerate, float delay) { this->sampleCount = (int) ((float) samplerate * delay * 0.5f); delete this->samples; - this->samples = new float[this->sampleCount]; + this->samples = new float[this->sampleCount](); this->offset = 0; - memset(this->samples, 0, this->sampleCount * sizeof(float)); } diff --git a/src/cpp/viper.cpp b/src/cpp/viper.cpp index 97730d5..59bf8a8 100644 --- a/src/cpp/viper.cpp +++ b/src/cpp/viper.cpp @@ -106,7 +106,7 @@ int32_t ViperEffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t uuid->node[2], uuid->node[3], uuid->node[4], uuid->node[5]); v4a_print(ANDROID_LOG_INFO, "ViperEffectCreate(), Constructing ProcessUnit_FX"); - auto *pContext = new ViperContext; + auto *pContext = new ViperContext(); pContext->interface = &viper_interface; pContext->effect = new ProcessUnit_FX();