From 0271fdf167c4e0a05bec77936f0740543257a4ef Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Thu, 7 Apr 2011 23:02:48 +0100 Subject: [PATCH] More minor nullptr stuff. --- juce_amalgamated.cpp | 100 +++++++++--------- juce_amalgamated.h | 12 ++- src/audio/midi/juce_MidiMessage.cpp | 4 +- src/gui/components/juce_Component.cpp | 12 +-- src/gui/components/juce_Desktop.cpp | 4 +- .../components/lookandfeel/juce_LookAndFeel.h | 2 +- .../components/menus/juce_MenuBarComponent.h | 2 +- src/gui/components/menus/juce_PopupMenu.cpp | 4 +- .../mouse/juce_DragAndDropContainer.cpp | 8 +- .../mouse/juce_MouseInputSource.cpp | 32 +++--- .../components/windows/juce_TooltipWindow.cpp | 2 +- .../windows/juce_TopLevelWindow.cpp | 2 +- src/io/files/juce_DirectoryIterator.cpp | 2 +- src/io/files/juce_DirectoryIterator.h | 8 +- src/io/files/juce_FileInputStream.cpp | 2 +- src/io/files/juce_FileOutputStream.cpp | 2 +- src/io/streams/juce_OutputStream.cpp | 8 +- src/text/juce_XmlElement.cpp | 10 +- src/threads/juce_Thread.cpp | 8 +- 19 files changed, 116 insertions(+), 108 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index c6749a648e..a3cd2721a1 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -7084,16 +7084,16 @@ void juce_CheckForDanglingStreams() OutputStream::OutputStream() : newLineString (NewLine::getDefault()) { - #if JUCE_DEBUG + #if JUCE_DEBUG activeStreams.add (this); - #endif + #endif } OutputStream::~OutputStream() { - #if JUCE_DEBUG + #if JUCE_DEBUG activeStreams.removeValue (this); - #endif + #endif } void OutputStream::writeBool (const bool b) @@ -7370,7 +7370,7 @@ DirectoryIterator::~DirectoryIterator() bool DirectoryIterator::next() { - return next (0, 0, 0, 0, 0, 0); + return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResult, int64* const fileSize, @@ -8458,7 +8458,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); FileInputStream::FileInputStream (const File& f) : file (f), - fileHandle (0), + fileHandle (nullptr), currentPosition (0), totalSize (0), needToSeek (true) @@ -8523,7 +8523,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); FileOutputStream::FileOutputStream (const File& f, const int bufferSize_) : file (f), - fileHandle (0), + fileHandle (nullptr), currentPosition (0), bufferSize (bufferSize_), bytesInBuffer (0), @@ -15323,11 +15323,11 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const Strin : name (name_), value (value_) { - #if JUCE_DEBUG + #if JUCE_DEBUG // this checks whether the attribute name string contains any illegal characters.. for (String::CharPointerType t (name.getCharPointer()); ! t.isEmpty(); ++t) jassert (t.isLetterOrDigit() || *t == '_' || *t == '-' || *t == ':'); - #endif + #endif } inline bool XmlElement::XmlAttributeNode::hasName (const String& nameToMatch) const noexcept @@ -15640,7 +15640,7 @@ bool XmlElement::writeToFile (const File& file, bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept { -#if JUCE_DEBUG + #if JUCE_DEBUG // if debugging, check that the case is actually the same, because // valid xml is case-sensitive, and although this lets it pass, it's // better not to.. @@ -15653,9 +15653,9 @@ bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept { return false; } -#else + #else return tagName.equalsIgnoreCase (tagNameWanted); -#endif + #endif } XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName) const @@ -16413,7 +16413,7 @@ void Thread::startThread() threadShouldExit_ = false; - if (threadHandle_ == 0) + if (threadHandle_ == nullptr) { launchThread(); setThreadPriority (threadHandle_, threadPriority_); @@ -16425,7 +16425,7 @@ void Thread::startThread (const int priority) { const ScopedLock sl (startStopLock); - if (threadHandle_ == 0) + if (threadHandle_ == nullptr) { threadPriority_ = priority; startThread(); @@ -16438,7 +16438,7 @@ void Thread::startThread (const int priority) bool Thread::isThreadRunning() const { - return threadHandle_ != 0; + return threadHandle_ != nullptr; } void Thread::signalThreadShouldExit() @@ -16491,7 +16491,7 @@ void Thread::stopThread (const int timeOutMilliseconds) killThread(); RunningThreadsList::getInstance().remove (this); - threadHandle_ = 0; + threadHandle_ = nullptr; threadId_ = 0; } } @@ -29428,7 +29428,7 @@ const String MidiMessage::getRhythmInstrumentName (const int n) "Mute Triangle", "Open Triangle" }; - return (n >= 35 && n <= 81) ? names [n - 35] : (const char*) 0; + return (n >= 35 && n <= 81) ? names [n - 35] : (const char*) nullptr; } const String MidiMessage::getControllerName (const int n) @@ -29459,7 +29459,7 @@ const String MidiMessage::getControllerName (const int n) "Poly Operation" }; - return isPositiveAndBelow (n, (int) 128) ? names[n] : (const char*) 0; + return isPositiveAndBelow (n, (int) 128) ? names[n] : (const char*) nullptr; } END_JUCE_NAMESPACE @@ -40246,12 +40246,12 @@ const Rectangle Component::getLocalArea (const Component* source, const Rec const Point Component::localPointToGlobal (const Point& point) const { - return ComponentHelpers::convertCoordinate (0, this, point); + return ComponentHelpers::convertCoordinate (nullptr, this, point); } const Rectangle Component::localAreaToGlobal (const Rectangle& area) const { - return ComponentHelpers::convertCoordinate (0, this, area); + return ComponentHelpers::convertCoordinate (nullptr, this, area); } /* Deprecated methods... */ @@ -40262,7 +40262,7 @@ const Point Component::relativePositionToGlobal (const Point& relative const Point Component::globalPositionToRelative (const Point& screenPosition) const { - return getLocalPoint (0, screenPosition); + return getLocalPoint (nullptr, screenPosition); } const Point Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point& positionRelativeToThis) const @@ -41741,7 +41741,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point& rel const MouseEvent me (source, relativePos, oldModifiers, this, this, time, - getLocalPoint (0, source.getLastMouseDownPosition()), + getLocalPoint (nullptr, source.getLastMouseDownPosition()), source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.hasMouseMovedSignificantlySincePressed()); @@ -41784,7 +41784,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point& r const MouseEvent me (source, relativePos, source.getCurrentModifiers(), this, this, time, - getLocalPoint (0, source.getLastMouseDownPosition()), + getLocalPoint (nullptr, source.getLastMouseDownPosition()), source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.hasMouseMovedSignificantlySincePressed()); @@ -42232,7 +42232,7 @@ bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept const Point Component::getMouseXYRelative() const { - return getLocalPoint (0, Desktop::getMousePosition()); + return getLocalPoint (nullptr, Desktop::getMousePosition()); } const Rectangle Component::getParentMonitorArea() const @@ -42440,7 +42440,7 @@ Component* Desktop::findComponentAt (const Point& screenPosition) const if (c->isVisible()) { - const Point relative (c->getLocalPoint (0, screenPosition)); + const Point relative (c->getLocalPoint (nullptr, screenPosition)); if (c->contains (relative)) return c->getComponentAt (relative); @@ -42632,7 +42632,7 @@ void Desktop::sendMouseMove() if (target != nullptr) { Component::BailOutChecker checker (target); - const Point pos (target->getLocalPoint (0, lastFakeMouseMove)); + const Point pos (target->getLocalPoint (nullptr, lastFakeMouseMove)); const Time now (Time::getCurrentTime()); const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(), @@ -69560,7 +69560,7 @@ public: // move rather than a real timer callback const Point globalMousePos (Desktop::getMousePosition()); - const Point localMousePos (getLocalPoint (0, globalMousePos)); + const Point localMousePos (getLocalPoint (nullptr, globalMousePos)); const uint32 now = Time::getMillisecondCounter(); @@ -69721,7 +69721,7 @@ private: void updateMouseOverStatus (const Point& globalMousePos) { - const Point relPos (getLocalPoint (0, globalMousePos)); + const Point relPos (getLocalPoint (nullptr, globalMousePos)); isOver = reallyContains (relPos, true); if (activeSubMenu != nullptr) @@ -70869,7 +70869,7 @@ public: } else { - const Point relPos (hit->getLocalPoint (0, screenPos)); + const Point relPos (hit->getLocalPoint (nullptr, screenPos)); hit = hit->getComponentAt (relPos.getX(), relPos.getY()); } @@ -70883,7 +70883,7 @@ public: if (ddt != nullptr && ddt->isInterestedInDragSource (dragDescLocal, source)) { - relativePos = hit->getLocalPoint (0, screenPos); + relativePos = hit->getLocalPoint (nullptr, screenPos); return ddt; } @@ -70958,7 +70958,7 @@ public: Point newPos (screenPos + imageOffset); if (getParentComponent() != nullptr) - newPos = getParentComponent()->getLocalPoint (0, newPos); + newPos = getParentComponent()->getLocalPoint (nullptr, newPos); //if (newX != getX() || newY != getY()) { @@ -71101,7 +71101,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription, const int lo = 150; const int hi = 400; - Point relPos (sourceComponent->getLocalPoint (0, lastMouseDown)); + Point relPos (sourceComponent->getLocalPoint (nullptr, lastMouseDown)); Point clipped (dragImage.getBounds().getConstrainedPoint (relPos)); for (int y = dragImage.getHeight(); --y >= 0;) @@ -71565,7 +71565,7 @@ public: if (peer != nullptr) { Component* const comp = peer->getComponent(); - const Point relativePos (comp->getLocalPoint (0, screenPos)); + const Point relativePos (comp->getLocalPoint (nullptr, screenPos)); // (the contains() call is needed to test for overlapping desktop windows) if (comp->contains (relativePos)) @@ -71585,44 +71585,44 @@ public: void sendMouseEnter (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseEnter (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseExit (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseExit (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseMove (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseMove (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseDown (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseDown (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseDrag (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseDrag (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseUp (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers()); + //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, getCurrentModifiers()); } void sendMouseWheel (Component* const comp, const Point& screenPos, const Time& time, float x, float y) { - //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y); + //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseWheel (source, comp->getLocalPoint (nullptr, screenPos), time, x, y); } // (returns true if the button change caused a modal event loop) @@ -71703,7 +71703,7 @@ public: if (newPeer != lastPeer) { - setComponentUnderMouse (0, screenPos, time); + setComponentUnderMouse (nullptr, screenPos, time); lastPeer = newPeer; setComponentUnderMouse (findComponentAt (screenPos), screenPos, time); } @@ -79042,7 +79042,7 @@ void TooltipWindow::showFor (const String& tip) Point mousePos (Desktop::getMousePosition()); if (getParentComponent() != nullptr) - mousePos = getParentComponent()->getLocalPoint (0, mousePos); + mousePos = getParentComponent()->getLocalPoint (nullptr, mousePos); int x, y, w, h; getLookAndFeel().getTooltipSize (tip, w, h); @@ -79408,7 +79408,7 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const if (getParentComponent() != nullptr) { - targetCentre = getParentComponent()->getLocalPoint (0, targetCentre); + targetCentre = getParentComponent()->getLocalPoint (nullptr, targetCentre); parentArea = getParentComponent()->getLocalBounds(); } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index d857770c17..b34e2ab52a 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -18986,8 +18986,12 @@ public: false if there are no more matching files. If it returns false, then none of the parameters will be filled-in. */ - bool next (bool* isDirectory, bool* isHidden, int64* fileSize, - Time* modTime, Time* creationTime, bool* isReadOnly); + bool next (bool* isDirectory, + bool* isHidden, + int64* fileSize, + Time* modTime, + Time* creationTime, + bool* isReadOnly); /** Returns the file that the iterator is currently pointing at. @@ -60278,7 +60282,7 @@ public: /** Changes the default look-and-feel. @param newDefaultLookAndFeel the new look-and-feel object to use - if this is - set to 0, it will revert to using the default one. The + set to null, it will revert to using the default one. The object passed-in must be deleted by the caller when it's no longer needed. @see getDefaultLookAndFeel @@ -60992,7 +60996,7 @@ public: /** Changes the model object to use to control the bar. - This can be 0, in which case the bar will be empty. Don't delete the object + This can be a null pointer, in which case the bar will be empty. Don't delete the object that is passed-in while it's still being used by this MenuBar. */ void setModel (MenuBarModel* newModel); diff --git a/src/audio/midi/juce_MidiMessage.cpp b/src/audio/midi/juce_MidiMessage.cpp index 16d08ab967..adb3e70e4a 100644 --- a/src/audio/midi/juce_MidiMessage.cpp +++ b/src/audio/midi/juce_MidiMessage.cpp @@ -1059,7 +1059,7 @@ const String MidiMessage::getRhythmInstrumentName (const int n) "Mute Triangle", "Open Triangle" }; - return (n >= 35 && n <= 81) ? names [n - 35] : (const char*) 0; + return (n >= 35 && n <= 81) ? names [n - 35] : (const char*) nullptr; } const String MidiMessage::getControllerName (const int n) @@ -1090,7 +1090,7 @@ const String MidiMessage::getControllerName (const int n) "Poly Operation" }; - return isPositiveAndBelow (n, (int) 128) ? names[n] : (const char*) 0; + return isPositiveAndBelow (n, (int) 128) ? names[n] : (const char*) nullptr; } END_JUCE_NAMESPACE diff --git a/src/gui/components/juce_Component.cpp b/src/gui/components/juce_Component.cpp index 6a9582276c..acfdacc4dc 100644 --- a/src/gui/components/juce_Component.cpp +++ b/src/gui/components/juce_Component.cpp @@ -947,12 +947,12 @@ const Rectangle Component::getLocalArea (const Component* source, const Rec const Point Component::localPointToGlobal (const Point& point) const { - return ComponentHelpers::convertCoordinate (0, this, point); + return ComponentHelpers::convertCoordinate (nullptr, this, point); } const Rectangle Component::localAreaToGlobal (const Rectangle& area) const { - return ComponentHelpers::convertCoordinate (0, this, area); + return ComponentHelpers::convertCoordinate (nullptr, this, area); } /* Deprecated methods... */ @@ -963,7 +963,7 @@ const Point Component::relativePositionToGlobal (const Point& relative const Point Component::globalPositionToRelative (const Point& screenPosition) const { - return getLocalPoint (0, screenPosition); + return getLocalPoint (nullptr, screenPosition); } const Point Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point& positionRelativeToThis) const @@ -2473,7 +2473,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point& rel const MouseEvent me (source, relativePos, oldModifiers, this, this, time, - getLocalPoint (0, source.getLastMouseDownPosition()), + getLocalPoint (nullptr, source.getLastMouseDownPosition()), source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.hasMouseMovedSignificantlySincePressed()); @@ -2516,7 +2516,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point& r const MouseEvent me (source, relativePos, source.getCurrentModifiers(), this, this, time, - getLocalPoint (0, source.getLastMouseDownPosition()), + getLocalPoint (nullptr, source.getLastMouseDownPosition()), source.getLastMouseDownTime(), source.getNumberOfMultipleClicks(), source.hasMouseMovedSignificantlySincePressed()); @@ -2967,7 +2967,7 @@ bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() noexcept const Point Component::getMouseXYRelative() const { - return getLocalPoint (0, Desktop::getMousePosition()); + return getLocalPoint (nullptr, Desktop::getMousePosition()); } //============================================================================== diff --git a/src/gui/components/juce_Desktop.cpp b/src/gui/components/juce_Desktop.cpp index bdd76c4a2b..2284e1c074 100644 --- a/src/gui/components/juce_Desktop.cpp +++ b/src/gui/components/juce_Desktop.cpp @@ -156,7 +156,7 @@ Component* Desktop::findComponentAt (const Point& screenPosition) const if (c->isVisible()) { - const Point relative (c->getLocalPoint (0, screenPosition)); + const Point relative (c->getLocalPoint (nullptr, screenPosition)); if (c->contains (relative)) return c->getComponentAt (relative); @@ -353,7 +353,7 @@ void Desktop::sendMouseMove() if (target != nullptr) { Component::BailOutChecker checker (target); - const Point pos (target->getLocalPoint (0, lastFakeMouseMove)); + const Point pos (target->getLocalPoint (nullptr, lastFakeMouseMove)); const Time now (Time::getCurrentTime()); const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(), diff --git a/src/gui/components/lookandfeel/juce_LookAndFeel.h b/src/gui/components/lookandfeel/juce_LookAndFeel.h index a33adb64cd..7363e34100 100644 --- a/src/gui/components/lookandfeel/juce_LookAndFeel.h +++ b/src/gui/components/lookandfeel/juce_LookAndFeel.h @@ -88,7 +88,7 @@ public: /** Changes the default look-and-feel. @param newDefaultLookAndFeel the new look-and-feel object to use - if this is - set to 0, it will revert to using the default one. The + set to null, it will revert to using the default one. The object passed-in must be deleted by the caller when it's no longer needed. @see getDefaultLookAndFeel diff --git a/src/gui/components/menus/juce_MenuBarComponent.h b/src/gui/components/menus/juce_MenuBarComponent.h index 03df671719..b3743325ab 100644 --- a/src/gui/components/menus/juce_MenuBarComponent.h +++ b/src/gui/components/menus/juce_MenuBarComponent.h @@ -55,7 +55,7 @@ public: //============================================================================== /** Changes the model object to use to control the bar. - This can be 0, in which case the bar will be empty. Don't delete the object + This can be a null pointer, in which case the bar will be empty. Don't delete the object that is passed-in while it's still being used by this MenuBar. */ void setModel (MenuBarModel* newModel); diff --git a/src/gui/components/menus/juce_PopupMenu.cpp b/src/gui/components/menus/juce_PopupMenu.cpp index 84600ab94b..ed7e6568f2 100644 --- a/src/gui/components/menus/juce_PopupMenu.cpp +++ b/src/gui/components/menus/juce_PopupMenu.cpp @@ -538,7 +538,7 @@ public: // move rather than a real timer callback const Point globalMousePos (Desktop::getMousePosition()); - const Point localMousePos (getLocalPoint (0, globalMousePos)); + const Point localMousePos (getLocalPoint (nullptr, globalMousePos)); const uint32 now = Time::getMillisecondCounter(); @@ -701,7 +701,7 @@ private: void updateMouseOverStatus (const Point& globalMousePos) { - const Point relPos (getLocalPoint (0, globalMousePos)); + const Point relPos (getLocalPoint (nullptr, globalMousePos)); isOver = reallyContains (relPos, true); if (activeSubMenu != nullptr) diff --git a/src/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/gui/components/mouse/juce_DragAndDropContainer.cpp index f7439e8d22..04410757e4 100644 --- a/src/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -110,7 +110,7 @@ public: } else { - const Point relPos (hit->getLocalPoint (0, screenPos)); + const Point relPos (hit->getLocalPoint (nullptr, screenPos)); hit = hit->getComponentAt (relPos.getX(), relPos.getY()); } @@ -124,7 +124,7 @@ public: if (ddt != nullptr && ddt->isInterestedInDragSource (dragDescLocal, source)) { - relativePos = hit->getLocalPoint (0, screenPos); + relativePos = hit->getLocalPoint (nullptr, screenPos); return ddt; } @@ -199,7 +199,7 @@ public: Point newPos (screenPos + imageOffset); if (getParentComponent() != nullptr) - newPos = getParentComponent()->getLocalPoint (0, newPos); + newPos = getParentComponent()->getLocalPoint (nullptr, newPos); //if (newX != getX() || newY != getY()) { @@ -344,7 +344,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription, const int lo = 150; const int hi = 400; - Point relPos (sourceComponent->getLocalPoint (0, lastMouseDown)); + Point relPos (sourceComponent->getLocalPoint (nullptr, lastMouseDown)); Point clipped (dragImage.getBounds().getConstrainedPoint (relPos)); for (int y = dragImage.getHeight(); --y >= 0;) diff --git a/src/gui/components/mouse/juce_MouseInputSource.cpp b/src/gui/components/mouse/juce_MouseInputSource.cpp index 8750fd3480..981ee51dd7 100644 --- a/src/gui/components/mouse/juce_MouseInputSource.cpp +++ b/src/gui/components/mouse/juce_MouseInputSource.cpp @@ -79,7 +79,7 @@ public: if (peer != nullptr) { Component* const comp = peer->getComponent(); - const Point relativePos (comp->getLocalPoint (0, screenPos)); + const Point relativePos (comp->getLocalPoint (nullptr, screenPos)); // (the contains() call is needed to test for overlapping desktop windows) if (comp->contains (relativePos)) @@ -100,44 +100,44 @@ public: //============================================================================== void sendMouseEnter (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseEnter (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseExit (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseExit (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseMove (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseMove (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseDown (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseDown (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseDrag (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time); + //DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseDrag (source, comp->getLocalPoint (nullptr, screenPos), time); } void sendMouseUp (Component* const comp, const Point& screenPos, const Time& time) { - //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers()); + //DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseUp (source, comp->getLocalPoint (nullptr, screenPos), time, getCurrentModifiers()); } void sendMouseWheel (Component* const comp, const Point& screenPos, const Time& time, float x, float y) { - //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); - comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y); + //DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (nullptr, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp)); + comp->internalMouseWheel (source, comp->getLocalPoint (nullptr, screenPos), time, x, y); } //============================================================================== @@ -219,7 +219,7 @@ public: if (newPeer != lastPeer) { - setComponentUnderMouse (0, screenPos, time); + setComponentUnderMouse (nullptr, screenPos, time); lastPeer = newPeer; setComponentUnderMouse (findComponentAt (screenPos), screenPos, time); } diff --git a/src/gui/components/windows/juce_TooltipWindow.cpp b/src/gui/components/windows/juce_TooltipWindow.cpp index fc52ce8222..522b1fceeb 100644 --- a/src/gui/components/windows/juce_TooltipWindow.cpp +++ b/src/gui/components/windows/juce_TooltipWindow.cpp @@ -87,7 +87,7 @@ void TooltipWindow::showFor (const String& tip) Point mousePos (Desktop::getMousePosition()); if (getParentComponent() != nullptr) - mousePos = getParentComponent()->getLocalPoint (0, mousePos); + mousePos = getParentComponent()->getLocalPoint (nullptr, mousePos); int x, y, w, h; getLookAndFeel().getTooltipSize (tip, w, h); diff --git a/src/gui/components/windows/juce_TopLevelWindow.cpp b/src/gui/components/windows/juce_TopLevelWindow.cpp index e9ec85e2f7..141016ff96 100644 --- a/src/gui/components/windows/juce_TopLevelWindow.cpp +++ b/src/gui/components/windows/juce_TopLevelWindow.cpp @@ -298,7 +298,7 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const if (getParentComponent() != nullptr) { - targetCentre = getParentComponent()->getLocalPoint (0, targetCentre); + targetCentre = getParentComponent()->getLocalPoint (nullptr, targetCentre); parentArea = getParentComponent()->getLocalBounds(); } diff --git a/src/io/files/juce_DirectoryIterator.cpp b/src/io/files/juce_DirectoryIterator.cpp index c34bab31a7..30b4591570 100644 --- a/src/io/files/juce_DirectoryIterator.cpp +++ b/src/io/files/juce_DirectoryIterator.cpp @@ -55,7 +55,7 @@ DirectoryIterator::~DirectoryIterator() bool DirectoryIterator::next() { - return next (0, 0, 0, 0, 0, 0); + return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); } bool DirectoryIterator::next (bool* const isDirResult, bool* const isHiddenResult, int64* const fileSize, diff --git a/src/io/files/juce_DirectoryIterator.h b/src/io/files/juce_DirectoryIterator.h index 8438628548..202fc84531 100644 --- a/src/io/files/juce_DirectoryIterator.h +++ b/src/io/files/juce_DirectoryIterator.h @@ -95,8 +95,12 @@ public: false if there are no more matching files. If it returns false, then none of the parameters will be filled-in. */ - bool next (bool* isDirectory, bool* isHidden, int64* fileSize, - Time* modTime, Time* creationTime, bool* isReadOnly); + bool next (bool* isDirectory, + bool* isHidden, + int64* fileSize, + Time* modTime, + Time* creationTime, + bool* isReadOnly); /** Returns the file that the iterator is currently pointing at. diff --git a/src/io/files/juce_FileInputStream.cpp b/src/io/files/juce_FileInputStream.cpp index a8b7991a42..2c7168c27b 100644 --- a/src/io/files/juce_FileInputStream.cpp +++ b/src/io/files/juce_FileInputStream.cpp @@ -37,7 +37,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); //============================================================================== FileInputStream::FileInputStream (const File& f) : file (f), - fileHandle (0), + fileHandle (nullptr), currentPosition (0), totalSize (0), needToSeek (true) diff --git a/src/io/files/juce_FileOutputStream.cpp b/src/io/files/juce_FileOutputStream.cpp index eec65eba4e..ab1eafb81f 100644 --- a/src/io/files/juce_FileOutputStream.cpp +++ b/src/io/files/juce_FileOutputStream.cpp @@ -35,7 +35,7 @@ int64 juce_fileSetPosition (void* handle, int64 pos); //============================================================================== FileOutputStream::FileOutputStream (const File& f, const int bufferSize_) : file (f), - fileHandle (0), + fileHandle (nullptr), currentPosition (0), bufferSize (bufferSize_), bytesInBuffer (0), diff --git a/src/io/streams/juce_OutputStream.cpp b/src/io/streams/juce_OutputStream.cpp index 14a01674dd..d25bf89c4b 100644 --- a/src/io/streams/juce_OutputStream.cpp +++ b/src/io/streams/juce_OutputStream.cpp @@ -53,16 +53,16 @@ void juce_CheckForDanglingStreams() OutputStream::OutputStream() : newLineString (NewLine::getDefault()) { - #if JUCE_DEBUG + #if JUCE_DEBUG activeStreams.add (this); - #endif + #endif } OutputStream::~OutputStream() { - #if JUCE_DEBUG + #if JUCE_DEBUG activeStreams.removeValue (this); - #endif + #endif } //============================================================================== diff --git a/src/text/juce_XmlElement.cpp b/src/text/juce_XmlElement.cpp index c53c1dedf9..26f078bf73 100644 --- a/src/text/juce_XmlElement.cpp +++ b/src/text/juce_XmlElement.cpp @@ -45,11 +45,11 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, const Strin : name (name_), value (value_) { - #if JUCE_DEBUG + #if JUCE_DEBUG // this checks whether the attribute name string contains any illegal characters.. for (String::CharPointerType t (name.getCharPointer()); ! t.isEmpty(); ++t) jassert (t.isLetterOrDigit() || *t == '_' || *t == '-' || *t == ':'); - #endif + #endif } inline bool XmlElement::XmlAttributeNode::hasName (const String& nameToMatch) const noexcept @@ -365,7 +365,7 @@ bool XmlElement::writeToFile (const File& file, //============================================================================== bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept { -#if JUCE_DEBUG + #if JUCE_DEBUG // if debugging, check that the case is actually the same, because // valid xml is case-sensitive, and although this lets it pass, it's // better not to.. @@ -378,9 +378,9 @@ bool XmlElement::hasTagName (const String& tagNameWanted) const noexcept { return false; } -#else + #else return tagName.equalsIgnoreCase (tagNameWanted); -#endif + #endif } XmlElement* XmlElement::getNextElementWithTagName (const String& requiredTagName) const diff --git a/src/threads/juce_Thread.cpp b/src/threads/juce_Thread.cpp index e0a0b68df3..04ff8ab683 100644 --- a/src/threads/juce_Thread.cpp +++ b/src/threads/juce_Thread.cpp @@ -180,7 +180,7 @@ void Thread::startThread() threadShouldExit_ = false; - if (threadHandle_ == 0) + if (threadHandle_ == nullptr) { launchThread(); setThreadPriority (threadHandle_, threadPriority_); @@ -192,7 +192,7 @@ void Thread::startThread (const int priority) { const ScopedLock sl (startStopLock); - if (threadHandle_ == 0) + if (threadHandle_ == nullptr) { threadPriority_ = priority; startThread(); @@ -205,7 +205,7 @@ void Thread::startThread (const int priority) bool Thread::isThreadRunning() const { - return threadHandle_ != 0; + return threadHandle_ != nullptr; } //============================================================================== @@ -259,7 +259,7 @@ void Thread::stopThread (const int timeOutMilliseconds) killThread(); RunningThreadsList::getInstance().remove (this); - threadHandle_ = 0; + threadHandle_ = nullptr; threadId_ = 0; } }