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