From 01f04fd3edb86ec69e1e1cee977a5b069ddfcd04 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 10 Jun 2014 21:55:45 +0000 Subject: QPID-3650: Avoid unaligned memory access git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1601779 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/rdma/RdmaIO.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cpp') diff --git a/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 78bcdec68e..2cc6573b74 100644 --- a/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/cpp/src/qpid/sys/rdma/RdmaIO.cpp @@ -200,7 +200,11 @@ namespace Rdma { if (!buff) { Buffer* ob = getSendBuffer(); // Have to send something as adapters hate it when you try to transfer 0 bytes - *reinterpret_cast< uint32_t* >(ob->bytes()) = htonl(credit); + char* bytes = ob->bytes(); + bytes[0] = 0xFF & (credit >> 24); + bytes[1] = 0xFF & (credit >> 16); + bytes[2] = 0xFF & (credit >> 8); + bytes[3] = 0xFF & (credit ); ob->dataCount(sizeof(uint32_t)); qp->postSend(credit | IgnoreData, ob); } else if (credit > 0) { -- cgit v1.2.1