Skip to content

Commit ce806ee

Browse files
committed
Merge pull request #38 from justinboswell/master
Fixed misaligned structure cast
2 parents ee47ae4 + 0c0f3ae commit ce806ee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

zmq.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,11 @@ namespace zmq
492492
if (rc == -1 && zmq_errno() == ETERM)
493493
break;
494494
assert (rc != -1);
495-
zmq_event_t* event = static_cast<zmq_event_t*>(zmq_msg_data (&eventMsg));
495+
const char* data = static_cast<const char*>(zmq_msg_data(&eventMsg));
496+
zmq_event_t msgEvent;
497+
msgEvent.event = *(uint16_t*)data; data += sizeof(uint16_t);
498+
msgEvent.value = *(int32_t*)data;
499+
zmq_event_t* event = &msgEvent;
496500

497501
#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT
498502
zmq_msg_t addrMsg;

0 commit comments

Comments
 (0)