From 8b34c8e3ffdcf8f5e411064e0d5bf1da52b169fd Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 22 May 2024 15:06:42 +0200 Subject: [PATCH] Revert "Minor modernization of DynamicAny code" --- .../AnyTypeCode/Indirected_Type_TypeCode.cpp | 18 +- TAO/tao/DynamicAny/DynAnyUtils_T.cpp | 8 +- TAO/tao/DynamicAny/DynAny_i.cpp | 264 ++++++------------ TAO/tao/DynamicAny/DynAny_i.h | 6 +- TAO/tao/DynamicAny/DynArray_i.cpp | 20 +- TAO/tao/DynamicAny/DynArray_i.h | 10 +- TAO/tao/DynamicAny/DynCommon.cpp | 51 ++-- TAO/tao/DynamicAny/DynEnum_i.cpp | 26 +- TAO/tao/DynamicAny/DynEnum_i.h | 8 +- TAO/tao/DynamicAny/DynSequence_i.cpp | 53 ++-- TAO/tao/DynamicAny/DynSequence_i.h | 10 +- TAO/tao/DynamicAny/DynStruct_i.cpp | 31 +- TAO/tao/DynamicAny/DynStruct_i.h | 10 +- TAO/tao/DynamicAny/DynUnion_i.cpp | 212 +++++--------- TAO/tao/DynamicAny/DynUnion_i.h | 6 +- TAO/tao/DynamicAny/DynValueBox_i.cpp | 8 +- TAO/tao/DynamicAny/DynValueBox_i.h | 6 +- TAO/tao/DynamicAny/DynValueCommon_i.h | 6 +- TAO/tao/DynamicAny/DynValue_i.cpp | 205 +++++++++----- TAO/tao/DynamicAny/DynValue_i.h | 31 +- TAO/tests/DynValue_Test/Analyzer.cpp | 7 +- 21 files changed, 436 insertions(+), 560 deletions(-) diff --git a/TAO/tao/AnyTypeCode/Indirected_Type_TypeCode.cpp b/TAO/tao/AnyTypeCode/Indirected_Type_TypeCode.cpp index e154a1121ca1b..93a88f1bbc783 100644 --- a/TAO/tao/AnyTypeCode/Indirected_Type_TypeCode.cpp +++ b/TAO/tao/AnyTypeCode/Indirected_Type_TypeCode.cpp @@ -63,11 +63,11 @@ void TAO::TypeCode::Indirected_Type::set_recursive_tc (CORBA::TypeCode_ptr tc) { // link only once (should never happen that this is called twice but test anyway) - if (this->recursive_tc_ == nullptr) + if (this->recursive_tc_ == 0) { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - if (tc == nullptr) // should never happen + if (tc == 0) // should never happen return; // make sure we are the right kind @@ -105,7 +105,7 @@ TAO::TypeCode::Indirected_Type::equivalent_i ( CORBA::TypeCode_ptr TAO::TypeCode::Indirected_Type::get_compact_typecode_i () const { - return this->recursive_tc_ ? this->recursive_tc_->get_compact_typecode () : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->get_compact_typecode () : 0; } char const * @@ -117,7 +117,7 @@ TAO::TypeCode::Indirected_Type::id_i () const char const * TAO::TypeCode::Indirected_Type::name_i () const { - return this->recursive_tc_ ? this->recursive_tc_->name () : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->name () : 0; } CORBA::ULong @@ -130,14 +130,14 @@ char const * TAO::TypeCode::Indirected_Type::member_name_i ( CORBA::ULong index) const { - return this->recursive_tc_ ? this->recursive_tc_->member_name (index) : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->member_name (index) : 0; } CORBA::TypeCode_ptr TAO::TypeCode::Indirected_Type::member_type_i ( CORBA::ULong index) const { - return this->recursive_tc_ ? this->recursive_tc_->member_type (index) : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->member_type (index) : 0; } CORBA::Visibility @@ -155,19 +155,19 @@ TAO::TypeCode::Indirected_Type::type_modifier_i () const CORBA::TypeCode_ptr TAO::TypeCode::Indirected_Type::concrete_base_type_i () const { - return this->recursive_tc_ ? this->recursive_tc_->concrete_base_type () : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->concrete_base_type () : 0; } CORBA::Any * TAO::TypeCode::Indirected_Type::member_label_i (CORBA::ULong index) const { - return this->recursive_tc_ ? this->recursive_tc_->member_label (index) : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->member_label (index) : 0; } CORBA::TypeCode_ptr TAO::TypeCode::Indirected_Type::discriminator_type_i () const { - return this->recursive_tc_ ? this->recursive_tc_->discriminator_type () : nullptr; + return this->recursive_tc_ ? this->recursive_tc_->discriminator_type () : 0; } CORBA::Long diff --git a/TAO/tao/DynamicAny/DynAnyUtils_T.cpp b/TAO/tao/DynamicAny/DynAnyUtils_T.cpp index 553dc93e5e0df..5c22e0f962e32 100644 --- a/TAO/tao/DynamicAny/DynAnyUtils_T.cpp +++ b/TAO/tao/DynamicAny/DynAnyUtils_T.cpp @@ -113,7 +113,7 @@ namespace TAO ANY_TC any_tc, CORBA::Boolean allow_truncation) { - DA_IMPL *p {}; + DA_IMPL *p = 0; ACE_NEW_THROW_EX (p, DA_IMPL (allow_truncation), CORBA::NO_MEMORY ()); @@ -128,7 +128,7 @@ namespace TAO // Currently only TAO_DynValue_i can throw the original (duplicate // of a previously found TAO_DynValue_i). The new BLANK one created // above on which we called init() will be deleted automatically by - // the unique_ptr. + // the ACE_Auto_Basic_Ptr. return original; } @@ -142,7 +142,7 @@ namespace TAO ANY_TC any_tc, CORBA::Boolean allow_truncation) { - DA_IMPL *p {}; + DA_IMPL *p = 0; ACE_NEW_THROW_EX (p, DA_IMPL (allow_truncation), CORBA::NO_MEMORY ()); @@ -157,7 +157,7 @@ namespace TAO // Currently only TAO_DynValue_i can throw the original (duplicate // of a previously found TAO_DynValue_i). The new BLANK one created // above on which we called init() will be deleted automatically by - // the unique_ptr. + // the ACE_Auto_Basic_Ptr. return original; } diff --git a/TAO/tao/DynamicAny/DynAny_i.cpp b/TAO/tao/DynamicAny/DynAny_i.cpp index 697eeb1801e98..270b617167b2f 100644 --- a/TAO/tao/DynamicAny/DynAny_i.cpp +++ b/TAO/tao/DynamicAny/DynAny_i.cpp @@ -142,7 +142,7 @@ TAO_DynAny_i::set_to_default_value (CORBA::TypeCode_ptr tc) TAO_OutputCDR stream; stream << CORBA::Object::_nil (); TAO_InputCDR in (stream); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (tc, in)); this->any_.replace (unk); @@ -262,7 +262,7 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) TAO_DynAny_i *rhs_n = TAO_DynAny_i::_narrow (rhs); - if (rhs_n == nullptr) + if (rhs_n == 0) { return false; } @@ -281,198 +281,115 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) return true; case CORBA::tk_short: { - CORBA::Short rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::Short lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::Short rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::Short lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_long: { - CORBA::Long rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::Long lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::Long rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::Long lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_ushort: { - CORBA::UShort rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::UShort lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::UShort rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::UShort lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_ulong: { - CORBA::ULong rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::ULong lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::ULong rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::ULong lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_float: { - CORBA::Float rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::Float lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::Float rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::Float lhs_v; + this->any_ >>= lhs_v; return ACE::is_equal (lhs_v, rhs_v); } case CORBA::tk_double: { - CORBA::Double rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::Double lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::Double rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::Double lhs_v; + this->any_ >>= lhs_v; return ACE::is_equal (lhs_v, rhs_v); } case CORBA::tk_longdouble: { - CORBA::LongDouble rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::LongDouble lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::LongDouble rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::LongDouble lhs_v; + this->any_ >>= lhs_v; return ACE::is_equal (lhs_v, rhs_v); } case CORBA::tk_longlong: { - CORBA::LongLong rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::LongLong lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::LongLong rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::LongLong lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_ulonglong: { - CORBA::ULongLong rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::ULongLong lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::ULongLong rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::ULongLong lhs_v; + this->any_ >>= lhs_v; return (lhs_v == rhs_v); } case CORBA::tk_boolean: { - CORBA::Boolean rhs_v {}; - if (!(rhs_n->any_ >>= CORBA::Any::to_boolean (rhs_v))) - { - throw CORBA::INTERNAL (); - } - CORBA::Boolean lhs_v {}; - if (!(this->any_ >>= CORBA::Any::to_boolean (lhs_v))) - { - throw CORBA::INTERNAL (); - } + CORBA::Boolean rhs_v; + rhs_n->any_ >>= CORBA::Any::to_boolean (rhs_v); + CORBA::Boolean lhs_v; + this->any_ >>= CORBA::Any::to_boolean (lhs_v); return (lhs_v == rhs_v); } case CORBA::tk_char: { - CORBA::Char rhs_v {}; - if (!(rhs_n->any_ >>= CORBA::Any::to_char (rhs_v))) - { - throw CORBA::INTERNAL (); - } - CORBA::Char lhs_v {}; - if (!(this->any_ >>= CORBA::Any::to_char (lhs_v))) - { - throw CORBA::INTERNAL (); - } + CORBA::Char rhs_v; + rhs_n->any_ >>= CORBA::Any::to_char (rhs_v); + CORBA::Char lhs_v; + this->any_ >>= CORBA::Any::to_char (lhs_v); return (lhs_v == rhs_v); } case CORBA::tk_wchar: { - CORBA::WChar rhs_v {}; - if (!(rhs_n->any_ >>= CORBA::Any::to_wchar (rhs_v))) - { - throw CORBA::INTERNAL (); - } - CORBA::WChar lhs_v {}; - if (!(this->any_ >>= CORBA::Any::to_wchar (lhs_v))) - { - throw CORBA::INTERNAL (); - } + CORBA::WChar rhs_v; + rhs_n->any_ >>= CORBA::Any::to_wchar (rhs_v); + CORBA::WChar lhs_v; + this->any_ >>= CORBA::Any::to_wchar (lhs_v); return (lhs_v == rhs_v); } case CORBA::tk_octet: { - CORBA::Octet rhs_v {}; - if (!(rhs_n->any_ >>= CORBA::Any::to_octet (rhs_v))) - { - throw CORBA::INTERNAL (); - } - CORBA::Octet lhs_v {}; - if (!(this->any_ >>= CORBA::Any::to_octet (lhs_v))) - { - throw CORBA::INTERNAL (); - } + CORBA::Octet rhs_v; + rhs_n->any_ >>= CORBA::Any::to_octet (rhs_v); + CORBA::Octet lhs_v; + this->any_ >>= CORBA::Any::to_octet (lhs_v); return (lhs_v == rhs_v); } case CORBA::tk_any: { - const CORBA::Any *rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - const CORBA::Any *lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + const CORBA::Any *rhs_v; + rhs_n->any_ >>= rhs_v; + const CORBA::Any *lhs_v; + this->any_ >>= lhs_v; + DynamicAny::DynAny_var rhs_dyn = TAO::MakeDynAnyUtils::make_dyn_any_t ( rhs_v->_tao_get_typecode (), @@ -495,39 +412,31 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) } case CORBA::tk_TypeCode: { - CORBA::TypeCode_ptr rhs_v {}; - if (!(rhs_n->any_ >>= rhs_v)) - { - throw CORBA::INTERNAL (); - } - CORBA::TypeCode_ptr lhs_v {}; - if (!(this->any_ >>= lhs_v)) - { - throw CORBA::INTERNAL (); - } + CORBA::TypeCode_ptr rhs_v; + rhs_n->any_ >>= rhs_v; + CORBA::TypeCode_ptr lhs_v; + this->any_ >>= lhs_v; // See CORBA 2.4.2 - must use equal() here. return lhs_v->equal (lhs_v); } case CORBA::tk_objref: { - CORBA::Object_ptr rhs_v {}; - if (!(rhs_n->any_ >>= CORBA::Any::to_object (rhs_v))) - { - throw CORBA::INTERNAL (); - } - CORBA::Object_ptr lhs_v {}; - if (!(this->any_ >>= CORBA::Any::to_object (lhs_v))) - { - throw CORBA::INTERNAL (); - } + CORBA::Object_ptr rhs_v; + rhs_n->any_ >>= CORBA::Any::to_object (rhs_v); + CORBA::Object_ptr lhs_v; + this->any_ >>= CORBA::Any::to_object (lhs_v); return lhs_v->_is_equivalent (lhs_v); } case CORBA::tk_string: { - CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - CORBA::ULong const bound = unaliased_tc->length (); - const char *rhs_v {}, *lhs_v {}; - CORBA::Boolean rstatus {}, lstatus {}; + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in ()); + + CORBA::ULong bound = + unaliased_tc->length (); + + const char *rhs_v, *lhs_v; + CORBA::Boolean rstatus, lstatus; if (bound == 0) { @@ -536,7 +445,7 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) if ((rstatus && lstatus) == 0) { - return false; + return 0; } } else @@ -546,7 +455,7 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) if ((rstatus && lstatus) == 0) { - return false; + return 0; } } @@ -554,11 +463,14 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) } case CORBA::tk_wstring: { - CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - CORBA::ULong const bound = unaliased_tc->length (); + CORBA::TypeCode_var unaliased_tc = + TAO_DynAnyFactory::strip_alias (this->type_.in ()); + + CORBA::ULong bound = + unaliased_tc->length (); - const CORBA::WChar *rhs_v {}, *lhs_v {}; - CORBA::Boolean rstatus {}, lstatus {}; + const CORBA::WChar *rhs_v, *lhs_v; + CORBA::Boolean rstatus, lstatus; if (bound == 0) { @@ -572,8 +484,10 @@ TAO_DynAny_i::equal (DynamicAny::DynAny_ptr rhs) } else { - rstatus = rhs_n->any_ >>= CORBA::Any::to_wstring (rhs_v, bound); - lstatus = this->any_ >>= CORBA::Any::to_wstring (lhs_v, bound); + rstatus = rhs_n->any_ >>= CORBA::Any::to_wstring (rhs_v, + bound); + lstatus = this->any_ >>= CORBA::Any::to_wstring (lhs_v, + bound); if ((rstatus && lstatus) == 0) { @@ -889,7 +803,7 @@ TAO_DynAny_i::destroy () if (!this->ref_to_component_ || this->container_is_destroying_) { - this->destroyed_ = true; + this->destroyed_ = 1; } } diff --git a/TAO/tao/DynamicAny/DynAny_i.h b/TAO/tao/DynamicAny/DynAny_i.h index 48177123bdd1a..5530cf49d8e3f 100644 --- a/TAO/tao/DynamicAny/DynAny_i.h +++ b/TAO/tao/DynamicAny/DynAny_i.h @@ -77,10 +77,8 @@ class TAO_DynamicAny_Export TAO_DynAny_i void init_common (); // Use copy() or assign() instead of these. - TAO_DynAny_i (const TAO_DynAny_i &) = delete; - TAO_DynAny_i &operator= (const TAO_DynAny_i &) = delete; - TAO_DynAny_i& operator= (TAO_DynAny_i&&) = delete; - TAO_DynAny_i (TAO_DynAny_i&&) = delete; + TAO_DynAny_i (const TAO_DynAny_i &src); + TAO_DynAny_i &operator= (const TAO_DynAny_i &src); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicAny/DynArray_i.cpp b/TAO/tao/DynamicAny/DynArray_i.cpp index 732aff39409c9..574102cc3b2c1 100644 --- a/TAO/tao/DynamicAny/DynArray_i.cpp +++ b/TAO/tao/DynamicAny/DynArray_i.cpp @@ -45,9 +45,9 @@ TAO_DynArray_i::init (const CORBA::Any & any) this->type_ = tc; - CORBA::ULong const numfields = this->get_tc_length (tc.in ()); + CORBA::ULong numfields = this->get_tc_length (tc.in ()); // Resize the array. - this->da_members_.resize (numfields); + this->da_members_.size (numfields); this->init_common (); @@ -79,7 +79,7 @@ TAO_DynArray_i::init (const CORBA::Any & any) for (CORBA::ULong i = 0; i < numfields; ++i) { CORBA::Any field_any; - TAO::Unknown_IDL_Type *field_unk {}; + TAO::Unknown_IDL_Type *field_unk = 0; TAO_InputCDR unk_in (cdr); ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in)); @@ -110,10 +110,10 @@ TAO_DynArray_i::init (CORBA::TypeCode_ptr tc) this->type_ = CORBA::TypeCode::_duplicate (tc); - CORBA::ULong const numfields = this->get_tc_length (tc); + CORBA::ULong numfields = this->get_tc_length (tc); // Resize the array. - this->da_members_.resize (numfields); + this->da_members_.size (numfields); this->init_common (); @@ -191,7 +191,7 @@ TAO_DynArray_i::get_elements () CORBA::ULong length = static_cast (this->da_members_.size ()); - DynamicAny::AnySeq *elements {}; + DynamicAny::AnySeq *elements = 0; ACE_NEW_THROW_EX (elements, DynamicAny::AnySeq (length), CORBA::NO_MEMORY ()); @@ -262,7 +262,7 @@ TAO_DynArray_i::get_elements_as_dyn_any () throw ::CORBA::OBJECT_NOT_EXIST (); } - DynamicAny::DynAnySeq *retval {}; + DynamicAny::DynAnySeq *retval = 0; ACE_NEW_THROW_EX (retval, DynamicAny::DynAnySeq (this->component_count_), CORBA::NO_MEMORY ()); @@ -375,7 +375,7 @@ TAO_DynArray_i::from_any (const CORBA::Any& any) { CORBA::Any field_any; TAO_InputCDR unk_in (cdr); - TAO::Unknown_IDL_Type *field_unk {}; + TAO::Unknown_IDL_Type *field_unk = 0; ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in)); field_any.replace (field_unk); @@ -452,7 +452,7 @@ TAO_DynArray_i::to_any () CORBA::Any, CORBA::NO_MEMORY ()); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), @@ -518,7 +518,7 @@ TAO_DynArray_i::destroy () this->da_members_[i]->destroy (); } - this->destroyed_ = true; + this->destroyed_ = 1; } } diff --git a/TAO/tao/DynamicAny/DynArray_i.h b/TAO/tao/DynamicAny/DynArray_i.h index e0ec1f8ad195c..01cb6eb844745 100644 --- a/TAO/tao/DynamicAny/DynArray_i.h +++ b/TAO/tao/DynamicAny/DynArray_i.h @@ -21,7 +21,7 @@ #include "tao/DynamicAny/DynCommon.h" #include "tao/LocalObject.h" -#include +#include "ace/Containers.h" #if defined (_MSC_VER) # pragma warning(push) @@ -89,14 +89,12 @@ class TAO_DynamicAny_Export TAO_DynArray_i void init_common (); // Use copy() or assign() instead of these. - TAO_DynArray_i (const TAO_DynArray_i &) = delete; - TAO_DynArray_i &operator= (const TAO_DynArray_i &) = delete; - TAO_DynArray_i& operator= (TAO_DynArray_i&&) = delete; - TAO_DynArray_i (TAO_DynArray_i&&) = delete; + TAO_DynArray_i (const TAO_DynArray_i &src); + TAO_DynArray_i &operator= (const TAO_DynArray_i &src); private: /// Each component is also a DynAny. - std::vector da_members_; + ACE_Array_Base da_members_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicAny/DynCommon.cpp b/TAO/tao/DynamicAny/DynCommon.cpp index 0f15db4bc5903..a9b0606205a3c 100644 --- a/TAO/tao/DynamicAny/DynCommon.cpp +++ b/TAO/tao/DynamicAny/DynCommon.cpp @@ -200,7 +200,8 @@ TAO_DynCommon::insert_reference (CORBA::Object_ptr value) if (ACE_OS::strcmp (value_id, "IDL:omg.org/CORBA/Object:1.0") != 0) { - const char *my_id = this->type_->id (); + const char *my_id = + this->type_->id (); if (ACE_OS::strcmp (value_id, my_id) != 0) { @@ -229,7 +230,7 @@ TAO_DynCommon::insert_reference (CORBA::Object_ptr value) } TAO_InputCDR in (cdr); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); @@ -385,7 +386,7 @@ TAO_DynCommon::insert_val (CORBA::ValueBase *value) } TAO_InputCDR in (out); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); this->any_.replace (unk); @@ -476,12 +477,14 @@ TAO_DynCommon::get_string () throw DynamicAny::DynAny::TypeMismatch (); } - char *retval {}; - CORBA::ULong const bound = unaliased_tc->length (); + char *retval = 0; + + CORBA::ULong const bound = + unaliased_tc->length (); // We will have caught a type mismatch above, so if this fails, // it must be for some other reason. - if (!(this->any_ >>= CORBA::Any::to_string (retval, bound))) + if ((this->any_ >>= CORBA::Any::to_string (retval, bound)) == 0) { throw DynamicAny::DynAny::InvalidValue (); } @@ -509,7 +512,7 @@ TAO_DynCommon::get_reference () { CORBA::Object_var retval; - if (!(this->any_ >>= CORBA::Any::to_object (retval.inout ()))) + if ((this->any_ >>= CORBA::Any::to_object (retval.inout ())) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } @@ -536,7 +539,7 @@ TAO_DynCommon::get_typecode () { CORBA::TypeCode_ptr retval; - if (!(this->any_ >>= retval)) + if ((this->any_ >>= retval) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } @@ -581,7 +584,7 @@ TAO_DynCommon::get_wchar () { CORBA::WChar retval; - if (!(this->any_ >>= CORBA::Any::to_wchar (retval))) + if ((this->any_ >>= CORBA::Any::to_wchar (retval)) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } @@ -613,13 +616,12 @@ TAO_DynCommon::get_wstring () CORBA::TypeCode_var unaliased_tc = this->check_type_and_unalias (CORBA::_tc_wstring); - CORBA::WChar *retval = {}; - CORBA::ULong const bound = unaliased_tc->length (); + CORBA::WChar *retval = 0; - if (!(this->any_ >>= CORBA::Any::to_wstring (retval, bound))) - { - throw CORBA::INTERNAL (); - } + CORBA::ULong bound = + unaliased_tc->length (); + + (void) (this->any_ >>= CORBA::Any::to_wstring (retval, bound)); return CORBA::wstring_dup (retval); } @@ -642,17 +644,17 @@ TAO_DynCommon::get_any () } else { - const CORBA::Any *tmp {}; + const CORBA::Any *tmp = 0; - if (!(this->any_ >>= tmp)) + if ((this->any_ >>= tmp) == 0) { throw DynamicAny::DynAny::TypeMismatch (); } - CORBA::Any *retval {}; + CORBA::Any *retval = 0; ACE_NEW_RETURN (retval, CORBA::Any (*tmp), - nullptr); + 0); return retval; } } @@ -704,7 +706,7 @@ TAO_DynCommon::get_val () CORBA::ValueBase_var retval; TAO::Any_Impl *any_impl = this->any_.impl (); - if (!any_impl) + if (any_impl == 0) { throw DynamicAny::DynAny::InvalidValue (); } @@ -776,7 +778,7 @@ TAO_DynCommon::next () throw ::CORBA::OBJECT_NOT_EXIST (); } - CORBA::Long const component_count = static_cast (this->component_count_); + CORBA::Long component_count = static_cast (this->component_count_); if (this->has_components_ == 0 || this->current_position_ + 1 >= component_count) @@ -856,7 +858,8 @@ TAO_DynCommon::insert_abstract (CORBA::AbstractBase_ptr value) if (cmp != 0) { - const char *my_id = this->type_->id (); + const char *my_id = + this->type_->id (); if (ACE_OS::strcmp (value_id, my_id) != 0) { @@ -883,7 +886,7 @@ TAO_DynCommon::insert_abstract (CORBA::AbstractBase_ptr value) } TAO_InputCDR in (out); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (this->type_.in (), in)); this->any_.replace (unk); @@ -923,7 +926,7 @@ TAO_DynCommon::get_abstract () CORBA::AbstractBase_var retval; TAO::Any_Impl *any_impl = this->any_.impl (); - if (!any_impl) + if (any_impl == 0) { throw DynamicAny::DynAny::InvalidValue (); } diff --git a/TAO/tao/DynamicAny/DynEnum_i.cpp b/TAO/tao/DynamicAny/DynEnum_i.cpp index 91bbf14983a34..7f25e22f02dd9 100644 --- a/TAO/tao/DynamicAny/DynEnum_i.cpp +++ b/TAO/tao/DynamicAny/DynEnum_i.cpp @@ -57,20 +57,14 @@ TAO_DynEnum_i::init (const CORBA::Any &any) // We don't want unk's rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - if (!for_reading.read_ulong (this->value_)) - { - throw CORBA::INTERNAL (); - } + for_reading.read_ulong (this->value_); } else { TAO_OutputCDR out; impl->marshal_value (out); TAO_InputCDR in (out); - if (!in.read_ulong (this->value_)) - { - throw CORBA::INTERNAL (); - } + in.read_ulong (this->value_); } this->init_common (); @@ -122,12 +116,15 @@ void TAO_DynEnum_i::set_as_string (const char *value_as_string) { CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - CORBA::ULong const count = ct.in ()->member_count (); - CORBA::ULong i {}; + + CORBA::ULong count = ct.in ()->member_count (); + + CORBA::ULong i; + const char *temp = 0; for (i = 0; i < count; ++i) { - const char *temp = ct.in ()->member_name (i); + temp = ct.in ()->member_name (i); if (!ACE_OS::strcmp (value_as_string, temp)) { @@ -220,7 +217,7 @@ TAO_DynEnum_i::to_any () CORBA::NO_MEMORY ()); TAO_InputCDR in_cdr (out_cdr); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), @@ -258,10 +255,7 @@ TAO_DynEnum_i::equal (DynamicAny::DynAny_ptr rhs) // We don't want unk's rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (unk->_tao_get_cdr ()); - if (!for_reading.read_ulong (value)) - { - throw CORBA::INTERNAL (); - } + for_reading.read_ulong (value); } else { diff --git a/TAO/tao/DynamicAny/DynEnum_i.h b/TAO/tao/DynamicAny/DynEnum_i.h index 5ea9940946887..6d05d6d7fae4e 100644 --- a/TAO/tao/DynamicAny/DynEnum_i.h +++ b/TAO/tao/DynamicAny/DynEnum_i.h @@ -42,7 +42,7 @@ class TAO_DynamicAny_Export TAO_DynEnum_i { public: /// Constructor. - TAO_DynEnum_i (CORBA::Boolean allow_truncation = true); + TAO_DynEnum_i (CORBA::Boolean allow_truncation=true); /// Destructor. ~TAO_DynEnum_i (); @@ -83,10 +83,8 @@ class TAO_DynamicAny_Export TAO_DynEnum_i void init_common (); // = Use copy() or assign() instead of these. - TAO_DynEnum_i (const TAO_DynEnum_i &) = delete; - TAO_DynEnum_i &operator= (const TAO_DynEnum_i &) = delete; - TAO_DynEnum_i& operator= (TAO_DynEnum_i&&) = delete; - TAO_DynEnum_i (TAO_DynEnum_i&&) = delete; + TAO_DynEnum_i (const TAO_DynEnum_i &src); + TAO_DynEnum_i &operator= (const TAO_DynEnum_i &src); private: /// Current numeric value of the enum. diff --git a/TAO/tao/DynamicAny/DynSequence_i.cpp b/TAO/tao/DynamicAny/DynSequence_i.cpp index f6afeb44652f2..749a3b79e932c 100644 --- a/TAO/tao/DynamicAny/DynSequence_i.cpp +++ b/TAO/tao/DynamicAny/DynSequence_i.cpp @@ -70,13 +70,10 @@ TAO_DynSequence_i::init (const CORBA::Any& any) // If the any is a sequence, first 4 bytes of cdr hold the // length. - if (!cdr.read_ulong (length)) - { - throw CORBA::INTERNAL (); - } + cdr.read_ulong (length); // Resize the array. - this->da_members_.resize (length); + this->da_members_.size (length); this->init_common (); @@ -88,7 +85,7 @@ TAO_DynSequence_i::init (const CORBA::Any& any) { CORBA::Any field_any; TAO_InputCDR unk_in (cdr); - TAO::Unknown_IDL_Type *field_unk {}; + TAO::Unknown_IDL_Type *field_unk = 0; ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in)); field_any.replace (field_unk); @@ -117,7 +114,7 @@ TAO_DynSequence_i::init (CORBA::TypeCode_ptr tc) } // Empty sequence. - this->da_members_.clear (); + this->da_members_.size (0); this->init_common (); @@ -220,17 +217,18 @@ TAO_DynSequence_i::set_length (CORBA::ULong length) if (length > this->component_count_) { // Grow array first, then initialize new members. - this->da_members_.resize (length); + this->da_members_.size (length); - CORBA::TypeCode_var elemtype = stripped_tc->content_type (); + CORBA::TypeCode_var elemtype = + stripped_tc->content_type (); for (CORBA::ULong i = this->component_count_; i < length; ++i) { this->da_members_[i] = - TAO::MakeDynAnyUtils::make_dyn_any_t ( - elemtype.in (), - elemtype.in (), - this->allow_truncation_ ); + TAO::MakeDynAnyUtils::make_dyn_any_t ( + elemtype.in (), + elemtype.in (), + this->allow_truncation_ ); } } else if (length < this->component_count_) @@ -241,7 +239,7 @@ TAO_DynSequence_i::set_length (CORBA::ULong length) this->da_members_[j]->destroy (); } - this->da_members_.resize (length); + this->da_members_.size (length); } // Now we can update component_count_. @@ -311,7 +309,7 @@ TAO_DynSequence_i::set_elements (const DynamicAny::AnySeq & value) // If the array grows, we must do it now. if (length > this->component_count_) { - this->da_members_.resize (length); + this->da_members_.size (length); } CORBA::TypeCode_var element_type = this->get_element_type (); @@ -354,7 +352,7 @@ TAO_DynSequence_i::set_elements (const DynamicAny::AnySeq & value) // If the array shrinks, we must wait until now to do it. if (length < this->component_count_) { - this->da_members_.resize (length); + this->da_members_.size (length); } // Now we can update component_count_. @@ -369,7 +367,7 @@ TAO_DynSequence_i::get_elements_as_dyn_any () throw ::CORBA::OBJECT_NOT_EXIST (); } - DynamicAny::DynAnySeq *retval {}; + DynamicAny::DynAnySeq *retval = 0; ACE_NEW_THROW_EX (retval, DynamicAny::DynAnySeq (this->component_count_), CORBA::NO_MEMORY ()); @@ -413,7 +411,7 @@ TAO_DynSequence_i::set_elements_as_dyn_any ( // If the array grows, we must do it now. if (length > this->component_count_) { - this->da_members_.resize (length); + this->da_members_.size (length); } CORBA::TypeCode_var element_type = @@ -454,7 +452,7 @@ TAO_DynSequence_i::set_elements_as_dyn_any ( // If the array shrinks, we must wait until now to do it. if (length < this->component_count_) { - this->da_members_.resize (length); + this->da_members_.size (length); } // Now we can update component_count_. @@ -504,15 +502,12 @@ TAO_DynSequence_i::from_any (const CORBA::Any & any) // If the any is a sequence, first 4 bytes of cdr hold the // length. - if (!cdr.read_ulong (arg_length)) - { - throw CORBA::INTERNAL (); - } + cdr.read_ulong (arg_length); // If the array grows, we must do it now. if (arg_length > this->component_count_) { - this->da_members_.resize (arg_length); + this->da_members_.size (arg_length); } CORBA::TypeCode_var field_tc = @@ -522,7 +517,7 @@ TAO_DynSequence_i::from_any (const CORBA::Any & any) { CORBA::Any field_any; TAO_InputCDR unk_in (cdr); - TAO::Unknown_IDL_Type *field_unk {}; + TAO::Unknown_IDL_Type *field_unk = 0; ACE_NEW (field_unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in)); @@ -552,7 +547,7 @@ TAO_DynSequence_i::from_any (const CORBA::Any & any) // If the array shrinks, we must wait until now to do it. if (arg_length < this->component_count_) { - this->da_members_.resize (arg_length); + this->da_members_.size (arg_length); } // Now we can update component_count_. @@ -614,12 +609,12 @@ TAO_DynSequence_i::to_any () TAO_InputCDR in_cdr (out_cdr); - CORBA::Any_ptr retval {}; + CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX (retval, CORBA::Any, CORBA::NO_MEMORY ()); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), @@ -690,7 +685,7 @@ TAO_DynSequence_i::destroy () this->da_members_[i]->destroy (); } - this->destroyed_ = true; + this->destroyed_ = 1; } } diff --git a/TAO/tao/DynamicAny/DynSequence_i.h b/TAO/tao/DynamicAny/DynSequence_i.h index 0d17853ac25cb..276a39f702265 100644 --- a/TAO/tao/DynamicAny/DynSequence_i.h +++ b/TAO/tao/DynamicAny/DynSequence_i.h @@ -20,7 +20,7 @@ #include "tao/DynamicAny/DynCommon.h" #include "tao/LocalObject.h" -#include +#include "ace/Containers.h" #if defined (_MSC_VER) # pragma warning(push) @@ -90,14 +90,12 @@ class TAO_DynamicAny_Export TAO_DynSequence_i void init_common (); // = Use copy() or assign() instead of these - TAO_DynSequence_i (const TAO_DynSequence_i &) = delete; - TAO_DynSequence_i &operator= (const TAO_DynSequence_i &) = delete; - TAO_DynSequence_i& operator= (TAO_DynSequence_i&&) = delete; - TAO_DynSequence_i (TAO_DynSequence_i&&) = delete; + TAO_DynSequence_i (const TAO_DynSequence_i &src); + TAO_DynSequence_i &operator= (const TAO_DynSequence_i &src); private: /// Each component is also a DynAny. - std::vector da_members_; + ACE_Array_Base da_members_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicAny/DynStruct_i.cpp b/TAO/tao/DynamicAny/DynStruct_i.cpp index 7a65de983dbdc..bfa40f2874ea9 100644 --- a/TAO/tao/DynamicAny/DynStruct_i.cpp +++ b/TAO/tao/DynamicAny/DynStruct_i.cpp @@ -65,10 +65,11 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any) CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (any._tao_get_typecode ()); - CORBA::ULong const numfields = unaliased_tc->member_count (); + CORBA::ULong numfields = + unaliased_tc->member_count (); // Resize the array. - this->da_members_.resize (numfields); + this->da_members_.size (numfields); this->init_common (); @@ -76,7 +77,7 @@ TAO_DynStruct_i::set_from_any (const CORBA::Any & any) TAO::Any_Impl *impl = any.impl (); TAO_OutputCDR out; TAO_InputCDR in (static_cast (0)); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; if (impl->encoded ()) { @@ -139,10 +140,11 @@ TAO_DynStruct_i::init (CORBA::TypeCode_ptr tc) CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - this->component_count_ = unaliased_tc->member_count (); + this->component_count_ = + unaliased_tc->member_count (); // Resize the array. - this->da_members_.resize (this->component_count_); + this->da_members_.size (this->component_count_); this->init_common (); @@ -439,7 +441,7 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any) TAO::Any_Impl *impl = any.impl (); TAO_OutputCDR out; TAO_InputCDR in (static_cast (0)); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; if (impl->encoded ()) { @@ -477,7 +479,7 @@ TAO_DynStruct_i::from_any (const CORBA::Any & any) CORBA::Any field_any; TAO_InputCDR unk_in (in); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in)); @@ -521,8 +523,8 @@ TAO_DynStruct_i::to_any () out_cdr << this->type_->id (); } - - TAO::Unknown_IDL_Type *field_unk {}; + TAO::Any_Impl *field_impl = 0; + TAO::Unknown_IDL_Type *field_unk = 0; TAO_InputCDR field_in_cdr (static_cast (0)); for (CORBA::ULong i = 0; i < this->component_count_; ++i) @@ -535,11 +537,12 @@ TAO_DynStruct_i::to_any () this->da_members_[i]->to_any (); TAO_OutputCDR field_out_cdr; - TAO::Any_Impl *field_impl = field_any->impl (); + field_impl = field_any->impl (); if (field_impl->encoded ()) { - field_unk = dynamic_cast (field_impl); + field_unk = + dynamic_cast (field_impl); if (!field_unk) throw CORBA::INTERNAL (); @@ -560,12 +563,12 @@ TAO_DynStruct_i::to_any () TAO_InputCDR in_cdr (out_cdr); - CORBA::Any_ptr retval {}; + CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX (retval, CORBA::Any, CORBA::NO_MEMORY ()); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), @@ -629,7 +632,7 @@ TAO_DynStruct_i::destroy () this->da_members_[i]->destroy (); } - this->destroyed_ = true; + this->destroyed_ = 1; } } diff --git a/TAO/tao/DynamicAny/DynStruct_i.h b/TAO/tao/DynamicAny/DynStruct_i.h index 50cc048c0a029..ba993d6c84c71 100644 --- a/TAO/tao/DynamicAny/DynStruct_i.h +++ b/TAO/tao/DynamicAny/DynStruct_i.h @@ -20,7 +20,7 @@ #include "tao/DynamicAny/DynCommon.h" #include "tao/LocalObject.h" -#include +#include "ace/Containers.h" #if defined (_MSC_VER) # pragma warning(push) @@ -94,14 +94,12 @@ class TAO_DynamicAny_Export TAO_DynStruct_i void init_common (); // = Use copy() or assign() instead of these. - TAO_DynStruct_i (const TAO_DynStruct_i &) = delete; - TAO_DynStruct_i &operator= (const TAO_DynStruct_i &) = delete; - TAO_DynStruct_i& operator= (TAO_DynStruct_i&&) = delete; - TAO_DynStruct_i (TAO_DynStruct_i&&) = delete; + TAO_DynStruct_i (const TAO_DynStruct_i &src); + TAO_DynStruct_i &operator= (const TAO_DynStruct_i &src); private: /// Each component is also a DynAny. - std::vector da_members_; + ACE_Array_Base da_members_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/DynamicAny/DynUnion_i.cpp b/TAO/tao/DynamicAny/DynUnion_i.cpp index 737644b6d2d08..bba6b5e1a7282 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.cpp +++ b/TAO/tao/DynamicAny/DynUnion_i.cpp @@ -75,13 +75,15 @@ TAO_DynUnion_i::init (CORBA::TypeCode_ptr tc) CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - CORBA::Any_var first_label = unaliased_tc->member_label (this->current_position_); + CORBA::Any_var first_label = + unaliased_tc->member_label (this->current_position_); // Initialize the discriminator to the label value of the first member. CORBA::TypeCode_var disc_tc = unaliased_tc->discriminator_type (); CORBA::TCKind disc_kind = TAO_DynAnyFactory::unalias (disc_tc.in ()); CORBA::TCKind label_kind = TAO_DynAnyFactory::unalias (first_label->_tao_get_typecode ()); - if (disc_kind == CORBA::tk_enum && label_kind == CORBA::tk_ulong) + if (disc_kind == CORBA::tk_enum && + label_kind == CORBA::tk_ulong) { // incase the discriminator is an enum type we have to walk // a slightly more complex path because enum labels are @@ -91,15 +93,10 @@ TAO_DynUnion_i::init (CORBA::TypeCode_ptr tc) disc_tc.in (), disc_tc.in (), this->allow_truncation_ ); - CORBA::ULong label_val {}; - if (first_label >>= label_val) - { - TAO_DynEnum_i::_narrow (this->discriminator_.in ())->set_as_ulong (label_val); - } - else - { - throw CORBA::INTERNAL (); - } + CORBA::ULong label_val; + first_label >>= label_val; + TAO_DynEnum_i::_narrow (this->discriminator_.in ()) + ->set_as_ulong (label_val); } else { @@ -149,7 +146,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any) tc->discriminator_type (); CORBA::Any disc_any; - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; // Get a CDR stream - if the Any doesn't have one, make one. TAO::Any_Impl *impl = any.impl (); @@ -228,7 +225,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any) CORBA::TypeCode_var member_tc = tc->member_type (i); CORBA::Any member_any; - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (member_tc.in (), in)); @@ -266,7 +263,7 @@ TAO_DynUnion_i::set_from_any (const CORBA::Any & any) tc->member_type (index); CORBA::Any default_any; - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW (unk, TAO::Unknown_IDL_Type (default_tc.in (), in)); @@ -332,7 +329,7 @@ TAO_DynUnion_i::set_discriminator (DynamicAny::DynAny_ptr value) CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); - CORBA::Boolean match = false; + CORBA::Boolean match = 0; for (i = 0; i < length; ++i) { @@ -364,15 +361,10 @@ TAO_DynUnion_i::set_discriminator (DynamicAny::DynAny_ptr value) // incase the discriminator is an enum type we have to walk // a slightly more complex path because enum labels are // stored as ulong in the union tc - CORBA::ULong label_val {}; - if (label_any >>= label_val) - { - TAO_DynEnum_i::_narrow (this->discriminator_.in ())->set_as_ulong (label_val); - } - else - { - throw CORBA::INTERNAL (); - } + CORBA::ULong label_val; + label_any >>= label_val; + TAO_DynEnum_i::_narrow (this->discriminator_.in ()) + ->set_as_ulong (label_val); } else { @@ -728,12 +720,12 @@ TAO_DynUnion_i::to_any () // Make the Any. TAO_InputCDR in_cdr (out_cdr); - CORBA::Any_ptr retval {}; + CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX (retval, CORBA::Any, CORBA::NO_MEMORY ()); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), @@ -753,9 +745,9 @@ TAO_DynUnion_i::equal (DynamicAny::DynAny_ptr rhs) TAO_DynUnion_i *impl = TAO_DynUnion_i::_narrow (rhs); - if (!impl) + if (impl == 0) { - return false; + return 0; } CORBA::Boolean equivalent = @@ -763,7 +755,7 @@ TAO_DynUnion_i::equal (DynamicAny::DynAny_ptr rhs) if (!equivalent) { - return false; + return 0; } CORBA::Boolean member_equal = @@ -800,7 +792,7 @@ TAO_DynUnion_i::destroy () this->discriminator_->destroy (); - this->destroyed_ = true; + this->destroyed_ = 1; } } @@ -836,7 +828,8 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, // if we are iterating through the union type code's // member_label() calls. CORBA::TypeCode_var tc = my_any.type (); - CORBA::TCKind const kind = TAO_DynAnyFactory::unalias (tc.in ()); + + CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc.in ()); // No need to do any type checking - it was done before this // call was made. @@ -844,62 +837,41 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, { case CORBA::tk_octet: // Default case label - just skip it. - return false; + return 0; case CORBA::tk_short: { - CORBA::Short my_val {}; - CORBA::Short other_val {}; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } + CORBA::Short my_val; + CORBA::Short other_val; + my_any >>= my_val; + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_long: { - CORBA::Long my_val {}; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } - CORBA::Long other_val {}; - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } + CORBA::Long my_val; + CORBA::Long other_val; + my_any >>= my_val; + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_ushort: { CORBA::UShort my_val; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } CORBA::UShort other_val; - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } + my_any >>= my_val; + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_ulong: { - CORBA::ULong my_val {}; - CORBA::ULong other_val {}; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } + CORBA::ULong my_val; + CORBA::ULong other_val; + my_any >>= my_val; // check whether the discriminator is possibly an enum type // since these get stored as ulong label values as well CORBA::TypeCode_var other_tc = other_any.type (); - CORBA::TCKind const kind = TAO_DynAnyFactory::unalias (other_tc.in ()); + CORBA::TCKind kind = TAO_DynAnyFactory::unalias (other_tc.in ()); if (kind == CORBA::tk_enum) { TAO::Any_Impl *other_impl = other_any.impl (); @@ -913,107 +885,67 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, // shared by another Any, so we use this to copy the // state, not the buffer. TAO_InputCDR for_reading (other_unk->_tao_get_cdr ()); - if (!for_reading.read_ulong (other_val)) - { - throw CORBA::INTERNAL (); - } + for_reading.read_ulong (other_val); } else { TAO_OutputCDR other_out; other_impl->marshal_value (other_out); TAO_InputCDR other_in (other_out); - if (!other_in.read_ulong (other_val)) - { - throw CORBA::INTERNAL (); - } + other_in.read_ulong (other_val); } } else - { - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } - } + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_boolean: { - CORBA::Boolean my_val {}; - CORBA::Boolean other_val {}; - if (!(my_any >>= CORBA::Any::to_boolean (my_val))) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= CORBA::Any::to_boolean (other_val))) - { - throw CORBA::INTERNAL (); - } + CORBA::Boolean my_val; + CORBA::Boolean other_val; + my_any >>= CORBA::Any::to_boolean (my_val); + other_any >>= CORBA::Any::to_boolean (other_val); return my_val == other_val; } case CORBA::tk_char: { - CORBA::Char my_val {}; - CORBA::Char other_val {}; - if (!(my_any >>= CORBA::Any::to_char (my_val))) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= CORBA::Any::to_char (other_val))) - { - throw CORBA::INTERNAL (); - } + CORBA::Char my_val; + CORBA::Char other_val; + my_any >>= CORBA::Any::to_char (my_val); + other_any >>= CORBA::Any::to_char (other_val); return my_val == other_val; } // For platforms without native 64-bit ints. case CORBA::tk_longlong: { - CORBA::LongLong my_val {}; - CORBA::LongLong other_val {}; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } + CORBA::LongLong my_val; + CORBA::LongLong other_val; + my_any >>= my_val; + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_ulonglong: { CORBA::ULongLong my_val; CORBA::ULongLong other_val; - if (!(my_any >>= my_val)) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= other_val)) - { - throw CORBA::INTERNAL (); - } + my_any >>= my_val; + other_any >>= other_val; return my_val == other_val; } case CORBA::tk_wchar: { CORBA::WChar my_val; CORBA::WChar other_val; - if (!(my_any >>= CORBA::Any::to_wchar (my_val))) - { - throw CORBA::INTERNAL (); - } - if (!(other_any >>= CORBA::Any::to_wchar (other_val))) - { - throw CORBA::INTERNAL (); - } + my_any >>= CORBA::Any::to_wchar (my_val); + other_any >>= CORBA::Any::to_wchar (other_val); return my_val == other_val; } case CORBA::tk_enum: { - CORBA::ULong my_val {}; - CORBA::ULong other_val {}; + CORBA::ULong my_val; + CORBA::ULong other_val; + TAO::Any_Impl *my_impl = my_any.impl (); if (my_impl->encoded ()) @@ -1027,20 +959,14 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, // We don't want unk's rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (my_unk->_tao_get_cdr ()); - if (!for_reading.read_ulong (my_val)) - { - throw CORBA::INTERNAL (); - } + for_reading.read_ulong (my_val); } else { TAO_OutputCDR my_out; my_impl->marshal_value (my_out); TAO_InputCDR my_in (my_out); - if (!(my_in.read_ulong (my_val))) - { - throw CORBA::INTERNAL (); - } + my_in.read_ulong (my_val); } TAO::Any_Impl *other_impl = other_any.impl (); @@ -1056,27 +982,21 @@ TAO_DynUnion_i::label_match (const CORBA::Any &my_any, // We don't want unk's rd_ptr to move, in case we are shared by // another Any, so we use this to copy the state, not the buffer. TAO_InputCDR for_reading (other_unk->_tao_get_cdr ()); - if (!for_reading.read_ulong (other_val)) - { - throw CORBA::INTERNAL (); - } + for_reading.read_ulong (other_val); } else { TAO_OutputCDR other_out; other_impl->marshal_value (other_out); TAO_InputCDR other_in (other_out); - if (!(other_in.read_ulong (other_val))) - { - throw CORBA::INTERNAL (); - } + other_in.read_ulong (other_val); } return my_val == other_val; } // Cannot happen - we've covered all the legal discriminator types. default: - return false; + return 0; } } diff --git a/TAO/tao/DynamicAny/DynUnion_i.h b/TAO/tao/DynamicAny/DynUnion_i.h index a835fc5933ea0..27436f421afe9 100644 --- a/TAO/tao/DynamicAny/DynUnion_i.h +++ b/TAO/tao/DynamicAny/DynUnion_i.h @@ -99,10 +99,8 @@ class TAO_DynamicAny_Export TAO_DynUnion_i const CORBA::Any &other_any); /// Use copy() or assign() instead of these. - TAO_DynUnion_i (const TAO_DynUnion_i &) = delete; - TAO_DynUnion_i &operator= (const TAO_DynUnion_i &) = delete; - TAO_DynUnion_i& operator= (TAO_DynUnion_i&&) = delete; - TAO_DynUnion_i (TAO_DynUnion_i&&) = delete; + TAO_DynUnion_i (const TAO_DynUnion_i &src); + TAO_DynUnion_i &operator= (const TAO_DynUnion_i &src); private: /// Just two components. diff --git a/TAO/tao/DynamicAny/DynValueBox_i.cpp b/TAO/tao/DynamicAny/DynValueBox_i.cpp index e11d12fe11cf7..cfa81bd3bea93 100644 --- a/TAO/tao/DynamicAny/DynValueBox_i.cpp +++ b/TAO/tao/DynamicAny/DynValueBox_i.cpp @@ -231,7 +231,7 @@ TAO_DynValueBox_i::destroy () this->boxed_.in ()->destroy (); } - this->destroyed_ = true; + this->destroyed_ = 1; } } @@ -310,7 +310,7 @@ TAO_DynValueBox_i::set_from_any (const CORBA::Any & any) CORBA::TypeCode_var unaliased_tc = TAO_DynAnyFactory::strip_alias (this->type_.in ()); CORBA::TypeCode_var boxed_tc (unaliased_tc->content_type ()); - TAO::Unknown_IDL_Type * unk {}; + TAO::Unknown_IDL_Type * unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (boxed_tc.in (), in), CORBA::NO_MEMORY ()); @@ -384,11 +384,11 @@ TAO_DynValueBox_i::to_any () // Convert the out_cdr into a new any. TAO_InputCDR in_cdr (out_cdr); - TAO::Unknown_IDL_Type * unk {}; + TAO::Unknown_IDL_Type * unk = 0; ACE_NEW_THROW_EX (unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), CORBA::NO_MEMORY ()); - CORBA::Any_ptr retval {}; + CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX (retval, CORBA::Any, CORBA::NO_MEMORY ()); retval->replace (unk); return retval; diff --git a/TAO/tao/DynamicAny/DynValueBox_i.h b/TAO/tao/DynamicAny/DynValueBox_i.h index d27be8f18069a..3dadf64cb6cc3 100644 --- a/TAO/tao/DynamicAny/DynValueBox_i.h +++ b/TAO/tao/DynamicAny/DynValueBox_i.h @@ -82,10 +82,8 @@ class TAO_DynamicAny_Export TAO_DynValueBox_i void set_from_any (const CORBA::Any &any); // = Use copy() or assign() instead of these. - TAO_DynValueBox_i (const TAO_DynValueBox_i &) = delete; - TAO_DynValueBox_i &operator= (const TAO_DynValueBox_i &) = delete; - TAO_DynValueBox_i& operator= (TAO_DynValueBox_i&&) = delete; - TAO_DynValueBox_i (TAO_DynValueBox_i&&) = delete; + TAO_DynValueBox_i (const TAO_DynValueBox_i &src); + TAO_DynValueBox_i &operator= (const TAO_DynValueBox_i &src); /// The boxed component of DynValueBox is another DynAny. DynamicAny::DynAny_var boxed_; diff --git a/TAO/tao/DynamicAny/DynValueCommon_i.h b/TAO/tao/DynamicAny/DynValueCommon_i.h index 52a2aa3e0c0f5..7dbf099ecbfad 100644 --- a/TAO/tao/DynamicAny/DynValueCommon_i.h +++ b/TAO/tao/DynamicAny/DynValueCommon_i.h @@ -56,10 +56,8 @@ class TAO_DynamicAny_Export TAO_DynValueCommon_i private: // = Use copy() or assign() instead of these. - TAO_DynValueCommon_i (const TAO_DynValueCommon_i &) = delete; - TAO_DynValueCommon_i &operator= (const TAO_DynValueCommon_i &) = delete; - TAO_DynValueCommon_i& operator= (TAO_DynValueCommon_i&&) = delete; - TAO_DynValueCommon_i (TAO_DynValueCommon_i&&) = delete; + TAO_DynValueCommon_i (const TAO_DynValueCommon_i &src); + TAO_DynValueCommon_i &operator= (const TAO_DynValueCommon_i &src); /// Check if the typecode is acceptable. Needs to be provided by DynValue or DynValueBox virtual void check_typecode (CORBA::TypeCode_ptr tc)=0; diff --git a/TAO/tao/DynamicAny/DynValue_i.cpp b/TAO/tao/DynamicAny/DynValue_i.cpp index a9f314f028376..728b5614b1add 100644 --- a/TAO/tao/DynamicAny/DynValue_i.cpp +++ b/TAO/tao/DynamicAny/DynValue_i.cpp @@ -21,6 +21,10 @@ TAO_DynValue_i::TAO_DynValue_i (CORBA::Boolean allow_truncation) { } +TAO_DynValue_i::~TAO_DynValue_i () +{ +} + void TAO_DynValue_i::init (const CORBA::Any & any) { @@ -59,7 +63,9 @@ TAO_DynValue_i::init (CORBA::TypeCode_ptr tc) i < this->component_count_; ++i) { - CORBA::TypeCode_var member_type (get_member_type (this->da_base_types_, i)); + CORBA::TypeCode_var + member_type ( + get_member_type (this->da_base_types_, i)); this->da_members_[i] = TAO::MakeDynAnyUtils:: make_dyn_any_t @@ -85,11 +91,15 @@ TAO_DynValue_i::init_helper (CORBA::TypeCode_ptr tc) this->type_ = CORBA::TypeCode::_duplicate (tc); // Work out how many total members and types there - // are in total in this derived->base hierarchy. - get_base_types (tc, this->da_base_types_, &this->component_count_); - this->da_members_.resize (this->component_count_); + // are in total in this derived->base hiarchy. + + get_base_types ( + tc, + this->da_base_types_, + &this->component_count_); + this->da_members_.size (this->component_count_); - // And initialize all of the DynCommon mix-in + // And initalize all of the DynCommon mix-in this->init_common (); } @@ -100,31 +110,37 @@ TAO_DynValue_i::get_base_types ( BaseTypesList_t &base_types, CORBA::ULong *total_member_count) { - // First initialize to the fully derived type we are + // First initalize to the fully derived type we are // starting with. + CORBA::ULong numberOfBases = 1u; - base_types.resize (numberOfBases); + base_types.size (numberOfBases); base_types[0] = TAO_DynAnyFactory::strip_alias (tc); if (total_member_count) { - *total_member_count = base_types[0]->member_count (); + *total_member_count = + base_types[0]->member_count (); } // Obtain each derived type's basetype and add this to // the list. - CORBA::TypeCode_var base (base_types[0]->concrete_base_type()); + + CORBA::TypeCode_var + base (base_types[0]->concrete_base_type()); while (base.in() && CORBA::tk_value == (base= // assignment - TAO_DynAnyFactory::strip_alias (base.in()))->kind ()) + TAO_DynAnyFactory::strip_alias (base.in())) + ->kind ()) { if (total_member_count) { *total_member_count += base->member_count (); } - base_types.resize (numberOfBases + 1); - base_types[numberOfBases++] = CORBA::TypeCode::_duplicate (base.in ()); + base_types.size (numberOfBases + 1); + base_types[numberOfBases++] = + CORBA::TypeCode::_duplicate (base.in ()); base = base->concrete_base_type(); } } @@ -141,13 +157,14 @@ TAO_DynValue_i::get_correct_base_type ( // derived type until that type's members are exhausted // and so on until we reach the member we have asked for. - CORBA::ULong currentBase = ACE_Utils::truncate_cast (base_types.size ()); + CORBA::ULong + currentBase = ACE_Utils::truncate_cast (base_types.size ()); if (!currentBase) { TAOLIB_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - %N:%l TAO_DynValue_i::get_correct_base_type () ") ACE_TEXT ("BaseTypesList_t is not initialised\n"))); - return nullptr; + return 0; } while (base_types[--currentBase]->member_count () <= index) @@ -168,24 +185,32 @@ TAO_DynValue_i::get_correct_base_type ( } CORBA::TypeCode_ptr -TAO_DynValue_i::get_member_type (const BaseTypesList_t &base_types, CORBA::ULong index) +TAO_DynValue_i::get_member_type ( + const BaseTypesList_t &base_types, + CORBA::ULong index) { - CORBA::TypeCode_ptr const base = get_correct_base_type (base_types, index); + const CORBA::TypeCode_ptr + base = get_correct_base_type (base_types, index); return base->member_type (index); } const char * -TAO_DynValue_i::get_member_name (const BaseTypesList_t &base_types, CORBA::ULong index) +TAO_DynValue_i::get_member_name ( + const BaseTypesList_t &base_types, + CORBA::ULong index) { - const CORBA::TypeCode_ptr base = get_correct_base_type (base_types, index); + const CORBA::TypeCode_ptr + base = get_correct_base_type (base_types, index); return base->member_name (index); } void TAO_DynValue_i::set_to_value () { - this->component_count_ = static_cast (this->da_members_.size ()); - this->current_position_ = this->component_count_ ? 0 : -1; + this->component_count_ = + static_cast (this->da_members_.size ()); + this->current_position_ = + this->component_count_ ? 0 : -1; this->is_null_ = false; } @@ -204,7 +229,7 @@ TAO_DynValue_i * TAO_DynValue_i::_narrow (CORBA::Object_ptr _tao_objref) { return (CORBA::is_nil (_tao_objref)) ? - nullptr : + 0 : dynamic_cast (_tao_objref); } @@ -221,7 +246,10 @@ TAO_DynValue_i::current_member_name () throw DynamicAny::DynAny::InvalidValue (); } - return CORBA::string_dup (this->get_member_name (this->da_base_types_, this->current_position_)); + return CORBA::string_dup ( + this->get_member_name ( + this->da_base_types_, + this->current_position_)); } CORBA::TCKind @@ -237,7 +265,10 @@ TAO_DynValue_i::current_member_kind () throw DynamicAny::DynAny::InvalidValue (); } - CORBA::TypeCode_var tc (get_member_type (this->da_base_types_, this->current_position_)); + CORBA::TypeCode_var tc ( + get_member_type ( + this->da_base_types_, + this->current_position_)); return TAO_DynAnyFactory::unalias (tc.in ()); } @@ -250,19 +281,24 @@ TAO_DynValue_i::get_members () } // Create the return NameValuePairSeq - DynamicAny::NameValuePairSeq *members {}; + DynamicAny::NameValuePairSeq *members = 0; ACE_NEW_THROW_EX ( members, DynamicAny::NameValuePairSeq (this->component_count_), CORBA::NO_MEMORY ()); members->length (this->component_count_); - DynamicAny::NameValuePairSeq_var safe_retval (members); + DynamicAny::NameValuePairSeq_var + safe_retval (members); // Assign member name and value to each slot. - for (CORBA::ULong i = 0u; i < this->component_count_; ++i) + for (CORBA::ULong i = 0u; + i < this->component_count_; + ++i) { - safe_retval[i].id = CORBA::string_dup (this->get_member_name (this->da_base_types_, i)); - CORBA::Any_var temp (this->da_members_[i]->to_any ()); + safe_retval[i].id = CORBA::string_dup ( + this->get_member_name (this->da_base_types_, i)); + CORBA::Any_var + temp (this->da_members_[i]->to_any ()); safe_retval[i].value = temp.in (); } @@ -279,8 +315,10 @@ TAO_DynValue_i::set_members ( } // Check lengths match. - CORBA::ULong const length = values.length (); - if (length != static_cast (this->da_members_.size ())) + const CORBA::ULong length = values.length (); + if (length != + static_cast + (this->da_members_.size ())) { throw DynamicAny::DynAny::InvalidValue (); } @@ -289,8 +327,10 @@ TAO_DynValue_i::set_members ( CORBA::ULong i; for (i = 0u; i < length; ++i) { - CORBA::TypeCode_var my_member (get_member_type (this->da_base_types_, i)); - CORBA::TypeCode_var value_member (values[i].value.type ()); + CORBA::TypeCode_var my_member ( + get_member_type (this->da_base_types_, i)); + CORBA::TypeCode_var value_member ( + values[i].value.type ()); if (!my_member->equivalent (value_member.in ())) { throw DynamicAny::DynAny::TypeMismatch (); @@ -300,7 +340,8 @@ TAO_DynValue_i::set_members ( // Copy in the new values to each member () for (i = 0u; i < length; ++i) { - this->da_members_[i] = TAO::MakeDynAnyUtils::make_dyn_any_t ( + this->da_members_[i] = TAO::MakeDynAnyUtils:: + make_dyn_any_t ( values[i].value._tao_get_typecode (), values[i].value, this->allow_truncation_); @@ -318,20 +359,22 @@ TAO_DynValue_i::get_members_as_dyn_any () } // Create the return NameDynAnyPairSeq - DynamicAny::NameDynAnyPairSeq *members {}; + DynamicAny::NameDynAnyPairSeq *members = 0; ACE_NEW_THROW_EX ( members, DynamicAny::NameDynAnyPairSeq (this->component_count_), CORBA::NO_MEMORY ()); members->length (this->component_count_); - DynamicAny::NameDynAnyPairSeq_var safe_retval (members); + DynamicAny::NameDynAnyPairSeq_var + safe_retval (members); // Assign name and value to each pearl on the string. for (CORBA::ULong i = 0u; i < this->component_count_; ++i) { - safe_retval[i].id = CORBA::string_dup (this->get_member_name (this->da_base_types_, i)); + safe_retval[i].id = CORBA::string_dup ( + this->get_member_name (this->da_base_types_, i)); // A deep copy is made only by copy() // (CORBA 2.4.2 section 9.2.3.6). @@ -368,7 +411,11 @@ TAO_DynValue_i::set_members_as_dyn_any ( CORBA::ULong i = 0u; for (; i < length; ++i) { - CORBA::TypeCode_var my_member (get_member_type (this->da_base_types_, i)), value_member (values[i].value->type ()); + CORBA::TypeCode_var + my_member ( + get_member_type (this->da_base_types_, i)), + value_member ( + values[i].value->type ()); if (!my_member->equivalent (value_member.in ())) { throw DynamicAny::DynAny::TypeMismatch (); @@ -392,7 +439,8 @@ TAO_DynValue_i::from_any (const CORBA::Any &any) throw ::CORBA::OBJECT_NOT_EXIST (); } - CORBA::TypeCode_var tc (any.type ()); + CORBA::TypeCode_var + tc (any.type ()); if (!this->type_->equivalent (tc.in ())) { throw DynamicAny::DynAny::TypeMismatch (); @@ -411,12 +459,14 @@ TAO_DynValue_i::equal (DynamicAny::DynAny_ptr rhs) CORBA::TypeCode_var tc (rhs->type ()); if (!tc->equivalent (this->type_.in ()) || - this->component_count_ != rhs->component_count ()) + this->component_count_ != + rhs->component_count () ) { return false; } - TAO_DynValue_i *rhs_v = dynamic_cast (rhs); + TAO_DynValue_i *rhs_v= + dynamic_cast (rhs); if (!rhs_v || this->is_null () != rhs_v->is_null ()) { @@ -429,7 +479,8 @@ TAO_DynValue_i::equal (DynamicAny::DynAny_ptr rhs) i < this->component_count_; ++i) { - if (!rhs_v->da_members_[i]->equal (this->da_members_[i].in ())) + if (!rhs_v->da_members_[i] + ->equal (this->da_members_[i].in ())) { return false; } @@ -447,18 +498,23 @@ TAO_DynValue_i::destroy () throw ::CORBA::OBJECT_NOT_EXIST (); } - if (!this->ref_to_component_ || this->container_is_destroying_) + if (!this->ref_to_component_ || + this->container_is_destroying_) { // Do a deep destroy. - this->component_count_ = static_cast (this->da_members_.size () ); + this->component_count_ = + static_cast ( + this->da_members_.size () ); - for (CORBA::ULong i = 0u; i < this->component_count_; ++i) + for (CORBA::ULong i = 0u; + i < this->component_count_; + ++i) { this->set_flag (da_members_[i].in (), 1); this->da_members_[i]->destroy (); } - this->destroyed_ = true; + this->destroyed_ = 1; } } @@ -559,7 +615,7 @@ TAO_DynValue_i::get_val () // Now read in this stream to create the actual value. TAO_InputCDR for_reading (out_cdr); - CORBA::ValueBase *retval {}; + CORBA::ValueBase *retval = 0; if (!CORBA::ValueBase::_tao_unmarshal ( for_reading, retval )) { @@ -583,12 +639,12 @@ TAO_DynValue_i::to_any () // Convert the out_cdr into a new any. TAO_InputCDR in_cdr (out_cdr); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk = 0; ACE_NEW_THROW_EX ( unk, TAO::Unknown_IDL_Type (this->type_.in (), in_cdr), CORBA::NO_MEMORY () ); - CORBA::Any_ptr retval {}; + CORBA::Any_ptr retval = 0; ACE_NEW_THROW_EX ( retval, CORBA::Any, @@ -663,11 +719,13 @@ TAO_DynValue_i::to_outputCDR (TAO_OutputCDR &out_cdr) TAO_OBV_GIOP_Flags::Value_tag_base | TAO_OBV_GIOP_Flags::Type_info_single; - CORBA::ULong const num_ids = ACE_Utils::truncate_cast (this->da_base_types_.size ()); + const CORBA::ULong num_ids = + ACE_Utils::truncate_cast (this->da_base_types_.size ()); CORBA::ULong trunc_ids; for (trunc_ids= 0u; trunc_ids < num_ids - 1u; ++trunc_ids) { - if (CORBA::VM_TRUNCATABLE != this->da_base_types_[trunc_ids]->type_modifier ()) + if (CORBA::VM_TRUNCATABLE != + this->da_base_types_[trunc_ids]->type_modifier ()) { break; // Found the first type that is not truncatable } @@ -685,7 +743,8 @@ TAO_DynValue_i::to_outputCDR (TAO_OutputCDR &out_cdr) { for (CORBA::ULong i= trunc_ids - 1u; i < num_ids; ++i) { - if (CORBA::VM_CUSTOM == this->da_base_types_[i]->type_modifier ()) + if (CORBA::VM_CUSTOM == + this->da_base_types_[i]->type_modifier ()) { we_are_chunking = true; break; @@ -756,8 +815,9 @@ TAO_DynValue_i::to_outputCDR (TAO_OutputCDR &out_cdr) // Now write out every member's value (add further chunking // marks for each seporate base-type's state). CORBA::Boolean need_first = true; - CORBA::ULong currentBase = num_ids; // Note NOT just the trunc_ids - CORBA::ULong currentBaseMember = 0u; + CORBA::ULong + currentBase= num_ids, // Note NOT just the trunc_ids + currentBaseMember = 0u; for (CORBA::ULong currentMember= 0u; currentMember < this->component_count_; ++currentMember) @@ -766,7 +826,7 @@ TAO_DynValue_i::to_outputCDR (TAO_OutputCDR &out_cdr) if (!currentBaseMember) { // Move on to the next derived type in the - // list of our type hierarchy + // list of our type hyarchy while (!this->da_base_types_[--currentBase] ->member_count ()) { @@ -838,7 +898,8 @@ TAO_DynValue_i::to_outputCDR (TAO_OutputCDR &out_cdr) } // Are we ending the current base-type? - if (this->da_base_types_[currentBase]->member_count () <= ++currentBaseMember) + if (this->da_base_types_[currentBase]->member_count () + <= ++currentBaseMember) { // Remind us to start again with the next derived type // for the next member to be writen. @@ -911,9 +972,9 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } if (is_indirected) { - // Effectively this member? is the same ValueType as previous + // Effectivly this member? is the same ValueType as previous // seen either in another member of this container OR the - // whole container itself. (Possibly can happen as a + // whole container itself. (Possiably can happen as a // circular linked list?) if (TAO_debug_level) { @@ -964,7 +1025,7 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // Ok since we are not indirected (this time), record "this" - // DynValue_i for later possible indirections to use. + // DynValue_i for later possiable indirections to use. if (strm.get_value_map ()->get() ->bind ( start_of_valuetype, @@ -977,7 +1038,7 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // Work out how many total types there - // are in this derived->base hierarchy. + // are in this derived->base hiarchy. const CORBA::ULong num_fields = static_cast (this->da_members_.size ()), num_ids = static_cast (ids.size ()); @@ -1001,7 +1062,7 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // Since this does not match we must be attempting - // to truncated to a base-type, thus the incoming + // to truncated to a base-type, thus the incomming // any must be chuncked and this outer type must // allow truncation. if (!is_chunked) @@ -1045,9 +1106,11 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // Now read in every member's value (reading further chunking - // marks for each separate base-type's state we pass). + // marks for each seporate base-type's state we pass). CORBA::Boolean need_first = true; - CORBA::ULong currentBase = ACE_Utils::truncate_cast (this->da_base_types_.size ()), currentBaseMember = 0u; + CORBA::ULong + currentBase = ACE_Utils::truncate_cast (this->da_base_types_.size ()), + currentBaseMember = 0u; for (CORBA::ULong currentMember= 0u; currentMember < num_fields; ++currentMember) @@ -1056,8 +1119,9 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) if (!currentBaseMember) { // Move on to the next derived type in the - // list of our type hierarchy - while (!this->da_base_types_[--currentBase]->member_count ()) + // list of our type hyarchy + while (!this->da_base_types_[--currentBase] + ->member_count ()) { // Skipping over all types that have no // state (i.e. no members to write). @@ -1080,12 +1144,14 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // OK read in the current member - CORBA::TypeCode_var field_tc (this->da_base_types_[currentBase]->member_type (currentBaseMember)); + CORBA::TypeCode_var + field_tc (this->da_base_types_[currentBase] + ->member_type (currentBaseMember)); if (CORBA::tk_value == field_tc->kind ()) { // This is recursive, keep reading from our inputCDR // this allows for indirection - this->da_members_[currentMember] = + this->da_members_[currentMember]= TAO::CreateDynAnyUtils ::create_dyn_any_t ( field_tc.in (), @@ -1096,7 +1162,7 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) { // Need to create an any for this field. TAO_InputCDR unk_in (strm); - TAO::Unknown_IDL_Type *unk {}; + TAO::Unknown_IDL_Type *unk= 0; ACE_NEW_THROW_EX ( unk, TAO::Unknown_IDL_Type (field_tc.in (), unk_in), @@ -1122,10 +1188,11 @@ TAO_DynValue_i::from_inputCDR (TAO_InputCDR &strm) } // Are we ending the current base-type? - if (this->da_base_types_[currentBase]->member_count () <= ++currentBaseMember) + if (this->da_base_types_[currentBase]->member_count () + <= ++currentBaseMember) { // Remind us to start again with the next derived type - // for the next member to be written. + // for the next member to be writen. currentBaseMember= 0u; if (currentBase < num_ids) diff --git a/TAO/tao/DynamicAny/DynValue_i.h b/TAO/tao/DynamicAny/DynValue_i.h index 24624e8e5538f..f3f8884342e94 100644 --- a/TAO/tao/DynamicAny/DynValue_i.h +++ b/TAO/tao/DynamicAny/DynValue_i.h @@ -7,6 +7,7 @@ */ //============================================================================= + #ifndef TAO_DYNVALUE_I_H #define TAO_DYNVALUE_I_H #include /**/ "ace/pre.h" @@ -17,8 +18,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include - #if defined (_MSC_VER) # pragma warning(push) # pragma warning (disable:4250) @@ -37,10 +36,10 @@ class TAO_DynamicAny_Export TAO_DynValue_i { public: /// Constructor. - TAO_DynValue_i (CORBA::Boolean allow_truncation = true); + TAO_DynValue_i (CORBA::Boolean allow_truncation=true); /// Destructor. - ~TAO_DynValue_i () = default; + ~TAO_DynValue_i (); /// Initialize using an Any. void init (const CORBA::Any& any); @@ -88,11 +87,11 @@ class TAO_DynamicAny_Export TAO_DynValue_i private: /// List of base types. - using BaseTypesList_t = std::vector; + typedef ACE_Array_Base BaseTypesList_t; - /// Decompose the given TypeCode into its hierarchical list of + /// Decompose the given TypeCode into its hiarchical list of /// basetypes. The first element of the list is our actual type, - /// each basetype follows in order backwards down the hierarchy. + /// each basetype follows in order backwards down the hiarchy. /// All types stored in the list are de-aliased. Optionally /// return the total_member_count of the fully derived type. static void get_base_types ( @@ -101,20 +100,20 @@ class TAO_DynamicAny_Export TAO_DynValue_i CORBA::ULong *total_member_count = 0); /// Return the unaliased valuetype typecode that corresponds to - /// index (0..total_members-1) from the given hierarchical list of + /// index (0..total_members-1) from the given hiarchical list of /// the derived type and it basetypes. static CORBA::TypeCode_ptr get_correct_base_type ( const BaseTypesList_t &base_types, CORBA::ULong &index); /// Return the member_type at index (0..total_members-1) from - /// the given hierarchical list of the derived type and it basetypes. + /// the given hiarchical list of the derived type and it basetypes. static CORBA::TypeCode_ptr get_member_type ( const BaseTypesList_t &, CORBA::ULong index); /// Return the member_name at index (0..total_members-1) from - /// the given hierarchical list of the derived type and it basetypes. + /// the given hiarchical list of the derived type and it basetypes. static const char * get_member_name ( const BaseTypesList_t &, CORBA::ULong index); @@ -136,18 +135,16 @@ class TAO_DynamicAny_Export TAO_DynValue_i /// Read the value from the input stream void from_inputCDR (TAO_InputCDR &); - /// These are not implemented! + /// These are not implimented! /// Use copy() or assign() instead of these. - TAO_DynValue_i (const TAO_DynValue_i &) = delete; - TAO_DynValue_i &operator= (const TAO_DynValue_i &) = delete; - TAO_DynValue_i& operator= (TAO_DynValue_i&&) = delete; - TAO_DynValue_i (TAO_DynValue_i&&) = delete; + TAO_DynValue_i (const TAO_DynValue_i &src); + TAO_DynValue_i &operator= (const TAO_DynValue_i &src); /// Each component of DynValue and DynValueBox is also a DynAny. - std::vector da_members_; + ACE_Array_Base da_members_; /// First element of this is our type, each basetype follows - /// in order backwards down the hierarchy. All types stored are + /// in order backwards down the hiarchy. All types stored are /// de-aliased. BaseTypesList_t da_base_types_; }; diff --git a/TAO/tests/DynValue_Test/Analyzer.cpp b/TAO/tests/DynValue_Test/Analyzer.cpp index 4dfc6972b5f3b..9dd484ea6d280 100644 --- a/TAO/tests/DynValue_Test/Analyzer.cpp +++ b/TAO/tests/DynValue_Test/Analyzer.cpp @@ -137,8 +137,7 @@ DynAnyAnalyzer::get_correct_base_type ( #define CASEE(type,CT,str) case CORBA::tk_##type: {\ CORBA::CT b = da->get_##type();\ - if (!newline) tab(""); \ - ACE_DEBUG ((LM_DEBUG, str , b));\ + if (!newline) tab(""); ACE_DEBUG ((LM_DEBUG, str , b));\ } break; void @@ -256,13 +255,13 @@ DynAnyAnalyzer::analyze ( base = get_correct_base_type ( base_types, sub_member_number); - const char *const visibility = + const char *const visability = ((CORBA::PRIVATE_MEMBER == base->member_visibility (sub_member_number)) ? "Private" : "Public "); tab ("["); ACE_DEBUG ((LM_DEBUG, "%03u] %C \"%C\": ", - ++member_number, visibility, fn.in () )); + ++member_number, visability, fn.in () )); if (CORBA::is_nil (cc.in ())) { ACE_DEBUG ((LM_DEBUG, " {Null}\n"));