Core/PacketIO: Use std::string_view to read strings from ByteBuffer

(cherry picked from commit d72e91bee2)
This commit is contained in:
Shauren
2024-08-03 13:40:17 +02:00
committed by Ovahlord
parent c54328eeba
commit ea96e408fe
4 changed files with 55 additions and 39 deletions

View File

@@ -49,7 +49,7 @@ public:
class TC_SHARED_API ByteBufferInvalidValueException : public ByteBufferException
{
public:
ByteBufferInvalidValueException(char const* type, char const* value);
ByteBufferInvalidValueException(char const* type, std::string_view value);
};
class TC_SHARED_API ByteBuffer
@@ -509,9 +509,9 @@ class TC_SHARED_API ByteBuffer
append(str, len);
}
std::string ReadCString(bool requireValidUtf8 = true);
std::string_view ReadCString(bool requireValidUtf8 = true);
std::string ReadString(uint32 length, bool requireValidUtf8 = true);
std::string_view ReadString(uint32 length, bool requireValidUtf8 = true);
uint8* contents()
{