Core/Algorithm: Use SafeCast to serialize string size

This commit is contained in:
SirLynix 2024-01-26 17:23:32 +01:00
parent 33374ed0c0
commit aad271febe
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ namespace Nz
*/ */
bool Serialize(SerializationContext& context, const std::string& value, TypeTag<std::string>) bool Serialize(SerializationContext& context, const std::string& value, TypeTag<std::string>)
{ {
if (!Serialize(context, UInt32(value.size()), TypeTag<UInt32>())) if (!Serialize(context, SafeCast<UInt32>(value.size()), TypeTag<UInt32>()))
return false; return false;
return context.stream->Write(value.data(), value.size()) == value.size(); return context.stream->Write(value.data(), value.size()) == value.size();