activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r586577 - in /activemq/activemq-cpp/trunk/src: main/activemq/io/DataInputStream.cpp test/activemq/io/DataInputStreamTest.cpp
Date Fri, 19 Oct 2007 18:55:34 GMT
Author: tabish
Date: Fri Oct 19 11:55:34 2007
New Revision: 586577

URL: http://svn.apache.org/viewvc?rev=586577&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-149

Fixing readFully method and adding a test for it.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/io/DataInputStream.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/io/DataInputStreamTest.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/io/DataInputStream.cpp?rev=586577&r1=586576&r2=586577&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/io/DataInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/io/DataInputStream.cpp Fri Oct 19 11:55:34
2007
@@ -293,6 +293,9 @@
 void DataInputStream::readFully( std::vector<unsigned char>& buffer )
     throw ( io::IOException, io::EOFException ) {
     try {
+        if( buffer.empty() ) {
+            return;
+        }
         this->readFully( &buffer[0], 0, buffer.size() );
     }
     AMQ_CATCH_RETHROW( EOFException )

Modified: activemq/activemq-cpp/trunk/src/test/activemq/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/io/DataInputStreamTest.cpp?rev=586577&r1=586576&r2=586577&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/io/DataInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/io/DataInputStreamTest.cpp Fri Oct 19 11:55:34
2007
@@ -139,6 +139,15 @@
     } catch(...){
         CPPUNIT_ASSERT( true );
     }
+
+    std::vector<unsigned char> buffer2;
+    buffer2.resize( 0 );
+    try{
+        reader.readFully( buffer2 );
+    } catch(...){
+        CPPUNIT_ASSERT( false );
+    }
+
 }
 
 void DataInputStreamTest::testUTF() {



Mime
View raw message