Initialize objects to zero using the "new" keyword with () option

This commit is contained in:
Iscle 2022-08-24 11:07:15 +02:00
parent c357e50030
commit deec86c3c3
3 changed files with 4 additions and 7 deletions

View File

@ -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) {

View File

@ -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));
}

View File

@ -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();