Add size_t to u32/s32 static_casts in irrArray

This fixes 5 narrowing cast warnings from Visual Studio 17 2022.
This commit is contained in:
Josiah VanderZee 2023-12-16 12:14:55 -06:00 committed by sfan5
parent 22f2c37322
commit 854e97f57c

View File

@ -241,7 +241,7 @@ public:
/** \return Size of elements in the array which are actually occupied. */ /** \return Size of elements in the array which are actually occupied. */
u32 size() const u32 size() const
{ {
return m_data.size(); return static_cast<u32>(m_data.size());
} }
@ -317,7 +317,7 @@ public:
// *it = first element in [first, last) that is >= element, or last if not found. // *it = first element in [first, last) that is >= element, or last if not found.
if (*it < element || element < *it) if (*it < element || element < *it)
return -1; return -1;
return it - m_data.begin(); return static_cast<u32>(it - m_data.begin());
} }
@ -335,8 +335,8 @@ public:
auto iters = std::equal_range(m_data.begin(), m_data.end(), element); auto iters = std::equal_range(m_data.begin(), m_data.end(), element);
if (iters.first == iters.second) if (iters.first == iters.second)
return -1; return -1;
last = (iters.second - m_data.begin()) - 1; last = static_cast<s32>((iters.second - m_data.begin()) - 1);
return iters.first - m_data.begin(); return static_cast<s32>(iters.first - m_data.begin());
} }
@ -351,7 +351,7 @@ public:
auto it = std::find(m_data.begin(), m_data.end(), element); auto it = std::find(m_data.begin(), m_data.end(), element);
if (it == m_data.end()) if (it == m_data.end())
return -1; return -1;
return it - m_data.begin(); return static_cast<u32>(it - m_data.begin());
} }