From 221c62de313ad811ca2b3ae8ba43996c96c347bc Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 13 Dec 2019 23:53:06 +0800 Subject: ... --- src/ui/render/flex_layout_render_object.cpp | 6 +++--- src/ui/render/render_object.cpp | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/ui/render') 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 no_basis_children; std::vector grow_children; std::vector shrink_chilren; - for (int i = 0; i < child_layout_data_.size(); i++) { + for (int i = 0; i < static_cast(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(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(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( + 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( + children_.size())); // Position index is out of bound. const auto i = children_.cbegin() + position; const auto removed_child = *i; -- cgit v1.2.3