mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-25 10:10:32 +01:00
Add size_t to u32 static_casts to irrString
The irrString implementation doesn't allow constructing a string with a size that would exceed a u32, so it should be safe to narrow the size of the underlying STL container back to a u32. This fixes 5 narrowing cast warnings from Visual Studio 17 2022.
This commit is contained in:
parent
94cb0cc19d
commit
22f2c37322
@ -266,7 +266,7 @@ public:
|
||||
the trailing NUL. */
|
||||
u32 size() const
|
||||
{
|
||||
return str.size();
|
||||
return static_cast<u32>(str.size());
|
||||
}
|
||||
|
||||
//! Informs if the string is empty or not.
|
||||
@ -834,7 +834,7 @@ public:
|
||||
if (!delimiter)
|
||||
return 0;
|
||||
|
||||
const u32 oldSize=ret.size();
|
||||
const u32 oldSize=static_cast<u32>(ret.size());
|
||||
|
||||
u32 tokenStartIdx = 0;
|
||||
for (u32 i=0; i<size()+1; ++i)
|
||||
@ -862,7 +862,7 @@ public:
|
||||
else if (!ignoreEmptyTokens)
|
||||
ret.push_back(string<T>());
|
||||
|
||||
return ret.size()-oldSize;
|
||||
return static_cast<u32>(ret.size()-oldSize);
|
||||
}
|
||||
|
||||
// This function should not be used and is only kept for "CGUIFileOpenDialog::pathToStringW".
|
||||
@ -888,10 +888,10 @@ private:
|
||||
return len;
|
||||
}
|
||||
static inline u32 calclen(const char* p) {
|
||||
return strlen(p);
|
||||
return static_cast<u32>(strlen(p));
|
||||
}
|
||||
static inline u32 calclen(const wchar_t* p) {
|
||||
return wcslen(p);
|
||||
return static_cast<u32>(wcslen(p));
|
||||
}
|
||||
|
||||
//! strcmp wrapper
|
||||
|
Loading…
Reference in New Issue
Block a user