Merge pull request #42 from tolchz/master

Fix a misaligned load
This commit is contained in:
Andrey Sibiryov 2015-03-05 09:31:39 -05:00
commit 403f5d6e32

View File

@ -500,8 +500,8 @@ namespace zmq
#if ZMQ_VERSION_MAJOR >= 4
const char* data = static_cast<const char*>(zmq_msg_data(&eventMsg));
zmq_event_t msgEvent;
msgEvent.event = *(uint16_t*)data; data += sizeof(uint16_t);
msgEvent.value = *(int32_t*)data;
memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t);
memcpy(&msgEvent.value, data, sizeof(int32_t));
zmq_event_t* event = &msgEvent;
#else
zmq_event_t* event = static_cast<zmq_event_t*>(zmq_msg_data(&eventMsg));