diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index 74d1f0304a..e45abb2569 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -957,8 +957,8 @@ void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) bool DynamicLibrary::open (const String& name) { close(); - handle = dlopen (name.toUTF8(), RTLD_LOCAL | RTLD_NOW); - return handle != 0; + handle = dlopen (name.isEmpty() ? nullptr : name.toUTF8(), RTLD_LOCAL | RTLD_NOW); + return handle != nullptr; } void DynamicLibrary::close() diff --git a/modules/juce_graphics/geometry/juce_Line.h b/modules/juce_graphics/geometry/juce_Line.h index f2292e7f9c..e479aec34b 100644 --- a/modules/juce_graphics/geometry/juce_Line.h +++ b/modules/juce_graphics/geometry/juce_Line.h @@ -66,8 +66,8 @@ public: } /** Creates a line from its start and end points. */ - Line (const Point& startPoint, - const Point& endPoint) noexcept + Line (const Point startPoint, + const Point endPoint) noexcept : start (startPoint), end (endPoint) { @@ -98,10 +98,10 @@ public: inline ValueType getEndY() const noexcept { return end.y; } /** Returns the line's start point. */ - inline const Point& getStart() const noexcept { return start; } + inline Point getStart() const noexcept { return start; } /** Returns the line's end point. */ - inline const Point& getEnd() const noexcept { return end; } + inline Point getEnd() const noexcept { return end; } /** Changes this line's start point */ void setStart (ValueType newStartX, ValueType newStartY) noexcept { start.setXY (newStartX, newStartY); } @@ -110,10 +110,10 @@ public: void setEnd (ValueType newEndX, ValueType newEndY) noexcept { end.setXY (newEndX, newEndY); } /** Changes this line's start point */ - void setStart (const Point& newStart) noexcept { start = newStart; } + void setStart (const Point newStart) noexcept { start = newStart; } /** Changes this line's end point */ - void setEnd (const Point& newEnd) noexcept { end = newEnd; } + void setEnd (const Point newEnd) noexcept { end = newEnd; } /** Returns a line that is the same as this one, but with the start and end reversed, */ const Line reversed() const noexcept { return Line (end, start); } @@ -250,7 +250,7 @@ public: @returns the point's distance from the line @see getPositionAlongLineOfNearestPoint */ - ValueType getDistanceFromPoint (const Point& targetPoint, + ValueType getDistanceFromPoint (const Point targetPoint, Point& pointOnLine) const noexcept { const Point delta (end - start); @@ -291,7 +291,7 @@ public: turn this number into a position, use getPointAlongLineProportionally(). @see getDistanceFromPoint, getPointAlongLineProportionally */ - ValueType findNearestProportionalPositionTo (const Point& point) const noexcept + ValueType findNearestProportionalPositionTo (const Point point) const noexcept { const Point delta (end - start); const double length = delta.x * delta.x + delta.y * delta.y; @@ -305,7 +305,7 @@ public: /** Finds the point on this line which is nearest to a given point. @see getDistanceFromPoint, findNearestProportionalPositionTo */ - Point findNearestPointTo (const Point& point) const noexcept + Point findNearestPointTo (const Point point) const noexcept { return getPointAlongLineProportionally (findNearestProportionalPositionTo (point)); } @@ -316,7 +316,7 @@ public: coordinate of this line at the given x (assuming the line extends infinitely in both directions). */ - bool isPointAbove (const Point& point) const noexcept + bool isPointAbove (const Point point) const noexcept { return start.x != end.x && point.y < ((end.y - start.y) @@ -349,8 +349,8 @@ private: //============================================================================== Point start, end; - static bool findIntersection (const Point& p1, const Point& p2, - const Point& p3, const Point& p4, + static bool findIntersection (const Point p1, const Point p2, + const Point p3, const Point p4, Point& intersection) noexcept { if (p2 == p3) diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index efd1df91e0..38f69f1d43 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -70,7 +70,7 @@ public: } /** Creates a Rectangle from the positions of two opposite corners. */ - Rectangle (const Point& corner1, const Point& corner2) noexcept + Rectangle (const Point corner1, const Point corner2) noexcept : pos (jmin (corner1.x, corner2.x), jmin (corner1.y, corner2.y)), w (corner1.x - corner2.x), @@ -139,16 +139,16 @@ public: //============================================================================== /** Returns the rectangle's top-left position as a Point. */ - inline const Point& getPosition() const noexcept { return pos; } + inline Point getPosition() const noexcept { return pos; } /** Changes the position of the rectangle's top-left corner (leaving its size unchanged). */ - inline void setPosition (const Point& newPos) noexcept { pos = newPos; } + inline void setPosition (const Point newPos) noexcept { pos = newPos; } /** Changes the position of the rectangle's top-left corner (leaving its size unchanged). */ inline void setPosition (const ValueType newX, const ValueType newY) noexcept { pos.setXY (newX, newY); } /** Returns the rectangle's top-left position as a Point. */ - const Point& getTopLeft() const noexcept { return pos; } + Point getTopLeft() const noexcept { return pos; } /** Returns the rectangle's top-right position as a Point. */ Point getTopRight() const noexcept { return Point (pos.x + w, pos.y); } @@ -188,7 +188,7 @@ public: Rectangle withPosition (const ValueType newX, const ValueType newY) const noexcept { return Rectangle (newX, newY, w, h); } /** Returns a rectangle with the same size as this one, but a new position. */ - Rectangle withPosition (const Point& newPos) const noexcept { return Rectangle (newPos.x, newPos.y, w, h); } + Rectangle withPosition (const Point newPos) const noexcept { return Rectangle (newPos.x, newPos.y, w, h); } /** Returns a rectangle whose size is the same as this one, but whose top-left position is (0, 0). */ Rectangle withZeroOrigin() const noexcept { return Rectangle (w, h); } @@ -267,26 +267,26 @@ public: } /** Returns a rectangle which is the same as this one moved by a given amount. */ - Rectangle operator+ (const Point& deltaPosition) const noexcept + Rectangle operator+ (const Point deltaPosition) const noexcept { return Rectangle (pos.x + deltaPosition.x, pos.y + deltaPosition.y, w, h); } /** Moves this rectangle by a given amount. */ - Rectangle& operator+= (const Point& deltaPosition) noexcept + Rectangle& operator+= (const Point deltaPosition) noexcept { pos += deltaPosition; return *this; } /** Returns a rectangle which is the same as this one moved by a given amount. */ - Rectangle operator- (const Point& deltaPosition) const noexcept + Rectangle operator- (const Point deltaPosition) const noexcept { return Rectangle (pos.x - deltaPosition.x, pos.y - deltaPosition.y, w, h); } /** Moves this rectangle by a given amount. */ - Rectangle& operator-= (const Point& deltaPosition) noexcept + Rectangle& operator-= (const Point deltaPosition) noexcept { pos -= deltaPosition; return *this; @@ -459,7 +459,7 @@ public: } /** Returns true if this co-ordinate is inside the rectangle. */ - bool contains (const Point& point) const noexcept + bool contains (const Point point) const noexcept { return point.x >= pos.x && point.y >= pos.y && point.x < pos.x + w && point.y < pos.y + h; } @@ -472,7 +472,7 @@ public: } /** Returns the nearest point to the specified point that lies within this rectangle. */ - Point getConstrainedPoint (const Point& point) const noexcept + Point getConstrainedPoint (const Point point) const noexcept { return Point (jlimit (pos.x, pos.x + w, point.x), jlimit (pos.y, pos.y + h, point.y));