diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 1fd9d1ffbb..62a229489a 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -700,12 +700,10 @@ void AudioDeviceManager::audioDeviceIOCallbackInt (const float** inputChannelDat for (int chan = 0; chan < numOutputChannels; ++chan) { - const float* const src = tempChans [chan]; - float* const dst = outputChannelData [chan]; - - if (src != nullptr && dst != nullptr) - for (int j = 0; j < numSamples; ++j) - dst[j] += src[j]; + if (const float* const src = tempChans [chan]) + if (float* const dst = outputChannelData [chan]) + for (int j = 0; j < numSamples; ++j) + dst[j] += src[j]; } } diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp index 473f1a17a4..795cfebe2b 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -75,11 +75,11 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, if (source != nullptr) { - int i, numActiveChans = 0, numInputs = 0, numOutputs = 0; + int numActiveChans = 0, numInputs = 0, numOutputs = 0; // messy stuff needed to compact the channels down into an array // of non-zero pointers.. - for (i = 0; i < totalNumInputChannels; ++i) + for (int i = 0; i < totalNumInputChannels; ++i) { if (inputChannelData[i] != nullptr) { @@ -89,7 +89,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, } } - for (i = 0; i < totalNumOutputChannels; ++i) + for (int i = 0; i < totalNumOutputChannels; ++i) { if (outputChannelData[i] != nullptr) { @@ -107,14 +107,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, tempBuffer.setSize (numInputs - numOutputs, numSamples, false, false, true); - for (i = 0; i < numOutputs; ++i) + for (int i = 0; i < numOutputs; ++i) { channels[numActiveChans] = outputChans[i]; memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); ++numActiveChans; } - for (i = numOutputs; i < numInputs; ++i) + for (int i = numOutputs; i < numInputs; ++i) { channels[numActiveChans] = tempBuffer.getSampleData (i - numOutputs, 0); memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); @@ -123,14 +123,14 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, } else { - for (i = 0; i < numInputs; ++i) + for (int i = 0; i < numInputs; ++i) { channels[numActiveChans] = outputChans[i]; memcpy (channels[numActiveChans], inputChans[i], sizeof (float) * (size_t) numSamples); ++numActiveChans; } - for (i = numInputs; i < numOutputs; ++i) + for (int i = numInputs; i < numOutputs; ++i) { channels[numActiveChans] = outputChans[i]; zeromem (channels[numActiveChans], sizeof (float) * (size_t) numSamples); @@ -143,7 +143,7 @@ void AudioSourcePlayer::audioDeviceIOCallback (const float** inputChannelData, AudioSourceChannelInfo info (&buffer, 0, numSamples); source->getNextAudioBlock (info); - for (i = info.buffer->getNumChannels(); --i >= 0;) + for (int i = info.buffer->getNumChannels(); --i >= 0;) buffer.applyGainRamp (i, info.startSample, info.numSamples, lastGain, gain); lastGain = gain; diff --git a/modules/juce_core/text/juce_String.h b/modules/juce_core/text/juce_String.h index bcb2b1d666..05c97ddc75 100644 --- a/modules/juce_core/text/juce_String.h +++ b/modules/juce_core/text/juce_String.h @@ -647,7 +647,7 @@ public: */ String fromFirstOccurrenceOf (const String& substringToStartFrom, bool includeSubStringInResult, - bool ignoreCase) const; + bool ignoreCase) const; /** Returns a section of the string starting from the last occurrence of a given substring. diff --git a/modules/juce_gui_basics/application/juce_Application.cpp b/modules/juce_gui_basics/application/juce_Application.cpp index a04cf021a0..302dcd6189 100644 --- a/modules/juce_gui_basics/application/juce_Application.cpp +++ b/modules/juce_gui_basics/application/juce_Application.cpp @@ -117,8 +117,8 @@ void JUCEApplication::sendUnhandledException (const std::exception* const e, const char* const sourceFile, const int lineNumber) { - if (JUCEApplicationBase::getInstance() != nullptr) - JUCEApplicationBase::getInstance()->unhandledException (e, sourceFile, lineNumber); + if (JUCEApplicationBase* const app = JUCEApplicationBase::getInstance()) + app->unhandledException (e, sourceFile, lineNumber); } //============================================================================== diff --git a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp index 33d7d57299..57115bba05 100644 --- a/modules/juce_gui_basics/widgets/juce_ComboBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ComboBox.cpp @@ -23,8 +23,8 @@ ============================================================================== */ -ComboBox::ItemInfo::ItemInfo (const String& name_, int itemId_, bool isEnabled_, bool isHeading_) - : name (name_), itemId (itemId_), isEnabled (isEnabled_), isHeading (isHeading_) +ComboBox::ItemInfo::ItemInfo (const String& nm, int iid, bool enabled, bool heading) + : name (nm), itemId (iid), isEnabled (enabled), isHeading (heading) { } @@ -148,9 +148,7 @@ void ComboBox::addSectionHeading (const String& headingName) void ComboBox::setItemEnabled (const int itemId, const bool shouldBeEnabled) { - ItemInfo* const item = getItemForId (itemId); - - if (item != nullptr) + if (ItemInfo* const item = getItemForId (itemId)) item->isEnabled = shouldBeEnabled; } @@ -162,12 +160,10 @@ bool ComboBox::isItemEnabled (int itemId) const noexcept void ComboBox::changeItemText (const int itemId, const String& newText) { - ItemInfo* const item = getItemForId (itemId); - - jassert (item != nullptr); - - if (item != nullptr) + if (ItemInfo* const item = getItemForId (itemId)) item->name = newText; + else + jassertfalse; } void ComboBox::clear (const bool dontSendChangeMessage) @@ -219,16 +215,18 @@ int ComboBox::getNumItems() const noexcept String ComboBox::getItemText (const int index) const { - const ItemInfo* const item = getItemForIndex (index); + if (const ItemInfo* const item = getItemForIndex (index)) + return item->name; - return item != nullptr ? item->name : String::empty; + return String::empty; } int ComboBox::getItemId (const int index) const noexcept { - const ItemInfo* const item = getItemForIndex (index); + if (const ItemInfo* const item = getItemForIndex (index)) + return item->itemId; - return item != nullptr ? item->itemId : 0; + return 0; } int ComboBox::indexOfItemId (const int itemId) const noexcept @@ -292,12 +290,13 @@ void ComboBox::setSelectedId (const int newItemId, const bool dontSendChangeMess bool ComboBox::selectIfEnabled (const int index) { - const ItemInfo* const item = getItemForIndex (index); - - if (item != nullptr && item->isEnabled) + if (const ItemInfo* const item = getItemForIndex (index)) { - setSelectedItemIndex (index); - return true; + if (item->isEnabled) + { + setSelectedItemIndex (index); + return true; + } } return false;