qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1511045 - in /qpid/branches/0.24/qpid: ./ cpp/src/ cpp/src/qpid/broker/ cpp/src/qpid/broker/PagedQueue.cpp
Date Tue, 06 Aug 2013 17:25:30 GMT
Author: gsim
Date: Tue Aug  6 17:25:30 2013
New Revision: 1511045

URL: http://svn.apache.org/r1511045
Log:
QPID-5042: use more portable encode and decode (merged r1511013 from trunk)

Modified:
    qpid/branches/0.24/qpid/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/qpid/broker/   (props changed)
    qpid/branches/0.24/qpid/cpp/src/qpid/broker/PagedQueue.cpp

Propchange: qpid/branches/0.24/qpid/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid:r1511013

Propchange: qpid/branches/0.24/qpid/cpp/src/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src:r1511013

Propchange: qpid/branches/0.24/qpid/cpp/src/qpid/broker/
------------------------------------------------------------------------------
  Merged /qpid/trunk/qpid/cpp/src/qpid/broker:r1511013

Modified: qpid/branches/0.24/qpid/cpp/src/qpid/broker/PagedQueue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.24/qpid/cpp/src/qpid/broker/PagedQueue.cpp?rev=1511045&r1=1511044&r2=1511045&view=diff
==============================================================================
--- qpid/branches/0.24/qpid/cpp/src/qpid/broker/PagedQueue.cpp (original)
+++ qpid/branches/0.24/qpid/cpp/src/qpid/broker/PagedQueue.cpp Tue Aug  6 17:25:30 2013
@@ -295,7 +295,8 @@ void PagedQueue::Page::load(MemoryMapped
     bool haveData = used > 0;
     used = 4;//first 4 bytes are the count
     if (haveData) {
-        uint32_t count = *(reinterpret_cast<uint32_t*>(region));
+        qpid::framing::Buffer buffer(region, sizeof(uint32_t));
+        uint32_t count = buffer.getLong();
         //decode messages into Page::messages
         for (size_t i = 0; i < count; ++i) {
             Message message;
@@ -331,7 +332,8 @@ void PagedQueue::Page::unload(MemoryMapp
         if (i->getState() == ACQUIRED) acquired.add(i->getSequence());
     }
     uint32_t count = messages.size();
-    ::memcpy(region, &count, sizeof(count));
+    qpid::framing::Buffer buffer(region, sizeof(uint32_t));
+    buffer.putLong(count);
     file.flush(region, size);
     file.unmap(region, size);
     //remove messages from memory



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message