activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1198980 - /activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
Date Mon, 07 Nov 2011 22:20:04 GMT
Author: tabish
Date: Mon Nov  7 22:20:04 2011
New Revision: 1198980

URL: http://svn.apache.org/viewvc?rev=1198980&view=rev
Log:
Backport of https://issues.apache.org/jira/browse/AMQCPP-374

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp

Modified: activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp?rev=1198980&r1=1198979&r2=1198980&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
(original)
+++ activemq/activemq-cpp/branches/activemq-cpp-3.4.x/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/BaseDataStreamMarshaller.cpp
Mon Nov  7 22:20:04 2011
@@ -674,8 +674,10 @@ std::vector<unsigned char> BaseDataStrea
 
         if( bs->readBoolean() ) {
             int size = dataIn->readInt();
-            data.resize( size );
-            dataIn->readFully( &data[0], (int)data.size() );
+            if (size > 0) {
+            	data.resize( size );
+            	dataIn->readFully( &data[0], (int)data.size() );
+            }
         }
 
         return data;
@@ -694,8 +696,10 @@ std::vector<unsigned char> BaseDataStrea
         if( dataIn->readBoolean() ) {
             int size = dataIn->readInt();
             std::vector<unsigned char> data;
-            data.resize( size );
-            dataIn->readFully( &data[0], (int)data.size() );
+            if (size > 0) {
+            	data.resize( size );
+            	dataIn->readFully( &data[0], (int)data.size() );
+            }
             return data;
         }
 
@@ -708,14 +712,14 @@ std::vector<unsigned char> BaseDataStrea
 
 ////////////////////////////////////////////////////////////////////////////////
 std::vector<unsigned char> BaseDataStreamMarshaller::tightUnmarshalConstByteArray(
-    decaf::io::DataInputStream* dataIn,
-    utils::BooleanStream* bs AMQCPP_UNUSED,
-    int size ) {
+    decaf::io::DataInputStream* dataIn, utils::BooleanStream* bs AMQCPP_UNUSED, int size
) {
 
     try{
         std::vector<unsigned char> data;
-        data.resize( size );
-        dataIn->readFully( &data[0], (int)data.size() );
+        if (size > 0) {
+        	data.resize( size );
+        	dataIn->readFully( &data[0], (int)data.size() );
+        }
         return data;
     }
     AMQ_CATCH_RETHROW( IOException )
@@ -729,8 +733,10 @@ std::vector<unsigned char> BaseDataStrea
 
     try{
         std::vector<unsigned char> data;
-        data.resize( size );
-        dataIn->readFully( &data[0], (int)data.size() );
+        if (size > 0) {
+        	data.resize( size );
+        	dataIn->readFully( &data[0], (int)data.size() );
+        }
         return data;
     }
     AMQ_CATCH_RETHROW( IOException )



Mime
View raw message