From f5d2190ebf6039391c5b65c9faa098352a5a07a5 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@1601779 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp b/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp index 78bcdec68e..2cc6573b74 100644 --- a/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp +++ b/qpid/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