From a401de808b1e18f1832c529169e8a4b7bc048723 Mon Sep 17 00:00:00 2001 From: parsons Date: Mon, 2 Jul 2001 21:00:16 +0000 Subject: ChangeLogTag: Mon Jul 2 15:53:29 2001 Jeff Parsons --- .../tests/InterfaceRepo/IFR_Test/Admin_Client.cpp | 6 +++- TAO/tao/DynamicAny/DynUnion_i.cpp | 12 +++---- TAO/tao/Typecode.cpp | 41 ++++++++++++++++++---- TAO/tao/append.cpp | 22 ++++++------ TAO/tao/skip.cpp | 20 +++++------ 5 files changed, 68 insertions(+), 33 deletions(-) diff --git a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp index 9559d95dd50..9dd2c7183e6 100644 --- a/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp +++ b/TAO/orbsvcs/tests/InterfaceRepo/IFR_Test/Admin_Client.cpp @@ -1421,7 +1421,11 @@ Admin_Client::union_test (CORBA::Environment &ACE_TRY_ENV) // Multiple labels for first member shifts index by 1. ACE_ASSERT (!ACE_OS::strcmp (str.in (), u_members[i + 1].name)); - TAO_InputCDR cdr (tc->member_label (i)->_tao_get_cdr ()); + CORBA::Any_var label = tc->member_label (i, + ACE_TRY_ENV); + ACE_CHECK; + + TAO_InputCDR cdr (label->_tao_get_cdr ()); CORBA::ULong val; // If we're at the default index, it's in the label as octet 0, diff --git a/TAO/tao/DynamicAny/DynUnion_i.cpp b/TAO/tao/DynamicAny/DynUnion_i.cpp index 9e7afe93db4..32fee34d969 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.cpp +++ b/TAO/tao/DynamicAny/DynUnion_i.cpp @@ -75,13 +75,13 @@ TAO_DynUnion_i::init (CORBA_TypeCode_ptr tc, this->init_common (); - CORBA::Any_ptr first_label = tc->member_label (this->current_position_, + CORBA::Any_var first_label = tc->member_label (this->current_position_, ACE_TRY_ENV); ACE_CHECK; // Initialize the discriminator to the label value of the first member. this->discriminator_ = - TAO_DynAnyFactory::make_dyn_any (*first_label, + TAO_DynAnyFactory::make_dyn_any (first_label.in (), ACE_TRY_ENV); ACE_CHECK; @@ -188,11 +188,11 @@ TAO_DynUnion_i::set_from_any (const CORBA_Any & any, // Get the index. for (i = 0; i < count; ++i) { - CORBA_Any_ptr label_any = tc->member_label (i, + CORBA_Any_var label_any = tc->member_label (i, ACE_TRY_ENV); ACE_CHECK; - match = this->label_match (*label_any, + match = this->label_match (label_any.in (), disc_any, ACE_TRY_ENV); ACE_CHECK; @@ -334,7 +334,7 @@ TAO_DynUnion_i::set_discriminator (DynamicAny::DynAny_ptr value, CORBA::ULong length = this->type_->member_count (ACE_TRY_ENV); ACE_CHECK; - CORBA_Any_ptr label_any = 0; + CORBA_Any_var label_any; CORBA::ULong i; // member_label() does not work with aliased type codes. @@ -351,7 +351,7 @@ TAO_DynUnion_i::set_discriminator (DynamicAny::DynAny_ptr value, ACE_TRY_ENV); ACE_CHECK; - match = this->label_match (*label_any, + match = this->label_match (label_any.in (), value_any.in (), ACE_TRY_ENV); ACE_CHECK; diff --git a/TAO/tao/Typecode.cpp b/TAO/tao/Typecode.cpp index d195817eaa6..60feb13c445 100644 --- a/TAO/tao/Typecode.cpp +++ b/TAO/tao/Typecode.cpp @@ -294,12 +294,20 @@ CORBA_TypeCode::member_name (CORBA::ULong slot, && this->private_state_->tc_member_name_list_known_) { if (slot < this->private_state_->tc_member_count_) - return this->private_state_->tc_member_name_list_[slot]; + { + return this->private_state_->tc_member_name_list_[slot]; + } else - ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0); + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); + } } else - return this->private_member_name (slot, ACE_TRY_ENV); + { + return this->private_member_name (slot, + ACE_TRY_ENV); + } } // Return the label of the i-th member. Applicable only to CORBA::tk_union @@ -307,16 +315,37 @@ CORBA::Any_ptr CORBA_TypeCode::member_label (CORBA::ULong slot, CORBA::Environment &ACE_TRY_ENV) const { + CORBA::Any_ptr retval = 0; + if (this->private_state_->tc_member_count_known_ && this->private_state_->tc_member_label_list_known_) { if (slot < this->private_state_->tc_member_count_) - return this->private_state_->tc_member_label_list_[slot]; + { + ACE_NEW_RETURN ( + retval, + CORBA::Any (*this->private_state_->tc_member_label_list_[slot]), + 0 + ); + } else - ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0); + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); + } } else - return this->private_member_label (slot, ACE_TRY_ENV); + { + CORBA::Any_ptr label = this->private_member_label (slot, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + ACE_NEW_RETURN (retval, + CORBA::Any (*label), + 0); + } + + return retval; } // only applicable to CORBA::tk_unions diff --git a/TAO/tao/append.cpp b/TAO/tao/append.cpp index 887cbccbf2f..5b601e53817 100644 --- a/TAO/tao/append.cpp +++ b/TAO/tao/append.cpp @@ -474,16 +474,17 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, CORBA::ULong current_member = null_member; CORBA::ULong default_member = null_member; + for (CORBA::ULong i = 0; i != member_count && current_member == null_member; ++i) { - CORBA::Any *any = - tc->member_label (i, ACE_TRY_ENV); + CORBA::Any_var any = tc->member_label (i, + ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); CORBA::Octet o; - if ((*any >>= CORBA::Any::to_octet (o)) && o == 0) + if ((any >>= CORBA::Any::to_octet (o)) && o == 0) { CORBA::ULong default_index = tc->default_index (ACE_TRY_ENV); @@ -503,7 +504,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_short: { CORBA::Short d; - if ((*any >>= d) && d == short_v) + if ((any >>= d) && d == short_v) current_member = i; } break; @@ -511,7 +512,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_ushort: { CORBA::UShort d; - if ((*any >>= d) && d == ushort_v) + if ((any >>= d) && d == ushort_v) current_member = i; } break; @@ -519,7 +520,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_long: { CORBA::Long d; - if ((*any >>= d) && d == long_v) + if ((any >>= d) && d == long_v) current_member = i; } break; @@ -527,7 +528,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_ulong: { CORBA::ULong d; - if ((*any >>= d) && d == ulong_v) + if ((any >>= d) && d == ulong_v) current_member = i; } break; @@ -549,7 +550,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_char: { CORBA::Char d; - if ((*any >>= CORBA::Any::to_char (d)) && d == char_v) + if ((any >>= CORBA::Any::to_char (d)) && d == char_v) current_member = i; } break; @@ -557,7 +558,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_wchar: { CORBA::WChar d; - if ((*any >>= CORBA::Any::to_wchar (d)) && d == wchar_v) + if ((any >>= CORBA::Any::to_wchar (d)) && d == wchar_v) current_member = i; } break; @@ -565,7 +566,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, case CORBA::tk_boolean: { CORBA::Boolean d; - if ((*any >>= CORBA::Any::to_boolean (d)) && d == boolean_v) + if ((any >>= CORBA::Any::to_boolean (d)) && d == boolean_v) current_member = i; } break; @@ -590,6 +591,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc, dest, ACE_TRY_ENV); } + return CORBA::TypeCode::TRAVERSE_STOP; } diff --git a/TAO/tao/skip.cpp b/TAO/tao/skip.cpp index c269e74d5cd..c280f19049c 100644 --- a/TAO/tao/skip.cpp +++ b/TAO/tao/skip.cpp @@ -425,16 +425,16 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, CORBA::ULong current_member = null_member; CORBA::ULong default_member = null_member; + for (CORBA::ULong i = 0; i != member_count && current_member == null_member; ++i) { - CORBA::Any *any = - tc->member_label (i, ACE_TRY_ENV); + CORBA::Any_var any = tc->member_label (i, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); CORBA::Octet o; - if ((*any >>= CORBA::Any::to_octet (o)) && o == 0) + if ((any >>= CORBA::Any::to_octet (o)) && o == 0) { CORBA::ULong default_index = tc->default_index (ACE_TRY_ENV); @@ -454,7 +454,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_short: { CORBA::Short d; - if ((*any >>= d) && d == short_v) + if ((any >>= d) && d == short_v) current_member = i; } break; @@ -462,7 +462,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_ushort: { CORBA::UShort d; - if ((*any >>= d) && d == ushort_v) + if ((any >>= d) && d == ushort_v) current_member = i; } break; @@ -470,7 +470,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_long: { CORBA::Long d; - if ((*any >>= d) && d == long_v) + if ((any >>= d) && d == long_v) current_member = i; } break; @@ -478,7 +478,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_ulong: { CORBA::ULong d; - if ((*any >>= d) && d == ulong_v) + if ((any >>= d) && d == ulong_v) current_member = i; } break; @@ -500,7 +500,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_char: { CORBA::Char d; - if ((*any >>= CORBA::Any::to_char (d)) && d == char_v) + if ((any >>= CORBA::Any::to_char (d)) && d == char_v) current_member = i; } break; @@ -508,7 +508,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_wchar: { CORBA::WChar d; - if ((*any >>= CORBA::Any::to_wchar (d)) && d == wchar_v) + if ((any >>= CORBA::Any::to_wchar (d)) && d == wchar_v) current_member = i; } break; @@ -516,7 +516,7 @@ TAO_Marshal_Union::skip (CORBA::TypeCode_ptr tc, case CORBA::tk_boolean: { CORBA::Boolean d; - if ((*any >>= CORBA::Any::to_boolean (d)) && d == boolean_v) + if ((any >>= CORBA::Any::to_boolean (d)) && d == boolean_v) current_member = i; } break; -- cgit v1.2.1