Port member initialization from constructor to declaration (C++11)

Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
This commit is contained in:
Rémi Verschelde
2020-05-12 17:01:17 +02:00
parent e7c9d81876
commit 1f6f364a56
325 changed files with 1689 additions and 3480 deletions

View File

@@ -49,7 +49,7 @@ class AudioEffectRecordInstance : public AudioEffectInstance {
bool is_recording;
Thread *io_thread;
bool thread_active;
bool thread_active = false;
Vector<AudioFrame> ring_buffer;
Vector<float> recording_data;
@@ -71,8 +71,7 @@ public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count);
virtual bool process_silence() const;
AudioEffectRecordInstance() :
thread_active(false) {}
AudioEffectRecordInstance() {}
~AudioEffectRecordInstance();
};

View File

@@ -31,7 +31,9 @@
// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
#include "reverb.h"
#include "core/math/math_funcs.h"
#include <math.h>
const float Reverb::comb_tunings[MAX_COMBS] = {
@@ -338,11 +340,8 @@ Reverb::Reverb() {
params.predelay = 150;
params.predelay_fb = 0.4;
params.hpf = 0;
hpf_h1 = 0;
hpf_h2 = 0;
input_buffer = memnew_arr(float, INPUT_BUFFER_MAX_SIZE);
echo_buffer = nullptr;
configure_buffers();
update_parameters();

View File

@@ -58,44 +58,34 @@ private:
struct Comb {
int size;
float *buffer;
float feedback;
float damp; //lowpass
float damp_h; //history
int pos;
int extra_spread_frames;
int size = 0;
float *buffer = nullptr;
float feedback = 0;
float damp = 0; //lowpass
float damp_h = 0; //history
int pos = 0;
int extra_spread_frames = 0;
Comb() {
size = 0;
buffer = 0;
feedback = 0;
damp_h = 0;
pos = 0;
}
Comb() {}
};
struct AllPass {
int size;
float *buffer;
int pos;
int extra_spread_frames;
AllPass() {
size = 0;
buffer = 0;
pos = 0;
}
int size = 0;
float *buffer = nullptr;
int pos = 0;
int extra_spread_frames = 0;
AllPass() {}
};
Comb comb[MAX_COMBS];
AllPass allpass[MAX_ALLPASS];
float *input_buffer;
float *echo_buffer;
float *echo_buffer = nullptr;
int echo_buffer_size;
int echo_buffer_pos;
float hpf_h1, hpf_h2;
float hpf_h1, hpf_h2 = 0;
struct Parameters {