mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-13 08:06:32 +01:00
Common function limits buffer size to sampleCount known to be small
This commit is contained in:
@@ -110,16 +110,13 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
|
||||
while (position < s1)
|
||||
{
|
||||
// Get a block of data into the buffers
|
||||
sampleCount block = mTrack0->GetBestBlockSize(position);
|
||||
if (position + block > s1)
|
||||
{
|
||||
block = s1 - position;
|
||||
}
|
||||
const auto block = limitSampleBufferSize(
|
||||
mTrack0->GetBestBlockSize(position), s1 - position
|
||||
);
|
||||
mTrack0->Get((samplePtr)buff0, floatSample, position, block);
|
||||
mTrack1->Get((samplePtr)buff1, floatSample, position, block);
|
||||
|
||||
int buffPos = 0;
|
||||
for (buffPos = 0; buffPos < block; ++buffPos)
|
||||
for (decltype(+block) buffPos = 0; buffPos < block; ++buffPos)
|
||||
{
|
||||
if (CompareSample(buff0[buffPos], buff1[buffPos]) > errorThreshold)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user