1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

(se)SerializeString: Include max length in the name

This commit clarifies the maximal length of the serialized strings.
It will avoid accidental use of serializeString() when a larger string can be expected.

Removes unused Wide String serialization functions
This commit is contained in:
SmallJoker 2020-09-20 13:12:55 +02:00 committed by Loïc Blot
parent ca5c2dbefa
commit 947466ab28
23 changed files with 168 additions and 223 deletions

View file

@ -27,7 +27,7 @@ void NameIdMapping::serialize(std::ostream &os) const
writeU16(os, m_id_to_name.size());
for (const auto &i : m_id_to_name) {
writeU16(os, i.first);
os << serializeString(i.second);
os << serializeString16(i.second);
}
}
@ -41,7 +41,7 @@ void NameIdMapping::deSerialize(std::istream &is)
m_name_to_id.clear();
for (u32 i = 0; i < count; i++) {
u16 id = readU16(is);
std::string name = deSerializeString(is);
std::string name = deSerializeString16(is);
m_id_to_name[id] = name;
m_name_to_id[name] = id;
}