diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-21 21:48:26 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-21 21:48:26 +0000 |
commit | c1b8f0c271b9aa5d4d91e40ee787cb883a645cf9 (patch) | |
tree | 011aa48dceb69ecfc14d98ef03a6af52806a1f37 /TAO | |
parent | 52f592e3157aadce07a393abd0b0807d080db4d3 (diff) | |
download | ATCD-c1b8f0c271b9aa5d4d91e40ee787cb883a645cf9.tar.gz |
ChangeLogTag: Thu Mar 21 15:45:59 2002 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/tao/Any.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index 4b228706fe5..3c45bb3f4ec 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -105,8 +105,10 @@ CORBA_Any::CORBA_Any (CORBA::TypeCode_ptr type, value_ (0), destructor_ (0) { - ACE_NEW (this->cdr_, ACE_Message_Block); - ACE_CDR::consolidate (this->cdr_, mb); + ACE_NEW (this->cdr_, + ACE_Message_Block); + ACE_CDR::consolidate (this->cdr_, + mb); } // Copy constructor for "Any". @@ -118,17 +120,25 @@ CORBA_Any::CORBA_Any (const CORBA_Any &src) destructor_ (0) { if (!CORBA::is_nil (src.type_.in ())) - this->type_ = - CORBA::TypeCode::_duplicate (src.type_.in ()); + { + this->type_ = CORBA::TypeCode::_duplicate (src.type_.in ()); + } else - this->type_ = - CORBA::TypeCode::_duplicate (CORBA::_tc_null); + { + this->type_ = CORBA::TypeCode::_duplicate (CORBA::_tc_null); + } // CDR stream always contains encoded object, if any holds anything // at all. this->byte_order_ = src.byte_order_; - ACE_NEW (this->cdr_, ACE_Message_Block); - ACE_CDR::consolidate (this->cdr_, src.cdr_); + + if (src.cdr_ != 0) + { + ACE_NEW (this->cdr_, + ACE_Message_Block); + ACE_CDR::consolidate (this->cdr_, + src.cdr_); + } // No need to copy src's value_. We can always get that from cdr. } @@ -167,12 +177,15 @@ CORBA_Any::operator= (const CORBA_Any &src) this->byte_order_ = src.byte_order_; - ACE_NEW_RETURN (this->cdr_, - ACE_Message_Block, - *this); + if (src.cdr_ != 0) + { + ACE_NEW_RETURN (this->cdr_, + ACE_Message_Block, + *this); - ACE_CDR::consolidate (this->cdr_, - src.cdr_); + ACE_CDR::consolidate (this->cdr_, + src.cdr_); + } return *this; } |