Skip to content

Commit 403f5d6

Browse files
author
Andrey Sibiryov
committed
Merge pull request #42 from tolchz/master
Fix a misaligned load
2 parents 1f05e0d + f141cf5 commit 403f5d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

zmq.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ namespace zmq
500500
#if ZMQ_VERSION_MAJOR >= 4
501501
const char* data = static_cast<const char*>(zmq_msg_data(&eventMsg));
502502
zmq_event_t msgEvent;
503-
msgEvent.event = *(uint16_t*)data; data += sizeof(uint16_t);
504-
msgEvent.value = *(int32_t*)data;
503+
memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t);
504+
memcpy(&msgEvent.value, data, sizeof(int32_t));
505505
zmq_event_t* event = &msgEvent;
506506
#else
507507
zmq_event_t* event = static_cast<zmq_event_t*>(zmq_msg_data(&eventMsg));

0 commit comments

Comments
 (0)