Author: gsim
Date: Thu Sep 12 09:26:30 2013
New Revision: 1522499

URL: http://svn.apache.org/r1522499
Log:
QPID-5122: QPID-5134: fix build on windows by avoiding use of templated Buffer 
method (don't need variable sized delivery tag)

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp?rev=1522499&r1=1522498&r2=1522499&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.cpp Thu Sep 12 09:26:30 
2013
@@ -256,14 +256,17 @@ qpid::broker::OwnershipToken* OutgoingFr
     return 0;
 }
 
-OutgoingFromQueue::Record::Record() : delivery(0), disposition(0), index(0) {}
+OutgoingFromQueue::Record::Record() : delivery(0), disposition(0), index(0)
+{
+    tag.bytes = tagData;
+    tag.size = TAG_WIDTH;
+}
 void OutgoingFromQueue::Record::init(size_t i)
 {
     index = i;
-    qpid::framing::Buffer buffer(tagData, Record::TAG_WIDTH);
-    buffer.putUInt<Record::TAG_WIDTH>(index);
-    tag.bytes = tagData;
-    tag.size = Record::TAG_WIDTH;
+    qpid::framing::Buffer buffer(tagData, tag.size);
+    assert(index <= std::numeric_limits<uint32_t>::max());
+    buffer.putLong(index);
 }
 void OutgoingFromQueue::Record::reset()
 {
@@ -277,7 +280,7 @@ size_t OutgoingFromQueue::Record::getInd
 {
     assert(t.size == TAG_WIDTH);
     qpid::framing::Buffer buffer(const_cast<char*>(t.bytes)/*won't ever be 
written to*/, t.size);
-    return (size_t) buffer.getUInt<TAG_WIDTH>();
+    return (size_t) buffer.getLong();
 }
 
 

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.h
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.h?rev=1522499&r1=1522498&r2=1522499&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/Outgoing.h Thu Sep 12 09:26:30 2013
@@ -118,8 +118,12 @@ class OutgoingFromQueue : public Outgoin
         int disposition;
         size_t index;
         pn_delivery_tag_t tag;
-        static const size_t TAG_WIDTH = sizeof(size_t);
-        char tagData[TAG_WIDTH];//index in encoded form, used for tag
+        //The delivery tag is a 4 byte value representing the
+        //index. It is encoded separately to avoid alignment issues.
+        //The number of deliveries held here is always strictly
+        //bounded, so 4 bytes is more than enough.
+        static const size_t TAG_WIDTH = sizeof(uint32_t);
+        char tagData[TAG_WIDTH];
 
         Record();
         void init(size_t i);



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

Reply via email to