Fix setBuffer of InputMessage class

This commit is contained in:
Konrad Kuśnierz 2019-03-09 23:35:52 +01:00 committed by GitHub
parent 322c6fde3e
commit 779eb56068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -38,11 +38,11 @@ void InputMessage::reset()
void InputMessage::setBuffer(const std::string& buffer)
{
int len = buffer.size();
checkWrite(MAX_HEADER_SIZE + len);
memcpy(m_buffer + MAX_HEADER_SIZE, buffer.c_str(), len);
m_readPos = MAX_HEADER_SIZE;
m_headerPos = MAX_HEADER_SIZE;
m_messageSize = len;
reset();
checkWrite(len);
memcpy((char*)(m_buffer + m_readPos), buffer.c_str(), len);
m_readPos += len;
m_messageSize += len;
}
uint8 InputMessage::getU8()