diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-23 05:39:35 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-04-23 05:39:35 +0000 |
commit | 76998b188c56bbc111057e62531a5048ea885620 (patch) | |
tree | 91474ee2fa406c9c0cdc55b7e5408c51e82cd998 | |
parent | 38a0b00fb8a0b635ff71ebf7f40124805803efca (diff) | |
download | ATCD-76998b188c56bbc111057e62531a5048ea885620.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/Marshal.i | 4 | ||||
-rw-r--r-- | TAO/tao/append.cpp | 11 | ||||
-rw-r--r-- | TAO/tao/skip.cpp | 215 |
3 files changed, 116 insertions, 114 deletions
diff --git a/TAO/tao/Marshal.i b/TAO/tao/Marshal.i index bafab78b623..7a584dd82c5 100644 --- a/TAO/tao/Marshal.i +++ b/TAO/tao/Marshal.i @@ -144,11 +144,11 @@ TAO_Marshal_WString::~TAO_Marshal_WString (void) // deep_free for Any ACE_INLINE CORBA::TypeCode::traverse_status TAO_Marshal_Any::deep_free (CORBA::TypeCode_ptr, - const void * /* source */, + const void *source, const void *, CORBA::Environment &) { - // ((CORBA::Any *) source)->~CORBA_Any (); + ((CORBA::Any *) source)->~CORBA_Any (); return CORBA::TypeCode::TRAVERSE_CONTINUE; } diff --git a/TAO/tao/append.cpp b/TAO/tao/append.cpp index 0eca9668080..8ccdf1047e1 100644 --- a/TAO/tao/append.cpp +++ b/TAO/tao/append.cpp @@ -119,8 +119,11 @@ TAO_Marshal_Any::append (CORBA::TypeCode_ptr, // encode the typecode retval = dest->encode (CORBA::_tc_TypeCode, &elem_tc, 0, env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) - // append the data - retval = dest->append (elem_tc, src, env); + { + // append the data + retval = dest->append (elem_tc, src, env); + CORBA::release (elem_tc); + } } if (retval != CORBA::TypeCode::TRAVERSE_CONTINUE) { @@ -434,9 +437,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_enum: { CORBA::Long l; - TAO_InputCDR stream ((ACE_Message_Block *) - member_label->value - ()); + TAO_InputCDR stream (member_label->_tao_get_cdr ()); (void)stream.decode (discrim_tc, &l, 0, env); if (l == *(CORBA::Long *) &discrim_val) discrim_matched = 1; diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp index 772c914dea4..6f35b47df85 100644 --- a/TAO/tao/skip.cpp +++ b/TAO/tao/skip.cpp @@ -117,6 +117,7 @@ TAO_Marshal_Any::skip (CORBA::TypeCode_ptr, else retval = CORBA::TypeCode::TRAVERSE_STOP; } + CORBA::release (elem_tc); return retval; } @@ -432,114 +433,108 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, retval = stream->decode (discrim_tc, &discrim_val, 0, env); if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) { - // now get ready to skip the actual union value - default_index = tc->default_index (env); + // now get ready to skip the actual union value + default_index = tc->default_index (env); + if (env.exception () == 0) + { + member_count = tc->member_count (env); if (env.exception () == 0) { - member_count = tc->member_count (env); - if (env.exception () == 0) - { - // check which label value matches with the discriminator - // value. Accordingly, marshal the corresponding - // member_type. If none match, check if default exists - // and marshal accordingly. Otherwise it is an error. + // check which label value matches with the discriminator + // value. Accordingly, marshal the corresponding + // member_type. If none match, check if default exists + // and marshal accordingly. Otherwise it is an error. - for (i = 0; i < member_count; i++) + for (i = 0; i < member_count; i++) + { + member_label = tc->member_label (i, env); + if (env.exception () == 0) { - member_label = tc->member_label (i, env); - if (env.exception () == 0) + // do the matching + CORBA::TypeCode_var type = member_label->type (); + switch (type->kind (env)) { - // do the matching - CORBA::TypeCode_var type = member_label->type (); - switch (type->kind (env)) + case CORBA::tk_short: + { + CORBA::Short s; + *member_label >>= s; + if (s == *(CORBA::Short *) &discrim_val) + discrim_matched = 1; + } + break; + case CORBA::tk_ushort: + { + CORBA::UShort s; + *member_label >>= s; + if (s == *(CORBA::UShort *) &discrim_val) + discrim_matched = 1; + } + break; + case CORBA::tk_long: + { + CORBA::Long l; + *member_label >>= l; + if (l == *(CORBA::Long *) &discrim_val) + discrim_matched = 1; + } + break; + case CORBA::tk_ulong: + { + CORBA::ULong l; + *member_label >>= l; + if (l == *(CORBA::ULong *) &discrim_val) + discrim_matched = 1; + } + break; + case CORBA::tk_enum: { - case CORBA::tk_short: - { - CORBA::Short s; - *member_label >>= s; - if (s == *(CORBA::Short *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_ushort: - { - CORBA::UShort s; - *member_label >>= s; - if (s == *(CORBA::UShort *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_long: - { - CORBA::Long l; - *member_label >>= l; - if (l == *(CORBA::Long *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_ulong: - { - CORBA::ULong l; - *member_label >>= l; - if (l == *(CORBA::ULong *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_enum: - { - CORBA::ULong ul; - TAO_InputCDR stream (member_label->_tao_get_cdr ()); - (void)stream.decode (discrim_tc, &ul, 0, env); - if (ul == *(CORBA::ULong *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_char: - { - CORBA::Char c; - *member_label >>= CORBA::Any::to_char (c); - if (c == *(CORBA::Char *) &discrim_val) - discrim_matched = 1; - } - break; - case CORBA::tk_wchar: - CORBA::WChar wc; - *member_label >>= CORBA::Any::to_wchar (wc); - if (wc == *(CORBA::WChar *) &discrim_val) + CORBA::ULong ul; + TAO_InputCDR stream (member_label->_tao_get_cdr ()); + (void)stream.decode (discrim_tc, &ul, 0, env); + if (ul == *(CORBA::ULong *) &discrim_val) discrim_matched = 1; - break; - case CORBA::tk_boolean: - { - CORBA::Boolean b; - *member_label >>= CORBA::Any::to_boolean (b); - if (b == *(CORBA::Boolean *) &discrim_val) - discrim_matched = 1; - } - break; - default: - env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO)); - return CORBA::TypeCode::TRAVERSE_STOP; - }// end of switch - - // get the member typecode - member_tc = tc->member_type (i, env); - if (env.exception () == 0) + } + break; + case CORBA::tk_char: { - if (default_index >= 0 && default_index-- == 0) - // have we reached the default label?, if so, - // save a handle to the typecode for the default - default_tc = member_tc; - if (discrim_matched) - { - // marshal according to the matched typecode - return stream->skip (member_tc, env); - } + CORBA::Char c; + *member_label >>= CORBA::Any::to_char (c); + if (c == *(CORBA::Char *) &discrim_val) + discrim_matched = 1; } - else + break; + case CORBA::tk_wchar: + CORBA::WChar wc; + *member_label >>= CORBA::Any::to_wchar (wc); + if (wc == *(CORBA::WChar *) &discrim_val) + discrim_matched = 1; + break; + case CORBA::tk_boolean: { - env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); - return CORBA::TypeCode::TRAVERSE_STOP; + CORBA::Boolean b; + *member_label >>= CORBA::Any::to_boolean (b); + if (b == *(CORBA::Boolean *) &discrim_val) + discrim_matched = 1; + } + break; + default: + env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_NO)); + return CORBA::TypeCode::TRAVERSE_STOP; + }// end of switch + + // get the member typecode + member_tc = tc->member_type (i, env); + if (env.exception () == 0) + { + if (default_index >= 0 && default_index-- == 0) + // have we reached the default label?, if so, + // save a handle to the typecode for the default + default_tc = member_tc; + if (discrim_matched) + { + // marshal according to the matched typecode + return stream->skip (member_tc, env); } } else @@ -547,24 +542,30 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } - } // end of for loop - // we are here only if there was no match - if (default_tc) - return stream->skip (default_tc, env); + } else - return CORBA::TypeCode::TRAVERSE_CONTINUE; - } + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } + } // end of for loop + // we are here only if there was no match + if (default_tc) + return stream->skip (default_tc, env); else - { - env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); - return CORBA::TypeCode::TRAVERSE_STOP; - } + return CORBA::TypeCode::TRAVERSE_CONTINUE; } else { env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); return CORBA::TypeCode::TRAVERSE_STOP; } + } + else + { + env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE)); + return CORBA::TypeCode::TRAVERSE_STOP; + } } else { |