NetworkPacket: don't copy push std::string and std::wstring

This commit is contained in:
Loic Blot 2017-04-14 18:26:24 +02:00
parent 093e621643
commit b1e6c2a9b8
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
2 changed files with 6 additions and 6 deletions

@ -105,7 +105,7 @@ NetworkPacket& NetworkPacket::operator>>(std::string& dst)
return *this;
}
NetworkPacket& NetworkPacket::operator<<(std::string src)
NetworkPacket& NetworkPacket::operator<<(const std::string &src)
{
u16 msgsize = src.size();
if (msgsize > STRING_MAX_LEN) {
@ -119,7 +119,7 @@ NetworkPacket& NetworkPacket::operator<<(std::string src)
return *this;
}
void NetworkPacket::putLongString(std::string src)
void NetworkPacket::putLongString(const std::string &src)
{
u32 msgsize = src.size();
if (msgsize > LONG_STRING_MAX_LEN) {
@ -155,7 +155,7 @@ NetworkPacket& NetworkPacket::operator>>(std::wstring& dst)
return *this;
}
NetworkPacket& NetworkPacket::operator<<(std::wstring src)
NetworkPacket& NetworkPacket::operator<<(const std::wstring &src)
{
u16 msgsize = src.size();
if (msgsize > WIDE_STRING_MAX_LEN) {

@ -52,12 +52,12 @@ public:
{ putRawString(src.c_str(), src.size()); }
NetworkPacket& operator>>(std::string& dst);
NetworkPacket& operator<<(std::string src);
NetworkPacket& operator<<(const std::string &src);
void putLongString(std::string src);
void putLongString(const std::string &src);
NetworkPacket& operator>>(std::wstring& dst);
NetworkPacket& operator<<(std::wstring src);
NetworkPacket& operator<<(const std::wstring &src);
std::string readLongString();