diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/layout_control.cpp | 8 | ||||
-rw-r--r-- | src/ui/render/flex_layout_render_object.cpp | 6 | ||||
-rw-r--r-- | src/ui/render/render_object.cpp | 12 | ||||
-rw-r--r-- | src/ui/routed_event_dispatch.hpp | 4 |
4 files changed, 20 insertions, 10 deletions
diff --git a/src/ui/layout_control.cpp b/src/ui/layout_control.cpp index cd9587c7..3b4646e5 100644 --- a/src/ui/layout_control.cpp +++ b/src/ui/layout_control.cpp @@ -13,7 +13,9 @@ void LayoutControl::AddChild(Control* control, const int position) { assert(control->GetParent() == nullptr); // The control already has a parent. assert(!dynamic_cast<Window*>(control)); // Can't add a window as child. assert(position >= 0 || - position <= this->children_.size()); // The position is out of range. + position <= + static_cast<int>( + this->children_.size())); // The position is out of range. children_.insert(this->children_.cbegin() + position, control); @@ -25,7 +27,9 @@ void LayoutControl::AddChild(Control* control, const int position) { void LayoutControl::RemoveChild(const int position) { assert(position >= 0 && - position < this->children_.size()); // The position is out of range. + position < + static_cast<int>( + this->children_.size())); // The position is out of range. const auto i = children_.cbegin() + position; const auto child = *i; diff --git a/src/ui/render/flex_layout_render_object.cpp b/src/ui/render/flex_layout_render_object.cpp index a5fde12a..1cac6899 100644 --- a/src/ui/render/flex_layout_render_object.cpp +++ b/src/ui/render/flex_layout_render_object.cpp @@ -59,7 +59,7 @@ Size FlexLayoutRenderObject::OnMeasureContent(const Size& available_size) { std::vector<int> no_basis_children; std::vector<int> grow_children; std::vector<int> shrink_chilren; - for (int i = 0; i < child_layout_data_.size(); i++) { + for (int i = 0; i < static_cast<int>(child_layout_data_.size()); i++) { const auto& layout_data = child_layout_data_[i]; if (layout_data.flex_basis.has_value()) has_basis_children.push_back(i); @@ -189,7 +189,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) { content_rect.width, actual_content_width); float anchor_x = 0; - for (int i = 0; i < children.size(); i++) { + for (int i = 0; i < static_cast<int>(children.size()); i++) { const auto child = children[i]; const auto size = child->GetPreferredSize(); @@ -219,7 +219,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) { content_rect.height, actual_content_height); float anchor_y = 0; - for (int i = 0; i < children.size(); i++) { + for (int i = 0; i < static_cast<int>(children.size()); i++) { const auto child = children[i]; const auto size = child->GetPreferredSize(); diff --git a/src/ui/render/render_object.cpp b/src/ui/render/render_object.cpp index b6a9e8e4..7f6255f7 100644 --- a/src/ui/render/render_object.cpp +++ b/src/ui/render/render_object.cpp @@ -11,9 +11,10 @@ void RenderObject::AddChild(RenderObject* render_object, const int position) { assert(!(child_mode_ == ChildMode::Single && children_.size() > 0)); assert(render_object->GetParent() == - nullptr); // Render object already has a parent. - assert(position >= 0); // Position index is less than 0. - assert(position <= children_.size()); // Position index is out of bound. + nullptr); // Render object already has a parent. + assert(position >= 0); // Position index is less than 0. + assert(position <= static_cast<int>( + children_.size())); // Position index is out of bound. children_.insert(children_.cbegin() + position, render_object); render_object->SetParent(this); @@ -21,8 +22,9 @@ void RenderObject::AddChild(RenderObject* render_object, const int position) { } void RenderObject::RemoveChild(const int position) { - assert(position >= 0); // Position index is less than 0. - assert(position < children_.size()); // Position index is out of bound. + assert(position >= 0); // Position index is less than 0. + assert(position < static_cast<int>( + children_.size())); // Position index is out of bound. const auto i = children_.cbegin() + position; const auto removed_child = *i; diff --git a/src/ui/routed_event_dispatch.hpp b/src/ui/routed_event_dispatch.hpp index 666be9ac..dd55ce17 100644 --- a/src/ui/routed_event_dispatch.hpp +++ b/src/ui/routed_event_dispatch.hpp @@ -24,6 +24,10 @@ void DispatchEvent(const std::string_view& event_name, Control* const original_sender, event::RoutedEvent<EventArgs>* (Control::*event_ptr)(), Control* const last_receiver, Args&&... args) { +#ifndef CRU_DEBUG + CRU_UNUSED(event_name) +#endif + #ifdef CRU_DEBUG bool do_log = true; if (event_name == "MouseMove") do_log = false; |