summaryrefslogtreecommitdiff
path: root/src/nameidmapping.cpp
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2020-09-20 13:12:55 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2020-10-01 09:52:59 +0200
commit947466ab28129fd69e6630974c6c4e901f2bebc6 (patch)
tree720b35a5f8c01e42a5078f7fb79d612d1a1484d9 /src/nameidmapping.cpp
parentca5c2dbefab3676514e48b445b36de50993de9f1 (diff)
downloadminetest-947466ab28129fd69e6630974c6c4e901f2bebc6.tar.gz
minetest-947466ab28129fd69e6630974c6c4e901f2bebc6.tar.bz2
minetest-947466ab28129fd69e6630974c6c4e901f2bebc6.zip
(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
Diffstat (limited to 'src/nameidmapping.cpp')
-rw-r--r--src/nameidmapping.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nameidmapping.cpp b/src/nameidmapping.cpp
index bd5bb1fc8..05cfae069 100644
--- a/src/nameidmapping.cpp
+++ b/src/nameidmapping.cpp
@@ -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;
}