summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-08 09:19:16 +0100
committerGitHub <noreply@github.com>2019-11-08 09:19:16 +0100
commit6952fc472741ad2947615b9935559640116f3556 (patch)
tree9499ea81b46b211ff9611a27bbf8c5a4a6f4adea
parent381a5f2138340293b37b4d3180418865d435c114 (diff)
parentfea58321e6f7285bee5937cb10257ca5ddb6dd4a (diff)
Merge pull request #33430 from madmiraal/fix-eq-maybe-uninitialized
Fix r1 (and r2) may be used uninitialized warning in eq.cpp.
-rw-r--r--servers/audio/effects/eq.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/servers/audio/effects/eq.cpp b/servers/audio/effects/eq.cpp
index e8f247d3bc..a9b576b1d9 100644
--- a/servers/audio/effects/eq.cpp
+++ b/servers/audio/effects/eq.cpp
@@ -103,7 +103,9 @@ void EQ::recalculate_band_coefficients() {
//printf("band %i, precoefs = %f,%f,%f\n",i,c2a,c2b,c2c);
- double r1, r2; //roots
+ // Default initializing to silence compiler warning about potential uninitialized use.
+ // Both variables are properly set in _solve_quadratic before use, or we continue if roots == 0.
+ double r1 = 0, r2 = 0; //roots
int roots = solve_quadratic(c2a, c2b, c2c, &r1, &r2);
ERR_CONTINUE(roots == 0);