Fixed broken conversion

This commit is contained in:
Sven Almgren
2012-03-15 16:15:41 +01:00
parent 9cdc8e7009
commit 76296fe2dd

View File

@@ -334,7 +334,11 @@ public:
if (get_payload_size() == 0) {
return close::status::NO_STATUS;
} else if (get_payload_size() >= 2) {
uint16_t code = ntohs(reinterpret_cast<uint16_t>(m_payload[1]) | reinterpret_cast<uint16_t>(m_payload[0]) << 8);
char val[2] = { m_payload[0], m_payload[1] };
uint16_t code;
memcpy(&code, val, sizeof(code));
code = ntohs(code);
return close::status::value(code);
} else {