Skip to content

Commit c0c0729

Browse files
committed
Reduce calls to getChildElement
Call `getChildElement` only once, keeping the pointer for the following calls. This was done to reduce the number of warnings that `size_t` is converted to `int` with possible loss of data.
1 parent c4f1cec commit c0c0729

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Source/MixerComponent.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,11 @@ void MixerComponent::restoreFromXml(const juce::XmlElement& element)
183183
{
184184
for (size_t i = 0; i < m_channelSliders.size(); i++)
185185
{
186-
juce::String value = element.getChildElement(i)->getAllSubText().trim();
186+
const juce::XmlElement* childElement = element.getChildElement(i);
187+
juce::String value = childElement->getAllSubText().trim();
187188
m_channelSliders[i]->setValue(value.getFloatValue());
188-
m_channelSliders[i]->setSolo(element.getChildElement(i)->getBoolAttribute("solo"));
189-
m_channelSliders[i]->setMute(element.getChildElement(i)->getBoolAttribute("mute"));
189+
m_channelSliders[i]->setSolo(childElement->getBoolAttribute("solo"));
190+
m_channelSliders[i]->setMute(childElement->getBoolAttribute("mute"));
190191
}
191192
}
192193
void MixerComponent::outputChannelNamesReset() {}

0 commit comments

Comments
 (0)