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 2007/07/03 15:24:18 UTC

svn commit: r552831 - in /activemq/activemq-cpp/trunk/src/main/activemq/io: BlockingByteArrayInputStream.cpp ByteArrayInputStream.cpp ByteArrayOutputStream.cpp

Author: tabish
Date: Tue Jul  3 06:24:17 2007
New Revision: 552831

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

Submitting optimized? ByteArray IO Stream's

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/io/BlockingByteArrayInputStream.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayInputStream.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayOutputStream.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/io/BlockingByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/io/BlockingByteArrayInputStream.cpp?view=diff&rev=552831&r1=552830&r2=552831
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/io/BlockingByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/io/BlockingByteArrayInputStream.cpp Tue Jul  3 06:24:17 2007
@@ -49,9 +49,11 @@
 
         // Remove old data
         this->buffer.clear();
+        this->buffer.reserve( lbufferSize );
 
         // Copy data to internal buffer.
-        this->buffer.insert( this->buffer.end(), lbuffer, lbuffer + lbufferSize );
+        std::back_insert_iterator< std::vector<unsigned char> > iter( this->buffer );
+        std::copy( lbuffer, lbuffer + lbufferSize, iter );
 
         // Begin at the Beginning.
         pos = this->buffer.begin();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayInputStream.cpp?view=diff&rev=552831&r1=552830&r2=552831
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayInputStream.cpp Tue Jul  3 06:24:17 2007
@@ -63,7 +63,8 @@
     defaultBuffer.reserve( lbufferSize );
 
     // Copy data to internal buffer.
-    defaultBuffer.insert( defaultBuffer.end(), lbuffer, lbuffer + lbufferSize );
+    std::back_insert_iterator< std::vector<unsigned char> > iter( defaultBuffer );
+    std::copy( lbuffer, lbuffer + lbufferSize, iter );
 
     // Begin at the Beginning.
     reset();

Modified: activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayOutputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayOutputStream.cpp?view=diff&rev=552831&r1=552830&r2=552831
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayOutputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/io/ByteArrayOutputStream.cpp Tue Jul  3 06:24:17 2007
@@ -58,6 +58,6 @@
                                    std::size_t len )
    throw ( IOException )
 {
-    activeBuffer->insert( activeBuffer->end(), buffer, buffer + len );
+    std::back_insert_iterator< std::vector<unsigned char> > iter( *activeBuffer );
+    std::copy( buffer, buffer + len, iter );
 }
-