activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r902235 - in /activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src: main/decaf/lang/Thread.cpp main/decaf/util/PriorityQueue.h test/decaf/io/DataInputStreamTest.cpp
Date Fri, 22 Jan 2010 19:23:34 GMT
Author: tabish
Date: Fri Jan 22 19:23:34 2010
New Revision: 902235

URL: http://svn.apache.org/viewvc?rev=902235&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQCPP-280

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/lang/Thread.cpp
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/util/PriorityQueue.h
    activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/lang/Thread.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/lang/Thread.cpp?rev=902235&r1=902234&r2=902235&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/lang/Thread.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/lang/Thread.cpp
Fri Jan 22 19:23:34 2010
@@ -186,7 +186,7 @@
             ThreadProperties::runCallback( properties );
 
             pthread_setspecific( currentThreadKey, NULL );
-            pthread_exit(0);
+            pthread_detach( properties->handle );
 
             properties->state = Thread::TERMINATED;
 

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/util/PriorityQueue.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/util/PriorityQueue.h?rev=902235&r1=902234&r2=902235&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/util/PriorityQueue.h
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/main/decaf/util/PriorityQueue.h
Fri Jan 22 19:23:34 2010
@@ -206,7 +206,9 @@
             this->getFromPriorityQueue( source );
         }
 
-        virtual ~PriorityQueue() {}
+        virtual ~PriorityQueue() {
+            delete [] elements;
+        }
 
         /**
          * Assignment operator, assign another Collection to this one.
@@ -246,6 +248,9 @@
             // TODO - Provide a more efficient way to clear the array without reallocating
it
             //        we should keep the size it grew to since if reused it could get that
big
             //        again and reallocating all that memory could be to slow.
+
+            delete [] this->elements;
+
             this->elements = new E[DEFAULT_CAPACITY];
             this->capacity = DEFAULT_CAPACITY;
             this->_size = 0;

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp?rev=902235&r1=902234&r2=902235&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.1.x/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
Fri Jan 22 19:23:34 2010
@@ -159,8 +159,14 @@
         std::vector<unsigned char> result;
         result.resize( testData.length() );
         is->readFully( result );
-        CPPUNIT_ASSERT_MESSAGE( "Incorrect data read",
-            string( (const char*)&result[0], 0, result.size() ) == testData );
+
+        string expected = "";
+        for( size_t ix = 0; ix < result.size(); ++ix ) {
+            expected += (char)result[ix];
+        }
+
+        CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
+
     } catch( IOException &e ) {
         CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());
     }
@@ -175,8 +181,14 @@
         openDataInputStream();
         unsigned char* rbytes = new unsigned char[ testData.length() ];
         is->readFully( rbytes, 0, testData.length() );
-        CPPUNIT_ASSERT_MESSAGE("Incorrect data read",
-            string( (const char*)rbytes, 0, testData.length() ) == testData );
+
+        string expected = "";
+        for( size_t ix = 0; ix < testData.length(); ++ix ) {
+            expected += (char)rbytes[ix];
+        }
+
+        CPPUNIT_ASSERT_MESSAGE("Incorrect data read", expected == testData );
+
         delete [] rbytes;
     } catch( IOException &e ) {
         CPPUNIT_FAIL("IOException during readFully test : " + e.getMessage());



Mime
View raw message