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:22:14 UTC

svn commit: r552828 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io: BlockingByteArrayInputStream.cpp ByteArrayInputStream.cpp

Author: tabish
Date: Tue Jul  3 06:22:13 2007
New Revision: 552828

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

Building Decaf lib, optimizations

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

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp?view=diff&rev=552828&r1=552827&r2=552828
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/BlockingByteArrayInputStream.cpp Tue Jul  3 06:22:13 2007
@@ -48,13 +48,12 @@
     synchronized( this ){
 
         // Remove old data
-        this->buffer.clear();
+        buffer.clear();
+        buffer.reserve( lbufferSize );
 
         // Copy data to internal buffer.
-        for( std::size_t ix = 0; ix < lbufferSize; ++ix )
-        {
-            this->buffer.push_back(lbuffer[ix]);
-        }
+        std::back_insert_iterator< std::vector<unsigned char> > iter( buffer );
+        std::copy( lbuffer, lbuffer + lbufferSize, iter );
 
         // Begin at the Beginning.
         pos = this->buffer.begin();

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp?view=diff&rev=552828&r1=552827&r2=552828
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/io/ByteArrayInputStream.cpp Tue Jul  3 06:22:13 2007
@@ -64,7 +64,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( buffer, buffer + len, iter );
 
     // Begin at the Beginning.
     reset();