Codechange: Replace C-style casts to size_t with static_cast. (#12455)

* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
This commit is contained in:
2024-04-19 20:34:36 +01:00
committed by GitHub
parent 6ee31a2a22
commit a28ab8cac2
24 changed files with 38 additions and 38 deletions

View File

@@ -845,7 +845,7 @@ public:
template <typename Tcontainer>
auto GetVisibleRangeIterators(Tcontainer &container) const
{
assert((size_t)this->GetCount() == container.size()); // Scrollbar and container size must match.
assert(static_cast<size_t>(this->GetCount()) == container.size()); // Scrollbar and container size must match.
auto first = std::next(std::begin(container), this->GetPosition());
auto last = std::next(first, std::min<size_t>(this->GetCapacity(), this->GetCount() - this->GetPosition()));
return std::make_pair(first, last);
@@ -864,7 +864,7 @@ public:
template <typename Tcontainer>
typename Tcontainer::iterator GetScrolledItemFromWidget(Tcontainer &container, int clickpos, const Window * const w, WidgetID widget, int padding = 0, int line_height = -1) const
{
assert((size_t)this->GetCount() == container.size()); // Scrollbar and container size must match.
assert(static_cast<size_t>(this->GetCount()) == container.size()); // Scrollbar and container size must match.
size_type row = this->GetScrolledRowFromWidget(clickpos, w, widget, padding, line_height);
if (row == Scrollbar::npos) return std::end(container);