[General] Reorder RW(string) arguments

Change limit of default max string size to 64 KiB
0.6.3
Koncord 7 years ago
parent f9ebe400f7
commit 695fb7d4a7

@ -44,7 +44,7 @@ namespace mwmp
rule = &ruleIt->second; rule = &ruleIt->second;
} }
packet->RW(key, send, QueryData::maxStringLength); packet->RW(key, send, false, QueryData::maxStringLength);
if (!send) if (!send)
{ {
ruleIt = server.rules.insert(pair<string, ServerRule>(key, ServerRule())).first; ruleIt = server.rules.insert(pair<string, ServerRule>(key, ServerRule())).first;
@ -77,7 +77,7 @@ namespace mwmp
} }
for(auto &&player : server.players) for(auto &&player : server.players)
packet->RW(player, send, QueryData::maxStringLength); packet->RW(player, send, false, QueryData::maxStringLength);
int32_t pluginsCount = server.plugins.size(); int32_t pluginsCount = server.plugins.size();
@ -94,7 +94,7 @@ namespace mwmp
for (auto &&plugin : server.plugins) 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); packet->RW(plugin.hash, send);
} }
} }

@ -76,7 +76,9 @@ namespace mwmp
bs->Read(data); 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) if (write)
{ {

Loading…
Cancel
Save