Added param for Serializer::WriteStr.

This commit is contained in:
Arron David Nelson 2024-02-17 00:48:14 -08:00
parent 8e88412deb
commit b1adf15f89

View File

@ -396,7 +396,7 @@ namespace ehs
}
template<typename T, typename O = UInt_64>
void WriteStr(const T* str, N inSize = 0)
void WriteStr(const T* str, const bool sizeKnown, N inSize = 0)
{
if (!inSize)
while (str[inSize])
@ -424,7 +424,8 @@ namespace ehs
{
Util::Copy(&data[offset], &str[0], bSize);
*(T*)&data[offset + inSize] = 0;
if (!sizeKnown)
*(T*)&data[offset + inSize] = 0;
}
else
{
@ -432,7 +433,8 @@ namespace ehs
for (N b = 0; b < sizeof(T); ++b)
data[offset + sizeof(T) * i + b] = ((Byte*)&str[i])[sizeof(T) - i - 1];
*(T*)&data[offset + bSize] = 0;
if (!sizeKnown)
*(T*)&data[offset + bSize] = 0;
}
}
else
@ -443,13 +445,15 @@ namespace ehs
for (N b = 0; b < sizeof(T); ++b)
data[offset + sizeof(T) * i + b] = ((Byte*)&str[i])[sizeof(T) - i - 1];
*(T*)&data[offset + bSize] = 0;
if (!sizeKnown)
*(T*)&data[offset + bSize] = 0;
}
else
{
Util::Copy(&data[offset], &str[0], bSize);
*(T*)&data[offset + bSize] = 0;
if (!sizeKnown)
*(T*)&data[offset + bSize] = 0;
}
}