From 695fb7d4a725bf46b7c0fcc49cbfa43037e8dbac Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 3 Jul 2018 01:12:59 +0800 Subject: [PATCH] [General] Reorder RW(string) arguments Change limit of default max string size to 64 KiB --- components/openmw-mp/Master/ProxyMasterPacket.hpp | 6 +++--- components/openmw-mp/Packets/BasePacket.hpp | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/components/openmw-mp/Master/ProxyMasterPacket.hpp b/components/openmw-mp/Master/ProxyMasterPacket.hpp index a9920d424..2b0fca1dc 100644 --- a/components/openmw-mp/Master/ProxyMasterPacket.hpp +++ b/components/openmw-mp/Master/ProxyMasterPacket.hpp @@ -44,7 +44,7 @@ namespace mwmp rule = &ruleIt->second; } - packet->RW(key, send, QueryData::maxStringLength); + packet->RW(key, send, false, QueryData::maxStringLength); if (!send) { ruleIt = server.rules.insert(pair(key, ServerRule())).first; @@ -77,7 +77,7 @@ namespace mwmp } for(auto &&player : server.players) - packet->RW(player, send, QueryData::maxStringLength); + packet->RW(player, send, false, QueryData::maxStringLength); int32_t pluginsCount = server.plugins.size(); @@ -94,7 +94,7 @@ namespace mwmp for (auto &&plugin : server.plugins) { - packet->RW(plugin.name, send, QueryData::maxStringLength); + packet->RW(plugin.name, send, false, QueryData::maxStringLength); packet->RW(plugin.hash, send); } } diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/BasePacket.hpp index 928a7ea0b..bca5cc75d 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/BasePacket.hpp @@ -76,7 +76,9 @@ namespace mwmp bs->Read(data); } - void RW(std::string &str, bool write, std::string::size_type maxSize = std::string::npos, bool compress = false) + const static uint32_t maxStrSize = 64 * 1024; // 64 KiB + + void RW(std::string &str, bool write, bool compress = false, std::string::size_type maxSize = maxStrSize) { if (write) {