diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-07-08 18:12:59 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-07-08 18:12:59 +0200 |
commit | aa2150c25c9b0dd518b058f0c50420417441fd23 (patch) | |
tree | 549d75aef00f6f3977224c1cecd3c02f74aaf349 /src/msg.hpp | |
parent | 1526ff638c9cb37b156fd80a40889ac3d8258343 (diff) |
VSM data are aligned to 32/64 bit boundary
Till now the VSM buffer was aligned to 16 bit boundary
which could possibly cause problems on RISC architectures
when accessing the message data in unsafe manner.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/msg.hpp')
-rw-r--r-- | src/msg.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/msg.hpp b/src/msg.hpp index 602ae55..2111bf1 100644 --- a/src/msg.hpp +++ b/src/msg.hpp @@ -77,6 +77,10 @@ namespace zmq private: + // Size in bytes of the largest message that is still copied around + // rather than being reference-counted. + enum {max_vsm_size = 29}; + // Shared message buffer. Message data are either allocated in one // continuous block along with this structure - thus avoiding one // malloc/free pair or they are stored in used-supplied memory. @@ -109,21 +113,24 @@ namespace zmq // the union. union { struct { + unsigned char unused [max_vsm_size + 1]; unsigned char type; unsigned char flags; } base; struct { + unsigned char data [max_vsm_size]; + unsigned char size; unsigned char type; unsigned char flags; - unsigned char size; - unsigned char data [max_vsm_size]; } vsm; struct { + content_t *content; + unsigned char unused [max_vsm_size + 1 - sizeof (content_t*)]; unsigned char type; unsigned char flags; - content_t *content; } lmsg; struct { + unsigned char unused [max_vsm_size + 1]; unsigned char type; unsigned char flags; } delimiter; |