diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-04-14 18:26:24 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-04-14 18:26:24 +0200 |
commit | b1e6c2a9b8f10254c027fe227811fc300bae2048 (patch) | |
tree | 339c9a89a261351d0c278b60216c1ce8eff8c68f /src/network | |
parent | 093e621643edf3bc7fa46e58cb1b5d940365ce22 (diff) | |
download | minetest-b1e6c2a9b8f10254c027fe227811fc300bae2048.tar.gz minetest-b1e6c2a9b8f10254c027fe227811fc300bae2048.tar.bz2 minetest-b1e6c2a9b8f10254c027fe227811fc300bae2048.zip |
NetworkPacket: don't copy push std::string and std::wstring
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkpacket.cpp | 6 | ||||
-rw-r--r-- | src/network/networkpacket.h | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 91e6c58e2..f7a6499dd 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -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) { diff --git a/src/network/networkpacket.h b/src/network/networkpacket.h index 3e436aba9..83dc33f6f 100644 --- a/src/network/networkpacket.h +++ b/src/network/networkpacket.h @@ -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(); |