Browse Source

Fix setBuffer of the OutputMessage class

Konrad Kuśnierz 1 year ago
parent
commit
1c8cea513c
No account linked to committer's email address
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      src/framework/net/outputmessage.cpp

+ 5
- 5
src/framework/net/outputmessage.cpp View File

@@ -38,11 +38,11 @@ void OutputMessage::reset()
38 38
 void OutputMessage::setBuffer(const std::string& buffer)
39 39
 {
40 40
     int len = buffer.size();
41
-    checkWrite(MAX_HEADER_SIZE + len);
42
-    memcpy(m_buffer + MAX_HEADER_SIZE, buffer.c_str(), len);
43
-    m_writePos = MAX_HEADER_SIZE;
44
-    m_headerPos = MAX_HEADER_SIZE;
45
-    m_messageSize = len;
41
+    reset();
42
+    checkWrite(len);
43
+    memcpy((char*)(m_buffer + m_writePos), buffer.c_str(), len);
44
+    m_writePos += len;
45
+    m_messageSize += len;
46 46
 }
47 47
 
48 48
 void OutputMessage::addU8(uint8 value)

Loading…
Cancel
Save