diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-01 00:45:49 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-01 00:45:49 +0000 |
commit | 5132021f59c37082bb0ac2d682020dd37d867378 (patch) | |
tree | 0599ef1d31c312cffd152e295b0efdeb218138f2 /ace/CDR_Stream.i | |
parent | dce560680c2da0c2e30b70e4944f5f8ad8f202c8 (diff) | |
download | ATCD-5132021f59c37082bb0ac2d682020dd37d867378.tar.gz |
ChangeLogTag:Tue Feb 29 16:40:43 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace/CDR_Stream.i')
-rw-r--r-- | ace/CDR_Stream.i | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index 9f493ef2103..60ce5f64052 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -56,8 +56,8 @@ ACE_CDR::swap_16 (const char *orig, char* target) ACE_INLINE void ACE_CDR::mb_align (ACE_Message_Block *mb) { - char *start = ptr_align_binary (mb->base (), - ACE_CDR::MAX_ALIGNMENT); + char *start = ACE_ptr_align_binary (mb->base (), + ACE_CDR::MAX_ALIGNMENT); mb->rd_ptr (start); mb->wr_ptr (start); @@ -225,9 +225,20 @@ ACE_INLINE void ACE_OutputCDR::reset (void) { this->current_ = &this->start_; + this->current_is_writable_ = 1; + ACE_CDR::mb_align (&this->start_); + this->current_alignment_ = 0; + + // It is tempting not to remove the memory, but we need to do so to + // release any potential user buffers chained in the continuation + // field. + ACE_Message_Block *cont = this->start_.cont (); + if (cont != 0) + { + ACE_Message_Block::release (cont); + this->start_.cont (0); + } - for (ACE_Message_Block *i = &this->start_; i; i = i->cont()) - ACE_CDR::mb_align (i); } // Decode the CDR stream. @@ -472,12 +483,17 @@ ACE_OutputCDR::adjust (size_t size, size_t align, char*& buf) { - buf = ptr_align_binary (this->current_->wr_ptr (), - align); + size_t offset = + ACE_align_binary (this->current_alignment_, align) + - this->current_alignment_; + + buf = this->current_->wr_ptr () + offset; char *end = buf + size; - if (end <= this->current_->end ()) + if (this->current_is_writable_ + && end <= this->current_->end ()) { + this->current_alignment_ += offset + size; this->current_->wr_ptr (end); return 0; } @@ -533,11 +549,17 @@ ACE_OutputCDR::do_byte_swap (void) const return this->do_byte_swap_; } +ACE_INLINE size_t +ACE_OutputCDR::current_alignment (void) const +{ + return this->current_alignment_; +} + ACE_INLINE int ACE_OutputCDR::align_write_ptr (size_t alignment) { - char *buf = ptr_align_binary (this->current_->wr_ptr (), - alignment); + char *buf = ACE_ptr_align_binary (this->current_->wr_ptr (), + alignment); if (buf <= this->current_->end ()) { @@ -897,7 +919,7 @@ ACE_InputCDR::adjust (size_t size, size_t align, char*& buf) { - buf = ptr_align_binary (this->rd_ptr (), align); + buf = ACE_ptr_align_binary (this->rd_ptr (), align); char *end = buf + size; if (end <= this->end ()) { @@ -1352,8 +1374,8 @@ ACE_InputCDR::byte_order (void) const ACE_INLINE int ACE_InputCDR::align_read_ptr (size_t alignment) { - char *buf = ptr_align_binary (this->rd_ptr (), - alignment); + char *buf = ACE_ptr_align_binary (this->rd_ptr (), + alignment); if (buf <= this->end ()) { |