Fix setBuffer of the OutputMessage class
This commit is contained in:
parent
92532a958e
commit
1c8cea513c
|
@ -38,11 +38,11 @@ void OutputMessage::reset()
|
||||||
void OutputMessage::setBuffer(const std::string& buffer)
|
void OutputMessage::setBuffer(const std::string& buffer)
|
||||||
{
|
{
|
||||||
int len = buffer.size();
|
int len = buffer.size();
|
||||||
checkWrite(MAX_HEADER_SIZE + len);
|
reset();
|
||||||
memcpy(m_buffer + MAX_HEADER_SIZE, buffer.c_str(), len);
|
checkWrite(len);
|
||||||
m_writePos = MAX_HEADER_SIZE;
|
memcpy((char*)(m_buffer + m_writePos), buffer.c_str(), len);
|
||||||
m_headerPos = MAX_HEADER_SIZE;
|
m_writePos += len;
|
||||||
m_messageSize = len;
|
m_messageSize += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputMessage::addU8(uint8 value)
|
void OutputMessage::addU8(uint8 value)
|
||||||
|
|
Loading…
Reference in New Issue