Browse Source

Fix some compiler warnings (thanks viciious)

Michael Ragazzon 6 years ago
parent
commit
9426bfdab9

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

@@ -130,7 +130,7 @@ struct Matrix3D : public ResolvedPrimitive< 16 >
 struct TranslateX : public UnresolvedPrimitive< 1 >
 {
 	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(); }
 };
 

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

@@ -135,7 +135,7 @@ public:
 
 	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())
 		{
@@ -196,6 +196,8 @@ private:
 			if (callback)
 				return (*callback)(t);
 			break;
+		default:
+			break;
 		}
 		return t;
 	}

+ 2 - 2
Source/Core/ElementAnimation.cpp

@@ -339,8 +339,8 @@ static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element,
 		if(prop0.unit != Property::TRANSFORM || prop1.unit != Property::TRANSFORM)
 			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);
 

+ 1 - 1
Source/Core/ElementUtilities.cpp

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