diff options
author | gokhale <asgokhale@users.noreply.github.com> | 1998-01-29 16:35:11 +0000 |
---|---|---|
committer | gokhale <asgokhale@users.noreply.github.com> | 1998-01-29 16:35:11 +0000 |
commit | 6876af88f48f3d7fd6ae8c749df5259645cf34ff (patch) | |
tree | b6b756d0eb83a3a232fd6d5c2cee83ebd540d030 /TAO/tao | |
parent | 43a20ce811960ffd06c20cb5714c0b3ed260ba71 (diff) | |
download | ATCD-6876af88f48f3d7fd6ae8c749df5259645cf34ff.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/decode.cpp | 15 | ||||
-rw-r--r-- | TAO/tao/encode.cpp | 16 |
2 files changed, 22 insertions, 9 deletions
diff --git a/TAO/tao/decode.cpp b/TAO/tao/decode.cpp index eac7514c125..1f47acab9eb 100644 --- a/TAO/tao/decode.cpp +++ b/TAO/tao/decode.cpp @@ -678,7 +678,7 @@ TAO_Marshal_Struct::decode (CORBA::TypeCode_ptr tc, CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE; CORBA::Boolean continue_decoding = CORBA::B_TRUE; CORBA::TypeCode_ptr param; - CORBA::Long size, alignment; + CORBA::Long size, alignment, align_offset; void *start_addr = (void *)data; @@ -701,9 +701,16 @@ TAO_Marshal_Struct::decode (CORBA::TypeCode_ptr tc, alignment = param->alignment (env); if (env.exception () == 0) { - data = (const void *)((ptr_arith_t) ptr_align_binary (data, alignment) + - (ptr_arith_t) ptr_align_binary (start_addr, alignment) - - (ptr_arith_t) start_addr); + align_offset = + (ptr_arith_t) ptr_align_binary (data, alignment) + - (ptr_arith_t) data + + (ptr_arith_t) ptr_align_binary (start_addr, alignment) + - (ptr_arith_t) start_addr; + // if both the start_addr and data are not aligned as per + // the alignment, we do not add the offset + data = (const void *) ((ptr_arith_t) data + + ((align_offset == alignment) ? + 0 : align_offset)); switch (param->kind_) { case CORBA::tk_null: diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp index 6d8e8cc98bc..5a57ae0d17b 100644 --- a/TAO/tao/encode.cpp +++ b/TAO/tao/encode.cpp @@ -409,7 +409,7 @@ TAO_Marshal_Struct::encode (CORBA::TypeCode_ptr tc, CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE; CORBA::Boolean continue_encoding = CORBA::B_TRUE; CORBA::TypeCode_ptr param; - CORBA::Long size, alignment; + CORBA::Long size, alignment, align_offset; void *start_addr = (void *)data; @@ -431,10 +431,16 @@ TAO_Marshal_Struct::encode (CORBA::TypeCode_ptr tc, alignment = param->alignment (env); if (env.exception () == 0) { - data = (const void *) - ((ptr_arith_t) ptr_align_binary (data, alignment) + - (ptr_arith_t) ptr_align_binary (start_addr, alignment) - - (ptr_arith_t) start_addr); + align_offset = + (ptr_arith_t) ptr_align_binary (data, alignment) + - (ptr_arith_t) data + + (ptr_arith_t) ptr_align_binary (start_addr, alignment) + - (ptr_arith_t) start_addr; + // if both the start_addr and data are not aligned as per + // the alignment, we do not add the offset + data = (const void *) ((ptr_arith_t) data + + ((align_offset == alignment) ? + 0 : align_offset)); switch (param->kind_) { case CORBA::tk_null: |