activemq-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=586579&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/decaf/src/main/decaf/io/DataInputStream.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.cpp?rev=586579&r1=586578&r2=586579&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.cpp Fri Oct 19
11:57:43 2007
@@ -282,6 +282,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() );
     }
     DECAF_CATCH_RETHROW( EOFException )

Modified: activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp?rev=586579&r1=586578&r2=586579&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/test/decaf/io/DataInputStreamTest.cpp Fri Oct
19 11:57:43 2007
@@ -138,6 +138,13 @@
     } catch(...){
         CPPUNIT_ASSERT( true );
     }
+
+    try{
+        std::vector<unsigned char> buffer2;
+        reader.readFully( buffer2 );
+    } catch(...){
+        CPPUNIT_ASSERT( false );
+    }
 }
 
 void DataInputStreamTest::testUTF() {



Mime
View raw message