diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-06-29 18:46:26 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-06-29 18:46:26 +0000 |
commit | d6663cdcb72d765b0c84761acf373571056a6df7 (patch) | |
tree | 907fcca826284b3b3aad7db7dd71d39d1a022d2a /TAO/tao/Sequence.cpp | |
parent | 8b510ba4f3008e3a46d562710525675fe51519ab (diff) | |
download | ATCD-d6663cdcb72d765b0c84761acf373571056a6df7.tar.gz |
ChangeLogTag:Thu Jun 29 11:28:04 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'TAO/tao/Sequence.cpp')
-rw-r--r-- | TAO/tao/Sequence.cpp | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/TAO/tao/Sequence.cpp b/TAO/tao/Sequence.cpp index 5038b29c4f1..f648bc39aea 100644 --- a/TAO/tao/Sequence.cpp +++ b/TAO/tao/Sequence.cpp @@ -507,21 +507,24 @@ TAO_Unbounded_WString_Sequence::_shrink_buffer (CORBA::ULong nl, // **************************************************************** -#if defined (TAO_NO_COPY_OCTET_SEQUENCES) TAO_Unbounded_Sequence<CORBA::Octet>:: TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<CORBA::Octet> &rhs) - : TAO_Unbounded_Base_Sequence (rhs), - mb_ (0) + : TAO_Unbounded_Base_Sequence (rhs) +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + , mb_ (0) +#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ { if (rhs.buffer_ != 0) { CORBA::Octet *tmp1 = TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (this->maximum_); + CORBA::Octet * const tmp2 = ACE_reinterpret_cast (CORBA::Octet * ACE_CAST_CONST, rhs.buffer_); +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) if (rhs.mb_ == 0) { ACE_OS::memcpy (tmp1, @@ -542,6 +545,9 @@ TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<CORBA::Octet> &rhs) offset += i->length (); } } +#else /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ + ACE_OS::memcpy (tmp1, tmp2, this->length_); +#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ this->buffer_ = tmp1; } @@ -557,6 +563,7 @@ TAO_Unbounded_Sequence<CORBA::Octet>::operator= (const TAO_Unbounded_Sequence<CO if (this == &rhs) return *this; +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) if (this->mb_ != 0) { ACE_Message_Block::release (this->mb_); @@ -564,7 +571,9 @@ TAO_Unbounded_Sequence<CORBA::Octet>::operator= (const TAO_Unbounded_Sequence<CO this->buffer_ = TAO_Unbounded_Sequence<CORBA::Octet>::allocbuf (rhs.length_); } - else if (this->release_) + else +#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ + if (this->release_) { if (this->maximum_ < rhs.length_) { @@ -585,6 +594,7 @@ TAO_Unbounded_Sequence<CORBA::Octet>::operator= (const TAO_Unbounded_Sequence<CO CORBA::Octet *tmp1 = ACE_reinterpret_cast (CORBA::Octet *, this->buffer_); CORBA::Octet * const tmp2 = ACE_reinterpret_cast (CORBA::Octet * ACE_CAST_CONST, rhs.buffer_); +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) // for (CORBA::ULong i = 0; i < this->length_; ++i) // tmp1[i] = tmp2[i]; if (rhs.mb_ == 0) @@ -600,20 +610,25 @@ TAO_Unbounded_Sequence<CORBA::Octet>::operator= (const TAO_Unbounded_Sequence<CO offset += i->length (); } } +#else /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ + ACE_OS::memcpy (tmp1, tmp2, this->length_); +#endif /* (TAO_NO_COPY_OCTET_SEQUENCES == 0) */ return *this; } +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) TAO_Unbounded_Sequence<CORBA::Octet>:: TAO_Unbounded_Sequence (CORBA::ULong length, const ACE_Message_Block *mb) : TAO_Unbounded_Base_Sequence (length, length, mb->rd_ptr (), - 0), - mb_ (ACE_Message_Block::duplicate (mb)) + 0) + , mb_ (ACE_Message_Block::duplicate (mb)) { } +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ TAO_Unbounded_Sequence<CORBA::Octet>::~TAO_Unbounded_Sequence (void) { @@ -639,12 +654,15 @@ TAO_Unbounded_Sequence<CORBA::Octet>::_allocate_buffer (CORBA::ULong length) for (CORBA::ULong i = 0; i < this->length_; ++i) tmp[i] = old[i]; +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) if (this->mb_ != 0) { ACE_Message_Block::release (this->mb_); this->mb_ = 0; } - else if (this->release_) + else +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ + if (this->release_) { TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (old); } @@ -655,24 +673,27 @@ TAO_Unbounded_Sequence<CORBA::Octet>::_allocate_buffer (CORBA::ULong length) void TAO_Unbounded_Sequence<CORBA::Octet>::_deallocate_buffer (void) { - if (this->mb_ == 0 - && this->buffer_ != 0 + if (this->buffer_ != 0 +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + && this->mb_ == 0 +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ && this->release_ != 0) { CORBA::Octet *tmp = ACE_reinterpret_cast (CORBA::Octet *, this->buffer_); TAO_Unbounded_Sequence<CORBA::Octet>::freebuf (tmp); } +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) else { ACE_Message_Block::release (this->mb_); this->mb_ = 0; } +#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */ + this->buffer_ = 0; } -#endif /* defined (TAO_NO_COPY_OCTET_SEQUENCES) */ - -//////////////////////////////////////////////////////////////////////////////// +// **************************************************************** int operator== (const TAO_Unbounded_Sequence<CORBA::Octet> &lhs, |