Browse Source

Merge branch 'master' into performance

# Conflicts:
#	Include/Rocket/Core/Dictionary.h
#	Include/Rocket/Core/Dictionary.inl
#	Include/Rocket/Core/Element.inl
#	Include/Rocket/Core/StringBase.h
#	Include/Rocket/Core/StringBase.inl
Michael Ragazzon 6 years ago
parent
commit
0fa8af7154

+ 0 - 4
Include/Rocket/Core/Colour.h

@@ -112,12 +112,8 @@ public:
 }
 }
 }
 }
 
 
-namespace Rocket {
-namespace Core {
 
 
 #include "Colour.inl"
 #include "Colour.inl"
 
 
-}
-}
 
 
 #endif
 #endif

+ 6 - 0
Include/Rocket/Core/Colour.inl

@@ -25,6 +25,9 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 // Lightweight, non-initialising constructor.
 // Lightweight, non-initialising constructor.
 template < typename ColourType, int AlphaDefault >
 template < typename ColourType, int AlphaDefault >
 Colour< ColourType, AlphaDefault >::Colour()
 Colour< ColourType, AlphaDefault >::Colour()
@@ -117,3 +120,6 @@ void ROCKETCORE_API Colour< float, 1 >::operator*=(const Colour& rhs);
 
 
 template < >
 template < >
 void ROCKETCORE_API Colour< byte, 255 >::operator*=(const Colour& rhs);
 void ROCKETCORE_API Colour< byte, 255 >::operator*=(const Colour& rhs);
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Element.h

@@ -807,9 +807,9 @@ private:
 	friend class LayoutInlineBox;
 	friend class LayoutInlineBox;
 };
 };
 
 
-#include "Element.inl"
-
 }
 }
 }
 }
 
 
+#include "Element.inl"
+
 #endif
 #endif

+ 6 - 1
Include/Rocket/Core/Element.inl

@@ -25,6 +25,9 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 // Returns the values of one of this element's properties.
 // Returns the values of one of this element's properties.
 // We can assume the property will exist based on the RCSS inheritance.
 // We can assume the property will exist based on the RCSS inheritance.
 template < typename T >
 template < typename T >
@@ -47,7 +50,9 @@ void Element::SetAttribute(const String& name, const T& value)
 // Gets the specified attribute, with default value.
 // Gets the specified attribute, with default value.
 template< typename T >
 template< typename T >
 T Element::GetAttribute(const String& name, const T& default_value) const
 T Element::GetAttribute(const String& name, const T& default_value) const
-{			
+{
 	return Get(attributes, name, default_value);
 	return Get(attributes, name, default_value);
 }
 }
 
 
+}
+}

+ 2 - 2
Include/Rocket/Core/ElementInstancerGeneric.h

@@ -61,9 +61,9 @@ public:
 	virtual void Release();
 	virtual void Release();
 };
 };
 
 
-#include "ElementInstancerGeneric.inl"
-
 }
 }
 }
 }
 
 
+#include "ElementInstancerGeneric.inl"
+
 #endif
 #endif

+ 7 - 1
Include/Rocket/Core/ElementInstancerGeneric.inl

@@ -25,11 +25,14 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 template <typename T>
 template <typename T>
 ElementInstancerGeneric<T>::~ElementInstancerGeneric()
 ElementInstancerGeneric<T>::~ElementInstancerGeneric()
 {
 {
 }
 }
-	
+
 // Instances an element given the tag name and attributes
 // Instances an element given the tag name and attributes
 template <typename T>
 template <typename T>
 Element* ElementInstancerGeneric<T>::InstanceElement(Element* /*parent*/, const String& tag, const XMLAttributes& /*attributes*/)
 Element* ElementInstancerGeneric<T>::InstanceElement(Element* /*parent*/, const String& tag, const XMLAttributes& /*attributes*/)
@@ -54,3 +57,6 @@ void ElementInstancerGeneric<T>::Release()
 {
 {
 	delete this;
 	delete this;
 }
 }
+
+}
+}

+ 1 - 1
Include/Rocket/Core/TransformPrimitive.h

@@ -130,7 +130,7 @@ struct Matrix3D : public ResolvedPrimitive< 16 >
 struct TranslateX : public UnresolvedPrimitive< 1 >
 struct TranslateX : public UnresolvedPrimitive< 1 >
 {
 {
 	TranslateX(const NumericValue* values) noexcept : UnresolvedPrimitive(values) { }
 	TranslateX(const NumericValue* values) noexcept : UnresolvedPrimitive(values) { }
-	TranslateX(float x, Property::Unit unit = Property::PX) noexcept : UnresolvedPrimitive({ NumericValue{x, unit} }) { }
+	TranslateX(float x, Property::Unit unit = Property::PX) noexcept : UnresolvedPrimitive({ NumericValue(x, unit) }) { }
 	String ToString() const noexcept { return "translateX" + UnresolvedPrimitive< 1 >::ToString(); }
 	String ToString() const noexcept { return "translateX" + UnresolvedPrimitive< 1 >::ToString(); }
 };
 };
 
 

+ 3 - 1
Include/Rocket/Core/Tween.h

@@ -135,7 +135,7 @@ public:
 
 
 	String to_string() const
 	String to_string() const
 	{
 	{
-		const std::array<String, size_t(Count)> type_str = { "none", "back", "bounce", "circular", "cubic", "elastic", "exponential", "linear", "quadratic", "quartic", "quintic", "sine", "callback" };
+		const std::array<String, size_t(Count)> type_str = { { "none", "back", "bounce", "circular", "cubic", "elastic", "exponential", "linear", "quadratic", "quartic", "quintic", "sine", "callback" } };
 
 
 		if (size_t(type_in) < type_str.size() && size_t(type_out) < type_str.size())
 		if (size_t(type_in) < type_str.size() && size_t(type_out) < type_str.size())
 		{
 		{
@@ -196,6 +196,8 @@ private:
 			if (callback)
 			if (callback)
 				return (*callback)(t);
 				return (*callback)(t);
 			break;
 			break;
+		default:
+			break;
 		}
 		}
 		return t;
 		return t;
 	}
 	}

+ 2 - 2
Include/Rocket/Core/Variant.h

@@ -146,9 +146,9 @@ private:
 	char data[LOCAL_DATA_SIZE];
 	char data[LOCAL_DATA_SIZE];
 };
 };
 
 
-#include "Variant.inl"
-
 }
 }
 }
 }
 
 
+#include "Variant.inl"
+
 #endif
 #endif

+ 8 - 3
Include/Rocket/Core/Variant.inl

@@ -25,6 +25,8 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
 
 
 inline Variant::Type Variant::GetType() const
 inline Variant::Type Variant::GetType() const
 {
 {
@@ -35,7 +37,7 @@ inline Variant::Type Variant::GetType() const
 template< typename T >
 template< typename T >
 Variant::Variant(const T& t) : type(NONE)
 Variant::Variant(const T& t) : type(NONE)
 {
 {
-	Set( t );
+	Set(t);
 }
 }
 
 
 // Clear and set new value
 // Clear and set new value
@@ -49,7 +51,7 @@ void Variant::Reset(const T& t)
 // Templatised data accessor.
 // Templatised data accessor.
 template< typename T >
 template< typename T >
 bool Variant::GetInto(T& value) const
 bool Variant::GetInto(T& value) const
-{	
+{
 	switch (type)
 	switch (type)
 	{
 	{
 	case BYTE:
 	case BYTE:
@@ -109,7 +111,7 @@ bool Variant::GetInto(T& value) const
 		break;
 		break;
 
 
 	case SCRIPTINTERFACE:
 	case SCRIPTINTERFACE:
-		return TypeConverter< ScriptInterface*, T >::Convert(*(ScriptInterface**)data, value);
+		return TypeConverter< ScriptInterface*, T >::Convert(*(ScriptInterface * *)data, value);
 		break;
 		break;
 
 
 	case VOIDPTR:
 	case VOIDPTR:
@@ -131,3 +133,6 @@ T Variant::Get() const
 	GetInto(value);
 	GetInto(value);
 	return value;
 	return value;
 }
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector2.h

@@ -132,9 +132,9 @@ class Vector2
 		Type y;
 		Type y;
 };
 };
 
 
-#include "Vector2.inl"
-
 }
 }
 }
 }
 
 
+#include "Vector2.inl"
+
 #endif
 #endif

+ 24 - 16
Include/Rocket/Core/Vector2.inl

@@ -25,6 +25,9 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 // Default constructor.
 template < typename Type >
 template < typename Type >
 Vector2< Type >::Vector2()
 Vector2< Type >::Vector2()
@@ -43,7 +46,7 @@ Vector2< Type >::Vector2(Type _x, Type _y)
 template < typename Type >
 template < typename Type >
 float Vector2< Type >::Magnitude() const
 float Vector2< Type >::Magnitude() const
 {
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 		return 0;
 
 
@@ -55,7 +58,7 @@ template < typename Type >
 Type Vector2< Type >::SquaredMagnitude() const
 Type Vector2< Type >::SquaredMagnitude() const
 {
 {
 	return x * x +
 	return x * x +
-		   y * y;
+		y * y;
 }
 }
 
 
 // Generates a normalised vector from this vector.
 // Generates a normalised vector from this vector.
@@ -70,7 +73,8 @@ Vector2< Type > Vector2< Type >::Normalise() const
 }
 }
 
 
 // Generates a rounded vector from this vector.
 // Generates a rounded vector from this vector.
-Vector2< float > Vector2< float >::Round() const
+template < >
+inline Vector2< float > Vector2< float >::Round() const
 {
 {
 	Vector2 < float > result;
 	Vector2 < float > result;
 	result.x = std::roundf(x);
 	result.x = std::roundf(x);
@@ -79,7 +83,8 @@ Vector2< float > Vector2< float >::Round() const
 }
 }
 
 
 // Generates a rounded vector from this vector.
 // Generates a rounded vector from this vector.
-Vector2< int > Vector2< int >::Round() const
+template < >
+inline Vector2< int > Vector2< int >::Round() const
 {
 {
 	return *this;
 	return *this;
 }
 }
@@ -89,7 +94,7 @@ template < typename Type >
 Type Vector2< Type >::DotProduct(const Vector2< Type >& rhs) const
 Type Vector2< Type >::DotProduct(const Vector2< Type >& rhs) const
 {
 {
 	return x * rhs.x +
 	return x * rhs.x +
-		   y * rhs.y;
+		y * rhs.y;
 }
 }
 
 
 // Returns this vector rotated around the origin.
 // Returns this vector rotated around the origin.
@@ -100,7 +105,7 @@ Vector2< Type > Vector2< Type >::Rotate(float theta) const
 	float sin_theta = Math::Sin(theta);
 	float sin_theta = Math::Sin(theta);
 
 
 	return Vector2< Type >(((Type)(cos_theta * x - sin_theta * y)),
 	return Vector2< Type >(((Type)(cos_theta * x - sin_theta * y)),
-							((Type)(sin_theta * x + cos_theta * y)));
+		((Type)(sin_theta * x + cos_theta * y)));
 }
 }
 
 
 // Returns the negation of this vector.
 // Returns the negation of this vector.
@@ -112,14 +117,14 @@ Vector2< Type > Vector2< Type >::operator-() const
 
 
 // Returns the sum of this vector and another.
 // Returns the sum of this vector and another.
 template < typename Type >
 template < typename Type >
-Vector2< Type > Vector2< Type >::operator+(const Vector2< Type >& rhs) const
+Vector2< Type > Vector2< Type >::operator+(const Vector2< Type > & rhs) const
 {
 {
 	return Vector2< Type >(x + rhs.x, y + rhs.y);
 	return Vector2< Type >(x + rhs.x, y + rhs.y);
 }
 }
 
 
 // Returns the result of subtracting another vector from this vector.
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
 template < typename Type >
-Vector2< Type > Vector2< Type >::operator-(const Vector2< Type >& rhs) const
+Vector2< Type > Vector2< Type >::operator-(const Vector2< Type > & rhs) const
 {
 {
 	return Vector2(x - rhs.x, y - rhs.y);
 	return Vector2(x - rhs.x, y - rhs.y);
 }
 }
@@ -140,7 +145,7 @@ Vector2< Type > Vector2< Type >::operator/(Type rhs) const
 
 
 // Adds another vector to this in-place.
 // Adds another vector to this in-place.
 template < typename Type >
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator+=(const Vector2& rhs)
+Vector2< Type >& Vector2< Type >::operator+=(const Vector2 & rhs)
 {
 {
 	x += rhs.x;
 	x += rhs.x;
 	y += rhs.y;
 	y += rhs.y;
@@ -150,7 +155,7 @@ Vector2< Type >& Vector2< Type >::operator+=(const Vector2& rhs)
 
 
 // Subtracts another vector from this in-place.
 // Subtracts another vector from this in-place.
 template < typename Type >
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator-=(const Vector2& rhs)
+Vector2< Type >& Vector2< Type >::operator-=(const Vector2 & rhs)
 {
 {
 	x -= rhs.x;
 	x -= rhs.x;
 	y -= rhs.y;
 	y -= rhs.y;
@@ -160,7 +165,7 @@ Vector2< Type >& Vector2< Type >::operator-=(const Vector2& rhs)
 
 
 // Scales this vector in-place.
 // Scales this vector in-place.
 template < typename Type >
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator*=(const Type& rhs)
+Vector2< Type >& Vector2< Type >::operator*=(const Type & rhs)
 {
 {
 	x *= rhs;
 	x *= rhs;
 	y *= rhs;
 	y *= rhs;
@@ -170,7 +175,7 @@ Vector2< Type >& Vector2< Type >::operator*=(const Type& rhs)
 
 
 // Scales this vector in-place by the inverse of a value.
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator/=(const Type& rhs)
+Vector2< Type >& Vector2< Type >::operator/=(const Type & rhs)
 {
 {
 	x /= rhs;
 	x /= rhs;
 	y /= rhs;
 	y /= rhs;
@@ -180,28 +185,31 @@ Vector2< Type >& Vector2< Type >::operator/=(const Type& rhs)
 
 
 // Equality operator.
 // Equality operator.
 template < typename Type >
 template < typename Type >
-bool Vector2< Type >::operator==(const Vector2& rhs) const
+bool Vector2< Type >::operator==(const Vector2 & rhs) const
 {
 {
 	return (x == rhs.x && y == rhs.y);
 	return (x == rhs.x && y == rhs.y);
 }
 }
 
 
 // Inequality operator.
 // Inequality operator.
 template < typename Type >
 template < typename Type >
-bool Vector2< Type >::operator!=(const Vector2& rhs) const
+bool Vector2< Type >::operator!=(const Vector2 & rhs) const
 {
 {
 	return (x != rhs.x || y != rhs.y);
 	return (x != rhs.x || y != rhs.y);
 }
 }
 
 
 // Auto-cast operator.
 // Auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector2< Type >::operator const Type*() const
+Vector2< Type >::operator const Type* () const
 {
 {
 	return &x;
 	return &x;
 }
 }
 
 
 // Constant auto-cast operator.
 // Constant auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector2< Type >::operator Type*()
+Vector2< Type >::operator Type* ()
 {
 {
 	return &x;
 	return &x;
 }
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector3.h

@@ -131,9 +131,9 @@ class Vector3
 		Type z;
 		Type z;
 };
 };
 
 
-#include "Vector3.inl"
-
 }
 }
 }
 }
 
 
+#include "Vector3.inl"
+
 #endif
 #endif

+ 19 - 13
Include/Rocket/Core/Vector3.inl

@@ -25,6 +25,9 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 // Default constructor.
 template < typename Type >
 template < typename Type >
 Vector3< Type >::Vector3()
 Vector3< Type >::Vector3()
@@ -44,7 +47,7 @@ Vector3< Type >::Vector3(Type _x, Type _y, Type _z)
 template < typename Type >
 template < typename Type >
 float Vector3< Type >::Magnitude() const
 float Vector3< Type >::Magnitude() const
 {
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 		return 0;
 
 
@@ -87,11 +90,11 @@ Type Vector3< Type >::DotProduct(const Vector3< Type >& rhs) const
 template < typename Type >
 template < typename Type >
 Vector3< Type> Vector3< Type >::CrossProduct(const Vector3< Type >& rhs) const
 Vector3< Type> Vector3< Type >::CrossProduct(const Vector3< Type >& rhs) const
 {
 {
-	return Vector3< Type > (
+	return Vector3< Type >(
 		y * rhs.z - z * rhs.y,
 		y * rhs.z - z * rhs.y,
 		z * rhs.x - x * rhs.z,
 		z * rhs.x - x * rhs.z,
 		x * rhs.y - y * rhs.x
 		x * rhs.y - y * rhs.x
-	);
+		);
 }
 }
 
 
 // Returns the negation of this vector.
 // Returns the negation of this vector.
@@ -103,14 +106,14 @@ Vector3< Type > Vector3< Type >::operator-() const
 
 
 // Returns the sum of this vector and another.
 // Returns the sum of this vector and another.
 template < typename Type >
 template < typename Type >
-Vector3< Type > Vector3< Type >::operator+(const Vector3< Type >& rhs) const
+Vector3< Type > Vector3< Type >::operator+(const Vector3< Type > & rhs) const
 {
 {
 	return Vector3< Type >(x + rhs.x, y + rhs.y, z + rhs.z);
 	return Vector3< Type >(x + rhs.x, y + rhs.y, z + rhs.z);
 }
 }
 
 
 // Returns the result of subtracting another vector from this vector.
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
 template < typename Type >
-Vector3< Type > Vector3< Type >::operator-(const Vector3< Type >& rhs) const
+Vector3< Type > Vector3< Type >::operator-(const Vector3< Type > & rhs) const
 {
 {
 	return Vector3(x - rhs.x, y - rhs.y, z - rhs.z);
 	return Vector3(x - rhs.x, y - rhs.y, z - rhs.z);
 }
 }
@@ -131,7 +134,7 @@ Vector3< Type > Vector3< Type >::operator/(Type rhs) const
 
 
 // Adds another vector to this in-place.
 // Adds another vector to this in-place.
 template < typename Type >
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator+=(const Vector3& rhs)
+Vector3< Type >& Vector3< Type >::operator+=(const Vector3 & rhs)
 {
 {
 	x += rhs.x;
 	x += rhs.x;
 	y += rhs.y;
 	y += rhs.y;
@@ -142,7 +145,7 @@ Vector3< Type >& Vector3< Type >::operator+=(const Vector3& rhs)
 
 
 // Subtracts another vector from this in-place.
 // Subtracts another vector from this in-place.
 template < typename Type >
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator-=(const Vector3& rhs)
+Vector3< Type >& Vector3< Type >::operator-=(const Vector3 & rhs)
 {
 {
 	x -= rhs.x;
 	x -= rhs.x;
 	y -= rhs.y;
 	y -= rhs.y;
@@ -153,7 +156,7 @@ Vector3< Type >& Vector3< Type >::operator-=(const Vector3& rhs)
 
 
 // Scales this vector in-place.
 // Scales this vector in-place.
 template < typename Type >
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator*=(const Type& rhs)
+Vector3< Type >& Vector3< Type >::operator*=(const Type & rhs)
 {
 {
 	x *= rhs;
 	x *= rhs;
 	y *= rhs;
 	y *= rhs;
@@ -164,7 +167,7 @@ Vector3< Type >& Vector3< Type >::operator*=(const Type& rhs)
 
 
 // Scales this vector in-place by the inverse of a value.
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator/=(const Type& rhs)
+Vector3< Type >& Vector3< Type >::operator/=(const Type & rhs)
 {
 {
 	x /= rhs;
 	x /= rhs;
 	y /= rhs;
 	y /= rhs;
@@ -175,28 +178,31 @@ Vector3< Type >& Vector3< Type >::operator/=(const Type& rhs)
 
 
 // Equality operator.
 // Equality operator.
 template < typename Type >
 template < typename Type >
-bool Vector3< Type >::operator==(const Vector3& rhs) const
+bool Vector3< Type >::operator==(const Vector3 & rhs) const
 {
 {
 	return (x == rhs.x && y == rhs.y && z == rhs.z);
 	return (x == rhs.x && y == rhs.y && z == rhs.z);
 }
 }
 
 
 // Inequality operator.
 // Inequality operator.
 template < typename Type >
 template < typename Type >
-bool Vector3< Type >::operator!=(const Vector3& rhs) const
+bool Vector3< Type >::operator!=(const Vector3 & rhs) const
 {
 {
 	return (x != rhs.x || y != rhs.y || z != rhs.z);
 	return (x != rhs.x || y != rhs.y || z != rhs.z);
 }
 }
 
 
 // Constant auto-cast operator.
 // Constant auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector3< Type >::operator const Type*() const
+Vector3< Type >::operator const Type* () const
 {
 {
 	return &x;
 	return &x;
 }
 }
 
 
 // Auto-cast operator.
 // Auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector3< Type >::operator Type*()
+Vector3< Type >::operator Type* ()
 {
 {
 	return &x;
 	return &x;
 }
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector4.h

@@ -135,9 +135,9 @@ class Vector4
 		Type w;
 		Type w;
 };
 };
 
 
-#include "Vector4.inl"
-
 }
 }
 }
 }
 
 
+#include "Vector4.inl"
+
 #endif
 #endif

+ 21 - 15
Include/Rocket/Core/Vector4.inl

@@ -25,6 +25,9 @@
  *
  *
  */
  */
 
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 // Default constructor.
 template < typename Type >
 template < typename Type >
 Vector4< Type >::Vector4()
 Vector4< Type >::Vector4()
@@ -34,14 +37,14 @@ Vector4< Type >::Vector4()
 // Initialising constructor.
 // Initialising constructor.
 template < typename Type >
 template < typename Type >
 Vector4< Type >::Vector4(Type _x, Type _y, Type _z, Type _w)
 Vector4< Type >::Vector4(Type _x, Type _y, Type _z, Type _w)
-	: x (_x), y (_y), z (_z), w (_w)
+	: x(_x), y(_y), z(_z), w(_w)
 {
 {
 }
 }
 
 
 // Implicit conversion from a 3D Vector.
 // Implicit conversion from a 3D Vector.
 template < typename Type >
 template < typename Type >
-Vector4< Type >::Vector4(Vector3< Type > const &v, Type w)
-	: x (v.x), y (v.y), z (v.z), w (w)
+Vector4< Type >::Vector4(Vector3< Type > const& v, Type w)
+	: x(v.x), y(v.y), z(v.z), w(w)
 {
 {
 }
 }
 
 
@@ -49,7 +52,7 @@ Vector4< Type >::Vector4(Vector3< Type > const &v, Type w)
 template < typename Type >
 template < typename Type >
 float Vector4< Type >::Magnitude() const
 float Vector4< Type >::Magnitude() const
 {
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 		return 0;
 
 
@@ -90,14 +93,14 @@ Vector4< Type > Vector4< Type >::operator-() const
 
 
 // Returns the sum of this vector and another.
 // Returns the sum of this vector and another.
 template < typename Type >
 template < typename Type >
-Vector4< Type > Vector4< Type >::operator+(const Vector4< Type >& rhs) const
+Vector4< Type > Vector4< Type >::operator+(const Vector4< Type > & rhs) const
 {
 {
 	return Vector4< Type >(x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w);
 	return Vector4< Type >(x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w);
 }
 }
 
 
 // Returns the result of subtracting another vector from this vector.
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
 template < typename Type >
-Vector4< Type > Vector4< Type >::operator-(const Vector4< Type >& rhs) const
+Vector4< Type > Vector4< Type >::operator-(const Vector4< Type > & rhs) const
 {
 {
 	return Vector4(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
 	return Vector4(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
 }
 }
@@ -118,7 +121,7 @@ Vector4< Type > Vector4< Type >::operator/(Type rhs) const
 
 
 // Adds another vector to this in-place.
 // Adds another vector to this in-place.
 template < typename Type >
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator+=(const Vector4& rhs)
+Vector4< Type >& Vector4< Type >::operator+=(const Vector4 & rhs)
 {
 {
 	x += rhs.x;
 	x += rhs.x;
 	y += rhs.y;
 	y += rhs.y;
@@ -130,7 +133,7 @@ Vector4< Type >& Vector4< Type >::operator+=(const Vector4& rhs)
 
 
 // Subtracts another vector from this in-place.
 // Subtracts another vector from this in-place.
 template < typename Type >
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator-=(const Vector4& rhs)
+Vector4< Type >& Vector4< Type >::operator-=(const Vector4 & rhs)
 {
 {
 	x -= rhs.x;
 	x -= rhs.x;
 	y -= rhs.y;
 	y -= rhs.y;
@@ -142,7 +145,7 @@ Vector4< Type >& Vector4< Type >::operator-=(const Vector4& rhs)
 
 
 // Scales this vector in-place.
 // Scales this vector in-place.
 template < typename Type >
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator*=(const Type& rhs)
+Vector4< Type >& Vector4< Type >::operator*=(const Type & rhs)
 {
 {
 	x *= rhs;
 	x *= rhs;
 	y *= rhs;
 	y *= rhs;
@@ -154,7 +157,7 @@ Vector4< Type >& Vector4< Type >::operator*=(const Type& rhs)
 
 
 // Scales this vector in-place by the inverse of a value.
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator/=(const Type& rhs)
+Vector4< Type >& Vector4< Type >::operator/=(const Type & rhs)
 {
 {
 	x /= rhs;
 	x /= rhs;
 	y /= rhs;
 	y /= rhs;
@@ -166,28 +169,28 @@ Vector4< Type >& Vector4< Type >::operator/=(const Type& rhs)
 
 
 // Equality operator.
 // Equality operator.
 template < typename Type >
 template < typename Type >
-bool Vector4< Type >::operator==(const Vector4& rhs) const
+bool Vector4< Type >::operator==(const Vector4 & rhs) const
 {
 {
 	return (x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w);
 	return (x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w);
 }
 }
 
 
 // Inequality operator.
 // Inequality operator.
 template < typename Type >
 template < typename Type >
-bool Vector4< Type >::operator!=(const Vector4& rhs) const
+bool Vector4< Type >::operator!=(const Vector4 & rhs) const
 {
 {
 	return (x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w);
 	return (x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w);
 }
 }
 
 
 // Auto-cast operator.
 // Auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector4< Type >::operator const Type*() const
+Vector4< Type >::operator const Type* () const
 {
 {
 	return &x;
 	return &x;
 }
 }
 
 
 // Constant auto-cast operator.
 // Constant auto-cast operator.
 template < typename Type >
 template < typename Type >
-Vector4< Type >::operator Type*()
+Vector4< Type >::operator Type* ()
 {
 {
 	return &x;
 	return &x;
 }
 }
@@ -197,5 +200,8 @@ Vector4< Type >::operator Type*()
 template < typename Type >
 template < typename Type >
 Vector4< Type >::operator Vector3< Type >() const
 Vector4< Type >::operator Vector3< Type >() const
 {
 {
-	return Vector3< Type > (x/w, y/w, z/w);
+	return Vector3< Type >(x / w, y / w, z / w);
+}
+
+}
 }
 }

+ 4 - 2
Source/Core/Context.cpp

@@ -692,7 +692,8 @@ void Context::ProcessMouseButtonUp(int button_index, int key_modifier_state)
 
 
 		// Unset the 'active' pseudo-class on all the elements in the active chain; because they may not necessarily
 		// Unset the 'active' pseudo-class on all the elements in the active chain; because they may not necessarily
 		// have had 'onmouseup' called on them, we can't guarantee this has happened already.
 		// have had 'onmouseup' called on them, we can't guarantee this has happened already.
-		std::for_each(active_chain.begin(), active_chain.end(), PseudoClassFunctor("active", false));
+		auto func = PseudoClassFunctor("active", false);
+		std::for_each(active_chain.begin(), active_chain.end(), func);
 		active_chain.clear();
 		active_chain.clear();
 
 
 		if (drag)
 		if (drag)
@@ -1178,7 +1179,8 @@ void Context::SendEvents(const ElementSet& old_items, const ElementSet& new_item
 {
 {
 	ElementList elements;
 	ElementList elements;
 	std::set_difference(old_items.begin(), old_items.end(), new_items.begin(), new_items.end(), std::back_inserter(elements));
 	std::set_difference(old_items.begin(), old_items.end(), new_items.begin(), new_items.end(), std::back_inserter(elements));
-	std::for_each(elements.begin(), elements.end(), RKTEventFunctor(event, parameters, interruptible));
+	auto func = RKTEventFunctor(event, parameters, interruptible);
+	std::for_each(elements.begin(), elements.end(), func);
 }
 }
 
 
 void Context::OnReferenceDeactivate()
 void Context::OnReferenceDeactivate()

+ 8 - 3
Source/Core/ElementAnimation.cpp

@@ -340,8 +340,8 @@ static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element,
 		if(prop0.unit != Property::TRANSFORM || prop1.unit != Property::TRANSFORM)
 		if(prop0.unit != Property::TRANSFORM || prop1.unit != Property::TRANSFORM)
 			return false;
 			return false;
 
 
-		auto& t0 = prop0.value.Get<TransformRef>();
-		auto& t1 = prop1.value.Get<TransformRef>();
+		auto t0 = prop0.value.Get<TransformRef>();
+		auto t1 = prop1.value.Get<TransformRef>();
 
 
 		auto result = PrepareTransformPair(*t0, *t1, element);
 		auto result = PrepareTransformPair(*t0, *t1, element);
 
 
@@ -436,9 +436,14 @@ bool ElementAnimation::AddKey(float target_time, const Property & in_property, E
 	}
 	}
 
 
 	if(result)
 	if(result)
-		if(extend_duration) duration = target_time;
+	{
+		if(extend_duration) 
+			duration = target_time;
+	}
 	else
 	else
+	{
 		keys.pop_back();
 		keys.pop_back();
+	}
 
 
 	return result;
 	return result;
 }
 }

+ 1 - 1
Source/Core/ElementUtilities.cpp

@@ -423,7 +423,7 @@ bool ElementUtilities::ApplyTransform(Element &element, bool apply)
 	element.GetEffectiveTransformState(&local_perspective, &perspective, &transform);
 	element.GetEffectiveTransformState(&local_perspective, &perspective, &transform);
 
 
 	bool have_perspective = false;
 	bool have_perspective = false;
-	float perspective_distance;
+	float perspective_distance = 0.0f;
 	Matrix4f the_projection;
 	Matrix4f the_projection;
 	if (local_perspective)
 	if (local_perspective)
 	{
 	{

+ 2 - 0
Source/Core/PropertyParserAnimation.cpp

@@ -159,6 +159,8 @@ static bool ParseAnimation(Property & property, const StringList& animation_valu
 				case Keyword::PAUSED:
 				case Keyword::PAUSED:
 					animation.paused = true;
 					animation.paused = true;
 					break;
 					break;
+				default:
+					break;
 				}
 				}
 			}
 			}
 			else
 			else