Author: astitcher
Date: Tue Jun 10 21:55:45 2014
New Revision: 1601779

URL: http://svn.apache.org/r1601779
Log:
QPID-3650: Avoid unaligned memory access

Modified:
    qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp?rev=1601779&r1=1601778&r2=1601779&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/rdma/RdmaIO.cpp Tue Jun 10 21:55:45 2014
@@ -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) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to