You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2008/07/23 11:40:49 UTC

svn commit: r679048 - /incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Author: gsim
Date: Wed Jul 23 02:40:49 2008
New Revision: 679048

URL: http://svn.apache.org/viewvc?rev=679048&view=rev
Log:
QPID-1183: Use the right sizes to insert data inside the message payload where sizeof(size_t) != sizeof(uint32_t). Patch from Manuel Teira.


Modified:
    incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp?rev=679048&r1=679047&r2=679048&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/perftest.cpp Wed Jul 23 02:40:49 2008
@@ -465,8 +465,8 @@
                 for (size_t i=0; i<opts.count; i++) {
                     // Stamp the iteration into the message data, avoid
                     // any heap allocation.
-                    const_cast<std::string&>(msg.getData()).replace(offset, sizeof(uint32_t), 
-                                                                    reinterpret_cast<const char*>(&i), sizeof(uint32_t));
+                    const_cast<std::string&>(msg.getData()).replace(offset, sizeof(size_t), 
+                                          reinterpret_cast<const char*>(&i), sizeof(size_t));
                     if (opts.syncPub) {
                         sync(session).messageTransfer(
                             arg::destination=destination,
@@ -561,7 +561,7 @@
                     //
                     // For now verify order only for a single publisher.
                     size_t offset = opts.uniqueData ? 5 /*marker is 'data:'*/ : 0;
-                    size_t n = *reinterpret_cast<const uint32_t*>(msg.getData().data() + offset);
+                    size_t n = *reinterpret_cast<const size_t*>(msg.getData().data() + offset);
                     if (opts.pubs == 1) {
                         if (opts.subs == 1 || opts.mode == FANOUT) verify(n==expect, "==", expect, n);
                         else verify(n>=expect, ">=", expect, n);