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
|
|
@ -38,10 +38,8 @@ public:
|
||||||
sampleRate (0),
|
sampleRate (0),
|
||||||
isRunning (false),
|
isRunning (false),
|
||||||
resultsBox (resultsBox_)
|
resultsBox (resultsBox_)
|
||||||
{
|
deviceInputLatency (0),
|
||||||
}
|
deviceOutputLatency (0)
|
||||||
|
|
||||||
~LatencyTester()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ class SineWaveVoice : public SynthesiserVoice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SineWaveVoice()
|
SineWaveVoice()
|
||||||
: angleDelta (0.0),
|
: currentAngle (0), angleDelta (0), level (0), tailOff (0)
|
||||||
tailOff (0.0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,9 +246,8 @@ public:
|
||||||
|
|
||||||
void changeListenerCallback (ChangeBroadcaster* source)
|
void changeListenerCallback (ChangeBroadcaster* source)
|
||||||
{
|
{
|
||||||
ColourSelector* cs = dynamic_cast <ColourSelector*> (source);
|
if (ColourSelector* cs = dynamic_cast <ColourSelector*> (source))
|
||||||
|
setColour (TextButton::buttonColourId, cs->getCurrentColour());
|
||||||
setColour (TextButton::buttonColourId, cs->getCurrentColour());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
IIRFilter::IIRFilter()
|
IIRFilter::IIRFilter()
|
||||||
: active (false), v1 (0), v2 (0)
|
: active (false), v1 (0), v2 (0)
|
||||||
{
|
{
|
||||||
|
zeromem (coefficients, sizeof (coefficients));
|
||||||
}
|
}
|
||||||
|
|
||||||
IIRFilter::IIRFilter (const IIRFilter& other)
|
IIRFilter::IIRFilter (const IIRFilter& other)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,10 @@ private:
|
||||||
class CombFilter
|
class CombFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CombFilter() noexcept : bufferSize (0), bufferIndex (0) {}
|
CombFilter() noexcept
|
||||||
|
: bufferSize (0), bufferIndex (0),
|
||||||
|
feedback (0), last (0), damp1 (0), damp2 (0)
|
||||||
|
{}
|
||||||
|
|
||||||
void setSize (const int size)
|
void setSize (const int size)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* source_,
|
||||||
bufferValidStart (0),
|
bufferValidStart (0),
|
||||||
bufferValidEnd (0),
|
bufferValidEnd (0),
|
||||||
nextPlayPos (0),
|
nextPlayPos (0),
|
||||||
|
sampleRate (0),
|
||||||
wasSourceLooping (false),
|
wasSourceLooping (false),
|
||||||
isPrepared (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);
|
readBufferSection (sectionToReadStart,
|
||||||
const int bufferIndexStart = (int) (sectionToReadStart % buffer.getNumSamples());
|
(int) (sectionToReadEnd - sectionToReadStart),
|
||||||
const int bufferIndexEnd = (int) (sectionToReadEnd % buffer.getNumSamples());
|
bufferIndexStart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
||||||
|
|
||||||
if (bufferIndexStart < bufferIndexEnd)
|
readBufferSection (sectionToReadStart,
|
||||||
{
|
initialSize,
|
||||||
readBufferSection (sectionToReadStart,
|
bufferIndexStart);
|
||||||
(int) (sectionToReadEnd - sectionToReadStart),
|
|
||||||
bufferIndexStart);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const int initialSize = buffer.getNumSamples() - bufferIndexStart;
|
|
||||||
|
|
||||||
readBufferSection (sectionToReadStart,
|
readBufferSection (sectionToReadStart + initialSize,
|
||||||
initialSize,
|
(int) (sectionToReadEnd - sectionToReadStart) - initialSize,
|
||||||
bufferIndexStart);
|
0);
|
||||||
|
}
|
||||||
readBufferSection (sectionToReadStart + initialSize,
|
|
||||||
(int) (sectionToReadEnd - sectionToReadStart) - initialSize,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{
|
||||||
const ScopedLock sl2 (bufferStartPosLock);
|
const ScopedLock sl2 (bufferStartPosLock);
|
||||||
|
|
||||||
bufferValidStart = newBVS;
|
bufferValidStart = newBVS;
|
||||||
bufferValidEnd = newBVE;
|
bufferValidEnd = newBVE;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferingAudioSource::readBufferSection (const int64 start, const int length, const int bufferOffset)
|
void BufferingAudioSource::readBufferSection (const int64 start, const int length, const int bufferOffset)
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,14 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource,
|
||||||
ratio (1.0),
|
ratio (1.0),
|
||||||
lastRatio (1.0),
|
lastRatio (1.0),
|
||||||
buffer (numChannels_, 0),
|
buffer (numChannels_, 0),
|
||||||
|
bufferPos (0),
|
||||||
sampsInBuffer (0),
|
sampsInBuffer (0),
|
||||||
|
subSampleOffset (0),
|
||||||
numChannels (numChannels_)
|
numChannels (numChannels_)
|
||||||
{
|
{
|
||||||
jassert (input != nullptr);
|
jassert (input != nullptr);
|
||||||
|
|
||||||
|
zeromem (coefficients, sizeof (coefficients));
|
||||||
}
|
}
|
||||||
|
|
||||||
ResamplingAudioSource::~ResamplingAudioSource() {}
|
ResamplingAudioSource::~ResamplingAudioSource() {}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ AudioDeviceManager::AudioDeviceManager()
|
||||||
listNeedsScanning (true),
|
listNeedsScanning (true),
|
||||||
useInputNames (false),
|
useInputNames (false),
|
||||||
inputLevel (0),
|
inputLevel (0),
|
||||||
|
testSoundPosition (0),
|
||||||
tempBuffer (2, 2),
|
tempBuffer (2, 2),
|
||||||
cpuUsageMs (0),
|
cpuUsageMs (0),
|
||||||
timeToCpuScale (0)
|
timeToCpuScale (0)
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,9 @@ bool SamplerSound::appliesToChannel (const int /*midiChannel*/)
|
||||||
SamplerVoice::SamplerVoice()
|
SamplerVoice::SamplerVoice()
|
||||||
: pitchRatio (0.0),
|
: pitchRatio (0.0),
|
||||||
sourceSamplePosition (0.0),
|
sourceSamplePosition (0.0),
|
||||||
lgain (0.0f),
|
lgain (0.0f), rgain (0.0f),
|
||||||
rgain (0.0f),
|
attackReleaseLevel (0), attackDelta (0), releaseDelta (0),
|
||||||
isInAttack (false),
|
isInAttack (false), isInRelease (false)
|
||||||
isInRelease (false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -924,7 +924,9 @@ void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph
|
||||||
AudioProcessorGraph::AudioProcessorGraph()
|
AudioProcessorGraph::AudioProcessorGraph()
|
||||||
: lastNodeId (0),
|
: lastNodeId (0),
|
||||||
renderingBuffers (1, 1),
|
renderingBuffers (1, 1),
|
||||||
currentAudioOutputBuffer (1, 1)
|
currentAudioInputBuffer (nullptr),
|
||||||
|
currentAudioOutputBuffer (1, 1),
|
||||||
|
currentMidiInputBuffer (nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,13 +77,13 @@ class AudioThumbnail::LevelDataSource : public TimeSliceClient
|
||||||
public:
|
public:
|
||||||
LevelDataSource (AudioThumbnail& thumb, AudioFormatReader* newReader, int64 hash)
|
LevelDataSource (AudioThumbnail& thumb, AudioFormatReader* newReader, int64 hash)
|
||||||
: lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0),
|
: lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0),
|
||||||
hashCode (hash), owner (thumb), reader (newReader)
|
hashCode (hash), owner (thumb), reader (newReader), lastReaderUseTime (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LevelDataSource (AudioThumbnail& thumb, InputSource* src)
|
LevelDataSource (AudioThumbnail& thumb, InputSource* src)
|
||||||
: lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0),
|
: lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0),
|
||||||
hashCode (src->hashCode()), owner (thumb), source (src)
|
hashCode (src->hashCode()), owner (thumb), source (src), lastReaderUseTime (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -525,6 +525,7 @@ AudioThumbnail::AudioThumbnail (const int originalSamplesPerThumbnailSample,
|
||||||
window (new CachedWindow()),
|
window (new CachedWindow()),
|
||||||
samplesPerThumbSample (originalSamplesPerThumbnailSample),
|
samplesPerThumbSample (originalSamplesPerThumbnailSample),
|
||||||
totalSamples (0),
|
totalSamples (0),
|
||||||
|
numSamplesFinished (0),
|
||||||
numChannels (0),
|
numChannels (0),
|
||||||
sampleRate (0)
|
sampleRate (0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ private:
|
||||||
struct ObjectHolder
|
struct ObjectHolder
|
||||||
{
|
{
|
||||||
ObjectHolder (const Thread::ThreadID& tid)
|
ObjectHolder (const Thread::ThreadID& tid)
|
||||||
: threadId (tid), object()
|
: threadId (tid), next (nullptr), object()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Thread::ThreadID threadId;
|
Thread::ThreadID threadId;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ PerformanceCounter::PerformanceCounter (const String& name_,
|
||||||
numRuns (0),
|
numRuns (0),
|
||||||
runsPerPrint (runsPerPrintout),
|
runsPerPrint (runsPerPrintout),
|
||||||
totalTime (0),
|
totalTime (0),
|
||||||
|
started (0),
|
||||||
outputFile (loggingFile)
|
outputFile (loggingFile)
|
||||||
{
|
{
|
||||||
if (outputFile != File::nonexistent)
|
if (outputFile != File::nonexistent)
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,18 @@
|
||||||
XmlDocument::XmlDocument (const String& documentText)
|
XmlDocument::XmlDocument (const String& documentText)
|
||||||
: originalText (documentText),
|
: originalText (documentText),
|
||||||
input (nullptr),
|
input (nullptr),
|
||||||
|
outOfData (false),
|
||||||
|
errorOccurred (false),
|
||||||
|
needToLoadDTD (false),
|
||||||
ignoreEmptyTextElements (true)
|
ignoreEmptyTextElements (true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlDocument::XmlDocument (const File& file)
|
XmlDocument::XmlDocument (const File& file)
|
||||||
: input (nullptr),
|
: input (nullptr),
|
||||||
|
outOfData (false),
|
||||||
|
errorOccurred (false),
|
||||||
|
needToLoadDTD (false),
|
||||||
ignoreEmptyTextElements (true),
|
ignoreEmptyTextElements (true),
|
||||||
inputSource (new FileInputSource (file))
|
inputSource (new FileInputSource (file))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,8 @@ public:
|
||||||
storedPathname (storedPath.isEmpty() ? f.getFileName() : storedPath),
|
storedPathname (storedPath.isEmpty() ? f.getFileName() : storedPath),
|
||||||
compressionLevel (compression),
|
compressionLevel (compression),
|
||||||
compressedSize (0),
|
compressedSize (0),
|
||||||
headerStart (0)
|
headerStart (0),
|
||||||
|
checksum (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2612,10 +2612,12 @@ void LookAndFeel::layoutFileBrowserComponent (FileBrowserComponent& browserComp,
|
||||||
|
|
||||||
y += controlsHeight + 4;
|
y += controlsHeight + 4;
|
||||||
|
|
||||||
Component* const listAsComp = dynamic_cast <Component*> (fileListComponent);
|
if (Component* const listAsComp = dynamic_cast <Component*> (fileListComponent))
|
||||||
listAsComp->setBounds (x, y, w, browserComp.getHeight() - y - bottomSectionHeight);
|
{
|
||||||
|
listAsComp->setBounds (x, y, w, browserComp.getHeight() - y - bottomSectionHeight);
|
||||||
|
y = listAsComp->getBottom() + 4;
|
||||||
|
}
|
||||||
|
|
||||||
y = listAsComp->getBottom() + 4;
|
|
||||||
filenameBox->setBounds (x + 50, y, w - 50, controlsHeight);
|
filenameBox->setBounds (x + 50, y, w - 50, controlsHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ public:
|
||||||
ContentComponent (TreeView& tree)
|
ContentComponent (TreeView& tree)
|
||||||
: owner (tree),
|
: owner (tree),
|
||||||
buttonUnderMouse (nullptr),
|
buttonUnderMouse (nullptr),
|
||||||
isDragging (false)
|
isDragging (false),
|
||||||
|
needSelectionOnMouseUp (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -924,7 +925,7 @@ class TreeView::InsertPointHighlight : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InsertPointHighlight()
|
InsertPointHighlight()
|
||||||
: lastItem (nullptr)
|
: lastItem (nullptr), lastIndex (0)
|
||||||
{
|
{
|
||||||
setSize (100, 12);
|
setSize (100, 12);
|
||||||
setAlwaysOnTop (true);
|
setAlwaysOnTop (true);
|
||||||
|
|
@ -1122,6 +1123,8 @@ TreeViewItem::TreeViewItem()
|
||||||
y (0),
|
y (0),
|
||||||
itemHeight (0),
|
itemHeight (0),
|
||||||
totalHeight (0),
|
totalHeight (0),
|
||||||
|
itemWidth (0),
|
||||||
|
totalWidth (0),
|
||||||
selected (false),
|
selected (false),
|
||||||
redrawNeeded (true),
|
redrawNeeded (true),
|
||||||
drawLinesInside (true),
|
drawLinesInside (true),
|
||||||
|
|
@ -1370,7 +1373,7 @@ Rectangle<int> TreeViewItem::getItemPosition (const bool relativeToTreeViewTopLe
|
||||||
|
|
||||||
Rectangle<int> r (indentX, y, jmax (0, width), totalHeight);
|
Rectangle<int> r (indentX, y, jmax (0, width), totalHeight);
|
||||||
|
|
||||||
if (relativeToTreeViewTopLeft)
|
if (relativeToTreeViewTopLeft && ownerView != nullptr)
|
||||||
r -= ownerView->viewport->getViewPosition();
|
r -= ownerView->viewport->getViewPosition();
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BubbleMessageComponent::BubbleMessageComponent (int fadeOutLengthMs)
|
BubbleMessageComponent::BubbleMessageComponent (int fadeOutLengthMs)
|
||||||
: fadeOutLength (fadeOutLengthMs),
|
: fadeOutLength (fadeOutLengthMs), mouseClickCounter (0),
|
||||||
deleteAfterUse (false)
|
expiryTime (0), deleteAfterUse (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SplashScreen::SplashScreen()
|
SplashScreen::SplashScreen()
|
||||||
|
: originalClickCounter (0)
|
||||||
{
|
{
|
||||||
setOpaque (true);
|
setOpaque (true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue