From 3e7d305094ca1b2f934dcf7faf59ebf1a4ea6a9e Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 16 Aug 2014 21:06:27 +0100 Subject: [PATCH] A few minor whitespace cleanups. --- .../codecs/juce_LAMEEncoderAudioFormat.cpp | 4 +-- .../AAX/juce_AAX_Wrapper.cpp | 10 +++---- .../wrapper/juce_ActiveX_GlueCode.cpp | 6 +++-- modules/juce_core/containers/juce_Array.h | 3 +-- .../containers/juce_NamedValueSet.cpp | 7 +++-- .../juce_core/containers/juce_NamedValueSet.h | 6 ++--- modules/juce_core/memory/juce_WeakReference.h | 4 +-- .../juce_core/native/juce_android_Network.cpp | 2 +- .../broadcasters/juce_ActionBroadcaster.cpp | 9 +++---- .../geometry/juce_AffineTransform.h | 27 +++++++++---------- .../components/juce_Component.h | 4 +-- .../layout/juce_ComponentAnimator.cpp | 11 ++++---- .../layout/juce_ComponentAnimator.h | 4 +-- .../layout/juce_ComponentBuilder.cpp | 2 +- .../layout/juce_ComponentBuilder.h | 2 +- .../juce_gui_basics/widgets/juce_ComboBox.h | 2 +- .../windows/juce_AlertWindow.cpp | 17 ++++++------ .../code_editor/juce_CodeEditorComponent.cpp | 12 ++++----- .../juce_gui_extra/misc/juce_ColourSelector.h | 2 +- 19 files changed, 66 insertions(+), 68 deletions(-) diff --git a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp index 5d30d443cf..8a5263cb12 100644 --- a/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_LAMEEncoderAudioFormat.cpp @@ -165,13 +165,13 @@ bool LAMEEncoderAudioFormat::canHandleFile (const File&) Array LAMEEncoderAudioFormat::getPossibleSampleRates() { const int rates[] = { 32000, 44100, 48000, 0 }; - return Array (rates); + return Array (rates); } Array LAMEEncoderAudioFormat::getPossibleBitDepths() { const int depths[] = { 16, 0 }; - return Array (depths); + return Array (depths); } bool LAMEEncoderAudioFormat::canDoStereo() { return true; } diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index aa23881d7f..dc9c3747ff 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -271,7 +271,7 @@ struct AAXClasses { if (component == nullptr) { - if (JuceAAX_Processor* params = dynamic_cast (GetEffectParameters())) + if (JuceAAX_Processor* params = dynamic_cast (GetEffectParameters())) component = new ContentWrapperComponent (*this, params->getPluginInstance()); else jassertfalse; @@ -481,7 +481,7 @@ struct AAXClasses case JUCEAlgorithmIDs::pluginInstance: { const size_t numObjects = dataSize / sizeof (PluginInstanceInfo); - PluginInstanceInfo* const objects = static_cast (data); + PluginInstanceInfo* const objects = static_cast (data); jassert (numObjects == 1); // not sure how to handle more than one.. @@ -496,7 +496,7 @@ struct AAXClasses const_cast(this)->preparePlugin(); const size_t numObjects = dataSize / sizeof (uint32_t); - uint32_t* const objects = static_cast (data); + uint32_t* const objects = static_cast (data); for (size_t i = 0; i < numObjects; ++i) new (objects + i) uint32_t (1); @@ -730,7 +730,7 @@ struct AAXClasses } for (int i = numOuts; i < numIns; ++i) - channels[i] = const_cast (inputs[i]); + channels[i] = const_cast (inputs[i]); process (channels, numIns, bufferSize, bypass, midiNodeIn, midiNodesOut); } @@ -756,7 +756,7 @@ struct AAXClasses } while (v > 0); - return static_cast (t); + return static_cast (t); } private: diff --git a/modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp b/modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp index ca0418bdc0..1b51154bd5 100644 --- a/modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp +++ b/modules/juce_browser_plugin_client/wrapper/juce_ActiveX_GlueCode.cpp @@ -785,8 +785,10 @@ private: //============================================================================== String getActiveXBrowserURL (const BrowserPluginComponent* comp) { - AXBrowserPluginHolderComponent* const ax = dynamic_cast (comp->getParentComponent()); - return ax != nullptr ? ax->getBrowserURL() : String::empty; + if (AXBrowserPluginHolderComponent* ax = dynamic_cast (comp->getParentComponent())) + return ax->getBrowserURL(); + + return String(); } //============================================================================== diff --git a/modules/juce_core/containers/juce_Array.h b/modules/juce_core/containers/juce_Array.h index 375576adc7..8e9cf3f9b0 100644 --- a/modules/juce_core/containers/juce_Array.h +++ b/modules/juce_core/containers/juce_Array.h @@ -65,8 +65,7 @@ private: public: //============================================================================== /** Creates an empty array. */ - Array() noexcept - : numUsed (0) + Array() noexcept : numUsed (0) { } diff --git a/modules/juce_core/containers/juce_NamedValueSet.cpp b/modules/juce_core/containers/juce_NamedValueSet.cpp index c4e198d0ff..504ab784f4 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.cpp +++ b/modules/juce_core/containers/juce_NamedValueSet.cpp @@ -88,9 +88,8 @@ NamedValueSet& NamedValueSet::operator= (NamedValueSet&& other) noexcept } #endif -NamedValueSet::~NamedValueSet() +NamedValueSet::~NamedValueSet() noexcept { - clear(); } void NamedValueSet::clear() @@ -113,7 +112,7 @@ int NamedValueSet::size() const noexcept return values.size(); } -const var& NamedValueSet::operator[] (const Identifier& name) const +const var& NamedValueSet::operator[] (const Identifier& name) const noexcept { if (const var* v = getVarPointer (name)) return *v; @@ -170,7 +169,7 @@ bool NamedValueSet::set (Identifier name, const var& newValue) return true; } -bool NamedValueSet::contains (const Identifier& name) const +bool NamedValueSet::contains (const Identifier& name) const noexcept { return getVarPointer (name) != nullptr; } diff --git a/modules/juce_core/containers/juce_NamedValueSet.h b/modules/juce_core/containers/juce_NamedValueSet.h index 0216326302..e4a98edc67 100644 --- a/modules/juce_core/containers/juce_NamedValueSet.h +++ b/modules/juce_core/containers/juce_NamedValueSet.h @@ -54,7 +54,7 @@ public: #endif /** Destructor. */ - ~NamedValueSet(); + ~NamedValueSet() noexcept; bool operator== (const NamedValueSet&) const; bool operator!= (const NamedValueSet&) const; @@ -67,7 +67,7 @@ public: If the name isn't found, this will return a void variant. @see getProperty */ - const var& operator[] (const Identifier& name) const; + const var& operator[] (const Identifier& name) const noexcept; /** Tries to return the named value, but if no such value is found, this will instead return the supplied default value. @@ -89,7 +89,7 @@ public: #endif /** Returns true if the set contains an item with the specified name. */ - bool contains (const Identifier& name) const; + bool contains (const Identifier& name) const noexcept; /** Removes a value from the set. @returns true if a value was removed; false if there was no value diff --git a/modules/juce_core/memory/juce_WeakReference.h b/modules/juce_core/memory/juce_WeakReference.h index b56808ad64..c11b19f85c 100644 --- a/modules/juce_core/memory/juce_WeakReference.h +++ b/modules/juce_core/memory/juce_WeakReference.h @@ -158,7 +158,7 @@ public: public: Master() noexcept {} - ~Master() + ~Master() noexcept { // You must remember to call clear() in your source object's destructor! See the notes // for the WeakReference class for an example of how to do this. @@ -187,7 +187,7 @@ public: to zero all the references to this object that may be out there. See the WeakReference class notes for an example of how to do this. */ - void clear() + void clear() noexcept { if (sharedPointer != nullptr) sharedPointer->clearPointer(); diff --git a/modules/juce_core/native/juce_android_Network.cpp b/modules/juce_core/native/juce_android_Network.cpp index 1b86deeeef..29a8cb5919 100644 --- a/modules/juce_core/native/juce_android_Network.cpp +++ b/modules/juce_core/native/juce_android_Network.cpp @@ -166,7 +166,7 @@ public: int numBytes = stream.callIntMethod (HTTPStream.read, javaArray, (jint) bytesToRead); if (numBytes > 0) - env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast (buffer)); + env->GetByteArrayRegion (javaArray, 0, numBytes, static_cast (buffer)); env->DeleteLocalRef (javaArray); return numBytes; diff --git a/modules/juce_events/broadcasters/juce_ActionBroadcaster.cpp b/modules/juce_events/broadcasters/juce_ActionBroadcaster.cpp index a7d56a6d3f..33f232d5b8 100644 --- a/modules/juce_events/broadcasters/juce_ActionBroadcaster.cpp +++ b/modules/juce_events/broadcasters/juce_ActionBroadcaster.cpp @@ -25,12 +25,11 @@ class ActionBroadcaster::ActionMessage : public MessageManager::MessageBase { public: - ActionMessage (const ActionBroadcaster* const broadcaster_, - const String& messageText, - ActionListener* const listener_) noexcept - : broadcaster (const_cast (broadcaster_)), + ActionMessage (const ActionBroadcaster* ab, + const String& messageText, ActionListener* l) noexcept + : broadcaster (const_cast (ab)), message (messageText), - listener (listener_) + listener (l) {} void messageCallback() override diff --git a/modules/juce_graphics/geometry/juce_AffineTransform.h b/modules/juce_graphics/geometry/juce_AffineTransform.h index dfc3a29c17..f30fdb81f8 100644 --- a/modules/juce_graphics/geometry/juce_AffineTransform.h +++ b/modules/juce_graphics/geometry/juce_AffineTransform.h @@ -83,8 +83,8 @@ public: void transformPoint (ValueType& x, ValueType& y) const noexcept { const ValueType oldX = x; - x = static_cast (mat00 * oldX + mat01 * y + mat02); - y = static_cast (mat10 * oldX + mat11 * y + mat12); + x = static_cast (mat00 * oldX + mat01 * y + mat02); + y = static_cast (mat10 * oldX + mat11 * y + mat12); } /** Transforms two 2D coordinates using this matrix. @@ -97,10 +97,10 @@ public: ValueType& x2, ValueType& y2) const noexcept { const ValueType oldX1 = x1, oldX2 = x2; - x1 = static_cast (mat00 * oldX1 + mat01 * y1 + mat02); - y1 = static_cast (mat10 * oldX1 + mat11 * y1 + mat12); - x2 = static_cast (mat00 * oldX2 + mat01 * y2 + mat02); - y2 = static_cast (mat10 * oldX2 + mat11 * y2 + mat12); + x1 = static_cast (mat00 * oldX1 + mat01 * y1 + mat02); + y1 = static_cast (mat10 * oldX1 + mat11 * y1 + mat12); + x2 = static_cast (mat00 * oldX2 + mat01 * y2 + mat02); + y2 = static_cast (mat10 * oldX2 + mat11 * y2 + mat12); } /** Transforms three 2D coordinates using this matrix. @@ -114,12 +114,12 @@ public: ValueType& x3, ValueType& y3) const noexcept { const ValueType oldX1 = x1, oldX2 = x2, oldX3 = x3; - x1 = static_cast (mat00 * oldX1 + mat01 * y1 + mat02); - y1 = static_cast (mat10 * oldX1 + mat11 * y1 + mat12); - x2 = static_cast (mat00 * oldX2 + mat01 * y2 + mat02); - y2 = static_cast (mat10 * oldX2 + mat11 * y2 + mat12); - x3 = static_cast (mat00 * oldX3 + mat01 * y3 + mat02); - y3 = static_cast (mat10 * oldX3 + mat11 * y3 + mat12); + x1 = static_cast (mat00 * oldX1 + mat01 * y1 + mat02); + y1 = static_cast (mat10 * oldX1 + mat11 * y1 + mat12); + x2 = static_cast (mat00 * oldX2 + mat01 * y2 + mat02); + y2 = static_cast (mat10 * oldX2 + mat11 * y2 + mat12); + x3 = static_cast (mat00 * oldX3 + mat01 * y3 + mat02); + y3 = static_cast (mat10 * oldX3 + mat11 * y3 + mat12); } //============================================================================== @@ -231,8 +231,7 @@ public: float x10, float y10, float x01, float y01) noexcept; - /** Returns the transform that will map three specified points onto three target points. - */ + /** Returns the transform that will map three specified points onto three target points. */ static AffineTransform fromTargetPoints (float sourceX1, float sourceY1, float targetX1, float targetY1, float sourceX2, float sourceY2, float targetX2, float targetY2, float sourceX3, float sourceY3, float targetX3, float targetY3) noexcept; diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index f381a8af9b..82b37fb502 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -2308,9 +2308,9 @@ private: bool mouseDownWasBlocked : 1; bool isMoveCallbackPending : 1; bool isResizeCallbackPending : 1; - #if JUCE_DEBUG + #if JUCE_DEBUG bool isInsidePaintCall : 1; - #endif + #endif }; union diff --git a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp index b7d052c91b..a22414bd22 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp @@ -25,8 +25,7 @@ class ComponentAnimator::AnimationTask { public: - AnimationTask (Component* const comp) - : component (comp) + AnimationTask (Component* const comp) noexcept : component (comp) { } @@ -34,7 +33,7 @@ public: float finalAlpha, int millisecondsToSpendMoving, bool useProxyComponent, - double startSpeed_, double endSpeed_) + double startSpd, double endSpd) { msElapsed = 0; msTotal = jmax (1, millisecondsToSpendMoving); @@ -51,10 +50,10 @@ public: bottom = component->getBottom(); alpha = component->getAlpha(); - const double invTotalDistance = 4.0 / (startSpeed_ + endSpeed_ + 2.0); - startSpeed = jmax (0.0, startSpeed_ * invTotalDistance); + const double invTotalDistance = 4.0 / (startSpd + endSpd + 2.0); + startSpeed = jmax (0.0, startSpd * invTotalDistance); midSpeed = invTotalDistance; - endSpeed = jmax (0.0, endSpeed_ * invTotalDistance); + endSpeed = jmax (0.0, endSpd * invTotalDistance); if (useProxyComponent) proxy = new ProxyComponent (*component); diff --git a/modules/juce_gui_basics/layout/juce_ComponentAnimator.h b/modules/juce_gui_basics/layout/juce_ComponentAnimator.h index f8ef6c6858..66c960b620 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentAnimator.h +++ b/modules/juce_gui_basics/layout/juce_ComponentAnimator.h @@ -148,10 +148,10 @@ public: private: //============================================================================== class AnimationTask; - OwnedArray tasks; + OwnedArray tasks; uint32 lastTime; - AnimationTask* findTaskFor (Component* component) const noexcept; + AnimationTask* findTaskFor (Component*) const noexcept; void timerCallback(); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ComponentAnimator) diff --git a/modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp b/modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp index 82519ea5f0..433ddf8d6f 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp +++ b/modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp @@ -238,7 +238,7 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree const int numExistingChildComps = parent.getNumChildComponents(); - Array componentsInOrder; + Array componentsInOrder; componentsInOrder.ensureStorageAllocated (numExistingChildComps); { diff --git a/modules/juce_gui_basics/layout/juce_ComponentBuilder.h b/modules/juce_gui_basics/layout/juce_ComponentBuilder.h index 9a4e0cbf59..c524111f42 100644 --- a/modules/juce_gui_basics/layout/juce_ComponentBuilder.h +++ b/modules/juce_gui_basics/layout/juce_ComponentBuilder.h @@ -226,7 +226,7 @@ public: private: //============================================================================= - OwnedArray types; + OwnedArray types; ScopedPointer component; ImageProvider* imageProvider; #if JUCE_DEBUG diff --git a/modules/juce_gui_basics/widgets/juce_ComboBox.h b/modules/juce_gui_basics/widgets/juce_ComboBox.h index 30cef785a6..11515ba424 100644 --- a/modules/juce_gui_basics/widgets/juce_ComboBox.h +++ b/modules/juce_gui_basics/widgets/juce_ComboBox.h @@ -418,7 +418,7 @@ private: bool isEnabled : 1, isHeading : 1; }; - OwnedArray items; + OwnedArray items; Value currentId; int lastCurrentId; bool isButtonDown, separatorPending, menuActive, scrollWheelEnabled; diff --git a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp index d9741fb943..1ce0ae6482 100644 --- a/modules/juce_gui_basics/windows/juce_AlertWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_AlertWindow.cpp @@ -404,7 +404,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) for (int i = textBlocks.size(); --i >= 0;) { - const AlertTextComp* const ac = static_cast (textBlocks.getUnchecked(i)); + const AlertTextComp* const ac = static_cast (textBlocks.getUnchecked(i)); w = jmax (w, ac->getPreferredWidth()); } @@ -412,7 +412,7 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) for (int i = textBlocks.size(); --i >= 0;) { - AlertTextComp* const ac = static_cast (textBlocks.getUnchecked(i)); + AlertTextComp* const ac = static_cast (textBlocks.getUnchecked(i)); ac->updateLayout ((int) (w * 0.8f)); h += ac->getHeight() + 10; } @@ -470,11 +470,11 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize) Component* const c = allComps.getUnchecked(i); h = 22; - const int comboIndex = comboBoxes.indexOf (dynamic_cast (c)); + const int comboIndex = comboBoxes.indexOf (dynamic_cast (c)); if (comboIndex >= 0 && comboBoxNames [comboIndex].isNotEmpty()) y += labelHeight; - const int tbIndex = textBoxes.indexOf (dynamic_cast (c)); + const int tbIndex = textBoxes.indexOf (dynamic_cast (c)); if (tbIndex >= 0 && textboxNames[tbIndex].isNotEmpty()) y += labelHeight; @@ -536,7 +536,8 @@ bool AlertWindow::keyPressed (const KeyPress& key) exitModalState (0); return true; } - else if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1) + + if (key.isKeyCode (KeyPress::returnKey) && buttons.size() == 1) { buttons.getUnchecked(0)->triggerClick(); return true; @@ -592,8 +593,8 @@ private: LookAndFeel& lf = associatedComponent != nullptr ? associatedComponent->getLookAndFeel() : LookAndFeel::getDefaultLookAndFeel(); - ScopedPointer alertBox (lf.createAlertWindow (title, message, button1, button2, button3, - iconType, numButtons, associatedComponent)); + ScopedPointer alertBox (lf.createAlertWindow (title, message, button1, button2, button3, + iconType, numButtons, associatedComponent)); jassert (alertBox != nullptr); // you have to return one of these! @@ -614,7 +615,7 @@ private: static void* showCallback (void* userData) { - static_cast (userData)->show(); + static_cast (userData)->show(); return nullptr; } }; diff --git a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp index b622452312..00aa69cb7e 100644 --- a/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp +++ b/modules/juce_gui_extra/code_editor/juce_CodeEditorComponent.cpp @@ -35,7 +35,7 @@ public: const CodeDocument::Position& selStart, const CodeDocument::Position& selEnd) { - Array newTokens; + Array newTokens; newTokens.ensureStorageAllocated (8); if (tokeniser == nullptr) @@ -129,13 +129,13 @@ private: int tokenType; }; - Array tokens; + Array tokens; int highlightColumnStart, highlightColumnEnd; static void createTokens (int startPosition, const String& lineText, CodeDocument::Iterator& source, CodeTokeniser& tokeniser, - Array & newTokens) + Array& newTokens) { CodeDocument::Iterator lastIterator (source); const int lineLength = lineText.length(); @@ -168,7 +168,7 @@ private: source = lastIterator; } - static void replaceTabsWithSpaces (Array & tokens, const int spacesPerTab) + static void replaceTabsWithSpaces (Array& tokens, const int spacesPerTab) { int x = 0; for (int i = 0; i < tokens.size(); ++i) @@ -412,7 +412,7 @@ bool CodeEditorComponent::isTextInputActive() const return true; } -void CodeEditorComponent::setTemporaryUnderlining (const Array >&) +void CodeEditorComponent::setTemporaryUnderlining (const Array >&) { jassertfalse; // TODO Windows IME not yet supported for this comp.. } @@ -1235,7 +1235,7 @@ ApplicationCommandTarget* CodeEditorComponent::getNextCommandTarget() return findFirstTargetParentComponent(); } -void CodeEditorComponent::getAllCommands (Array & commands) +void CodeEditorComponent::getAllCommands (Array& commands) { const CommandID ids[] = { StandardApplicationCommandIDs::cut, StandardApplicationCommandIDs::copy, diff --git a/modules/juce_gui_extra/misc/juce_ColourSelector.h b/modules/juce_gui_extra/misc/juce_ColourSelector.h index 2e256bd8d4..d16700cbf7 100644 --- a/modules/juce_gui_extra/misc/juce_ColourSelector.h +++ b/modules/juce_gui_extra/misc/juce_ColourSelector.h @@ -145,7 +145,7 @@ private: ScopedPointer sliders[4]; ScopedPointer colourSpace; ScopedPointer hueSelector; - OwnedArray swatchComponents; + OwnedArray swatchComponents; const int flags; int edgeGap; Rectangle previewArea;