Fix uninitialized variables

This commit is contained in:
Jonas Kvinge
2021-03-26 21:30:13 +01:00
parent 8a39a43ad5
commit 14fb647647
27 changed files with 64 additions and 65 deletions

View File

@@ -141,7 +141,7 @@ int Analyzer::Base::resizeExponent(int exp) {
int Analyzer::Base::resizeForBands(int bands) {
int exp;
int exp = 0;
if (bands <= 8)
exp = 4;
else if (bands <= 16)

View File

@@ -164,7 +164,7 @@ void BlockAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bool new_fram
// Paint the background
canvas_painter.drawPixmap(0, 0, background_);
for (int y, x = 0; x < static_cast<int>(scope_.size()); ++x) {
for (int x = 0, y = 0; x < static_cast<int>(scope_.size()); ++x) {
// determine y
for (y = 0; scope_[x] < yscale_[y]; ++y) continue;
@@ -242,7 +242,7 @@ QColor ensureContrast(const QColor &bg, const QColor &fg, int amount) {
public:
explicit OutputOnExit(const QColor &color) : c(color) {}
~OutputOnExit() {
int h, s, v;
int h = 0, s = 0, v = 0;
c.getHsv(&h, &s, &v);
}
@@ -252,8 +252,8 @@ QColor ensureContrast(const QColor &bg, const QColor &fg, int amount) {
OutputOnExit allocateOnTheStack(fg);
int bh, bs, bv;
int fh, fs, fv;
int bh = 0, bs = 0, bv = 0;
int fh = 0, fs = 0, fv = 0;
bg.getHsv(&bh, &bs, &bv);
fg.getHsv(&fh, &fs, &fv);
@@ -347,7 +347,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
// make a complimentary fadebar colour
// TODO dark is not always correct, dumbo!
int h, s, v;
int h = 0, s = 0, v = 0;
palette().color(QPalette::Window).darker(150).getHsv(&h, &s, &v);
const QColor fg2(QColor::fromHsv(h + 120, s, v));

View File

@@ -116,7 +116,7 @@ void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
p.drawPixmap(0, 0, canvas_);
return;
}
double h;
double h = 0.0;
const uint MAX_HEIGHT = height() - 1;
QPainter canvas_painter(&canvas_);
@@ -124,7 +124,7 @@ void BoomAnalyzer::analyze(QPainter& p, const Scope& scope, bool new_frame) {
Analyzer::interpolate(scope, scope_);
for (int i = 0, x = 0, y; i < bands_; ++i, x += kColumnWidth + 1) {
for (int i = 0, x = 0, y = 0; i < bands_; ++i, x += kColumnWidth + 1) {
h = log10(scope_[i] * 256.0) * F_;
if (h > MAX_HEIGHT) h = MAX_HEIGHT;

View File

@@ -68,7 +68,7 @@ void FHT::ewma(float* d, float* s, float w) {
void FHT::logSpectrum(float* out, float* p) {
int n = num_ / 2, i, j, k, *r;
int n = num_ / 2, i = 0, j = 0, k = 0, *r = nullptr;
if (log_vector_.size() < n) {
log_vector_.resize(n);
float f = n / log10(static_cast<double>(n));
@@ -135,8 +135,8 @@ void FHT::transform(float* p) {
void FHT::transform8(float* p) {
float a, b, c, d, e, f, g, h, b_f2, d_h2;
float a_c_eg, a_ce_g, ac_e_g, aceg, b_df_h, bdfh;
float a = 0.0, b = 0.0, c = 0.0, d = 0.0, e = 0.0, f = 0.0, g = 0.0, h = 0.0, b_f2 = 0.0, d_h2 = 0.0;
float a_c_eg = 0.0, a_ce_g = 0.0, ac_e_g = 0.0, aceg = 0.0, b_df_h = 0.0, bdfh = 0.0;
a = *p++, b = *p++, c = *p++, d = *p++;
e = *p++, f = *p++, g = *p++, h = *p;
@@ -169,8 +169,8 @@ void FHT::_transform(float* p, int n, int k) {
return;
}
int i, j, ndiv2 = n / 2;
float a, *t1, *t2, *t3, *t4, *ptab, *pp;
int i = 0, j = 0, ndiv2 = n / 2;
float a = 0.0, *t1 = nullptr, *t2 = nullptr, *t3 = nullptr, *t4 = nullptr, *ptab = nullptr, *pp = nullptr;
for (i = 0, t1 = buf_(), t2 = buf_() + ndiv2, pp = &p[k]; i < ndiv2; i++)
*t1++ = *pp++, *t2++ = *pp++;