diff options
author | bala <balanatarajan@users.noreply.github.com> | 2002-10-14 22:25:37 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2002-10-14 22:25:37 +0000 |
commit | 74e198d27016518263fc9dbc1b1f03f0cddab79a (patch) | |
tree | 046948ded50b1d926980e76daea70b4f0476dc7b /ace/CDR_Base.cpp | |
parent | 6d1bf2016047bdfd1f8cfe706e756377b24a5e3b (diff) | |
download | ATCD-74e198d27016518263fc9dbc1b1f03f0cddab79a.tar.gz |
ChangeLogTag: Mon Oct 14 17:23:43 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
Diffstat (limited to 'ace/CDR_Base.cpp')
-rw-r--r-- | ace/CDR_Base.cpp | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/ace/CDR_Base.cpp b/ace/CDR_Base.cpp index a6afa86830b..c01c3e40039 100644 --- a/ace/CDR_Base.cpp +++ b/ace/CDR_Base.cpp @@ -508,43 +508,28 @@ ACE_CDR::consolidate (ACE_Message_Block *dst, if (src == 0) return; - // If we do not have a chain of message blocks, all that is needed - // is an increment of the reference count. - if(src->cont () != 0) - { - size_t newsize = - ACE_CDR::first_size (ACE_CDR::total_length (src, 0) - + ACE_CDR::MAX_ALIGNMENT); - dst->size (newsize); - - // We must copy the contents of <src> into the new buffer, but - // respecting the alignment. - ptrdiff_t srcalign = - ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptrdiff_t dstalign = - ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - int offset = srcalign - dstalign; - if (offset < 0) - offset += ACE_CDR::MAX_ALIGNMENT; - dst->rd_ptr (offset); - dst->wr_ptr (dst->rd_ptr ()); - - for (const ACE_Message_Block* i = src; - i != 0; - i = i->cont ()) - { - dst->copy (i->rd_ptr (), i->length ()); - } - } - else + size_t newsize = + ACE_CDR::first_size (ACE_CDR::total_length (src, 0) + + ACE_CDR::MAX_ALIGNMENT); + dst->size (newsize); + + // We must copy the contents of <src> into the new buffer, but + // respecting the alignment. + ptrdiff_t srcalign = + ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t dstalign = + ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + int offset = srcalign - dstalign; + if (offset < 0) + offset += ACE_CDR::MAX_ALIGNMENT; + dst->rd_ptr (offset); + dst->wr_ptr (dst->rd_ptr ()); + + for (const ACE_Message_Block* i = src; + i != 0; + i = i->cont ()) { - // Just increment the refcount of the underlying datablock and - // assign the data block to the message block - dst->data_block (src->data_block()->duplicate()); - - // Adjust rd/wr pointers - dst->rd_ptr (src->rd_ptr()); - dst->wr_ptr (src->wr_ptr()); + dst->copy (i->rd_ptr (), i->length ()); } } |