mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
Bug1784: Changed conditions for exceptions from Sequence...
... That for SetSamples was too strict, making needless errors in case of harmless zero-length clips. The one for Get was analogous to SetSamples. That for Delete was too lax. But reexamination shows the stricter condition to be satisfied in all calls. Sequence::Delete() can be reached only from WaveClip::Clear and WaveClip::ClearAndAddCutLine(), and all calls to those are in WaveTrack.cpp.
This commit is contained in:
parent
6e72aed6a5
commit
92691d8485
@ -1123,8 +1123,7 @@ bool Sequence::Get(samplePtr buffer, sampleFormat format,
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
if (start < 0 || start > mNumSamples ||
|
||||
start + len > mNumSamples) {
|
||||
if (start < 0 || start + len > mNumSamples) {
|
||||
if (mayThrow)
|
||||
THROW_INCONSISTENCY_EXCEPTION;
|
||||
ClearSamples( buffer, floatSample, 0, len );
|
||||
@ -1164,8 +1163,7 @@ void Sequence::SetSamples(samplePtr buffer, sampleFormat format,
|
||||
{
|
||||
const auto size = mBlock.size();
|
||||
|
||||
if (start < 0 || start >= mNumSamples ||
|
||||
start + len > mNumSamples)
|
||||
if (start < 0 || start + len > mNumSamples)
|
||||
THROW_INCONSISTENCY_EXCEPTION;
|
||||
|
||||
size_t tempSize = mMaxSamples;
|
||||
@ -1660,7 +1658,7 @@ void Sequence::Delete(sampleCount start, sampleCount len)
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
if (len < 0 || start < 0 || start >= mNumSamples)
|
||||
if (len < 0 || start < 0 || start + len > mNumSamples)
|
||||
THROW_INCONSISTENCY_EXCEPTION;
|
||||
|
||||
//TODO: add a ref-deref mechanism to SeqBlock/BlockArray so we don't have to make this a critical section.
|
||||
|
Loading…
x
Reference in New Issue
Block a user