mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-28 15:38:48 +01:00
Identify the few unsafe narrowing conversions from sampleCount...
... I believe this list of four places is exhaustive. There are many, many more safe narrowings that I examined. This resulted from changing the definition of sampleCount in my builds so that narrowing conversions failed to compile without some fixes, and I examined and fixed every place. The rest of that work is not yet shared.
This commit is contained in:
@@ -848,7 +848,9 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
|
||||
}
|
||||
else {
|
||||
if (t_int >= 0) {
|
||||
value = (t_int / mFields[i].base);
|
||||
// UNSAFE_SAMPLE_COUNT_TRUNCATION
|
||||
// truncation danger!
|
||||
value = (static_cast<long long>( t_int ) / mFields[i].base);
|
||||
if (mFields[i].range > 0)
|
||||
value = value % mFields[i].range;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user