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 2010/01/22 16:39:02 UTC
svn commit: r902126 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
Author: tabish
Date: Fri Jan 22 15:39:01 2010
New Revision: 902126
URL: http://svn.apache.org/viewvc?rev=902126&view=rev
Log:
Change the code to fix an "invalid read of size 1" in valgrind.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp?rev=902126&r1=902125&r2=902126&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/DataInputStreamTest.cpp Fri Jan 22 15:39:01 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());