mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed some coverity warnings.
This commit is contained in:
parent
e05393c36d
commit
01e3e4c40c
19 changed files with 74 additions and 54 deletions
|
|
@ -35,6 +35,7 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* source_,
|
|||
bufferValidStart (0),
|
||||
bufferValidEnd (0),
|
||||
nextPlayPos (0),
|
||||
sampleRate (0),
|
||||
wasSourceLooping (false),
|
||||
isPrepared (false)
|
||||
{
|
||||
|
|
@ -208,42 +209,40 @@ bool BufferingAudioSource::readNextBufferChunk()
|
|||
}
|
||||
}
|
||||
|
||||
if (sectionToReadStart != sectionToReadEnd)
|
||||
if (sectionToReadStart == sectionToReadEnd)
|
||||
return false;
|
||||
|
||||
jassert (buffer.getNumSamples() > 0);
|
||||
const int bufferIndexStart = (int) (sectionToReadStart % buffer.getNumSamples());
|
||||
const int bufferIndexEnd = (int) (sectionToReadEnd % buffer.getNumSamples());
|
||||
|
||||
if (bufferIndexStart < bufferIndexEnd)
|
||||
{
|
||||
jassert (buffer.getNumSamples() > 0);
|
||||
const int bufferIndexStart = (int) (sectionToReadStart % buffer.getNumSamples());
|
||||
const int bufferIndexEnd = (int) (sectionToReadEnd % buffer.getNumSamples());
|
||||
readBufferSection (sectionToReadStart,
|
||||
(int) (sectionToReadEnd - sectionToReadStart),
|
||||
bufferIndexStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
||||
|
||||
if (bufferIndexStart < bufferIndexEnd)
|
||||
{
|
||||
readBufferSection (sectionToReadStart,
|
||||
(int) (sectionToReadEnd - sectionToReadStart),
|
||||
bufferIndexStart);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
||||
readBufferSection (sectionToReadStart,
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
|
||||
readBufferSection (sectionToReadStart,
|
||||
initialSize,
|
||||
bufferIndexStart);
|
||||
|
||||
readBufferSection (sectionToReadStart + initialSize,
|
||||
(int) (sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
}
|
||||
readBufferSection (sectionToReadStart + initialSize,
|
||||
(int) (sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||
0);
|
||||
}
|
||||
|
||||
{
|
||||
const ScopedLock sl2 (bufferStartPosLock);
|
||||
|
||||
bufferValidStart = newBVS;
|
||||
bufferValidEnd = newBVE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void BufferingAudioSource::readBufferSection (const int64 start, const int length, const int bufferOffset)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue