Browse Source

Fix some compiler warnings

Michael Ragazzon 6 years ago
parent
commit
2a53aa9424

+ 2 - 0
Source/Core/ComputeProperty.cpp

@@ -140,6 +140,8 @@ float ComputeAbsoluteLength(const Property& property, float dp_ratio)
 				return inch * (1.0f / 72.0f);
 			case Property::PC: // pica
 				return inch * (1.0f / 6.0f);
+			default:
+				break;
 			}
 		}
 	}

+ 2 - 0
Source/Core/ElementStyle.cpp

@@ -468,6 +468,8 @@ float ElementStyle::ResolveNumberLengthPercentage(const Property * property, Rel
 	case Property::PERCENT:
 		scale_value = property->value.Get< float >() * 0.01f;
 		break;
+	default:
+		break;
 	}
 
 	return base_value * scale_value;

+ 0 - 1
Source/Core/ElementUtilities.cpp

@@ -332,7 +332,6 @@ static void SetBox(Element* element)
 	Box box;
 	LayoutEngine::BuildBox(box, containing_block, element);
 
-	const Property *local_height = element->GetLocalProperty(HEIGHT);
 	if (element->GetComputedValues().height.type != Style::Height::Auto)
 		box.SetContent(Vector2f(box.GetSize().x, containing_block.y));
 

+ 1 - 1
Source/Core/Event.cpp

@@ -45,7 +45,7 @@ Event::Event() : id(EventId::Invalid)
 }
 
 Event::Event(Element* _target_element, EventId id, const String& type, const Dictionary& _parameters, bool interruptible)
-	: id(id), type(type), interruptible(interruptible), parameters(_parameters), target_element(_target_element)
+	: parameters(_parameters), target_element(_target_element), type(type), id(id), interruptible(interruptible)
 {
 	phase = EventPhase::None;
 	interrupted = false;

+ 1 - 0
Source/Core/LayoutLineBox.cpp

@@ -149,6 +149,7 @@ LayoutInlineBox* LayoutLineBox::Close(LayoutInlineBox* overflow)
 		{
 			case Style::TextAlign::Center:  element_offset = (dimensions.x - box_cursor) * 0.5f; break;
 			case Style::TextAlign::Right:   element_offset = (dimensions.x - box_cursor); break;
+			default: break;
 		}
 
 		if (element_offset != 0)

+ 2 - 5
Source/Core/TransformPrimitive.cpp

@@ -114,9 +114,7 @@ float NumericValue::ResolveDepth(Element& e) const noexcept
 
 float NumericValue::ResolveAbsoluteUnit(Property::Unit base_unit) const noexcept
 {
-	switch (base_unit)
-	{
-	case Property::RAD:
+	if(base_unit == Property::RAD)
 	{
 		switch (unit)
 		{
@@ -127,10 +125,10 @@ float NumericValue::ResolveAbsoluteUnit(Property::Unit base_unit) const noexcept
 			return number;
 		case Property::PERCENT:
 			return number * 0.01f * 2.0f * Math::ROCKET_PI;
+		default:
 			break;
 		}
 	}
-	}
 	return number;
 }
 
@@ -587,7 +585,6 @@ struct GetGenericTypeVisitor
 
 	GenericType run(const PrimitiveVariant& primitive)
 	{
-		PrimitiveVariant result = primitive;
 		switch (primitive.type)
 		{
 		case PrimitiveVariant::TRANSLATEX:  return this->operator()(primitive.translate_x); break;

+ 0 - 1
Source/Debugger/ElementInfo.cpp

@@ -234,7 +234,6 @@ void ElementInfo::UpdateSourceElement()
 	Core::Element* attributes_content = GetElementById("attributes-content");
 	if (attributes_content)
 	{
-		int index = 0;
 		Core::String attributes;
 
 		if (source_element != NULL)