Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Fix missed conversions after multiplication
Browse files Browse the repository at this point in the history
Corresponds to commit 6c1e159 and a couple of missed CodeQL alerts.

Signed-off-by: Avery King <[email protected]>
  • Loading branch information
generic-pers0n committed Aug 3, 2022
1 parent 6c1e159 commit bea56ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libraries/lib-math/Dither.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void Dither::Apply(enum DitherType ditherType,
// No need to dither, because source and destination
// format are the same. Just copy samples.
if (destStride == 1 && sourceStride == 1)
memcpy(dest, source, len * SAMPLE_SIZE(destFormat));
memcpy(dest, source, static_cast<size_t>(len) * SAMPLE_SIZE(destFormat));
else
{
if (sourceFormat == floatSample)
Expand Down
4 changes: 2 additions & 2 deletions src/SpectrumAnalyst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ float SpectrumAnalyst::GetProcessedValue(float freq0, float freq1) const
float bin0, bin1, binwidth;

if (mAlg == Spectrum) {
bin0 = freq0 * static_cast<float>(mWindowSize) / mRate;
bin1 = freq1 * static_cast<float>(mWindowSize) / mRate;
bin0 = static_cast<float>(freq0) * mWindowSize / mRate;
bin1 = static_cast<float>(freq1) * mWindowSize / mRate;
} else {
bin0 = freq0 * mRate;
bin1 = freq1 * mRate;
Expand Down

0 comments on commit bea56ad

Please sign in to comment.