Skip to content

Commit

Permalink
oops add OutputMessage::addRawString
Browse files Browse the repository at this point in the history
  • Loading branch information
divinity76 committed Sep 13, 2024
1 parent b507c90 commit 892e611
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/framework/net/outputmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ void OutputMessage::addString(const std::string& buffer)
m_messageSize += len;
}

void OutputMessage::addRawString(const std::string& buffer)
{
int len = buffer.length();
if (len > MAX_STRING_LENGTH)
throw stdext::exception(stdext::format("string length > %d", MAX_STRING_LENGTH));
checkWrite(len);
memcpy((char*)(m_buffer + m_writePos), buffer.c_str(), len);
m_writePos += len;
m_messageSize += len;
}

void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
{
if(bytes <= 0)
Expand Down
1 change: 1 addition & 0 deletions src/framework/net/outputmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class OutputMessage : public LuaObject
void addU32(uint32 value);
void addU64(uint64 value);
void addString(const std::string& buffer);
void addRawString(const std::string& buffer);
void addPaddingBytes(int bytes, uint8 byte = 0);

void encryptRsa();
Expand Down

0 comments on commit 892e611

Please sign in to comment.