1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Bug 2351 - Selection toolbar displays incorrect number of samples beyond 2^31 -1

This commit is contained in:
Leland Lucius 2021-02-13 12:42:41 -06:00
parent 8fdb18427e
commit d21b13a8e1

View File

@ -1019,7 +1019,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
}
for(i = 0; i < mFields.size(); i++) {
int value = -1;
long long value = -1;
if (mFields[i].frac) {
// JKC: This old code looks bogus to me.
@ -1027,7 +1027,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
//value = (int)(t_frac * mFields[i].base + 0.5); // +0.5 as rounding required
// I did the rounding earlier.
if (t_frac >= 0)
value = (int)(t_frac * mFields[i].base);
value = t_frac * mFields[i].base;
// JKC: TODO: Find out what the range is supposed to do.
// It looks bogus too.
//if (mFields[i].range > 0)
@ -1035,9 +1035,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
}
else {
if (t_int >= 0) {
// UNSAFE_SAMPLE_COUNT_TRUNCATION
// truncation danger!
value = (t_int.as_long_long() / mFields[i].base);
value = t_int.as_long_long() / mFields[i].base;
if (mFields[i].range > 0)
value = value % mFields[i].range;
}
@ -1049,7 +1047,7 @@ void NumericConverter::ValueToControls(double rawValue, bool nearest /* = true *
field += wxT("-");
}
else
field = wxString::Format(mFields[i].formatStr, value);
field = wxString::Format(mFields[i].formatStr, (int) value);
mValueString += field;
mValueString += mFields[i].label;
}