cppcheck reported that unsupported curve types could leave entries in the
frequency curve array uninitialized before being passed to the FIR generator.
Add a default switch case to initialize curve samples to zero and avoid
propagating undefined values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix cppcheck warnings where array elements were accessed before validating
their indices. Reorder conditional expressions to ensure bounds checks are
performed before array accesses, taking advantage of C++ short-circuit
evaluation.
In EMNR::NP::interpM(), check the index limit before accessing xvals[idx].
In SNBA::scanFrame(), verify i is within the merit array bounds before
evaluating merit[i].
These changes improve defensive programming practices and prevent potential
undefined behavior if an index exceeds the valid range. No functional changes.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Correct std::fill() calls in SPHP::flush() that used x0.end() as the
end iterator when clearing x1, y0, and y1.
The incorrect ranges were likely introduced by a copy/paste error and
resulted in iterator pairs from different containers being used
together, causing undefined behavior.
Use each buffer's own end iterator when clearing its contents.
Detected by cppcheck's mismatchingContainer check.
Signed-off-by: Robin Getz <rgetz503@gmail.com>