Browse Source

Fix some static analysis warnings

Michael Ragazzon 6 years ago
parent
commit
af46806480

+ 2 - 2
Include/RmlUi/Core/PropertiesIteratorView.h

@@ -52,8 +52,8 @@ class PropertiesIterator;
 class RMLUICORE_API PropertiesIteratorView {
 public:
 	PropertiesIteratorView(UniquePtr<PropertiesIterator> ptr);
-	PropertiesIteratorView(PropertiesIteratorView&& other);
-	PropertiesIteratorView& operator=(PropertiesIteratorView&& other);
+	PropertiesIteratorView(PropertiesIteratorView&& other) noexcept;
+	PropertiesIteratorView& operator=(PropertiesIteratorView&& other) noexcept;
 	PropertiesIteratorView(const PropertiesIteratorView& other) = delete;
 	PropertiesIteratorView& operator=(const PropertiesIteratorView&) = delete;
 	~PropertiesIteratorView();

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

@@ -75,9 +75,9 @@ public:
 
 	Variant();
 	Variant(const Variant&);
-	Variant(Variant&&);
+	Variant(Variant&&) noexcept;
 	Variant& operator=(const Variant& copy);
-	Variant& operator=(Variant&& other);
+	Variant& operator=(Variant&& other) noexcept;
 	~Variant();
 
 	// Construct by variant type

+ 1 - 1
Source/Core/LayoutBlockBox.cpp

@@ -92,7 +92,7 @@ LayoutBlockBox::LayoutBlockBox(LayoutEngine* _layout_engine, LayoutBlockBox* _pa
 			if (self_offset_parent != this)
 			{
 				// Get the next position within our offset parent's containing block.
-				parent->PositionBlockBox(position, box, element->GetComputedValues().clear);
+				parent->PositionBlockBox(position, box, element ? element->GetComputedValues().clear : Style::Clear::None);
 				element->SetOffset(position - (self_offset_parent->GetPosition() - offset_root->GetPosition()), self_offset_parent->GetElement());
 			}
 			else

+ 2 - 3
Source/Core/LayoutLineBox.cpp

@@ -236,11 +236,10 @@ LayoutInlineBox* LayoutLineBox::AddBox(LayoutInlineBox* box)
 			right_spacing = GetSpacing(box->GetBox(), Box::RIGHT);
 			// Add the right spacing for any ancestor elements that must close immediately after it.
 			LayoutInlineBox* closing_box = box;
-			while (closing_box != nullptr &&
-				   closing_box->IsLastChild())
+			while (closing_box && closing_box->IsLastChild())
 			{
 				closing_box = closing_box->GetParent();
-				if (closing_box != nullptr)
+				if (closing_box)
 					right_spacing += GetSpacing(closing_box->GetBox(), Box::RIGHT);
 			}
 

+ 2 - 2
Source/Core/PropertiesIteratorView.cpp

@@ -37,9 +37,9 @@ namespace Core {
 
 PropertiesIteratorView::PropertiesIteratorView(UniquePtr<PropertiesIterator> ptr) : ptr(std::move(ptr)) {}
 
-PropertiesIteratorView::PropertiesIteratorView(PropertiesIteratorView&& other) : ptr(std::move(other.ptr)) {}
+PropertiesIteratorView::PropertiesIteratorView(PropertiesIteratorView&& other) noexcept : ptr(std::move(other.ptr)) {}
 
-PropertiesIteratorView& PropertiesIteratorView::operator=(PropertiesIteratorView&& other) 
+PropertiesIteratorView& PropertiesIteratorView::operator=(PropertiesIteratorView&& other) noexcept
 {
 	ptr = std::move(other.ptr);
 	return *this;

+ 2 - 2
Source/Core/Variant.cpp

@@ -51,7 +51,7 @@ Variant::Variant(const Variant& copy) : type(NONE)
 	Set(copy);
 }
 
-Variant::Variant(Variant&& other) : type(NONE)
+Variant::Variant(Variant&& other) noexcept : type(NONE)
 {
 	Set(std::move(other));
 }
@@ -427,7 +427,7 @@ Variant& Variant::operator=(const Variant& copy)
 	return *this;
 }
 
-Variant& Variant::operator=(Variant&& other)
+Variant& Variant::operator=(Variant&& other) noexcept
 {
 	if (other.type != type)
 		Clear();