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:
@@ -34,7 +34,7 @@ template <typename T, size_t N> struct ArrayT<T[N]> {
|
||||
template <typename E, typename T>
|
||||
inline typename ArrayT<T>::Item ItemAtT(E idx, const T &t, typename ArrayT<T>::Item t_unk)
|
||||
{
|
||||
if ((size_t)idx >= ArrayT<T>::length) {
|
||||
if (static_cast<size_t>(idx) >= ArrayT<T>::length) {
|
||||
return t_unk;
|
||||
}
|
||||
return t[idx];
|
||||
@@ -48,7 +48,7 @@ inline typename ArrayT<T>::Item ItemAtT(E idx, const T &t, typename ArrayT<T>::I
|
||||
template <typename E, typename T>
|
||||
inline typename ArrayT<T>::Item ItemAtT(E idx, const T &t, typename ArrayT<T>::Item t_unk, E idx_inv, typename ArrayT<T>::Item t_inv)
|
||||
{
|
||||
if ((size_t)idx < ArrayT<T>::length) {
|
||||
if (static_cast<size_t>(idx) < ArrayT<T>::length) {
|
||||
return t[idx];
|
||||
}
|
||||
if (idx == idx_inv) {
|
||||
|
||||
Reference in New Issue
Block a user