1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-17 16:11:11 +02:00

Define sampleCount as a class, not a type alias...

... Define lots of operators for disambiguation, but they will go away after
all conversions from sampleCount to built-in numerical types are forced
to be explicit.
This commit is contained in:
Paul Licameli
2016-08-20 21:57:55 -04:00
parent fbfee42a00
commit 26b5e77050
7 changed files with 253 additions and 17 deletions

View File

@@ -517,10 +517,10 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat,
// UNSAFE_SAMPLE_COUNT_TRUNCATION
// -- but used only experimentally as of this writing
// Is there a proof size_t will not overflow?
const auto hitStartInCache = FFMAX(0,start-mDecodeCache[i]->start);
const auto hitStartInCache = FFMAX(sampleCount{0},start-mDecodeCache[i]->start);
//we also need to find out which end was hit - if it is the tail only we need to update from a later index.
const auto hitStartInRequest = start < mDecodeCache[i]->start
? len - samplesHit : 0;
? len - samplesHit : sampleCount{ 0 };
for(decltype(samplesHit) j = 0; j < samplesHit; j++)
{
const auto outIndex = hitStartInRequest + j;