You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/07/30 23:59:24 UTC

svn commit: r799454 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp

Author: tabish
Date: Thu Jul 30 21:59:24 2009
New Revision: 799454

URL: http://svn.apache.org/viewvc?rev=799454&view=rev
Log:
64bit OS fix

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp?rev=799454&r1=799453&r2=799454&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp Thu Jul 30 21:59:24 2009
@@ -70,8 +70,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 void TimerTaskHeap::upHeap() {
 
-	std::size_t current = heap.size() - 1;
-	std::size_t parent = ( current - 1 ) / 2;
+    if( heap.size() <= 1 ) {
+        return;  // Can't get any higher than the top.
+    }
+
+    std::size_t current = heap.size() - 1;
+    std::size_t parent = ( current - 1 ) / 2;
 
     while( heap[current]->when < heap[parent]->when) {