summaryrefslogtreecommitdiff
path: root/ace/CDR_Stream.inl
diff options
context:
space:
mode:
Diffstat (limited to 'ace/CDR_Stream.inl')
-rw-r--r--ace/CDR_Stream.inl34
1 files changed, 34 insertions, 0 deletions
diff --git a/ace/CDR_Stream.inl b/ace/CDR_Stream.inl
index 6d68e938d15..47dc98f7da8 100644
--- a/ace/CDR_Stream.inl
+++ b/ace/CDR_Stream.inl
@@ -153,7 +153,10 @@ ACE_OutputCDR::reset (void)
this->current_ = &this->start_;
this->current_is_writable_ = true;
ACE_CDR::mb_align (&this->start_);
+
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
this->current_alignment_ = 0;
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
// It is tempting not to remove the memory, but we need to do so to
// release any potential user buffers chained in the continuation
@@ -416,17 +419,24 @@ ACE_OutputCDR::adjust (size_t size,
if (!this->current_is_writable_)
return this->grow_and_adjust (size, align, buf);
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
const size_t offset =
ACE_align_binary (this->current_alignment_, align)
- this->current_alignment_;
buf = this->current_->wr_ptr () + offset;
+#else
+ buf = this->current_->wr_ptr ();
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
char *end = buf + size;
if (end <= this->current_->end () &&
end >= buf)
{
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
this->current_alignment_ += offset + size;
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
this->current_->wr_ptr (end);
return 0;
}
@@ -518,14 +528,26 @@ ACE_OutputCDR::reset_byte_order (int byte_order)
ACE_INLINE size_t
ACE_OutputCDR::current_alignment (void) const
{
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
return this->current_alignment_;
+#else
+ // Default value set to 0
+ return 0;
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
ACE_INLINE int
ACE_OutputCDR::align_write_ptr (size_t alignment)
{
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
char *dummy;
return this->adjust (0, alignment, dummy);
+#else
+ ACE_UNUSED_ARG (alignment);
+ // A return value of -1 from this function is used
+ // to indicate failure, returning 0
+ return 0;
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
ACE_INLINE ACE_Char_Codeset_Translator *
@@ -986,7 +1008,12 @@ ACE_InputCDR::adjust (size_t size,
size_t align,
char*& buf)
{
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
buf = ACE_ptr_align_binary (this->rd_ptr (), align);
+#else
+ buf = this->rd_ptr ();
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
+
char *end = buf + size;
if (end <= this->wr_ptr ())
{
@@ -996,6 +1023,9 @@ ACE_InputCDR::adjust (size_t size,
this->good_bit_ = false;
return -1;
+#if defined (ACE_LACKS_CDR_ALIGNMENT)
+ ACE_UNUSED_ARG (align);
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
ACE_INLINE int
@@ -1436,8 +1466,12 @@ ACE_InputCDR::byte_order (void) const
ACE_INLINE int
ACE_InputCDR::align_read_ptr (size_t alignment)
{
+#if !defined (ACE_LACKS_CDR_ALIGNMENT)
char *buf = ACE_ptr_align_binary (this->rd_ptr (),
alignment);
+#else
+ char *buf = this->rd_ptr ();
+#endif /* ACE_LACKS_CDR_ALIGNMENT */
if (buf <= this->wr_ptr ())
{