activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r559903 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io: DataInputStream.cpp DataInputStream.h FilterInputStream.h
Date Thu, 26 Jul 2007 17:46:18 GMT
Author: tabish
Date: Thu Jul 26 10:46:18 2007
New Revision: 559903

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

Attempting to fix the code so that we meet the Contract of InputStream

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.h
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/FilterInputStream.h

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?view=diff&rev=559903&r1=559902&r2=559903
==============================================================================
--- 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 Thu Jul 26
10:46:18 2007
@@ -56,22 +56,7 @@
                 "DataInputStream::read - Buffer is null" );
         }
 
-        std::size_t read = 0;
-
-        try {
-            read = inputStream->read( &buffer[offset], length );
-        } catch( EOFException& ex ){
-            if( read == 0 )
-                return -1;
-        }
-
-        if( read == 0 ){
-            throw IOException(
-                __FILE__, __LINE__,
-                "DataInputStream::read - failed to extract data, not EOF." );
-        }
-
-        return read;
+        return inputStream->read( &buffer[offset], length );
     }
     DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
     DECAF_CATCH_RETHROW( NullPointerException )
@@ -243,7 +228,7 @@
 
         while( true ) {
 
-            if( inputStream->read( (unsigned char*)( &buffer[pos] ), 1 ) == (size_t)-1
) {
+            if( inputStream->read( (unsigned char*)( &buffer[pos] ), 1 ) == -1 ) {
                 throw EOFException(
                     __FILE__, __LINE__,
                     "DataInputStream::readString - Reached EOF" );
@@ -277,8 +262,8 @@
 
         std::size_t n = 0;
         while( n < length ) {
-            std::size_t count = inputStream->read( &buffer[n], (length - n) );
-            if( count == (std::size_t)-1 ) {
+            int count = inputStream->read( &buffer[n], (length - n) );
+            if( count == -1 ) {
                 throw EOFException(
                     __FILE__, __LINE__,
                     "DataInputStream::readUTF - Reached EOF" );
@@ -323,8 +308,8 @@
 
         std::size_t n = 0;
         while( n < length ) {
-            std::size_t count = inputStream->read( &buffer[offset + n], (length -
n) );
-            if( count == (std::size_t)-1 ) {
+            int count = inputStream->read( &buffer[offset + n], (length - n) );
+            if( count == -1 ) {
                 throw EOFException(
                     __FILE__, __LINE__,
                     "DataInputStream::readFully - Reached EOF" );

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.h?view=diff&rev=559903&r1=559902&r2=559903
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/DataInputStream.h Thu Jul 26 10:46:18
2007
@@ -357,8 +357,8 @@
 
             std::size_t n = 0;
             do{
-                std::size_t count = inputStream->read( &buffer[n], length - n );
-                if( count == (std::size_t)-1 ) {
+                int count = inputStream->read( &buffer[n], length - n );
+                if( count == -1 ) {
                     throw EOFException(
                         __FILE__, __LINE__,
                         "DataInputStream::readLong - Reached EOF" );

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/FilterInputStream.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/FilterInputStream.h?view=diff&rev=559903&r1=559902&r2=559903
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/FilterInputStream.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/FilterInputStream.h Thu Jul 26
10:46:18 2007
@@ -105,7 +105,7 @@
          * This method simply performs in.read(b, len) and returns the result.
          * @param buffer (out) the target buffer.
          * @param bufferSize the size of the output buffer.
-         * @return The number of bytes read or -1 if EOS is detected
+         * @return The number of bytes read or -1 if EOF is detected
          * @throws IOException thrown if an error occurs.
          */
         virtual int read( unsigned char* buffer, std::size_t bufferSize )



Mime
View raw message